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

[22] JEP 447: Statements before super(...) (Preview) #1637

Closed
1 task done
Tracked by #1397
mpalat opened this issue Nov 28, 2023 · 3 comments
Closed
1 task done
Tracked by #1397

[22] JEP 447: Statements before super(...) (Preview) #1637

mpalat opened this issue Nov 28, 2023 · 3 comments
Assignees
Milestone

Comments

@mpalat
Copy link
Contributor

mpalat commented Nov 28, 2023

https://openjdk.org/jeps/447
In constructors in the Java programming language, allow statements that do not reference the instance being created to appear before an explicit constructor invocation.

Latest spec changes: https://cr.openjdk.org/~gbierman/jep447/latest/
Will have direct impact on the compiler and friends

The Compiler Support

@mpalat mpalat added this to the BETA_JAVA22 milestone Nov 28, 2023
@mpalat mpalat self-assigned this Nov 29, 2023
@mpalat
Copy link
Contributor Author

mpalat commented Nov 29, 2023

Taking a shot at this - Doing an initial investigation for now.

Random Thoughts:
There is a grammar change as per JLS delta

ConstructorBody:
{ [ExplicitConstructorInvocation] [BlockStatements] }

now becomes

ConstructorBody:
{ [BlockStatements] }
{ [BlockStatements] ExplicitConstructorInvocation [BlockStatements] }

However, in our java.g, the relevant code is:
ConstructorDeclaration ::= ConstructorHeader MethodBody
/.$putCase consumeConstructorDeclaration() ; $break ./

Essentially, the error checking for ExplicitConstructionInvocation is handled later in the pipeline. My initial thought here is that we may not have to change grammar/java.g but rather handle these cases later [yes, adhering to the principle of minimal/no grammar change if possible]

mpalat added a commit to mpalat/eclipse.jdt.core that referenced this issue Jan 2, 2024
eclipse-jdt#1637 - WIP - ONLY
OUTLINE OF TESTCASES - DONOT MERGE NOW
@mpalat mpalat mentioned this issue Jan 2, 2024
3 tasks
mpalat added a commit to mpalat/eclipse.jdt.core that referenced this issue Feb 25, 2024
mpalat added a commit that referenced this issue Feb 29, 2024
…2063)

 Compiler support for [22] JEP 447: Statements before super(...) (Preview)  - issue #1637 (#2063)
@mpalat
Copy link
Contributor Author

mpalat commented Feb 29, 2024

Taking a shot at this - Doing an initial investigation for now.

Compiler support for this is done via #2063. Any issues found will be addressed via additional PRs. And for the record, was able to do without an explicit grammar change as envisaged earlier.

@mpalat
Copy link
Contributor Author

mpalat commented Mar 7, 2024

IDE support will be done via issue #2083. Closing this.

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

1 participant