JDK-8015831 : Add lint check for calling overridable methods from a constructor
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2013-06-03
  • Updated: 2024-02-05
  • Resolved: 2023-03-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b15Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8314437 :  
Description
One of the coding guidelines from "Effective Java" and elsewhere is to not call overridable methods from a constructor. A compiler is an in excellent position to perform this kind of check.

The Java Specialists newsletter reports instance of this coding pattern in the JDK codebase:

    www.javaspecialists.eu/archive/Issue210.html
Comments
[~vromero], [~mcimadamore], [~jlahoda] The changes to the javac.1 manpage that are part of this issue should have been applied to the closed javac.md source and re-generated to apply them to the open java.1 page. These changes will be lost as soon as the manpages are re-generated, both for JDK 21 and JDK 22, so this needs to be fixed in both JDK 21 and JDK 22.
14-06-2023

Changeset: 8f5bb538 Author: Archie L. Cobbs <archie.cobbs@gmail.com> Committer: Vicente Romero <vromero@openjdk.org> Date: 2023-03-17 22:05:50 +0000 URL: https://git.openjdk.org/jdk/commit/8f5bb538aba42bffb9611546a18f14eb2ea82b70
17-03-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11874 Date: 2023-01-06 02:20:53 +0000
06-01-2023

Jan, I can look this one if you want.
10-03-2015

Maurizio recommended Jan to look at this one.
18-07-2013