RFR: 8255757: Javac emits duplicate pool entries on array::clone [v2]
Guoxiong Li
github.com+13688759+lgxbslgx at openjdk.java.net
Thu Dec 31 10:11:59 UTC 2020
On Wed, 30 Dec 2020 22:40:13 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Cleanup variable and useless test code.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java line 244:
>
>> 242: // array clone can be qualified by the array type in later targets
>> 243: if (qualifiedSymbolCache == null) {
>> 244: qualifiedSymbolCache = new HashMap<>();
>
> given that the map is initialized in the constructor I assume that this line should never be executed right? also I think that you can clear the map in the `finally` block of method `Gen::genClass`
I assumed that other developers will revise `qualifiedSymbolCache` elsewhere in the future. So I judge if it is null to avoid NPE. The newly added code in the finally block of `Gen::genClass` states that this judgement is necessary.
> test/langtools/tools/javac/classfiles/T8255757/T8255757.java line 77:
>
>> 75: .outdir(curPath)
>> 76: .run()
>> 77: .writeAll();
>
> nit: I think that invoking the `writeAll` method is not necessary as the output is discarded, so it can be removed from the chain
Fixed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1912
More information about the compiler-dev
mailing list