Fwd: compiler bug causes incompatibility between using JDK 14 and comparing bytecode

Brian Goetz brian.goetz at oracle.com
Wed Jun 17 22:58:53 UTC 2020



Sent from my iPad

Begin forwarded message:

> From: Robert Field <Robert.Field at Oracle.COM>
> Date: June 17, 2020 at 6:13:10 PM EDT
> 
> Subject: compiler bug causes incompatibility between using JDK 14 and comparing bytecode
> 
> 
> The compilation of records in JDK 14 preview generates multiple matching constant pool entries.  For example below: #7 and #24, #13 and #25, #17 and #26 ......
> 
> -Robert
> 
> Classfile /w/bytecode-api/target/classes/impl/low/internal/LazyAttribute$InnerClassImpl.class
>   Last modified Jun 17, 2020; size 2783 bytes
>   SHA-256 checksum a1a3d14e87b2da409b838d3a0b0b80ec12334e0d2ecf6b797db54fa0ae636687
>   Compiled from "LazyAttribute.java"
> final class impl.low.internal.LazyAttribute$InnerClassImpl extends java.lang.Record implements impl.low.model.attribute.InnerClassesAttributeLow$InnerClass
>   minor version: 65535
>   major version: 58
>   flags: (0x0030) ACC_FINAL, ACC_SUPER
>   this_class: #8                          // impl/low/internal/LazyAttribute$InnerClassImpl
>   super_class: #2                         // java/lang/Record
>   interfaces: 1, fields: 4, methods: 8, attributes: 5
> Constant pool:
>    #1 = Methodref          #2.#3          // java/lang/Record."<init>":()V
>    #2 = Class              #4             // java/lang/Record
>    #3 = NameAndType        #5:#6          // "<init>":()V
>    #4 = Utf8               java/lang/Record
>    #5 = Utf8               <init>
>    #6 = Utf8               ()V
>    #7 = Fieldref           #8.#9          // impl/low/internal/LazyAttribute$InnerClassImpl.innerClass:Limpl/low/model/pool/ClassInfo;
>    #8 = Class              #10            // impl/low/internal/LazyAttribute$InnerClassImpl
>    #9 = NameAndType        #11:#12        // innerClass:Limpl/low/model/pool/ClassInfo;
>   #10 = Utf8               impl/low/internal/LazyAttribute$InnerClassImpl
>   #11 = Utf8               innerClass
>   #12 = Utf8               Limpl/low/model/pool/ClassInfo;
>   #13 = Fieldref           #8.#14         // impl/low/internal/LazyAttribute$InnerClassImpl.outerClass:Ljava/util/Optional;
>   #14 = NameAndType        #15:#16        // outerClass:Ljava/util/Optional;
>   #15 = Utf8               outerClass
>   #16 = Utf8               Ljava/util/Optional;
>   #17 = Fieldref           #8.#18         // impl/low/internal/LazyAttribute$InnerClassImpl.innerName:Ljava/util/Optional;
>   #18 = NameAndType        #19:#16        // innerName:Ljava/util/Optional;
>   #19 = Utf8               innerName
>   #20 = Fieldref           #8.#21         // impl/low/internal/LazyAttribute$InnerClassImpl.accessFlags:I
>   #21 = NameAndType        #22:#23        // accessFlags:I
>   #22 = Utf8               accessFlags
>   #23 = Utf8               I
>   #24 = Fieldref           #8.#9          // impl/low/internal/LazyAttribute$InnerClassImpl.innerClass:Limpl/low/model/pool/ClassInfo;
>   #25 = Fieldref           #8.#14         // impl/low/internal/LazyAttribute$InnerClassImpl.outerClass:Ljava/util/Optional;
>   #26 = Fieldref           #8.#18         // impl/low/internal/LazyAttribute$InnerClassImpl.innerName:Ljava/util/Optional;
>   #27 = Fieldref           #8.#21         // impl/low/internal/LazyAttribute$InnerClassImpl.accessFlags:I
>   #28 = InvokeDynamic      #0:#29         // #0:toString:(Limpl/low/internal/LazyAttribute$InnerClassImpl;)Ljava/lang/String;
>   #29 = NameAndType        #30:#31        // toString:(Limpl/low/internal/LazyAttribute$InnerClassImpl;)Ljava/lang/String;
> ...


More information about the amber-dev mailing list