-
Enhancement
-
Resolution: Fixed
-
P3
-
asm_tools_6.0
-
None
-
b06
Class file version 52:0 allows REF_invokeStatic and REF_invokeSpecial to refer both Method and InterfaceMethod CP entries.
Jasm always creates REF_invokeStatic and REF_invokeSpecial refering Method, even if an explicit constant InterfaceMethod is created.
Example:
Source:
public interface Test version 52:0 {
const #1 = InterfaceMethod m:"()V";
const #2 = MethodHandle REF_invokeSpecial:#1;
}
Commands:
$ java -jar asmtools.jar jasm Test.jasm
$ java -jar asmtools.jar jdec Test.class
Output (note that #2 refers #7 instead of #1 and #7 refers #1 as the method name):
class Test {
0xCAFEBABE;
0; // minor version
52; // version
[] { // Constant Pool
; // first element is empty
InterfaceMethod #11 #3; // #1
MethodHandle 7b #7; // #2
NameAndType #10 #9; // #3
Utf8 "Test.jasm"; // #4
class #6; // #5
Utf8 "java/lang/Object"; // #6
Method #11 #1; // #7
Utf8 "SourceFile"; // #8
Utf8 "()V"; // #9
Utf8 "m"; // #10
class #12; // #11
Utf8 "Test"; // #12
} // Constant Pool
....................
} // end class Test5
Jasm always creates REF_invokeStatic and REF_invokeSpecial refering Method, even if an explicit constant InterfaceMethod is created.
Example:
Source:
public interface Test version 52:0 {
const #1 = InterfaceMethod m:"()V";
const #2 = MethodHandle REF_invokeSpecial:#1;
}
Commands:
$ java -jar asmtools.jar jasm Test.jasm
$ java -jar asmtools.jar jdec Test.class
Output (note that #2 refers #7 instead of #1 and #7 refers #1 as the method name):
class Test {
0xCAFEBABE;
0; // minor version
52; // version
[] { // Constant Pool
; // first element is empty
InterfaceMethod #11 #3; // #1
MethodHandle 7b #7; // #2
NameAndType #10 #9; // #3
Utf8 "Test.jasm"; // #4
class #6; // #5
Utf8 "java/lang/Object"; // #6
Method #11 #1; // #7
Utf8 "SourceFile"; // #8
Utf8 "()V"; // #9
Utf8 "m"; // #10
class #12; // #11
Utf8 "Test"; // #12
} // Constant Pool
....................
} // end class Test5