Skip to content

Updating to automatically generated JDK-16+36 nb-javac - WIP #2801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e9b63b2
Updating to automatically generated JDK-16+36 nb-javac
dukescript Mar 10, 2021
50d7079
Updating nb-javac licensing information
dukescript Mar 11, 2021
ea47cfc
Removing special nbjavac supporting code
dukescript Mar 11, 2021
959d69d
Only use nb-javac libs when they are present
dukescript Mar 13, 2021
a20ff13
Merge remote-tracking branch 'origin/master' into AutomaticNbJavac
dukescript Mar 21, 2021
72e5932
Using newly staged nb-javac 1140
dukescript Mar 24, 2021
19735fe
Prevent linkage errors when unregistering WeakListeners from JavaData…
dukescript Mar 25, 2021
37c7ff4
Ignore nbjavac package in completions, if present
dukescript Mar 25, 2021
203e17d
Default behavior is now vanilla-javac like behavior
dukescript Mar 25, 2021
ae09714
Adjusting to changes in master
dukescript Mar 26, 2021
d922bfa
Report download error
dukescript Mar 26, 2021
d78d082
Adding temporary download location
dukescript Mar 28, 2021
a144517
Merge remote-tracking branch 'origin/master' into AutomaticNbJavac
dukescript Apr 3, 2021
248a926
Updating to nb-javac with support for the IDE mode
dukescript Apr 7, 2021
7c2feb9
Giving up on this test
dukescript Apr 7, 2021
332d825
Using more descriptive assertXYZ methods
dukescript Apr 7, 2021
177f1af
Fixing org.netbeans.modules.apisupport.hints.UseNbBundleMessagesTest
dukescript Apr 18, 2021
b602b3d
Updating to more javac-like nb-javac without the IDE mode
dukescript Apr 19, 2021
81916e6
Merge remote-tracking branch 'origin/master' into AutomaticNbJavac
dukescript Apr 20, 2021
d0480eb
Various fixes.
jlahoda Apr 23, 2021
8981aa6
A few more fixes.
jlahoda Apr 23, 2021
710d5be
Fixing more tests.
jlahoda Apr 24, 2021
051f374
Adding forgotten file.
jlahoda Apr 24, 2021
cdeba3d
A few more test fixes.
jlahoda Apr 24, 2021
d94bed2
More test stabilization.
jlahoda Apr 24, 2021
5b26ff6
Reverting wrong change.
jlahoda Apr 24, 2021
5a761e2
Some improvements.
jlahoda Apr 24, 2021
f984ac5
Fixing more tests.
jlahoda Apr 25, 2021
1c0fc01
More test stabilization.
jlahoda Apr 25, 2021
6cd2d1c
Disabling two final tests.
jlahoda Apr 25, 2021
45af55c
Including interesting changes from jlahoda
dukescript Apr 26, 2021
1e91a98
Merge remote-tracking branch 'origin/master' into AutomaticNbJavac
dukescript May 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ derby.log
/extide/gradle/netbeans-gradle-tooling/gradle/wrapper/gradle-wrapper.jar
/extide/gradle/release/modules/gradle/daemon-loader/.gradle/
/nbbuild/misc/prepare-bundles/target/
/nb/updatecenters/extras/nbjavac.api/nbproject/private/
/nb/updatecenters/extras/nbjavac.impl/nbproject/private/
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ matrix:
- ant $OPTS build
script:
- ant $OPTS -f java/java.completion test
- ant $OPTS -Dtest.config=vanilla-javac -f java/java.source.base test
- ant $OPTS -f java/java.source.base test

- name: Test refactoring.java without nb-javac on Java 14
jdk: openjdk8
Expand All @@ -524,7 +524,7 @@ matrix:
- ant $OPTS clean
- ant $OPTS build
script:
- ant $OPTS -Dtest.config=batch1-vanilla-javac -f java/java.hints test
- ant $OPTS -Dtest.config=batch1 -f java/java.hints test

- name: Test java.hints batch2 without nb-javac on Java 14
jdk: openjdk8
Expand All @@ -537,7 +537,7 @@ matrix:
- ant $OPTS clean
- ant $OPTS build
script:
- ant $OPTS -Dtest.config=batch2-vanilla-javac -f java/java.hints test
- ant $OPTS -Dtest.config=batch2 -f java/java.hints test

- name: Test Java modules without nb-javac on Java 15
jdk: openjdk8
Expand All @@ -551,7 +551,7 @@ matrix:
- ant $OPTS build
script:
- ant $OPTS -f java/java.completion test
- ant $OPTS -Dtest.config=vanilla-javac -f java/java.source.base test
- ant $OPTS -f java/java.source.base test

- name: Test refactoring.java without nb-javac on Java 15
jdk: openjdk8
Expand All @@ -577,7 +577,7 @@ matrix:
- ant $OPTS clean
- ant $OPTS build
script:
- ant $OPTS -Dtest.config=batch1-vanilla-javac -f java/java.hints test
- ant $OPTS -Dtest.config=batch1 -f java/java.hints test

- name: Test java.hints batch2 without nb-javac on Java 15
jdk: openjdk8
Expand All @@ -590,7 +590,7 @@ matrix:
- ant $OPTS clean
- ant $OPTS build
script:
- ant $OPTS -Dtest.config=batch2-vanilla-javac -f java/java.hints test
- ant $OPTS -Dtest.config=batch2 -f java/java.hints test


- name: Test apisupport modules
Expand Down
4 changes: 4 additions & 0 deletions apisupport/apisupport.ant/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@
<code-name-base>org.netbeans.modules.apisupport.wizards</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.j2seplatform</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.nbjunit</code-name-base>
<recursive/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ public void testJdkProperties() throws Exception {
eval.addPropertyChangeListener(l);
String bootcp = eval.getProperty(Evaluator.NBJDK_BOOTCLASSPATH);
String origbootcp = bootcp;
assertNotNull(bootcp); // who knows what actual value will be inside a unit test - probably empty
//on JDK 9+, bootcp is null here, as sun.boot.class.path is not filled anymore:
// assertNotNull(bootcp); // who knows what actual value will be inside a unit test - probably empty
ep = p.getHelper().getProperties("nbproject/platform.properties");
ep.setProperty(ModuleProperties.JAVA_PLATFORM_PROPERTY, "testjdk");
p.getHelper().putProperties("nbproject/platform.properties", ep);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,9 @@ public void testClassPathExtensionChanges() throws Exception { // #179578
assertEquals(p.getHelper().resolveFile("build/cluster/modules/ext/y.jar").getAbsolutePath(), cp.toString());
}

public void testBootClasspath() throws Exception {
//JDK9+: it is unclear how bootclasspath prepend should work for modular platforms, as whether that works
//is mostly dependent on the source level:
public void JDK_9_testBootClasspath() throws Exception {
NbModuleProject p = generateStandaloneModule("prj");
ClassPath boot = ClassPath.getClassPath(p.getSourceDirectory(), ClassPath.BOOT);
// XXX test that it is sane... although by default, ${nbjdk.home} will be undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,22 @@ public class UseNbBundleMessagesTest {
@Test public void annotationOnClass() throws Exception {
HintTest.create().classpath(cp()).
input("package test;\n" +
"@javax.annotation.Resource(description=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"class Test {\n" +
"}\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
input("test/Bundle.properties", "k=v\n", false).
run(UseNbBundleMessages.class).
findWarning("1:27-1:43:warning:" + UseNbBundleMessages_error_text()).
findWarning("1:3-1:16:warning:" + UseNbBundleMessages_error_text()).
applyFix().
assertVerbatimOutput("test/Bundle.properties", "").
assertOutput("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"@javax.annotation.Resource(description=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"@Messages(\"k=v\")\n" +
"class Test {\n" +
"}\n");
Expand All @@ -290,18 +295,23 @@ public class UseNbBundleMessagesTest {
HintTest.create().classpath(cp()).
input("package test;\n" +
"class Test {\n" +
" @javax.annotation.Resource(description=\"#k\")\n" +
" @A(comments=\"#k\")\n" +
" void m() {}\n" +
"}\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
input("test/Bundle.properties", "k=v\n", false).
run(UseNbBundleMessages.class).
findWarning("2:31-2:47:warning:" + UseNbBundleMessages_error_text()).
findWarning("2:7-2:20:warning:" + UseNbBundleMessages_error_text()).
applyFix().
assertVerbatimOutput("test/Bundle.properties", "").
assertOutput("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"class Test {\n" +
" @javax.annotation.Resource(description=\"#k\")\n" +
" @A(comments=\"#k\")\n" +
" @Messages(\"k=v\")\n" +
" void m() {}\n" +
"}\n");
Expand All @@ -311,35 +321,46 @@ public class UseNbBundleMessagesTest {
HintTest.create().classpath(cp()).
input("package test;\n" +
"class Test {\n" +
" @javax.annotation.Resource(description=\"#k\")\n" +
" @A(comments=\"#k\")\n" +
" static final Void f = null;\n" +
"}\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
input("test/Bundle.properties", "k=v\n", false).
run(UseNbBundleMessages.class).
findWarning("2:31-2:47:warning:" + UseNbBundleMessages_error_text()).
findWarning("2:7-2:20:warning:" + UseNbBundleMessages_error_text()).
applyFix().
assertVerbatimOutput("test/Bundle.properties", "").
assertOutput("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"class Test {\n" +
" @javax.annotation.Resource(description=\"#k\")\n" +
" @A(comments=\"#k\")\n" +
" @Messages(\"k=v\")\n" +
" static final Void f = null;\n" +
"}\n");
}

@Test public void annotationOnPackage() throws Exception {
//nb-javac: JDK's javac does not attribute package clause
@Test public void NB_JAVAC_annotationOnPackage() throws Exception {
HintTest.create().classpath(cp()).
input("test/package-info.java",
"@javax.annotation.Generated(value={}, comments=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"package test;\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
input("test/Bundle.properties", "k=v\n", false).
run(UseNbBundleMessages.class).
findWarning("0:38-0:51:warning:" + UseNbBundleMessages_error_text()).
findWarning("0:3-0:16:warning:" + UseNbBundleMessages_error_text()).
applyFix().
assertVerbatimOutput("test/Bundle.properties", "").
assertOutput("test/package-info.java",
"@javax.annotation.Generated(value={}, comments=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"@Messages(\"k=v\")\n" +
"package test;\n" +
"import org.openide.util.NbBundle.Messages;\n");
Expand Down Expand Up @@ -403,20 +424,25 @@ public class UseNbBundleMessagesTest {
HintTest.create().classpath(cp()).
input("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"@javax.annotation.Resource(description=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"@Messages(\"k=v\")\n" +
"class Test {\n" +
" String m() {\n" +
" return org.openide.util.NbBundle.getMessage(Test.class, \"k\");\n" +
" }\n" +
"}\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
run(UseNbBundleMessages.class).
findWarning("6:41-6:51:warning:" + UseNbBundleMessages_error_text()).
applyFix().
assertOutput("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"import static test.Bundle.*;\n" +
"@javax.annotation.Resource(description=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"@Messages(\"k=v\")\n" +
"class Test {\n" +
" String m() {\n" +
Expand All @@ -429,10 +455,15 @@ public class UseNbBundleMessagesTest {
HintTest.create().classpath(cp()).
input("package test;\n" +
"import org.openide.util.NbBundle.Messages;\n" +
"@javax.annotation.Resource(description=\"#k\")\n" +
"@A(comments=\"#k\")\n" +
"@Messages(\"k=v\")\n" +
"class Test {\n" +
"}\n").
input("test/A.java",
"package test;\n" +
"@interface A {\n" +
" String comments();\n" +
"}\n").
run(UseNbBundleMessages.class).
assertWarnings();
}
Expand Down
5 changes: 0 additions & 5 deletions ergonomics/ide.ergonomics/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,6 @@
<code-name-base>org.netbeans.modules.server</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.source.nbjavac</code-name-base>
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.libs.nashorn</code-name-base>
<compile-dependency/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.Collections;
import java.util.Map;
import org.junit.Ignore;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.modules.csl.api.DeclarationFinder.DeclarationLocation;
import org.netbeans.modules.groovy.editor.test.GroovyTestBase;
Expand Down Expand Up @@ -125,6 +126,7 @@ public void testExtendsImplements3() throws Exception {
"class Declaration2 extends Declaration1 implements Interface1, Int^erface2 {", "Interface2.java", 12);
}

@Ignore
public void testInnerClasses1() throws Exception {
checkDeclaration(TEST_BASE + "a/Declaration3.groovy",
" return Inner^Classes.Type.DUMMY_1;", "InnerClasses.java", 12);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
import javax.swing.text.Document;
import javax.swing.text.Element;
import junit.framework.Assert;
import static org.junit.Assert.assertNotEquals;
import org.netbeans.api.annotations.common.NullAllowed;
import org.netbeans.api.editor.mimelookup.MimeLookup;
import org.netbeans.api.editor.mimelookup.MimePath;
Expand Down Expand Up @@ -4589,11 +4590,7 @@ protected void checkDeclaration(String relFilePath, String caretLine, String dec

protected void checkDeclaration(String relFilePath, String caretLine, String file, int offset) throws Exception {
DeclarationLocation location = findDeclaration(relFilePath, caretLine);
if (location == DeclarationLocation.NONE) {
// if we dont found a declaration, bail out.
assertTrue("DeclarationLocation.NONE", false);
}

assertNotEquals("if we dont found a declaration, bail out", DeclarationLocation.NONE, location);
assertEquals(file, location.getFileObject() != null ? location.getFileObject().getNameExt() : "<none>");
assertEquals(offset, location.getOffset());
}
Expand Down
34 changes: 15 additions & 19 deletions java/classfile/src/org/netbeans/modules/classfile/ModuleTarget.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,57 +27,53 @@
* @author Tomas Zezula
*/
public final class ModuleTarget {
private final String osName;
private final String osArch;
private final String osVersion;
private final String platform;

ModuleTarget(
final DataInputStream in,
final ConstantPool cp) throws IOException {
int index = in.readUnsignedShort();
this.osName = index == 0 ?
null :
((CPUTF8Info)cp.get(index)).getName();
index = in.readUnsignedShort();
this.osArch = index == 0 ?
null :
((CPUTF8Info)cp.get(index)).getName();
index = in.readUnsignedShort();
this.osVersion = index == 0 ?
this.platform = index == 0 ?
null :
((CPUTF8Info)cp.get(index)).getName();
}

/**
* Returns the platform name required by the module.
* @return the platform name or null if no information is present
*/
public String getPlatform() {
return platform;
}

/**
* Returns the operating system name required by the module.
* @return the operating system name or null if no information is present
*/
public String getOSName() {
return osName;
return null;
}

/**
* Returns the operating system architecture required by the module.
* @return the operating system architecture or null if no information is present
*/
public String getOSArch() {
return osArch;
return null;
}

/**
* Returns the operating system version required by the module.
* @return the operating system version or null if no information is present
*/
public String getOSVersion() {
return osVersion;
return null;
}

@Override
public String toString() {
return String.format(
"os_name=%s, os_arch=%s, os_version=%s", //NOI18N
osName,
osArch,
osVersion);
"platform=%s", //NOI18N
platform);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ public void testModulePackages() throws IOException {
final ClassFile cf = new ClassFile(in, true);
assertNotNull(cf);
assertTrue(cf.isModule());
final List<String> pkgs = cf.getModulePackages();
assertNotNull("No module packages for: " + moduleName, pkgs); //NOI18N
if (!"java.se".equals(moduleName) && moduleName.startsWith("java.")) {
final List<String> pkgs = cf.getModulePackages();
assertNotNull("No module packages for: " + moduleName, pkgs); //NOI18N
}
}
} catch (IOException ioe) {
throw new RuntimeException(ioe);
Expand Down Expand Up @@ -227,8 +229,7 @@ private static Path getModulesRoot() {
return null;
}
final Path jimageRoot = provider.getPath(URI.create("jrt:///")); //NOI18N
final Path modules = jimageRoot.resolve("modules");
return Files.exists(modules) ? modules : jimageRoot;
return jimageRoot;
} catch (IOException ioe) {
LOG.log(Level.WARNING, "Cannot load jrt nio provider.", ioe); //NOI18N
return null;
Expand Down
4 changes: 4 additions & 0 deletions java/debugger.jpda.projects/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@
<compile-dependency/>
<test/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.j2seplatform</code-name-base>
<compile-dependency/>
</test-dependency>
<test-dependency>
<code-name-base>org.netbeans.modules.java.source</code-name-base>
<compile-dependency/>
Expand Down
Loading