Repository: incubator-netbeans Updated Branches: refs/heads/jdk-javac 4e662ec70 -> 3761d7383
Support for testing GoToSupportTest. Project: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/commit/3761d738 Tree: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/tree/3761d738 Diff: http://git-wip-us.apache.org/repos/asf/incubator-netbeans/diff/3761d738 Branch: refs/heads/jdk-javac Commit: 3761d73831b3a54f798ed8ba919c25256e1ef333 Parents: 4e662ec Author: Jan Lahoda <[email protected]> Authored: Sun Oct 8 22:13:21 2017 +0200 Committer: Jan Lahoda <[email protected]> Committed: Sun Oct 8 22:13:21 2017 +0200 ---------------------------------------------------------------------- java.editor/nbproject/project.xml | 4 ++ .../api/java/source/SourceUtilsTestUtil.java | 45 ++++++-------------- nbbuild/jdk.xml | 2 +- 3 files changed, 17 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/3761d738/java.editor/nbproject/project.xml ---------------------------------------------------------------------- diff --git a/java.editor/nbproject/project.xml b/java.editor/nbproject/project.xml index 18faab0..3f9bbac 100644 --- a/java.editor/nbproject/project.xml +++ b/java.editor/nbproject/project.xml @@ -540,6 +540,10 @@ <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.base</code-name-base> <recursive/> <compile-dependency/> http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/3761d738/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTestUtil.java ---------------------------------------------------------------------- diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTestUtil.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTestUtil.java index ed8ff74..cd181c1 100644 --- a/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTestUtil.java +++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTestUtil.java @@ -28,11 +28,13 @@ import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; +import java.util.stream.Collectors; import javax.swing.event.ChangeListener; import javax.swing.text.Document; import junit.framework.Assert; import org.netbeans.api.editor.mimelookup.MimePath; import org.netbeans.api.java.classpath.ClassPath; +import org.netbeans.api.java.classpath.JavaClassPathConstants; import org.netbeans.api.java.queries.SourceForBinaryQuery; import org.netbeans.api.java.source.JavaSource.Phase; import org.netbeans.editor.BaseDocument; @@ -75,7 +77,7 @@ public final class SourceUtilsTestUtil extends ProxyLookup { private static SourceUtilsTestUtil DEFAULT_LOOKUP = null; private static final Set<String> NB_JAVAC = Collections.unmodifiableSet(new HashSet<String>( - Arrays.asList("nb-javac-api.jar","nb-javac-impl.jar"))); //NOI18N + Arrays.asList("nb-javac-api.jar","nb-javac-impl.jar", "vanilla-javac-api.jar"))); //NOI18N public SourceUtilsTestUtil() { // Assert.assertNull(DEFAULT_LOOKUP); @@ -217,37 +219,14 @@ public final class SourceUtilsTestUtil extends ProxyLookup { public static synchronized List<URL> getBootClassPath() { if (bootClassPath == null) { - try { - String cp = System.getProperty("sun.boot.class.path"); - String tools = System.getProperty("tools.jar.location"); - if (tools != null) { - cp = cp + System.getProperty("path.separator") + tools; - } - List<URL> urls = new ArrayList<URL>(); - for (String path : cp.split(Pattern.quote(System.getProperty("path.separator")))) { - final File f = new File(path); - if (!f.canRead()) - continue; - //Remove nb-javac-impl.jar & nb-javac-api.jar added to test as boot prepend - if (NB_JAVAC.contains(f.getName())) { - continue; - } - - FileObject fo = FileUtil.toFileObject(f); - - if (FileUtil.isArchiveFile(fo)) { - fo = FileUtil.getArchiveRoot(fo); - } - - if (fo != null) { - urls.add(fo.getURL()); - } - } - bootClassPath = urls; - } catch (FileStateInvalidException e) { - if (log.isLoggable(Level.SEVERE)) - log.log(Level.SEVERE, e.getMessage(), e); - } + bootClassPath = TestUtil.getBootClassPath() + .entries() + .stream() + .map(e -> e.getURL()) + .filter(u -> { + return NB_JAVAC.stream().noneMatch(j -> u.getPath().contains(j)); + }) + .collect(Collectors.toList()); } return bootClassPath; @@ -301,7 +280,7 @@ public final class SourceUtilsTestUtil extends ProxyLookup { public ClassPath findClassPath(FileObject file, String type) { try { - if (ClassPath.BOOT == type) { + if (ClassPath.BOOT == type || JavaClassPathConstants.MODULE_BOOT_PATH.equals(type)) { return ClassPathSupport.createClassPath(getBootClassPath().toArray(new URL[0])); } http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/3761d738/nbbuild/jdk.xml ---------------------------------------------------------------------- diff --git a/nbbuild/jdk.xml b/nbbuild/jdk.xml index 76f76f0..146c268 100644 --- a/nbbuild/jdk.xml +++ b/nbbuild/jdk.xml @@ -221,7 +221,7 @@ <os family="windows"/> <!-- #72467 --> </condition> <property name=".exe" value=""/> - <condition property="test.nbjdk.java" value="${test.nbjdk.home}/bin/java${.exe}" else="${nbjdk.home}/bin/java3{.exe}"> + <condition property="test.nbjdk.java" value="${test.nbjdk.home}/bin/java${.exe}" else="${nbjdk.home}/bin/java${.exe}"> <and> <isset property="test.nbjdk.home" /> <available file="${test.nbjdk.home}/bin/java${.exe}" type="file"/>
