RFR: 8015831: Add lint check for calling overridable methods from a constructor [v5]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Jan 10 23:41:19 UTC 2023
On Tue, 10 Jan 2023 19:42:06 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 2345:
>>
>>> 2343: if (!innerType.hasTag(CLASS) || !outerType.hasTag(CLASS))
>>> 2344: return false;
>>> 2345: innerType = erasure(innerType);
>>
>> The javac way to write this would be either to compare types using `Types.isSameType` or to compare the underlying class symbols with == (as class symbols are shared across multiple type instances).
>
> OK I'm glad you pointed that out because I'm a little unclear on the best way to do this bit.
>
> Just to confirm, you are saying that this:
>
> `if (erasure(type).equalsIgnoreMetadata(outerType)) {`
>
> should be replaced with this?
>
> `if (isSameType(type, outerType)) {`
yes
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the build-dev
mailing list