We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following class:
public class HelloWorld { public static void main(String... args) { System.out.println(new Rectangle(4, 3)); } public static class Rectangle { int width, height; transient int area = -1; public Rectangle (int width, int height) { this.width = width; this.height = height; this.precalculateArea(); } public void precalculateArea() { this.area = width * height; } @Override public String toString() { return "area: " + area; } } }
When compiling with javac -Xlint:all HelloWorld.java, javac produces the following warning:
javac -Xlint:all HelloWorld.java
javac
HelloWorld.java:13: warning: [this-escape] possible 'this' escape before subclass is fully initialized this.precalculateArea(); ^ 1 warning
My understanding is that this check is important for the upcoming value classes JEP. I think it would be nice if JDT also reported this warning.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider the following class:
When compiling with
javac -Xlint:all HelloWorld.java
,javac
produces the following warning:My understanding is that this check is important for the upcoming value classes JEP. I think it would be nice if JDT also reported this warning.
The text was updated successfully, but these errors were encountered: