geertjanw closed pull request #350: [NETBEANS-234] Fixing handling of broken
generics in fields.
URL: https://github.com/apache/incubator-netbeans/pull/350
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
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 82b6d9bf1..9853a5c55 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
@@ -384,9 +384,7 @@ public Void visitVariable(VariableTree node, Void p) {
if ((decl.mods.flags & Flags.ENUM) == 0) {
decl.init = null;
}
- if (decl.type.getKind() == TypeKind.ERROR) {
- decl.sym.type = decl.type = syms.objectType;
- }
+ decl.sym.type = decl.type = error2Object(decl.type);
clearAnnotations(decl.sym.getMetadata());
return super.visitVariable(node, p);
}
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 0616a3731..2ef999369 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
@@ -214,4 +214,22 @@ public void testErroneousMethodClassNETBEANS_224() throws
Exception {
"cache/s1/java/15/classes/test/Test3.sig")),
createdFiles);
}
+
+ public void testRepairFieldBrokenGenerics() throws Exception {
+ ParsingOutput result =
runIndexing(Arrays.asList(compileTuple("test/Test4.java", "package test; import
java.util.List; public class Test4 { public List<Undef> test; }")),
+ 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!!!
+ }
+
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists