RFR: 8289647: AssertionError during annotation processing of record related tests [v2]

Vicente Romero vromero at openjdk.org
Thu Jul 28 15:20:48 UTC 2022


On Wed, 20 Jul 2022 14:07:34 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This PR fixes a situation where the same record component was entered *and* schedule for later annotation at the same time.
>> 
>> The test case of the original bug report was recreated as part of "RecordCompilationTests". I tested that it breaks with the expected assertion error mentioned on the original bug report, without the proposed changes.
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add bug id at existing test

looks good, added some suggestions

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1506:

> 1504:         }
> 1505: 
> 1506:         public RecordComponent findRecordComponentToRemove(JCVariableDecl var) {

given that this method has only one client and it is simple, consider inlining its code in the client code

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java line 1525:

> 1523:             RecordComponent rc = null;
> 1524:             if (existing != null) {
> 1525:                 // Found a record component with an erroneous type: remove it and create a new one

I don't think this comment is valid anymore as we are removing an existing record component regardless

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java line 1004:

> 1002:                      *  component.
> 1003:                      */
> 1004:                     RecordComponent rc = sym.findRecordComponentToRemove(field);

I would add an additional comment explaining why we are looking for the record component first and removing it later so that we remember the reason if we need to revisit this code in the future

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

Marked as reviewed by vromero (Reviewer).

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


More information about the compiler-dev mailing list