RFR: 8335385: javac crash on unattributed piece of AST

Vicente Romero vromero at openjdk.org
Wed Jul 3 13:01:19 UTC 2024


On Wed, 3 Jul 2024 06:33:22 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java line 2427:
>> 
>>> 2425:     Symbol findIdent(DiagnosticPosition pos, Env<AttrContext> env, Name name, KindSelector kind) {
>>> 2426:         try {
>>> 2427:             return checkNonExistentType(checkRestrictedType(pos, findIdentInternal(pos, env, name, kind), name));
>> 
>> should the new code be moved into `checkNonExistentType` so that all of its clients benefit from it?
>
> The `CompletionFailure` happens inside `findIdentInternal` or `findIdentInTypeInternal`, so handling this in `checkNonExistentType` is too late, I'm afraid. I was thinking of having a method encapsulating the try-catch, but that would mean the code to lookup the type would need to be in a capturing lambda, which seemed a bit heavyweight for this place. But that would surely be doable, if preferred.

I'm OK with the current solution given that you considered the alternative

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19969#discussion_r1664152312


More information about the compiler-dev mailing list