You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jg...@apache.org on 2022/10/14 06:09:53 UTC

[netbeans] branch master updated: Limit ValidateClassFilesTest to scan only JARs referenced from modules (#4775)

This is an automated email from the ASF dual-hosted git repository.

jgauravgupta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 3cbe596ea5 Limit ValidateClassFilesTest to scan only JARs referenced from modules (#4775)
3cbe596ea5 is described below

commit 3cbe596ea56c05de76f23474a2857aa28f6dc065
Author: Matthias Bläsing <mb...@doppel-helix.eu>
AuthorDate: Fri Oct 14 08:09:45 2022 +0200

    Limit ValidateClassFilesTest to scan only JARs referenced from modules (#4775)
    
    With the addition of jakarta ee 10 API jars it was found, that there is
    an implicit assumption, that all JARs not referenced by modules have
    to be JDK 8 compatible. In the case of jakarta ee 10 this is an
    invalid assumption as it explicitly does not support JDK 8. The module
    that introduces the binaries correctly declares a JDK 11 dependeny, but
    at runtime the module <-> binary association is lost.
    
    To prevent false positives, the test must be limited to JARs, that are
    directly referenced from modules.
---
 ide/extexecution.process.jdk9/manifest.mf                         | 2 +-
 .../src/org/netbeans/core/validation/ValidateClassFilesTest.java  | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ide/extexecution.process.jdk9/manifest.mf b/ide/extexecution.process.jdk9/manifest.mf
index c658b40501..c03a01512d 100644
--- a/ide/extexecution.process.jdk9/manifest.mf
+++ b/ide/extexecution.process.jdk9/manifest.mf
@@ -3,5 +3,5 @@ AutoUpdate-Show-In-Client: false
 OpenIDE-Module: org.netbeans.modules.extexecution.process.jdk9
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/extexecution/process/jdk9/resources/Bundle.properties
 OpenIDE-Module-Specification-Version: 1.18
-OpenIDE-Module-Java-Dependencies: Java > 1.9.0
+OpenIDE-Module-Java-Dependencies: Java > 9
 OpenIDE-Module-Provides: org.netbeans.spi.extexecution.base.ProcessesImplementation
diff --git a/platform/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateClassFilesTest.java b/platform/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateClassFilesTest.java
index a2b00bbe44..6ac824a7d5 100644
--- a/platform/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateClassFilesTest.java
+++ b/platform/o.n.core/test/qa-functional/src/org/netbeans/core/validation/ValidateClassFilesTest.java
@@ -78,7 +78,11 @@ public class ValidateClassFilesTest extends NbTestCase {
                 final File file = path.toFile();
                 if (file.getName().endsWith(".jar")) {
 
-                    int classFileVersion = classFileVersions.getOrDefault(file.getName(), 52);
+                    if(! classFileVersions.containsKey(file.getName())) {
+                        return FileVisitResult.CONTINUE;
+                    }
+
+                    int classFileVersion = classFileVersions.get(file.getName());
 
                     JarFile jf = new JarFile(file);
                     Enumeration<JarEntry> en = jf.entries();
@@ -129,7 +133,7 @@ public class ValidateClassFilesTest extends NbTestCase {
                 if (dep.getType() == Dependency.TYPE_JAVA) {
                     String javaVersion = dep.getVersion();
                     if (javaVersion.startsWith("1.")) {
-                        break;
+                        javaVersion = javaVersion.substring(2);
                     }
                     int classFileVersion = Integer.parseInt(javaVersion) + 44;
                     for (File jar : module.getAllJars()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists