for this source:
class Test {
String foo() {
final String hello = "Hello!";
return hello;
}
}
javac generates this code, we are actually interested in the code for method foo():
java.lang.String foo();
descriptor: ()Ljava/lang/String;
flags: (0x0000)
Code:
stack=1, locals=2, args_size=1
0: ldc #2 // String Hello!
2: areturn
LineNumberTable:
line 4: 0
the max number of locals is set to 2 when actually there is no local used / needed
this issue was initially reported by Remi at amber-dev: http://mail.openjdk.java.net/pipermail/amber-dev/2018-September/003407.html
class Test {
String foo() {
final String hello = "Hello!";
return hello;
}
}
javac generates this code, we are actually interested in the code for method foo():
java.lang.String foo();
descriptor: ()Ljava/lang/String;
flags: (0x0000)
Code:
stack=1, locals=2, args_size=1
0: ldc #2 // String Hello!
2: areturn
LineNumberTable:
line 4: 0
the max number of locals is set to 2 when actually there is no local used / needed
this issue was initially reported by Remi at amber-dev: http://mail.openjdk.java.net/pipermail/amber-dev/2018-September/003407.html