Skip to content
Open
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
7 changes: 6 additions & 1 deletion src/org/jetbrains/java/decompiler/main/ClassWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ private void writeClassDefinition(ClassNode node, TextBuffer buffer, int indent)
flags &= ~CodeConstants.ACC_FINAL;

// remove implicit static flag for local enums (JLS 14.3 Local class and interface declarations)
if (node.type == ClassNode.Type.LOCAL) {
if (node.type == ClassNode.Type.MEMBER || node.type == ClassNode.Type.LOCAL) {
flags &= ~CodeConstants.ACC_STATIC;
}
}
Expand Down Expand Up @@ -1142,6 +1142,11 @@ public boolean writeMethod(ClassNode node, StructMethod mt, int methodIndex, Tex
buffer.appendIndent(indent);

if (CodeConstants.INIT_NAME.equals(name)) {
// Enum constructors are implicitly private
if (isEnum) {
flags &= ~CodeConstants.ACC_PRIVATE;
}

if (node.type == ClassNode.Type.ANONYMOUS) {
name = "";
dInit = true;
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestConstructorSwitchExpression3.dec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public enum TestConstructorSwitchExpression3 {
T1,
T2;

private TestConstructorSwitchExpression3(int i) {
TestConstructorSwitchExpression3(int i) {
System.out.println(i);// 18
}// 19

Expand Down
8 changes: 4 additions & 4 deletions testData/results/pkg/TestDoubleBraceInitializers.dec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TestDoubleBraceInitializers {
System.out.println(date);// 21
}// 22

public static enum TestEnum {
public enum TestEnum {
A {
{
System.out.println("A");// 26
Expand All @@ -37,11 +37,11 @@ public class TestDoubleBraceInitializers {
}// 30
};

private TestEnum() {
TestEnum() {
}// 24
}

public static enum TestEnum1 {
public enum TestEnum1 {
A {
{
System.out.println("A");// 35
Expand All @@ -57,7 +57,7 @@ public class TestDoubleBraceInitializers {

public int field;

private TestEnum1() {
TestEnum1() {
}// 46
}
}
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/TestDoubleBraceInitializersJ17.dec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class TestDoubleBraceInitializersJ17 {
System.out.println(date);// 21
}// 22

public static enum TestEnum {
public enum TestEnum {
A {
{
System.out.println("A");// 26
Expand All @@ -38,7 +38,7 @@ public class TestDoubleBraceInitializersJ17 {
};
}

public static enum TestEnum1 {
public enum TestEnum1 {
A {
{
System.out.println("A");// 35
Expand Down
6 changes: 3 additions & 3 deletions testData/results/pkg/TestEnum.dec
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public enum TestEnum {
public void m() {
}// 32

private TestEnum() {
TestEnum() {
this("?", null);// 36
}

private TestEnum(@Deprecated String s, TestEnum.Type t) {
TestEnum(@Deprecated String s, TestEnum.Type t) {
this.s = s;// 37
}

Expand All @@ -48,7 +48,7 @@ public enum TestEnum {
}
}// 59

private static enum Type {
private enum Type {
ODD,
EVEN;
}
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestEnumArrayStaticInit.dec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum TestEnumArrayStaticInit {
private static final TestEnumArrayStaticInit[] VALUES;
private final int v;

private TestEnumArrayStaticInit(int v) {
TestEnumArrayStaticInit(int v) {
this.v = v;// 11
}// 12

Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestLVTComplex.dec
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class TestLVTComplex {
System.out.println(a2);
}

private static enum Bob {
private enum Bob {
HI,
LO;

Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestSwitchExprString1.dec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TestSwitchExprString1 {
}
}

static enum Type {
enum Type {
A,
B;
}
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestSwitchExpressionReturnType.dec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class TestSwitchExpressionReturnType {
};
}

static enum Type {
enum Type {
A,
B,
C,
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/TestSwitchOnEnum.dec
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public class TestSwitchOnEnum {
}
}// 46

static enum A {
enum A {
A1,
A2;
}

static enum B {
enum B {
B1,
B2;
}
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestSwitchOnEnumFake.dec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class TestSwitchOnEnumFake {
return var4 + var5;// 35
}

static enum Values {
enum Values {
A,
B,
C,
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/TestSwitchOnEnumJ21.dec
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class TestSwitchOnEnumJ21 {
public static class C implements TestSwitchOnEnumJ21.A {
}

static enum TestEnum implements TestSwitchOnEnumJ21.A {
enum TestEnum implements TestSwitchOnEnumJ21.A {
A,
B,
C;
Expand Down Expand Up @@ -632,4 +632,4 @@ Lines mapping:
105 <-> 143
106 <-> 144
107 <-> 142
108 <-> 145
108 <-> 145
2 changes: 1 addition & 1 deletion testData/results/pkg/TestSwitchPatternMatching19.dec
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class TestSwitchPatternMatching19 {
interface F {
}

static enum XXX
enum XXX
implements TestSwitchPatternMatching19.A,
TestSwitchPatternMatching19.B,
TestSwitchPatternMatching19.C,
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestSwitchTernary.dec
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class TestSwitchTernary {
}
}// 38

public static enum TestEnum {
public enum TestEnum {
A,
B,
C;
Expand Down
4 changes: 2 additions & 2 deletions testData/results/pkg/TestTextTokens3.dec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TestTextTokens3 {
}
}

public static enum Entry {
public enum Entry {
A,
B,
C,
Expand Down Expand Up @@ -99,7 +99,7 @@ Tokens:
(12:13, 12:14) local [reference] pkg/TestTextTokens3#get(Lpkg/TestTextTokens3$Entry;)Ljava/lang/String;(1:s)
(12:17, 12:18) local [reference] pkg/TestTextTokens3#get(Lpkg/TestTextTokens3$Entry;)Ljava/lang/String;(1:s)
(14:20, 14:21) local [reference] pkg/TestTextTokens3#get(Lpkg/TestTextTokens3$Entry;)Ljava/lang/String;(1:s)
(18:23, 18:28) class [declaration] pkg/TestTextTokens3$Entry
(18:16, 18:21) class [declaration] pkg/TestTextTokens3$Entry
(19:7, 19:8) field [declaration] pkg/TestTextTokens3$Entry#A:Lpkg/TestTextTokens3$Entry;
(20:7, 20:8) field [declaration] pkg/TestTextTokens3$Entry#B:Lpkg/TestTextTokens3$Entry;
(21:7, 21:8) field [declaration] pkg/TestTextTokens3$Entry#C:Lpkg/TestTextTokens3$Entry;
Expand Down
2 changes: 1 addition & 1 deletion testData/results/pkg/TestVarArgCalls.dec
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class TestVarArgCalls {
}
}

public static enum Test {
public enum Test {
A,
B;
}
Expand Down