This is an automated email from the ASF dual-hosted git repository. geertjan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 727e223 Fixing a few problems that happen during indexing using JDK's javac. (#428) 727e223 is described below commit 727e22333ef7c34ad84f7891db5b36af2c7df2ce Author: Jan Lahoda <lah...@gmail.com> AuthorDate: Tue Feb 20 09:36:51 2018 +0100 Fixing a few problems that happen during indexing using JDK's javac. (#428) --- .../java/source/indexing/VanillaCompileWorker.java | 12 +++++++++--- .../source/indexing/VanillaCompileWorkerTest.java | 20 +++++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java index 9853a5c..e7e26ff 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java +++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java @@ -71,7 +71,6 @@ import javax.lang.model.element.ModuleElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; -import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; import org.netbeans.api.java.classpath.ClassPath; import org.netbeans.api.java.queries.CompilerOptionsQuery; @@ -414,11 +413,17 @@ final class VanillaCompileWorker extends CompileWorker { } else { mt = (Type.MethodType) msym.type; } + clearMethodType(mt); + if (msym.erasure_field != null && msym.erasure_field.hasTag(TypeTag.METHOD)) + clearMethodType((Type.MethodType) msym.erasure_field); + clearAnnotations(decl.sym.getMetadata()); + return super.visitMethod(node, p); + } + + private void clearMethodType(Type.MethodType mt) { mt.restype = error2Object(mt.restype); mt.argtypes = error2Object(mt.argtypes); mt.thrown = error2Object(mt.thrown); - clearAnnotations(decl.sym.getMetadata()); - return super.visitMethod(node, p); } @Override @@ -431,6 +436,7 @@ final class VanillaCompileWorker extends CompileWorker { ct.interfaces_field = error2Object(ct.interfaces_field); ct.typarams_field = error2Object(ct.typarams_field); ct.supertype_field = error2Object(ct.supertype_field); + clearAnnotations(clazz.sym.getMetadata()); super.visitClass(node, p); for (JCTree def : clazz.defs) { if (def.hasTag(JCTree.Tag.ERRONEOUS)) { 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 index 2ef9993..7532477 100644 --- 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 @@ -86,7 +86,7 @@ public class VanillaCompileWorkerTest extends CompileWorkerTestBase { } public void testRepair2() throws Exception { - ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test4.java", "package test; public class Test4 { @Undef public void test1() { } @Deprecated @Undef public void test2() { } }")), + ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test4.java", "package test; @Undef public class Test4 { @Undef public void test1() { } @Deprecated @Undef public void test2() { } }")), Arrays.asList()); assertFalse(result.lowMemory); @@ -173,6 +173,24 @@ public class VanillaCompileWorkerTest extends CompileWorkerTestBase { //TODO: check file content!!! } + public void testErasureField() throws Exception { + ParsingOutput result = runIndexing(Arrays.asList(compileTuple("test/Test4.java", "package test; public class Test4<T> { void test(Test4<Undef> t2, Undef t1) { } static void t(Test4 raw) { raw.test(null, null); } }")), + Arrays.asList()); + + 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()); + } + + assertEquals(new HashSet<String>(Arrays.asList("cache/s1/java/15/classes/test/Test4.sig")), + createdFiles); + //TODO: check file content!!! + } + public void testModuleInfoAndSourceLevel8() throws Exception { setSourceLevel("8"); -- To stop receiving notification emails like this one, please contact geert...@apache.org. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists