On Fri, 30 Jun 2023 23:46:48 GMT, Chen Liang <li...@openjdk.org> wrote:

> The main downside of throwing an exception is that exception stack trace 
> filling is very costly. If this API is used to process unsanitized strings 
> like users inputs, throwing might impose performance costs for handling bad 
> inputs.

For discussion purposes, pushed an update where the new method returns null on 
a non-primitive name.

To approximate normal name lookup is a Java source file (without imports), 
could be done with code like:

Objects.requireNonNullElse(Class.forPrimitiveName(name), name -> 
Class.forName(name))

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14743#issuecomment-1629694729

Reply via email to