RFR: 8015831: Add lint check for calling overridable methods from a constructor
Archie L. Cobbs
duke at openjdk.org
Fri Jan 6 14:51:54 UTC 2023
On Fri, 6 Jan 2023 04:48:27 GMT, David Holmes <dholmes at openjdk.org> wrote:
> The associated JBS issue has been dormant for 6+ years and this is a very intrusive change affecting many, many files. Has the resurrection of this project previously been discussed somewhere?
Hi @dholmes-ora,
The work to add this warning has been guided by @briangoetz in discussions on the amber-dev mailing list. See that thread for how we came up with the current design, underlying motivation, etc.
Regarding intrusiveness (assuming you're referring simply to the number of files touched), as mentioned this was one of two options. The other option would be to patch to about ~30 `Java.gmk` files in `make/modules` to exclude `this-escape` from `-Xlint` during the various module builds.
Going this route is fine with me, but it has the downside that any new code being developed would not benefit from the new warning. This was in fact my original approach (and it was a lot easier :) but Brian rightly pointed out that adding `@SuppressWarnings` annotations was the the safer (i.e, more conservative) approach.
> If you haven't done so already then you probably should socialize on compiler-dev and get agreement on the semantics and other details.
Hi @AlanBateman,
As mentioned this has been under discussion on amber-dev for a while. Happy to continue that discussion here as well.
> I think you will also need to separate the addition of the lint warning from the changes to the wider JDK. It might be okay to add the feature but have it disabled for the JDK build initially.
Sounds reasonable... so I take it you would also be in favor of patching `make/modules` instead of adding `@SuppressWarnings` annotations everywhere... is that correct?
If this is generally agreed as a better route then let me know and I'll update the patch.
Thanks for both of your comments.
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the security-dev
mailing list