diff --git a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java index 3f711bc5fb..375eb1c68d 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java +++ b/src/org/jetbrains/java/decompiler/main/rels/NestedClassProcessor.java @@ -333,7 +333,8 @@ private static void computeLocalVarsAndDefinitions(ClassNode node) { if (nd.type != ClassNode.Type.LAMBDA && !nd.classStruct.isSynthetic() && (nd.access & CodeConstants.ACC_STATIC) == 0 && - (nd.access & CodeConstants.ACC_INTERFACE) == 0) { + (nd.access & CodeConstants.ACC_INTERFACE) == 0 && + nd.classStruct.getRecordComponents() == null) { clTypes.add(nd.type); Map> mask = getMaskLocalVars(nd.getWrapper()); diff --git a/test/org/jetbrains/java/decompiler/SingleClassesTest.java b/test/org/jetbrains/java/decompiler/SingleClassesTest.java index 4a69bd93da..a187f4cd8d 100644 --- a/test/org/jetbrains/java/decompiler/SingleClassesTest.java +++ b/test/org/jetbrains/java/decompiler/SingleClassesTest.java @@ -708,6 +708,7 @@ private void registerDefault() { register(JAVA_8, "TestSwitchInTry"); register(JAVA_21, "TestSwitchPatternMatchingJ21"); register(JAVA_21, "TestCastIntersectionJ21"); + register(JAVA_16, "TestRecordLocal"); } private void registerEntireClassPath() { diff --git a/testData/results/pkg/TestRecordLocal.dec b/testData/results/pkg/TestRecordLocal.dec new file mode 100644 index 0000000000..ead34e0590 --- /dev/null +++ b/testData/results/pkg/TestRecordLocal.dec @@ -0,0 +1,23 @@ +package pkg; + +import java.util.List; + +public class TestRecordLocal { + public Object test(List list) { + record Rec(TestRecordLocal a, List b) { + } + + return new Rec(this, list);// 9 + } +} + +class 'pkg/TestRecordLocal' { + method 'test (Ljava/util/List;)Ljava/lang/Object;' { + 4 9 + 5 9 + 9 9 + } +} + +Lines mapping: +9 <-> 10 diff --git a/testData/src/java16/pkg/TestRecordLocal.java b/testData/src/java16/pkg/TestRecordLocal.java new file mode 100644 index 0000000000..a6c6739053 --- /dev/null +++ b/testData/src/java16/pkg/TestRecordLocal.java @@ -0,0 +1,11 @@ +package pkg; + +import java.util.List; + +public class TestRecordLocal { + public Object test(List list) { + record Rec(TestRecordLocal a, List b) {} + + return new Rec(this, list); + } +}