1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
Description: [java] IDEA-323038 Stub decompiler fails on enums in Java 21-ea builds
Java 21 compiler adds the method parameter section to mandated methods like valueOf
in enums (see JDK-8292275). The new thing is that mandated method parameter may have
no name. It's unexpected for stub decompiler, which fails with NullPointerException.
Author: Tagir Valeev <tagir.valeev@jetbrains.com>
Origin: upstream, https://github.com/JetBrains/intellij-community/commit/459851b9caea42ab6e99494409470a9060321686
Bug: https://youtrack.jetbrains.com/issue/IDEA-323038
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057513
Forwarded: not-needed
Applied-Upstream: 459851b9caea42ab6e99494409470a9060321686
Last-Update: 2024-01-24
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
@@ -649,7 +649,7 @@
@Override
public void visitParameter(String name, int access) {
int paramIndex = myParamNameIndex++ - myParamIgnoreCount;
- if (!isSet(access, Opcodes.ACC_SYNTHETIC) && paramIndex >= 0 && paramIndex < myParamCount) {
+ if (name != null && !isSet(access, Opcodes.ACC_SYNTHETIC) && paramIndex >= 0 && paramIndex < myParamCount) {
setParameterName(name, paramIndex);
}
}
@@ -666,7 +666,7 @@
}
}
- private void setParameterName(String name, int paramIndex) {
+ private void setParameterName(@NotNull String name, int paramIndex) {
if (ClsParsingUtil.isJavaIdentifier(name, LanguageLevel.HIGHEST)) {
myParamStubs[paramIndex].setName(name);
}
|