Hi, Thanks! I was expecting something like this. You just want to check the class name in an assertion - that’s fine. Kind regards, Uwe P.S.: You could improve the assertion with the Type class, so it would also fail on otherwise broken descriptor strings (missing "L" or missing ";"): static boolean checkClassName(String cn) { Type tp = Type.getType(cn); // additional sanity so only valid "L;" descriptors work if (tp.getSort() != Type.OBJECT) { return false; } try { Class<?> c = Class.forName(tp.getClassName(), false, null); return true; } catch (ClassNotFoundException e) { return false; } } ----- Uwe Schindler uschindler@apache.org ASF Member, Apache Lucene PMC / Committer Bremen, Germany http://lucene.apache.org/
-----Original Message----- From: core-libs-dev [mailto:core-libs-dev-bounces@openjdk.java.net] On Behalf Of Paul Sandoz Sent: Thursday, February 18, 2016 3:05 PM Cc: Java Core Libs <core-libs-dev@openjdk.java.net> Subject: Re: RFR 8144931: Assert class signatures are correct and refer to valid classes
Hi Uwe
Not a stupid question.
We took the conservative approach to preserve the existing costs (avoid linkage and string generation).
Paul.
On 18 Feb 2016, at 14:54, Uwe Schindler <uschindler@apache.org> wrote:
Hi,
just a stupid question from somebody outside the OpenJDK developers: You are already using ASM to generate the class files. Why not also use the Type class in ASM to generate the signatures of a class constant?:
Instead of:
static final String LF_HIDDEN_SIG = className("Ljava/lang/invoke/LambdaForm$Hidden;");
Use the following to define the constant:
import jdk.internal.org.objectweb.asm.Type; import java.lang.invoke.LambdaForm.Hidden; static final String LF_HIDDEN_SIG = Type.getDescriptor(Hidden.class);
This is compile-time checked, because of the .class notation.
Thanks, Uwe
----- Uwe Schindler uschindler@apache.org ASF Member, Apache Lucene PMC / Committer Bremen, Germany http://lucene.apache.org/
-----Original Message----- From: core-libs-dev [mailto:core-libs-dev-bounces@openjdk.java.net] On Behalf Of shilpi.rastogi@oracle.com Sent: Thursday, February 18, 2016 12:18 PM To: Vladimir Ivanov <vladimir.x.ivanov@oracle.com>; core-libs- dev@openjdk.java.net Subject: Re: RFR 8144931: Assert class signatures are correct and refer to valid classes
Thank You Vladimir!
I have done the changes. Please review the updated patch-
http://cr.openjdk.java.net/~srastogi/8144931/webrev.02/
Regards, Shilpi
On 2/18/2016 1:58 PM, Vladimir Ivanov wrote:
Shilpi,
_CLASS suffix looks redundant and you can abbreviate LAMBDA_FORM to LF: LF_HIDDEN_SIG LF_COMPILED_SIG FORCEINLINE_SIG DONTINLINE_SIG
Otherwise, looks fine.
Best regards, Vladimir Ivanov
On 2/17/16 5:47 PM, shilpi rastogi wrote:
Hi All,
Please review fix for the following bug-
https://bugs.openjdk.java.net/browse/JDK-8144931 http://cr.openjdk.java.net/~srastogi/8144931/webrev.01/
Thanks, Shilpi