rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Guard against Exceptions in the JavaTypeSignatureBuilder.

Open traceyyoshima opened this issue 4 years ago • 1 comments

tools.jar is loaded through java.home and is based on which JDK exists in the environment.

The tools.jar contains classes that are important for building signatures for types and mapping the type information into JavaTypes.

Throughout the supported lifecycle of a JDK bugs like NPEs are patched over time. So, there may be bugs in key classes like Symbol that are necessary for signature building and type mapping if the environment uses an older version of a JDK.

Rather than tack in guards against NPEs, we should update the SignatureBuilders in general to account for potential issues that may exist in the classes loaded from tools.jar.

This issue will add a programmatic solution to detecting potential NPEs while producing consistent type signatures regardless of which java version exists in the environment.

traceyyoshima avatar Feb 10 '22 00:02 traceyyoshima

The NPE was reported by a user without details about how it occurred.

I wasn't able to reproduce the NPE, but we should guard against an NPEs caused by incomplete symbols or symbols with an ERR kind.

There is no guarantee that the symbol is complete or is missing type attribution while creating the type signature. Preventing an NPE must be well thought through since it may change the type signature. And the type signature must be unique to prevent type misattribution.

traceyyoshima avatar Feb 23 '22 21:02 traceyyoshima