-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b117
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8028880 | port-stage-ppc-aix | Kumar Srinivasan | P3 | Resolved | Fixed | master |
The internal ASM (and the external version) does not generate the correct constant pool entry for invokespecial and invokestatic instructions for non-abstract methods on interfaces.
Currently ASM will generate a CONSTANT_Methodref entry, rather than a CONSTANT_InterfaceMethodref. This in turn results in incorrect byte code of generated anon classes for lambda expressions and method references, that may result in possible VM-related errors.
A simple class exercises this aspect:
import java.util.function.*;
class A {
interface I {
default Supplier<Integer> a() { return () -> 1; }
default Supplier<Integer> b(int i) { return () -> i; }
default Supplier<Integer> c(int i) { return () -> m(i); }
int m(int i);
static Integer d() {
return 0;
}
}
static class C implements I {
public int m(int i) { return i;}
}
public static void main(String[] args) {
I i = new C();
i.a();
i.b(1);
i.c(1);
I.d();
}
}
Compile and execute with:
java -Djdk.internal.lambda.dumpProxyClasses=. -cp . A
then analyze the byte code of the generated proxy classes, for example:
javap -v -p A\$I\$\$Lambda\$1.class
Note this currently executes fine, even though the constant pool entry is incorrect (possibly indicating a byte code validation issue with the VM).
Currently ASM will generate a CONSTANT_Methodref entry, rather than a CONSTANT_InterfaceMethodref. This in turn results in incorrect byte code of generated anon classes for lambda expressions and method references, that may result in possible VM-related errors.
A simple class exercises this aspect:
import java.util.function.*;
class A {
interface I {
default Supplier<Integer> a() { return () -> 1; }
default Supplier<Integer> b(int i) { return () -> i; }
default Supplier<Integer> c(int i) { return () -> m(i); }
int m(int i);
static Integer d() {
return 0;
}
}
static class C implements I {
public int m(int i) { return i;}
}
public static void main(String[] args) {
I i = new C();
i.a();
i.b(1);
i.c(1);
I.d();
}
}
Compile and execute with:
java -Djdk.internal.lambda.dumpProxyClasses=. -cp . A
then analyze the byte code of the generated proxy classes, for example:
javap -v -p A\$I\$\$Lambda\$1.class
Note this currently executes fine, even though the constant pool entry is incorrect (possibly indicating a byte code validation issue with the VM).
- backported by
-
JDK-8028880 [asm] generate CONSTANT_InterfaceMethodref for invoke{special/static) of non-abstract methods on ifaces
- Resolved
- blocks
-
JDK-8027232 Update j.l.invoke code generating class files to use ASM enhancements for invocation of non-abstract methods on ifaces
- Closed
- duplicates
-
JDK-8026504 [asm] update internal ASM to the Beta version
- Resolved
- relates to
-
JDK-8029031 "ant clean jar" on nashorn repo results in number of ASM deprecated warnings
- Resolved