RFR: 8015831: Add lint check for calling overridable methods from a constructor [v7]
Archie L. Cobbs
duke at openjdk.org
Thu Jan 12 19:15:20 UTC 2023
On Thu, 12 Jan 2023 17:40:36 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> But the filtering will end up dropping the expression Ref on the floor, right? (because B and A are unrelated).
Ah, I see what you mean.
Here's a more complete example:
public class CastLeak {
public CastLeak() {
((CastLeak)(Runnable)this).mightLeak();
}
public void mightLeak() {
}
}
That would be a leak for any subclass that implements `Runnable`. Yet no warning is generated.
So the filtering by expression type is going to potentially create false negatives. But it also eliminates a bunch of false positives. And the false negatives are probably all somewhat pathological like the example above.
So I still think it's worth doing.
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the build-dev
mailing list