Skip to content
New issue

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

[24] JEP 492: Flexible Constructor Bodies (Third Preview) #2901

Closed
Tracked by #2899
mpalat opened this issue Sep 4, 2024 · 8 comments
Closed
Tracked by #2899

[24] JEP 492: Flexible Constructor Bodies (Third Preview) #2901

mpalat opened this issue Sep 4, 2024 · 8 comments
Assignees
Milestone

Comments

@mpalat
Copy link
Contributor

mpalat commented Sep 4, 2024

ref: https://openjdk.org/jeps/492
JLS Changes: https://cr.openjdk.org/~gbierman/jep492/latest/
https://bugs.openjdk.org/browse/JDK-8338287

Summary
In constructors in the Java programming language, allow statements to appear before an explicit constructor invocation, i.e., super(..) or this(..). The statements cannot reference the instance under construction, but they can initialize its fields. Initializing fields before invoking another constructor makes a class more reliable when methods are overridden. This is a preview language feature.

History
This feature was originally proposed by JEP 447, and delivered as a preview feature in JDK 22. JEP 482 was the second preview and the support of the same is captured in jdt.core issue #2472

@mpalat
Copy link
Contributor Author

mpalat commented Sep 4, 2024

@stephan-herrmann assigning to you since you had done the earlier part. Please feel free to reassign

@mpalat mpalat changed the title JEP draft: Flexible Constructor Bodies (Third Preview) [24] JEP draft: Flexible Constructor Bodies (Third Preview) Sep 5, 2024
@stephan-herrmann
Copy link
Contributor

JLS changes will be done via https://bugs.openjdk.org/browse/JDK-8338289 (which is still empty as of today :) ).

@stephan-herrmann
Copy link
Contributor

We have a spec draft: https://cr.openjdk.org/~gbierman/jep492/jep492-20241101/specs/flexible-constructor-bodies-jls.html - said to contain only a small number of minor bug fixes.

@stephan-herrmann
Copy link
Contributor

Currently, JLS changes can be found in https://cr.openjdk.org/~gbierman/jep492/jep492-20241101/specs/flexible-constructor-bodies-jls.html

@mpalat mpalat changed the title [24] JEP draft: Flexible Constructor Bodies (Third Preview) [24] JEP 492: Flexible Constructor Bodies (Third Preview) Nov 4, 2024
@mpalat
Copy link
Contributor Author

mpalat commented Nov 4, 2024

stephan-herrmann added a commit to stephan-herrmann/eclipse.jdt.core that referenced this issue Jan 28, 2025
+ new rule: field assignment not in lambdas nor local / anon classes

Relates to eclipse-jdt#2901
stephan-herrmann added a commit that referenced this issue Jan 28, 2025
+ new rule: field assignment not in lambdas nor local / anon classes

Relates to #2901
@stephan-herrmann
Copy link
Contributor

stephan-herrmann commented Feb 1, 2025

Sub-issues are mined from https://bugs.openjdk.org/browse/JDK-8333313?jql=labels%20%3D%20javac-pre-capture%20ORDER%20BY%20status%20ASC

There may be more, still. I'm done with that list 😄

@stephan-herrmann
Copy link
Contributor

Done here (until more bug reports come our way 😄)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants