mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-decompiler] Don't ignore nested classes in sealed class permits list
GitOrigin-RevId: e2eecb48b7d7f0941556ee5208041fe29819cba7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4e322147be
commit
999fe6d746
+6
-9
@@ -534,16 +534,13 @@ public class ClassWriter {
|
||||
if (!allSubClassesAreNested) { // only generate permits lists for non-nested classes
|
||||
buffer.append("permits ");
|
||||
for (int i = 0; i < permittedSubclassQualifiedNames.size(); i++) {
|
||||
String qualifiedName = permittedSubclassQualifiedNames.get(i);
|
||||
boolean isNested = qualifiedNested.contains(qualifiedName);
|
||||
if (!isNested) {
|
||||
if (i > 0) {
|
||||
buffer.append(", ");
|
||||
}
|
||||
DecompilerContext.getImportCollector().getShortName(qualifiedName);
|
||||
String simpleName = qualifiedName.substring(qualifiedName.lastIndexOf('/') + 1);
|
||||
buffer.append(simpleName);
|
||||
String qualifiedName = permittedSubclassQualifiedNames.get(i).replace("$", ".");
|
||||
if (i > 0) {
|
||||
buffer.append(", ");
|
||||
}
|
||||
DecompilerContext.getImportCollector().getShortName(qualifiedName);
|
||||
String simpleName = qualifiedName.substring(qualifiedName.lastIndexOf('/') + 1);
|
||||
buffer.append(simpleName);
|
||||
}
|
||||
buffer.append(' ');
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.java.decompiler;
|
||||
|
||||
import org.jetbrains.java.decompiler.main.DecompilerContext;
|
||||
@@ -176,6 +176,7 @@ public class SingleClassesTest {
|
||||
"sealed/RootWithInterfaceOuter", "sealed/ClassImplements", "sealed/ClassNonSealedExtendsImplements");
|
||||
}
|
||||
@Test public void testRootWithModule() { doTest("sealed/foo/RootWithModule", "sealed/bar/BarClassExtends");}
|
||||
@Test public void testRootWithInterfaceInnerAndOuter() { doTest("sealed/RootWithInterfaceInnerAndOuter", "sealed/ClassNonSealed");}
|
||||
@Test public void testArrayTypeAnnotations() { doTest("typeAnnotations/ArrayTypeAnnotations",
|
||||
"typeAnnotations/A", "typeAnnotations/B", "typeAnnotations/C", "typeAnnotations/D");
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
package sealed;
|
||||
|
||||
non-sealed class ClassNonSealed extends RootWithClassOuter {
|
||||
non-sealed class ClassNonSealed extends RootWithClassOuter implements RootWithInterfaceInnerAndOuter {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package sealed;
|
||||
|
||||
sealed interface RootWithInterfaceInnerAndOuter permits RootWithInterfaceInnerAndOuter.Inner, ClassNonSealed {
|
||||
public static final class Inner implements RootWithInterfaceInnerAndOuter {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package sealed;
|
||||
|
||||
final class FinalImplements implements RootWithInterfaceOuter {
|
||||
final class ClassImplements implements RootWithInterfaceOuter {
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package sealed;
|
||||
|
||||
non-sealed class ClassNonSealed extends RootWithClassOuter {
|
||||
non-sealed class ClassNonSealed extends RootWithClassOuter implements RootWithInterfaceInnerAndOuter{
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package sealed;
|
||||
|
||||
non-sealed class ClassNonSealedExtendsImplements extends RootWithClassOuter implements RootWithInterfaceOuter {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package sealed;
|
||||
|
||||
non-sealed class ClassNonSealedImplements extends RootWithClassOuter implements RootWithInterfaceOuter {
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package sealed;
|
||||
|
||||
sealed interface RootWithClassInner {
|
||||
final class Inner implements RootWithClassInner {
|
||||
sealed class RootWithClassInner {
|
||||
static final class Inner extends RootWithClassInner {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package sealed;
|
||||
|
||||
abstract sealed class RootWithClassOuter permits ClassExtends, ClassNonSealed, ClassNonSealedImplements {
|
||||
abstract sealed class RootWithClassOuter permits ClassExtends, ClassNonSealed, ClassNonSealedExtendsImplements {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package sealed;
|
||||
|
||||
sealed interface RootWithInterfaceInnerAndOuter permits RootWithInterfaceInnerAndOuter.Inner, ClassNonSealed {
|
||||
final class Inner implements RootWithInterfaceInnerAndOuter {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package sealed;
|
||||
|
||||
sealed interface RootWithInterfaceOuter permits FinalImplements, InterfaceNonSealed, ClassNonSealedImplements {
|
||||
sealed interface RootWithInterfaceOuter permits ClassImplements, InterfaceNonSealed, ClassNonSealedExtendsImplements {
|
||||
}
|
||||
Reference in New Issue
Block a user