RFR: 8301580: Error recovery does not clear returnResult [v2]

Jan Lahoda jlahoda at openjdk.org
Fri Feb 3 19:08:25 UTC 2023


On Fri, 3 Feb 2023 12:26:16 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Using info.dup(), as suggested.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 5222:
> 
>> 5220:     public void visitErroneous(JCErroneous tree) {
>> 5221:         if (tree.errs != null) {
>> 5222:             Env<AttrContext> errEnv = env.dup(env.tree);
> 
> question: shouldn't we do: `env.dup(node, env.info.dup());` instead, that way both env's won't share the info?

I was a little bit on the fence on this, as some code, like `Attr.attribClass` stores and re-sets the result, while other dupes the info. Let's dupe the info then. Thanks!

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

PR: https://git.openjdk.org/jdk/pull/12361


More information about the compiler-dev mailing list