You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2017/10/04 19:41:18 UTC
[06/13] incubator-netbeans git commit: Work in progress: an
experiment on using javac from JDK for source code modeling.
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MemberAdditionTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MemberAdditionTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MemberAdditionTest.java
index 7e4a19c..98f5da1 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MemberAdditionTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MemberAdditionTest.java
@@ -28,7 +28,7 @@ import com.sun.source.tree.Tree;
import com.sun.source.tree.TypeParameterTree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.TreePath;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -200,7 +200,7 @@ public class MemberAdditionTest extends NbTestCase {
return i.topLevel;
}
- private static class TopLevelClassInfo extends TreeScanner<Void, Boolean> {
+ private static class TopLevelClassInfo extends ErrorAwareTreeScanner<Void, Boolean> {
private ClassTree topLevel;
@@ -211,7 +211,7 @@ public class MemberAdditionTest extends NbTestCase {
}
- private static class FindVariableDeclaration extends TreeScanner<Void, Boolean> {
+ private static class FindVariableDeclaration extends ErrorAwareTreeScanner<Void, Boolean> {
private VariableTree var;
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MethodBodyTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MethodBodyTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MethodBodyTest.java
index 5b7d9b9..a614545 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MethodBodyTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MethodBodyTest.java
@@ -20,7 +20,7 @@ package org.netbeans.api.java.source.gen;
import com.sun.source.tree.*;
import com.sun.source.util.SourcePositions;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.util.Collections;
import java.util.EnumSet;
@@ -320,7 +320,7 @@ public class MethodBodyTest extends GeneratorTestBase {
MethodTree method = (MethodTree) clazz.getMembers().get(1);
final NewClassTree[] nctFin = new NewClassTree[1];
- new TreeScanner() {
+ new ErrorAwareTreeScanner() {
@Override
public Object visitNewClass(NewClassTree node, Object p) {
nctFin[0] = node;
@@ -378,7 +378,7 @@ public class MethodBodyTest extends GeneratorTestBase {
MethodTree method = (MethodTree) clazz.getMembers().get(1);
final NewClassTree[] nctFin = new NewClassTree[1];
- new TreeScanner() {
+ new ErrorAwareTreeScanner() {
@Override
public Object visitNewClass(NewClassTree node, Object p) {
nctFin[0] = node;
@@ -652,7 +652,7 @@ public class MethodBodyTest extends GeneratorTestBase {
public void run(final WorkingCopy workingCopy) throws java.io.IOException {
workingCopy.toPhase(Phase.RESOLVED);
TreeMaker treeMaker = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitReturn(ReturnTree node, Void p) {
ExpressionTree parsed = workingCopy.getTreeUtilities().parseExpression("str.toString().length()", new SourcePositions[1]);
workingCopy.rewrite(node.getExpression(), parsed);
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ModifiersTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ModifiersTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ModifiersTest.java
index 4de632d..3a20381 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ModifiersTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ModifiersTest.java
@@ -31,7 +31,7 @@ import com.sun.source.tree.NewArrayTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.TypeParameterTree;
import com.sun.source.tree.VariableTree;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
@@ -1453,7 +1453,7 @@ public class ModifiersTest extends GeneratorTestMDRCompat {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
ClassTree clazz = (ClassTree) workingCopy.getCompilationUnit().getTypeDecls().get(0);
- new TreeScanner() {
+ new ErrorAwareTreeScanner() {
@Override
public Object visitVariable(VariableTree var, Object p) {
ModifiersTree mods = var.getModifiers();
@@ -1495,7 +1495,7 @@ public class ModifiersTest extends GeneratorTestMDRCompat {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
ClassTree clazz = (ClassTree) workingCopy.getCompilationUnit().getTypeDecls().get(0);
- new TreeScanner() {
+ new ErrorAwareTreeScanner() {
@Override public Object visitMethod(MethodTree node, Object p) {
if (node.getName().contentEquals("add")) {
workingCopy.rewrite(node.getModifiers(), make.addModifiersModifier(node.getModifiers(), Modifier.DEFAULT));
@@ -1537,7 +1537,7 @@ public class ModifiersTest extends GeneratorTestMDRCompat {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
ClassTree clazz = (ClassTree) workingCopy.getCompilationUnit().getTypeDecls().get(0);
- new TreeScanner() {
+ new ErrorAwareTreeScanner() {
@Override public Object visitMethod(MethodTree node, Object p) {
if (node.getName().contentEquals("find")) {
workingCopy.rewrite(node.getModifiers(), make.Modifiers(Collections.emptySet()));
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MoveTreeTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MoveTreeTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MoveTreeTest.java
index 767d285..b3ea208 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MoveTreeTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MoveTreeTest.java
@@ -34,7 +34,7 @@ import com.sun.source.tree.TypeCastTree;
import com.sun.source.tree.TypeParameterTree;
import com.sun.source.tree.VariableTree;
import com.sun.source.tree.WhileLoopTree;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
@@ -721,7 +721,7 @@ public class MoveTreeTest extends GeneratorTestBase {
VariableTree locVar = (VariableTree) method.getBody().getStatements().get(0);
TypeCastTree tct = (TypeCastTree) locVar.getInitializer();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
if (node.getArguments().size() == 1) {
workingCopy.tag(node, "test");
@@ -784,7 +784,7 @@ public class MoveTreeTest extends GeneratorTestBase {
VariableTree locVar = (VariableTree) method.getBody().getStatements().get(0);
TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
if (node.getArguments().size() == 1) {
workingCopy.tag(node, "test");
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MultiCatchTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MultiCatchTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MultiCatchTest.java
index 010f3aa..d2e5cd1 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MultiCatchTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/MultiCatchTest.java
@@ -19,7 +19,7 @@
package org.netbeans.api.java.source.gen;
import com.sun.source.tree.*;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -137,7 +137,7 @@ public class MultiCatchTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitIdentifier(IdentifierTree node, Void p) {
if (node.getName().contentEquals("FileNotFoundException")) {
workingCopy.rewrite(node, make.Identifier("IOException"));
@@ -186,7 +186,7 @@ public class MultiCatchTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitUnionType(UnionTypeTree node, Void p) {
List<Tree> alternatives = new ArrayList<Tree>(node.getTypeAlternatives());
alternatives.add(make.Identifier("IOException"));
@@ -235,7 +235,7 @@ public class MultiCatchTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitUnionType(UnionTypeTree node, Void p) {
List<Tree> alternatives = new ArrayList<Tree>(node.getTypeAlternatives());
alternatives.add(0, make.Identifier("IOException"));
@@ -284,7 +284,7 @@ public class MultiCatchTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override public Void visitUnionType(UnionTypeTree node, Void p) {
List<Tree> alternatives = new ArrayList<Tree>(node.getTypeAlternatives());
alternatives.add(1, make.Identifier("IOException"));
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RefactoringRegressionsTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RefactoringRegressionsTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RefactoringRegressionsTest.java
index ba16891..ced9501 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RefactoringRegressionsTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RefactoringRegressionsTest.java
@@ -26,7 +26,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Collections;
import com.sun.source.tree.*;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
@@ -562,7 +562,7 @@ public class RefactoringRegressionsTest extends GeneratorTestMDRCompat {
public void run(final WorkingCopy workingCopy) throws IOException {
workingCopy.toPhase(Phase.RESOLVED);
CompilationUnitTree cut = workingCopy.getCompilationUnit();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override
public Void visitMemberSelect(MemberSelectTree node, Void p) {
if ("E".equals(node.getIdentifier().toString())) {
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RewriteOccasionalStatements.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RewriteOccasionalStatements.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RewriteOccasionalStatements.java
index e32f969..bccff6e 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RewriteOccasionalStatements.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/RewriteOccasionalStatements.java
@@ -20,7 +20,7 @@ package org.netbeans.api.java.source.gen;
import com.sun.source.tree.*;
import com.sun.source.tree.Tree.Kind;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import org.junit.Test;
import org.netbeans.api.java.source.*;
import org.netbeans.junit.NbTestSuite;
@@ -451,7 +451,7 @@ public class RewriteOccasionalStatements extends GeneratorTestBase {
*/
- class SimpleScanner extends TreeScanner<Void, Void> {
+ class SimpleScanner extends ErrorAwareTreeScanner<Void, Void> {
private final WorkingCopy wc;
protected GeneratorUtilities gu;
@@ -501,7 +501,7 @@ public class RewriteOccasionalStatements extends GeneratorTestBase {
workingCopy.toPhase(JavaSource.Phase.RESOLVED);
CompilationUnitTree cut = workingCopy.getCompilationUnit();
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override
public Void visitMethodInvocation(MethodInvocationTree node, Void p) {
if (node.getMethodSelect().getKind() == Kind.IDENTIFIER && ((IdentifierTree) node.getMethodSelect()).getName().contentEquals("a")) {
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchTest.java
index 51eb1d6..64e3ef8 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/SwitchTest.java
@@ -25,7 +25,7 @@ import com.sun.source.tree.StatementTree;
import com.sun.source.tree.SwitchTree;
import com.sun.source.tree.Tree.Kind;
import com.sun.source.util.TreePath;
-import com.sun.source.util.TreePathScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreePathScanner;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -170,7 +170,7 @@ public class SwitchTest extends GeneratorTestBase {
return;
}
final TreeMaker make = copy.getTreeMaker();
- new TreePathScanner<Void, Void>() {
+ new ErrorAwareTreePathScanner<Void, Void>() {
@Override public Void visitIf(IfTree node, Void p) {
List<StatementTree> statements = new ArrayList<StatementTree>(((BlockTree) node.getThenStatement()).getStatements());
statements.add(make.Break(null));
@@ -218,7 +218,7 @@ public class SwitchTest extends GeneratorTestBase {
return;
}
final TreeMaker make = copy.getTreeMaker();
- new TreePathScanner<Void, Void>() {
+ new ErrorAwareTreePathScanner<Void, Void>() {
@Override public Void visitCase(CaseTree node, Void p) {
IfTree nue = make.If(make.Binary(Kind.EQUAL_TO, make.Identifier("p"), make.Literal(0)), make.Block(node.getStatements().subList(0, node.getStatements().size() - 1), false), null);
copy.rewrite(getCurrentPath().getParentPath().getLeaf(), nue);
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TryTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TryTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TryTest.java
index 1e3567f..4ccdba1 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TryTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TryTest.java
@@ -19,7 +19,7 @@
package org.netbeans.api.java.source.gen;
import com.sun.source.tree.*;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@@ -506,7 +506,7 @@ public class TryTest extends GeneratorTestMDRCompat {
workingCopy.toPhase(Phase.RESOLVED); //for RESOLVED, the 1.7 runtime (java.lang.AutoCloseable) would be needed
final TreeMaker make = workingCopy.getTreeMaker();
- new TreeScanner<Void, Void>() {
+ new ErrorAwareTreeScanner<Void, Void>() {
@Override
public Void visitVariable(VariableTree node, Void p) {
if (node.getName().contentEquals("in")) {
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TypeAnnotationTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TypeAnnotationTest.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TypeAnnotationTest.java
index e15b47f..0476263 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TypeAnnotationTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/TypeAnnotationTest.java
@@ -19,7 +19,7 @@
package org.netbeans.api.java.source.gen;
import com.sun.source.tree.*;
-import com.sun.source.util.TreePathScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreePathScanner;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -162,7 +162,7 @@ public class TypeAnnotationTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreePathScanner<Void, Void>(){
+ new ErrorAwareTreePathScanner<Void, Void>(){
@Override public Void visitAnnotatedType(AnnotatedTypeTree node, Void p) {
workingCopy.rewrite(node, WorkingCopyTest.MakeAnnotatedTypeTemp(make, node.getUnderlyingType(), alter.alter(workingCopy, node.getAnnotations())));
return null;
@@ -210,7 +210,7 @@ public class TypeAnnotationTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreePathScanner<Void, Void>(){
+ new ErrorAwareTreePathScanner<Void, Void>(){
@Override public Void visitAnnotatedType(AnnotatedTypeTree node, Void p) {
workingCopy.rewrite(node, WorkingCopyTest.MakeAnnotatedTypeTemp(make, make.Identifier("String"), node.getAnnotations()));
return null;
@@ -258,7 +258,7 @@ public class TypeAnnotationTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreePathScanner<Void, Void>(){
+ new ErrorAwareTreePathScanner<Void, Void>(){
@Override public Void visitParameterizedType(ParameterizedTypeTree node, Void p) {
List<AnnotationTree> annotations = Collections.singletonList(workingCopy.getTreeMaker().TypeAnnotation(make.Identifier("A"), Collections.<ExpressionTree>emptyList()));
Tree orig = node.getTypeArguments().get(0);
@@ -308,7 +308,7 @@ public class TypeAnnotationTest extends GeneratorTestBase {
workingCopy.toPhase(Phase.RESOLVED);
final TreeMaker make = workingCopy.getTreeMaker();
- new TreePathScanner<Void, Void>(){
+ new ErrorAwareTreePathScanner<Void, Void>(){
@Override public Void visitAnnotatedType(AnnotatedTypeTree node, Void p) {
workingCopy.rewrite(node, node.getUnderlyingType());
return super.visitAnnotatedType(node, p);
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/TreeLoaderTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/TreeLoaderTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/TreeLoaderTest.java
deleted file mode 100644
index 08a68c6..0000000
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/TreeLoaderTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.java.source;
-
-import java.io.File;
-import java.io.IOException;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.TypeElement;
-import org.netbeans.api.java.source.CompilationController;
-import org.netbeans.api.java.source.JavaSource;
-import org.netbeans.api.java.source.JavaSource.Phase;
-import org.netbeans.api.java.source.SourceUtilsTestUtil;
-import org.netbeans.api.java.source.Task;
-import org.netbeans.api.java.source.TestUtilities;
-import org.netbeans.junit.NbTestCase;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
-
-/**
- *
- * @author lahvac
- */
-public class TreeLoaderTest extends NbTestCase {
-
- public TreeLoaderTest(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- clearWorkDir();
- SourceUtilsTestUtil.prepareTest(new String[0], new Object[0]);
- }
-
- public void test171340() throws Exception {
- prepareTest();
-
- FileObject src1 = FileUtil.createData(sourceRoot, "test/Test1.java");
- FileObject src2 = FileUtil.createData(sourceRoot, "test/Test2.java");
-
- TestUtilities.copyStringToFile(src1,
- "package test;\n" +
- "public class Test1 {}");
- TestUtilities.copyStringToFile(src2,
- "package test;\n" +
- "public class Test2 {" +
- " public void test() {}" +
- "}");
- SourceUtilsTestUtil.compileRecursively(sourceRoot);
- JavaSource javaSource = JavaSource.forFileObject(src1);
- javaSource.runUserActionTask(new Task<CompilationController>() {
- public void run(CompilationController controller) throws IOException {
- controller.toPhase(Phase.RESOLVED);
- TypeElement typeElement = controller.getElements().getTypeElement("test.Test2");
- assertNotNull(typeElement);
- ExecutableElement method = (ExecutableElement) typeElement.getEnclosedElements().get(1);
- assertNotNull(controller.getTrees().getPath(method));
- }
- }, true);
- }
-
- private FileObject sourceRoot;
-
- private void prepareTest() throws Exception {
- File work = getWorkDir();
- FileObject workFO = FileUtil.toFileObject(work);
-
- assertNotNull(workFO);
-
- sourceRoot = workFO.createFolder("src");
- FileObject buildRoot = workFO.createFolder("build");
- FileObject cache = workFO.createFolder("cache");
-
- SourceUtilsTestUtil.prepareTest(sourceRoot, buildRoot, cache);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
index 0ca6a3c..26e657b 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
@@ -18,7 +18,6 @@
*/
package org.netbeans.modules.java.source.indexing;
-import com.sun.source.tree.CompilationUnitTree;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
@@ -26,15 +25,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
-import javax.tools.JavaFileObject;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import static org.junit.Assert.*;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.source.SourceUtilsTestUtil;
import org.netbeans.api.java.source.TestUtilities;
@@ -52,6 +43,7 @@ import org.netbeans.modules.parsing.impl.indexing.SPIAccessor;
import org.netbeans.modules.parsing.impl.indexing.SuspendSupport.SuspendStatusImpl;
import org.netbeans.modules.parsing.impl.indexing.lucene.LuceneIndexFactory;
import org.netbeans.modules.parsing.spi.indexing.Context;
+import org.netbeans.modules.parsing.spi.indexing.ErrorsCache;
import org.netbeans.spi.java.classpath.support.ClassPathSupport;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
@@ -66,10 +58,10 @@ public abstract class CompileWorkerTestBase extends NbTestCase {
super(name);
}
- public void test219787() throws Exception {
- ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test3.java", "package test; public class Test3")),
- Arrays.asList(virtualCompileTuple("test/Test1.virtual", "package test; public class Test1 {}"),
- virtualCompileTuple("test/Test2.virtual", "package test; public class Test2 {}")));
+ public void testClassesLivingElsewhere() throws Exception {
+ ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test1.java", "package test; public class Test1 { Test2a t; } class Test1a { }"),
+ compileTuple("test/Test2.java", "package test; public class Test2 { Test1a t; } class Test2a { }")),
+ Arrays.asList());
assertFalse(result.lowMemory);
assertTrue(result.success);
@@ -80,10 +72,15 @@ public abstract class CompileWorkerTestBase extends NbTestCase {
createdFiles.add(getWorkDir().toURI().relativize(created.toURI()).getPath());
}
- assertEquals(new HashSet<String>(Arrays.asList("cache/s1/java/15/classes/test/Test3.sig")), createdFiles);
+ assertEquals(new HashSet<String>(Arrays.asList("cache/s1/java/15/classes/test/Test1.sig",
+ "cache/s1/java/15/classes/test/Test1a.sig",
+ "cache/s1/java/15/classes/test/Test2.sig",
+ "cache/s1/java/15/classes/test/Test2a.sig")),
+ createdFiles);
+ assertFalse(ErrorsCache.isInError(getRoot(), true));
}
-
- private ParsingOutput runIndexing(List<CompileTuple> files, List<CompileTuple> virtualFiles) throws Exception {
+
+ protected ParsingOutput runIndexing(List<CompileTuple> files, List<CompileTuple> virtualFiles) throws Exception {
TransactionContext txc = TransactionContext.beginStandardTransaction(src.toURL(), true, false, false);
Factory f = new JavaCustomIndexer.Factory();
Context ctx = SPIAccessor.getInstance().createContext(CacheFolder.getDataFolder(src.toURL()), src.toURL(), f.getIndexerName(), f.getIndexVersion(), LuceneIndexFactory.getDefault(), false, false, true, SPIAccessor.getInstance().createSuspendStatus(new SuspendStatusImpl() {
@@ -142,13 +139,17 @@ public abstract class CompileWorkerTestBase extends NbTestCase {
return testFile;
}
- private CompileTuple virtualCompileTuple(String relativePath, String content) throws Exception {
+ protected CompileTuple virtualCompileTuple(String relativePath, String content) throws Exception {
FileObject file = createSrcFile(relativePath, "");
return new CompileTuple(FileObjects.sourceFileObject(file, src, null, content), SPIAccessor.getInstance().create(new FileObjectIndexable(src, relativePath)), true, true);
}
- private CompileTuple compileTuple(String relativePath, String content) throws Exception {
+ protected CompileTuple compileTuple(String relativePath, String content) throws Exception {
FileObject file = createSrcFile(relativePath, content);
return new CompileTuple(FileObjects.sourceFileObject(file, src), SPIAccessor.getInstance().create(new FileObjectIndexable(src, relativePath)), false, true);
}
+
+ protected FileObject getRoot() {
+ return src;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/MultiPassCompileWorkerTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/MultiPassCompileWorkerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/MultiPassCompileWorkerTest.java
deleted file mode 100644
index d2632df..0000000
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/MultiPassCompileWorkerTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.java.source.indexing;
-
-import java.util.Collection;
-import org.netbeans.modules.java.source.indexing.CompileWorker.ParsingOutput;
-import org.netbeans.modules.java.source.indexing.JavaCustomIndexer.CompileTuple;
-import org.netbeans.modules.parsing.spi.indexing.Context;
-
-/**
- *
- * @author lahvac
- */
-public class MultiPassCompileWorkerTest extends CompileWorkerTestBase {
-
- public MultiPassCompileWorkerTest(String name) {
- super(name);
- }
-
- @Override
- protected ParsingOutput runCompileWorker(Context context, JavaParsingContext javaContext, Collection<? extends CompileTuple> files) throws Exception {
- JavaCustomIndexer.NO_ONE_PASS_COMPILE_WORKER = true;
- ParsingOutput fromOnePass = new OnePassCompileWorker().compile(null, context, javaContext, files);
- return new MultiPassCompileWorker().compile(fromOnePass, context, javaContext, files);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorkerTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorkerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorkerTest.java
deleted file mode 100644
index 0878533..0000000
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/OnePassCompileWorkerTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.java.source.indexing;
-
-import java.util.Collection;
-import org.netbeans.modules.java.source.indexing.CompileWorker.ParsingOutput;
-import org.netbeans.modules.java.source.indexing.JavaCustomIndexer.CompileTuple;
-import org.netbeans.modules.parsing.spi.indexing.Context;
-
-/**
- *
- * @author lahvac
- */
-public class OnePassCompileWorkerTest extends CompileWorkerTestBase {
-
- public OnePassCompileWorkerTest(String name) {
- super(name);
- }
-
- @Override
- protected ParsingOutput runCompileWorker(Context context, JavaParsingContext javaContext, Collection<? extends CompileTuple> files) {
- return new OnePassCompileWorker().compile(null, context, javaContext, files);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorkerTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorkerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorkerTest.java
deleted file mode 100644
index 5b0233b..0000000
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/SuperOnePassCompileWorkerTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.netbeans.modules.java.source.indexing;
-
-import java.util.Collection;
-import org.netbeans.modules.java.source.indexing.CompileWorker.ParsingOutput;
-import org.netbeans.modules.java.source.indexing.JavaCustomIndexer.CompileTuple;
-import org.netbeans.modules.parsing.spi.indexing.Context;
-
-/**
- *
- * @author lahvac
- */
-public class SuperOnePassCompileWorkerTest extends CompileWorkerTestBase {
-
- public SuperOnePassCompileWorkerTest(String name) {
- super(name);
- }
-
- @Override
- protected ParsingOutput runCompileWorker(Context context, JavaParsingContext javaContext, Collection<? extends CompileTuple> files) {
- return new SuperOnePassCompileWorker().compile(null, context, javaContext, files);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
new file mode 100644
index 0000000..c2f5ee0
--- /dev/null
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorkerTest.java
@@ -0,0 +1,71 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.java.source.indexing;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
+import org.netbeans.modules.java.source.indexing.CompileWorker.ParsingOutput;
+import org.netbeans.modules.java.source.indexing.JavaCustomIndexer.CompileTuple;
+import org.netbeans.modules.parsing.spi.indexing.Context;
+
+/**TODO: this test needs to run with vanilla javac
+ *
+ * @author lahvac
+ */
+public class VanillaCompileWorkerTest extends CompileWorkerTestBase {
+
+ public VanillaCompileWorkerTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected ParsingOutput runCompileWorker(Context context, JavaParsingContext javaContext, Collection<? extends CompileTuple> files) {
+ return new VanillaCompileWorker().compile(null, context, javaContext, files);
+ }
+
+ public void testVanillaWorker() throws Exception {
+ ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test3.java", "package test; public class Test3"),
+ compileTuple("test/Test4.java", "package test; public class Test4 { Undef undef; }")),
+ Arrays.asList(virtualCompileTuple("test/Test1.virtual", "package test; public class Test1 {}"),
+ virtualCompileTuple("test/Test2.virtual", "package test; public class Test2 {}")));
+
+ assertFalse(result.lowMemory);
+ assertTrue(result.success);
+
+ Set<String> createdFiles = new HashSet<String>();
+
+ for (File created : result.createdFiles) {
+ createdFiles.add(getWorkDir().toURI().relativize(created.toURI()).getPath());
+ }
+
+ //TODO:
+// assertEquals(new HashSet<String>(Arrays.asList("cache/s1/java/15/classes/test/Test3.sig")), createdFiles);
+ result = runIndexing(Arrays.asList(compileTuple("test/Test4.java", "package test; public class Test4 { void t() { Undef undef; } }")),
+ Collections.emptyList());
+
+ assertFalse(result.lowMemory);
+ assertTrue(result.success);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
index e63a8ea..a9abe87 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
@@ -27,6 +27,7 @@ import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Arrays;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Enumeration;
@@ -45,6 +46,7 @@ import junit.framework.*;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.source.ClasspathInfo;
import org.netbeans.junit.NbTestCase;
+import org.netbeans.modules.java.source.ElementUtils;
import org.netbeans.modules.java.source.JavaSourceAccessor;
import org.netbeans.modules.java.source.TestUtil;
import org.netbeans.modules.java.source.indexing.TransactionContext;
@@ -108,9 +110,8 @@ public class ClasspathInfoTest extends NbTestCase {
public void testGetTypeDeclaration() throws Exception {
ClasspathInfo ci = ClasspathInfo.create( bootPath, classPath, null);
- JavacTaskImpl jTask = JavacParser.createJavacTask(ci, (DiagnosticListener) null, (String) null, null, null, null, null, null, null);
+ JavacTaskImpl jTask = JavacParser.createJavacTask(ci, (DiagnosticListener) null, (String) null, null, null, null, null, null, Collections.emptyList());
jTask.enter();
- JavacElements elements = (JavacElements) jTask.getElements();
List<String> notFound = new LinkedList<String>();
JarFile jf = new JarFile( rtJar );
@@ -121,7 +122,7 @@ public class ClasspathInfoTest extends NbTestCase {
String typeName = jeName.substring( 0, jeName.length() - ".class".length() );
typeName = typeName.replace( "/", "." ); //.replace( "$", "." );
- TypeElement te = elements.getTypeElementByBinaryName( typeName );
+ TypeElement te = ElementUtils.getTypeElementByBinaryName(jTask, typeName );
// assertNotNull( "Declaration for " + typeName + " should not be null.", td );
if ( te == null ) {
if (!typeName.endsWith("package-info")) {
@@ -148,7 +149,7 @@ public class ClasspathInfoTest extends NbTestCase {
// empty package
continue;
}
- PackageElement pd = JavacParser.createJavacTask(ci, (DiagnosticListener) null, (String) null, null, null, null, null, null, null).getElements().getPackageElement( packageName );
+ PackageElement pd = JavacParser.createJavacTask(ci, (DiagnosticListener) null, (String) null, null, null, null, null, null, Collections.emptyList()).getElements().getPackageElement( packageName );
assertNotNull( "Declaration for " + packageName + " should not be null.", pd );
}
}
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
index a64483f..5d7d1d5 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/JavacParserTest.java
@@ -22,7 +22,7 @@ package org.netbeans.modules.java.source.parsing;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreePath;
-import com.sun.source.util.TreePathScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreePathScanner;
import com.sun.tools.javac.code.Source;
import java.io.File;
import java.io.FileOutputStream;
@@ -158,7 +158,7 @@ public class JavacParserTest extends NbTestCase {
assertSame(tree.get(), parameter.getCompilationUnit());
- new TreePathScanner<Void, long[]>() {
+ new ErrorAwareTreePathScanner<Void, long[]>() {
@Override
public Void scan(Tree tree, long[] parentSpan) {
@@ -249,7 +249,7 @@ public class JavacParserTest extends NbTestCase {
assertSame(tree.get(), parameter.getCompilationUnit());
- new TreePathScanner<Void, long[]>() {
+ new ErrorAwareTreePathScanner<Void, long[]>() {
@Override
public Void scan(Tree tree, long[] parentSpan) {
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
index b54a417..7ef958a 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
@@ -91,7 +91,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -112,7 +111,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -129,7 +127,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -147,7 +144,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -165,7 +161,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -185,7 +180,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNotNull(impl);
final Options opts = Options.instance(impl.getContext());
@@ -218,7 +212,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
List<? extends FileObject> roots = h.getRoots();
@@ -231,7 +224,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
roots = h.getRoots();
@@ -242,7 +234,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Next", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
roots = h.getRoots();
@@ -269,7 +260,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
List<? extends String> names = h.getModuleNames();
@@ -282,7 +272,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -293,7 +282,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Next", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -320,7 +308,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
List<? extends String> names = h.getModuleNames();
@@ -334,7 +321,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("TestUpdated", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -347,7 +333,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("TestUpdated", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -373,7 +358,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("Test", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
List<? extends String> names = h.getModuleNames();
@@ -387,7 +371,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNull(Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -400,7 +383,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNull(Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -427,7 +409,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertNull(Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
List<? extends String> names = h.getModuleNames();
@@ -441,7 +422,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("TestNew", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
@@ -454,7 +434,6 @@ public class ModuleOraculumTest extends NbTestCase {
cpInfo,
parser,
null,
- null,
false);
assertEquals("TestNew", Options.instance(impl.getContext()).get("-Xmodule:")); //NOI18N
names = h.getModuleNames();
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/transform/Transformer.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/transform/Transformer.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/transform/Transformer.java
index b0ac072..dff1d3d 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/transform/Transformer.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/transform/Transformer.java
@@ -22,7 +22,7 @@ package org.netbeans.modules.java.source.transform;
import org.netbeans.modules.java.source.query.CommentHandler;
import org.openide.util.NbBundle;
import com.sun.source.tree.*;
-import com.sun.source.util.TreeScanner;
+import org.netbeans.api.java.source.support.ErrorAwareTreeScanner;
import com.sun.tools.javac.model.JavacTypes;
import com.sun.tools.javac.util.Context;
import java.util.List;
@@ -39,7 +39,7 @@ import org.netbeans.modules.java.source.builder.TreeFactory;
* is done by a supplied ImmutableTreeTranslator implementation. A new context
* is set upon successful completion of this Transformer.
*/
-public abstract class Transformer<R, P> extends TreeScanner<R,P> {
+public abstract class Transformer<R, P> extends ErrorAwareTreeScanner<R,P> {
CommentHandler commentHandler;
public TreeMaker make;
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/ClassNamesForFileOraculumImplTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/ClassNamesForFileOraculumImplTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/ClassNamesForFileOraculumImplTest.java
deleted file mode 100644
index 43dadab..0000000
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/ClassNamesForFileOraculumImplTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.netbeans.modules.java.source.usages;
-
-import com.sun.tools.javac.api.ClassNamesForFileOraculum;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.NestingKind;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-/**
- *
- * @author lahvac
- */
-public class ClassNamesForFileOraculumImplTest {
-
- public ClassNamesForFileOraculumImplTest() {
- }
-
- @Test
- public void testDivineSources() {
- TestJavaFileObject fo1 = new TestJavaFileObject();
- TestJavaFileObject fo2 = new TestJavaFileObject();
- Map<JavaFileObject, List<String>> fo2FQNs = new HashMap<JavaFileObject, List<String>>();
-
- fo2FQNs.put(fo1, Arrays.asList("a.b.c.Class1"));
- fo2FQNs.put(fo2, Arrays.asList("e.f.g"));
-
- ClassNamesForFileOraculum oraculum = new ClassNamesForFileOraculumImpl(fo2FQNs);
-
- assertArrayEquals(new JavaFileObject[] {fo1}, oraculum.divineSources("a.b.c"));
- assertNull(oraculum.divineSources("a.b"));
- assertNull(oraculum.divineSources("e.f.g"));
- }
-
- private static final class TestJavaFileObject extends SimpleJavaFileObject {
-
- public TestJavaFileObject() {
- super(URI.create("test://test.java"), Kind.SOURCE);
- }
-
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/CompromiseSATest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/CompromiseSATest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/CompromiseSATest.java
index 78cd883..f62766b 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/CompromiseSATest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/CompromiseSATest.java
@@ -50,6 +50,7 @@ import org.netbeans.modules.classfile.ClassFile;
import org.netbeans.modules.classfile.ClassName;
import org.netbeans.modules.classfile.Method;
import org.netbeans.modules.classfile.Variable;
+import org.netbeans.modules.java.source.ElementUtils;
import org.netbeans.modules.java.source.usages.ClassIndexImpl.UsageType;
/**
@@ -223,8 +224,7 @@ public class CompromiseSATest extends NbTestCase {
InputStream in = this.prepareData (testClassName);
try {
JavacTask jt = prepareJavac ();
- JavacElements elements = (JavacElements) jt.getElements();
- TypeElement be = elements.getTypeElementByBinaryName(testClassName);
+ TypeElement be = ElementUtils.getTypeElementByBinaryName(jt, testClassName);
assertNotNull ("Javac Error", be);
String className = ClassFileUtil.encodeClassName(be);
ClassFile cf = new ClassFile (in, true);
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
----------------------------------------------------------------------
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
index ca9d1d8..a39cad7 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
@@ -23,6 +23,7 @@ import com.sun.source.tree.CompilationUnitTree;
import com.sun.tools.javac.api.JavacTaskImpl;
import java.io.File;
import java.util.ArrayDeque;
+import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
@@ -106,14 +107,14 @@ public class SourceAnalyzerTest extends NbTestCase {
true,
false,
true);
+ final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
final JavacTaskImpl jt = JavacParser.createJavacTask(
cpInfo,
diag,
SourceLevelQuery.getSourceLevel(src), //NOI18N
SourceLevelQuery.Profile.DEFAULT,
- null, null, null, null, null);
- final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
- final Iterable<? extends CompilationUnitTree> trees = jt.parse(jfo);
+ null, null, null, null, Arrays.asList(jfo));
+ final Iterable<? extends CompilationUnitTree> trees = jt.parse();
jt.enter();
jt.analyze();
final SourceAnalyzerFactory.SimpleAnalyzer sa = SourceAnalyzerFactory.createSimpleAnalyzer();
@@ -159,14 +160,14 @@ public class SourceAnalyzerTest extends NbTestCase {
true,
false,
true);
+ final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
final JavacTaskImpl jt = JavacParser.createJavacTask(
cpInfo,
diag,
SourceLevelQuery.getSourceLevel(src), //NOI18N
SourceLevelQuery.Profile.DEFAULT,
- null, null, null, null, null);
- final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
- final Iterable<? extends CompilationUnitTree> trees = jt.parse(jfo);
+ null, null, null, null, Arrays.asList(jfo));
+ final Iterable<? extends CompilationUnitTree> trees = jt.parse();
jt.enter();
jt.analyze();
final SourceAnalyzerFactory.SimpleAnalyzer sa = SourceAnalyzerFactory.createSimpleAnalyzer();
@@ -208,14 +209,14 @@ public class SourceAnalyzerTest extends NbTestCase {
true,
false,
true);
+ final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
final JavacTaskImpl jt = JavacParser.createJavacTask(
cpInfo,
diag,
SourceLevelQuery.getSourceLevel(src), //NOI18N
SourceLevelQuery.Profile.DEFAULT,
- null, null, null, null, null);
- final JavaFileObject jfo = FileObjects.sourceFileObject(javaFile, src);
- final Iterable<? extends CompilationUnitTree> trees = jt.parse(jfo);
+ null, null, null, null, Arrays.asList(jfo));
+ final Iterable<? extends CompilationUnitTree> trees = jt.parse();
jt.enter();
jt.analyze();
final SourceAnalyzerFactory.SimpleAnalyzer sa = SourceAnalyzerFactory.createSimpleAnalyzer();
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.jdk9.req/build.xml
----------------------------------------------------------------------
diff --git a/java.source.jdk9.req/build.xml b/java.source.jdk9.req/build.xml
new file mode 100644
index 0000000..3ee732c
--- /dev/null
+++ b/java.source.jdk9.req/build.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="netbeans" name="java.source.jdk9.req">
+ <description>Builds, tests, and runs the project org.netbeans.modules.java.source.jdk9.req</description>
+ <import file="../nbbuild/templates/projectized.xml"/>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.jdk9.req/manifest.mf
----------------------------------------------------------------------
diff --git a/java.source.jdk9.req/manifest.mf b/java.source.jdk9.req/manifest.mf
new file mode 100644
index 0000000..9ab42f9
--- /dev/null
+++ b/java.source.jdk9.req/manifest.mf
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.java.source.jdk9.req
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/source/jdk9/req/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+OpenIDE-Module-Package-Dependencies: [com.sun.source.tree.ModuleTree]
+OpenIDE-Module-Provides: org.netbeans.modules.javac
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.jdk9.req/nbproject/project.properties
----------------------------------------------------------------------
diff --git a/java.source.jdk9.req/nbproject/project.properties b/java.source.jdk9.req/nbproject/project.properties
new file mode 100644
index 0000000..ff160e0
--- /dev/null
+++ b/java.source.jdk9.req/nbproject/project.properties
@@ -0,0 +1,3 @@
+is.eager=true
+javac.source=1.7
+javac.compilerargs=-Xlint -Xlint:-serial
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.jdk9.req/nbproject/project.xml
----------------------------------------------------------------------
diff --git a/java.source.jdk9.req/nbproject/project.xml b/java.source.jdk9.req/nbproject/project.xml
new file mode 100644
index 0000000..43d5e53
--- /dev/null
+++ b/java.source.jdk9.req/nbproject/project.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.java.source.jdk9.req</code-name-base>
+ <module-dependencies/>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.jdk9.req/src/org/netbeans/modules/java/source/jdk9/req/Bundle.properties
----------------------------------------------------------------------
diff --git a/java.source.jdk9.req/src/org/netbeans/modules/java/source/jdk9/req/Bundle.properties b/java.source.jdk9.req/src/org/netbeans/modules/java/source/jdk9/req/Bundle.properties
new file mode 100644
index 0000000..3991227
--- /dev/null
+++ b/java.source.jdk9.req/src/org/netbeans/modules/java/source/jdk9/req/Bundle.properties
@@ -0,0 +1 @@
+OpenIDE-Module-Name=Java Source JDK 9 Required
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/build.xml
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/build.xml b/java.source.nbjavac/build.xml
new file mode 100644
index 0000000..28b8f66
--- /dev/null
+++ b/java.source.nbjavac/build.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="netbeans" name="java.source.nbjavac">
+ <description>Builds, tests, and runs the project org.netbeans.modules.java.source.nbjavac</description>
+ <import file="../nbbuild/templates/projectized.xml"/>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/manifest.mf
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/manifest.mf b/java.source.nbjavac/manifest.mf
new file mode 100644
index 0000000..0abeede
--- /dev/null
+++ b/java.source.nbjavac/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+AutoUpdate-Show-In-Client: false
+OpenIDE-Module: org.netbeans.modules.java.source.nbjavac
+OpenIDE-Module-Implementation-Version: 1
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/source/nbjavac/Bundle.properties
+OpenIDE-Module-Requires: org.netbeans.modules.nbjavac
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/nbproject/project.properties
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/nbproject/project.properties b/java.source.nbjavac/nbproject/project.properties
new file mode 100644
index 0000000..8942dda
--- /dev/null
+++ b/java.source.nbjavac/nbproject/project.properties
@@ -0,0 +1,5 @@
+is.eager=true
+javac.source=1.8
+javac.compilerargs=-Xlint -Xlint:-serial
+spec.version.base=1.0
+requires.nb.javac.impl=true
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/nbproject/project.xml
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/nbproject/project.xml b/java.source.nbjavac/nbproject/project.xml
new file mode 100644
index 0000000..75f5402
--- /dev/null
+++ b/java.source.nbjavac/nbproject/project.xml
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>org.netbeans.modules.java.source.nbjavac</code-name-base>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>org.netbeans.api.annotations.common</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.28</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.66</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.api.java.classpath</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.54</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.lib.nbjavac</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.javacapi</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.21</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.libs.javacimpl</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.parsing.api</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>9.7</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <implementation-version/>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.filesystems</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.11</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>9.8</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>org.openide.util.lookup</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>8.34</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <test-dependencies>
+ <test-type>
+ <name>unit</name>
+ <test-dependency>
+ <code-name-base>org.netbeans.lib.nbjavac</code-name-base>
+ <compile-dependency/>
+ <test/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.libs.junit4</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.editor.mimelookup</code-name-base>
+ <compile-dependency/>
+ <test/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.java.source</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.java.source.base</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ <test/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.nbjunit</code-name-base>
+ <recursive/>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.parsing.indexing</code-name-base>
+ <compile-dependency/>
+ <test/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ <test-dependency>
+ <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
+ <compile-dependency/>
+ </test-dependency>
+ </test-type>
+ </test-dependencies>
+ <public-packages/>
+ </data>
+ </configuration>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/Bundle.properties
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/Bundle.properties b/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/Bundle.properties
new file mode 100644
index 0000000..ae5ccca
--- /dev/null
+++ b/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/Bundle.properties
@@ -0,0 +1 @@
+OpenIDE-Module-Name=Java Source nb-javac Bridge
http://git-wip-us.apache.org/repos/asf/incubator-netbeans/blob/ffc0de5a/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/indexing/ClassNamesForFileOraculumImpl.java
----------------------------------------------------------------------
diff --git a/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/indexing/ClassNamesForFileOraculumImpl.java b/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/indexing/ClassNamesForFileOraculumImpl.java
new file mode 100644
index 0000000..196b078
--- /dev/null
+++ b/java.source.nbjavac/src/org/netbeans/modules/java/source/nbjavac/indexing/ClassNamesForFileOraculumImpl.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.netbeans.modules.java.source.nbjavac.indexing;
+
+import com.sun.tools.javac.api.ClassNamesForFileOraculum;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import javax.tools.JavaFileObject;
+
+/**
+ *
+ * @author Jan Lahoda
+ */
+public class ClassNamesForFileOraculumImpl implements ClassNamesForFileOraculum {
+
+ private final Map<JavaFileObject, List<String>> misplacedSource2FQNs;
+
+ public ClassNamesForFileOraculumImpl(Map<JavaFileObject, List<String>> misplacedSource2FQNs) {
+ this.misplacedSource2FQNs = misplacedSource2FQNs;
+ }
+
+ public String[] divineClassName(JavaFileObject jfo) {
+ if (misplacedSource2FQNs.isEmpty()) {
+ return null;
+ }
+
+ List<String> result = misplacedSource2FQNs.get(jfo);
+
+ if (result != null) {
+ return result.toArray(new String[result.size()]);
+ }
+
+ return null;
+ }
+
+ public JavaFileObject[] divineSources(String fqn) {
+ if (fqn == null || fqn.length() == 0 || misplacedSource2FQNs.isEmpty()) {
+ return null;
+ }
+
+ fqn += "."; //fqn should always be a package name
+
+ List<JavaFileObject> jfos = new LinkedList<JavaFileObject>();
+ for (Map.Entry<JavaFileObject, List<String>> entry : misplacedSource2FQNs.entrySet()) {
+ for (String s : entry.getValue()) {
+ if (s.startsWith(fqn)) {
+ if (s.indexOf('.', fqn.length()) == -1) {
+ jfos.add(entry.getKey());
+ break;
+ }
+ }
+ }
+ }
+
+ return jfos.size() > 0 ? jfos.toArray(new JavaFileObject[jfos.size()]) : null;
+ }
+}