add additional tests for static initializers
This commit is contained in:
@@ -83,7 +83,9 @@ public class SingleClassesTest {
|
|||||||
@Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); }
|
@Test public void testMethodReferenceLetterClass() { doTest("pkg/TestMethodReferenceLetterClass"); }
|
||||||
@Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); }
|
@Test public void testMemberAnnotations() { doTest("pkg/TestMemberAnnotations"); }
|
||||||
@Test public void testStaticNameClash() { doTest("pkg/TestStaticNameClash"); }
|
@Test public void testStaticNameClash() { doTest("pkg/TestStaticNameClash"); }
|
||||||
@Test public void testInterfaceWithObject() { doTest("pkg/TestInterfaceWithObject"); }
|
@Test public void testInterfaceWithPrimitiveField() { doTest("pkg/TestInterfaceWithPrimitiveField"); }
|
||||||
|
@Test public void testInterfaceWithObjectField() { doTest("pkg/TestInterfaceWithObjectField"); }
|
||||||
|
@Test public void testTestMutableStaticOtherClass() { doTest("pkg/TestMutableStaticOtherClass"); }
|
||||||
|
|
||||||
protected void doTest(String testFile, String... companionFiles) {
|
protected void doTest(String testFile, String... companionFiles) {
|
||||||
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
ConsoleDecompiler decompiler = fixture.getDecompiler();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
testData/classes/pkg/TestInterfaceWithObjectField.class
Normal file
BIN
testData/classes/pkg/TestInterfaceWithObjectField.class
Normal file
Binary file not shown.
BIN
testData/classes/pkg/TestInterfaceWithPrimitiveField.class
Normal file
BIN
testData/classes/pkg/TestInterfaceWithPrimitiveField.class
Normal file
Binary file not shown.
BIN
testData/classes/pkg/TestMutableStaticOtherClass.class
Normal file
BIN
testData/classes/pkg/TestMutableStaticOtherClass.class
Normal file
Binary file not shown.
@@ -1,25 +1,26 @@
|
|||||||
package pkg;
|
package pkg;
|
||||||
|
|
||||||
public class TestClassFields {
|
public class TestClassFields {
|
||||||
|
static int staticMutable;
|
||||||
private static int[] sizes;
|
private static int[] sizes;
|
||||||
private static String[] names = new String[]{"name1", "name2"};
|
private static String[] names = new String[]{"name1", "name2"};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
sizes = new int[names.length];// 26
|
sizes = new int[names.length];// 27
|
||||||
}// 27
|
}// 28
|
||||||
}
|
}
|
||||||
|
|
||||||
class 'pkg/TestClassFields' {
|
class 'pkg/TestClassFields' {
|
||||||
method '<clinit> ()V' {
|
method '<clinit> ()V' {
|
||||||
11 7
|
11 8
|
||||||
14 7
|
14 8
|
||||||
17 7
|
17 8
|
||||||
1a 8
|
1a 9
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Lines mapping:
|
Lines mapping:
|
||||||
26 <-> 8
|
|
||||||
27 <-> 9
|
27 <-> 9
|
||||||
|
28 <-> 10
|
||||||
Not mapped:
|
Not mapped:
|
||||||
25
|
26
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package pkg;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public interface TestInterfaceWithObject {
|
public interface TestInterfaceWithObjectField {
|
||||||
BigDecimal BUGS_IN_THE_DECOMPILER = BigDecimal.ZERO;
|
BigDecimal BUGS_IN_THE_DECOMPILER = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
6
testData/results/TestInterfaceWithPrimitiveField.dec
Normal file
6
testData/results/TestInterfaceWithPrimitiveField.dec
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package pkg;
|
||||||
|
|
||||||
|
public interface TestInterfaceWithPrimitiveField {
|
||||||
|
int MAX_BYTE_VALUE = 127;
|
||||||
|
}
|
||||||
|
|
||||||
27
testData/results/TestMutableStaticOtherClass.dec
Normal file
27
testData/results/TestMutableStaticOtherClass.dec
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package pkg;
|
||||||
|
|
||||||
|
import pkg.TestClassFields;
|
||||||
|
|
||||||
|
public class TestMutableStaticOtherClass {
|
||||||
|
private static final int SIZE;
|
||||||
|
|
||||||
|
static {
|
||||||
|
TestClassFields.staticMutable = 3;// 12
|
||||||
|
SIZE = TestClassFields.staticMutable;// 13
|
||||||
|
}// 14
|
||||||
|
}
|
||||||
|
|
||||||
|
class 'pkg/TestMutableStaticOtherClass' {
|
||||||
|
method '<clinit> ()V' {
|
||||||
|
0 8
|
||||||
|
1 8
|
||||||
|
4 9
|
||||||
|
7 9
|
||||||
|
a 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Lines mapping:
|
||||||
|
12 <-> 9
|
||||||
|
13 <-> 10
|
||||||
|
14 <-> 11
|
||||||
@@ -17,6 +17,7 @@ package pkg;
|
|||||||
|
|
||||||
public class TestClassFields {
|
public class TestClassFields {
|
||||||
|
|
||||||
|
static int staticMutable;
|
||||||
private static int[] sizes;
|
private static int[] sizes;
|
||||||
private static String[] names;
|
private static String[] names;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.math.BigDecimal;
|
|||||||
* @author Alexandru-Constantin Bledea
|
* @author Alexandru-Constantin Bledea
|
||||||
* @since March 06, 2016
|
* @since March 06, 2016
|
||||||
*/
|
*/
|
||||||
public interface TestInterfaceWithObject {
|
public interface TestInterfaceWithObjectField {
|
||||||
|
|
||||||
BigDecimal BUGS_IN_THE_DECOMPILER = BigDecimal.ZERO;
|
BigDecimal BUGS_IN_THE_DECOMPILER = BigDecimal.ZERO;
|
||||||
|
|
||||||
13
testData/src/pkg/TestInterfaceWithPrimitiveField.java
Normal file
13
testData/src/pkg/TestInterfaceWithPrimitiveField.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package pkg;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Alexandru-Constantin Bledea
|
||||||
|
* @since March 06, 2016
|
||||||
|
*/
|
||||||
|
public interface TestInterfaceWithPrimitiveField {
|
||||||
|
|
||||||
|
int MAX_BYTE_VALUE = Byte.MAX_VALUE;
|
||||||
|
|
||||||
|
}
|
||||||
15
testData/src/pkg/TestMutableStaticOtherClass.java
Normal file
15
testData/src/pkg/TestMutableStaticOtherClass.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package pkg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Alexandru-Constantin Bledea
|
||||||
|
* @since March 17, 2016
|
||||||
|
*/
|
||||||
|
public class TestMutableStaticOtherClass {
|
||||||
|
|
||||||
|
private static final int SIZE;
|
||||||
|
|
||||||
|
static {
|
||||||
|
TestClassFields.staticMutable = 3;
|
||||||
|
SIZE = TestClassFields.staticMutable;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user