Skip to content

Commit 6a9457b

Browse files
committed
Deeper check of GenericType in discard bounds.
1 parent d6b2a21 commit 6a9457b

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ buildscript {
1717
}
1818

1919
group 'com.github.jonathanxd'
20-
version '4.0.0.41-beta-bytecode'
20+
version '4.0.0.42-beta-bytecode'
2121

2222
apply from: project(":Kores").file("gradle/common.gradle")
2323

src/test/java/com/github/jonathanxd/kores/test/asm/RecursiveGenericTypeTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ public void selfPrivateAccessBugTest() throws Throwable {
7272
GenericType recursive =
7373
Generic.type("M").extends$(Generic.type(Map.class).of(Generic.type("E"), Generic.type("M")));
7474

75+
decl.getFields().add(PartFactory.fieldDec()
76+
.modifiers(KoresModifier.PRIVATE, KoresModifier.STATIC, KoresModifier.FINAL)
77+
.type(recursive.getBounds()[0].getType())
78+
.name("f2")
79+
.value(Literals.NULL)
80+
.build());
81+
7582
decl.getConstructors().add(PartFactory.constructorDec()
7683
.modifiers(KoresModifier.PUBLIC)
7784
.parameters(

src/test/resources/disassembled/RecursiveGenericTypeTest_MyClass_Result.class.disassembled

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
md5: c64b44bf58c493755ff888689506b3c2
1+
md5: 8b3ae4657f30416da10d1187c6eafd1d
22

33
version: Java 8 (52)
44
access: ACC_PUBLIC (33)
@@ -9,6 +9,9 @@ public class com.MyClass extends java.lang.Object {
99

1010
!access: ACC_PRIVATE, ACC_STATIC, ACC_FINAL (26)
1111
private static final java.lang.String f1 = Test
12+
!access: ACC_PRIVATE, ACC_STATIC, ACC_FINAL (26)
13+
!signature: TLjava/util/Map;
14+
private static final java.util.Map f2
1215

1316
!access: ACC_PUBLIC (1)
1417
!signature: (Ljava/lang/reflect/Type;TE;TM;)V
@@ -22,7 +25,7 @@ public class com.MyClass extends java.lang.Object {
2225
aload 0
2326
invokespecial java.lang.Object.<init>()void (ownerIsInterface: false)
2427
Label_1:
25-
LINE 1 -> Label_1
28+
LINE 2 -> Label_1
2629
getstatic com.MyClass.f1 (type: java.lang.String)
2730
return
2831
Label_2:
@@ -37,7 +40,11 @@ public class com.MyClass extends java.lang.Object {
3740
!access: PACKAGE_PRIVATE, ACC_STATIC (8)
3841
static void <clinit>() {
3942
desc: ()V
40-
maxStack: 0, maxLocals: 0
43+
maxStack: 1, maxLocals: 0
44+
Label_0:
45+
LINE 1 -> Label_0
46+
aconst_null
47+
putstatic com.MyClass.f2 (type: java.util.Map)
4148
return
4249
}
4350

0 commit comments

Comments
 (0)