This is an automated email from the ASF dual-hosted git repository.
skygo pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push:
new 9e08ff4525 Prevent Type.Unknown to be cast to ClassType in
VanilaCompileWorker
new 4fe9e203af Merge pull request #4036 from
lkishalmi/prevent-cce-in-vanilacompileworker
9e08ff4525 is described below
commit 9e08ff452522fa003c63e15252cb149c65c342c7
Author: Laszlo Kishalmi <[email protected]>
AuthorDate: Tue Apr 26 20:52:08 2022 -0700
Prevent Type.Unknown to be cast to ClassType in VanilaCompileWorker
---
.../modules/java/source/indexing/VanillaCompileWorker.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git
a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
index d35cf64e86..a019f79907 100644
---
a/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
+++
b/java/java.source.base/src/org/netbeans/modules/java/source/indexing/VanillaCompileWorker.java
@@ -690,6 +690,11 @@ final class VanillaCompileWorker extends CompileWorker {
//likely a duplicate of another class, don't touch:
return null;
}
+ if (isOtherClass(csym)) {
+ // Something went somewhere the csym.type is Type.Unknown,
+ // do not go any further
+ return null;
+ }
currentClass = csym;
Type.ClassType ct = (Type.ClassType) csym.type;
if (csym == syms.objectType.tsym) {
@@ -1049,9 +1054,14 @@ final class VanillaCompileWorker extends CompileWorker {
}
return isErroneousClass(((JCClassDecl) tree).sym);
}
+
private boolean isErroneousClass(Element el) {
return el instanceof ClassSymbol && (((ClassSymbol) el).asType() ==
null || ((ClassSymbol) el).asType().getKind() == TypeKind.ERROR);
}
+ private boolean isOtherClass(Element el) {
+ return el instanceof ClassSymbol && (((ClassSymbol) el).asType() ==
null || ((ClassSymbol) el).asType().getKind() == TypeKind.OTHER);
+ }
+
public static Function<Diagnostic<?>, String> DIAGNOSTIC_TO_TEXT = d ->
d.getMessage(null);
}
---------------------------------------------------------------------
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