RFR[9]:Fix java/lang/invoke/MethodHandleImpl's use of Unsafe.defineAnonymousClass()

Michael Haupt michael.haupt at oracle.com
Wed May 11 13:23:27 UTC 2016


Hi Shilpi,

thank you for preparing these patches. They both implement solution (A), which is to patch the package name. As it happens, most of the complexity in the solutions is due to the desire to make the solution tidy in terms of association of the anonymous class with the host class' package. As the bug description mentions, this is not necessary: the alternative solution (B), namely to have the anonymous class in the default package, appears to be more interesting due to the following reasons:

1. It does not require the excessive logic to find the right place in the constant pool to patch in the package name (your approach 1).

2. It does not require to go through ASM every time to generate the class in the right package (your approach 2).

How about adopting the simpler scheme?

Best,

Michael

> Am 11.05.2016 um 13:24 schrieb shilpi.rastogi at oracle.com:
> 
> Hi All,
> 
> Please review the following-
> 
> https://bugs.openjdk.java.net/browse/JDK-8149574
> 
> Solution: Changed anonymous class package name with the package name of its host class.
> 
> Two approaches to solve this-
> 1.  Parse .class and get the class name index form constant pool and patch it with new name
> http://cr.openjdk.java.net/~srastogi/8149574/webrev.05/
> 
> 2. Create class with new name (With ASM)
> http://cr.openjdk.java.net/~srastogi/8149574/webrev.06/
> 
> Which approach is better?
> 
> Thanks,
> Shilpi
> 
> 
> 

-- 

 <http://www.oracle.com/>
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Java Platform Group | LangTools Team | Nashorn
Oracle Deutschland B.V. & Co. KG | Schiffbauergasse 14 | 14467 Potsdam, Germany

ORACLE Deutschland B.V. & Co. KG | Hauptverwaltung: Riesstraße 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V. | Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Nederland, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher
 <http://www.oracle.com/commitment>	Oracle is committed to developing practices and products that help protect the environment




More information about the core-libs-dev mailing list