Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/org/jetbrains/java/decompiler/main/ClassWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,15 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent)
}
}

// Classes defined inside of interfaces are implicitly public/static (JLS 9.5 Member Type Declarations)
if (
node.type == ClassNode.Type.MEMBER &&
(node.parent.getWrapper().getClassStruct().getAccessFlags() & CodeConstants.ACC_INTERFACE) != 0
) {
flags &= ~CodeConstants.ACC_PUBLIC;
flags &= ~CodeConstants.ACC_STATIC;
}

if (interceptor != null) {
String oldName = interceptor.getOldName(cl.qualifiedName);
appendRenameComment(buffer, oldName, MType.CLASS, indent);
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/MoreAnnotations.dec
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public @interface MoreAnnotations {

Class<? extends CharSequence>[] classArray() default {CharSequence.class, String.class, StringBuilder.class};

public @interface NestedAnnotation {
@interface NestedAnnotation {
String value() default "MyString";
}

public static enum TestEnum {
enum TestEnum {
FirstValue,
SecondValue;
}
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/TestGenericSubclassTypes.dec
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public interface TestGenericSubclassTypes<T> {
return i -> i;// 27
}

public static class Constant<T> implements TestGenericSubclassTypes.Numerical<T> {
class Constant<T> implements TestGenericSubclassTypes.Numerical<T> {
@Override
public int get(T in) {
return 1;// 16
}
}

public interface Numerical<T> {
interface Numerical<T> {
int get(T var1);
}
}
Expand Down
6 changes: 3 additions & 3 deletions testData/results/pkg/TestInterfaceSubclass.dec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ public interface TestInterfaceSubclass {

int doOtherThing();

public abstract static class AbstractClass implements TestInterfaceSubclass {
abstract class AbstractClass implements TestInterfaceSubclass {
public abstract double doDoubleThing();
}

public static class Multiple extends TestInterfaceSubclass.AbstractClass implements TestInterfaceSubclass {
class Multiple extends TestInterfaceSubclass.AbstractClass implements TestInterfaceSubclass {
@Override
public void doThing() {
System.out.println("Hello");// 29
Expand All @@ -26,7 +26,7 @@ public interface TestInterfaceSubclass {
}
}

public static class Subclass implements TestInterfaceSubclass {
class Subclass implements TestInterfaceSubclass {
@Override
public void doThing() {
System.out.println("Hi");// 12
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestInterfaceSuper.dec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public interface TestInterfaceSuper {
default void defaultMethod() {
}// 4

public static class Impl implements TestInterfaceSuper {
class Impl implements TestInterfaceSuper {
@Override
public void defaultMethod() {
TestInterfaceSuper.super.defaultMethod();// 8
Expand Down
6 changes: 3 additions & 3 deletions testData/results/pkg/TestRecordPatterns6.dec
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class TestRecordPatterns6 {
}

sealed interface I permits TestRecordPatterns6.I.R1, TestRecordPatterns6.I.R2, TestRecordPatterns6.I.R3 {
public record R1(Object o) implements TestRecordPatterns6.I {
record R1(Object o) implements TestRecordPatterns6.I {
}

public record R2(int i) implements TestRecordPatterns6.I {
record R2(int i) implements TestRecordPatterns6.I {
}

public record R3(String s) implements TestRecordPatterns6.I {
record R3(String s) implements TestRecordPatterns6.I {
}
}
}
Expand Down
Loading