File: java21-stub-decompiler-fails-on-enums.patch

package info (click to toggle)
intellij-community-idea 183.5153.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 178,408 kB
  • sloc: java: 2,023,773; xml: 78,706; ansic: 2,742; cpp: 1,688; javascript: 1,657; objc: 1,316; sh: 724; perl: 221; ruby: 102; python: 87; makefile: 7
file content (31 lines) | stat: -rw-r--r-- 1,652 bytes parent folder | download
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);
       }