mattisonchao commented on pull request #10986:
URL: https://github.com/apache/pulsar/pull/10986#issuecomment-871351798
> @mattisonchao I am pretty sure that this code is not for JDK11.
>
> when you build this code with JDK11 with target = 11 the result will be
very different.
>
> btw we are still building Pulsar for JDK8, so the change is good for me
Sorry, It's my mistake.
I re-run the code using Java 15 and its bytecode is as follows.
```java
// class version 59.0 (59)
// access flags 0x21
public class Test {
// compiled from: Test.java
// access flags 0x19
public final static INNERCLASS java/lang/invoke/MethodHandles$Lookup
java/lang/invoke/MethodHandles Lookup
// access flags 0x1
public <init>()V
L0
LINENUMBER 1 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
RETURN
L1
LOCALVARIABLE this LTest; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x9
public static main([Ljava/lang/String;)V
L0
LINENUMBER 3 L0
LDC "abc"
ASTORE 1
L1
LINENUMBER 4 L1
ICONST_0
ISTORE 2
L2
FRAME APPEND [java/lang/String I]
ILOAD 2
BIPUSH 8
IF_ICMPGE L3
L4
LINENUMBER 5 L4
ALOAD 1
INVOKEDYNAMIC
makeConcatWithConstants(Ljava/lang/String;)Ljava/lang/String; [
// handle kind 0x6 : INVOKESTATIC
java/lang/invoke/StringConcatFactory.makeConcatWithConstants(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;
// arguments:
"\u0001d"
]
ASTORE 1
L5
LINENUMBER 4 L5
IINC 2 1
GOTO L2
L3
LINENUMBER 7 L3
FRAME CHOP 1
RETURN
L6
LOCALVARIABLE i I L2 L3 2
LOCALVARIABLE args [Ljava/lang/String; L0 L6 0
LOCALVARIABLE str Ljava/lang/String; L1 L6 1
MAXSTACK = 2
MAXLOCALS = 3
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]