Generated parameter names for -parameters (JEP118)
Jesper Steen Møller
jesper at selskabet.org
Wed May 29 14:10:39 PDT 2013
Hej Compiler-dev
I'm investigating the support for JEP118.
Is this a bug:
$ cat ParameterNames.java
import java.util.concurrent.Callable;
public class ParameterNames {
public Callable<String> makeInner(final String message) {
return new Callable<String>() {
public String call() throws Exception {
return message;
}
};
}
}
$ javac -parameters ParameterNames.java
$ javap -c -s -p -l -v ParameterNames\$1.class
Classfile /Users/jesper/Eclipse/JDT-Java8-workspace/Zest/src/ParameterNames$1.class
Last modified 29-05-2013; size 869 bytes
MD5 checksum 014ebef5db6af83f23b19b1cef7b2b44
Compiled from "ParameterNames.java"
class ParameterNames$1 extends java.lang.Object implements java.util.concurrent.Callable<java.lang.String>
Signature: #23 // Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/String;>;
SourceFile: "ParameterNames.java"
EnclosingMethod: #27.#28 // ParameterNames.makeInner
InnerClasses:
#5; //class ParameterNames$1
minor version: 0
major version: 52
flags: ACC_SUPER
Constant pool:
#1 = Fieldref #5.#29 // ParameterNames$1.this$0:LParameterNames;
#2 = Fieldref #5.#30 // ParameterNames$1.val$message:Ljava/lang/String;
#3 = Methodref #6.#31 // java/lang/Object."<init>":()V
#4 = Methodref #5.#32 // ParameterNames$1.call:()Ljava/lang/String;
#5 = Class #33 // ParameterNames$1
#6 = Class #35 // java/lang/Object
#7 = Class #36 // java/util/concurrent/Callable
#8 = Utf8 val$message
#9 = Utf8 Ljava/lang/String;
#10 = Utf8 this$0
#11 = Utf8 LParameterNames;
#12 = Utf8 <init>
#13 = Utf8 (LParameterNames;Ljava/lang/String;)V
#14 = Utf8 Code
#15 = Utf8 LineNumberTable
#16 = Utf8 MethodParameters
#17 = Utf8 call
#18 = Utf8 ()Ljava/lang/String;
#19 = Utf8 Exceptions
#20 = Class #37 // java/lang/Exception
#21 = Utf8 ()Ljava/lang/Object;
#22 = Utf8 Signature
#23 = Utf8 Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/String;>;
#24 = Utf8 SourceFile
#25 = Utf8 ParameterNames.java
#26 = Utf8 EnclosingMethod
#27 = Class #38 // ParameterNames
#28 = NameAndType #39:#40 // makeInner:(Ljava/lang/String;)Ljava/util/concurrent/Callable;
#29 = NameAndType #10:#11 // this$0:LParameterNames;
#30 = NameAndType #8:#9 // val$message:Ljava/lang/String;
#31 = NameAndType #12:#41 // "<init>":()V
#32 = NameAndType #17:#18 // call:()Ljava/lang/String;
#33 = Utf8 ParameterNames$1
#34 = Utf8 InnerClasses
#35 = Utf8 java/lang/Object
#36 = Utf8 java/util/concurrent/Callable
#37 = Utf8 java/lang/Exception
#38 = Utf8 ParameterNames
#39 = Utf8 makeInner
#40 = Utf8 (Ljava/lang/String;)Ljava/util/concurrent/Callable;
#41 = Utf8 ()V
{
final java.lang.String val$message;
descriptor: Ljava/lang/String;
flags: ACC_FINAL, ACC_SYNTHETIC
final ParameterNames this$0;
descriptor: LParameterNames;
flags: ACC_FINAL, ACC_SYNTHETIC
ParameterNames$1(ParameterNames, java.lang.String);
descriptor: (LParameterNames;Ljava/lang/String;)V
flags:
LineNumberTable:
line 6: 0
Code:
stack=2, locals=3, args_size=3
0: aload_0
1: aload_1
2: putfield #1 // Field this$0:LParameterNames;
5: aload_0
6: aload_2
7: putfield #2 // Field val$message:Ljava/lang/String;
10: aload_0
11: invokespecial #3 // Method java/lang/Object."<init>":()V
14: return
LineNumberTable:
line 6: 0
MethodParameters: length = 0x5
02 00 0A 80 10
^^^^^^^^^^^^^^
Seems like an entry is missing from the table??
Kind regards,
Jesper
More information about the compiler-dev
mailing list