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

[23] Flow analysis fails to recognize initialization in an instance initializer block #3748

Closed
jarthana opened this issue Feb 21, 2025 · 2 comments
Assignees

Comments

@jarthana
Copy link
Member

This is somewhat an opposite of #3116. Here's the testcase:

public class X {
	final int fin;
	{
		fin = 0;
	}
	X() {
		int abc = 0; // Commenting out this line brings out the error
		// fin = 5; // Swapping this line with the one below also produces the correct error.
		this(fin = 10);
	}
	X(int x) {}
}

This may be specific to invocation between constructors. I am not sure, though. Copying @stephan-herrmann

@jarthana jarthana changed the title [23] Flow analysis fails to recognize initialization in a block [23] Flow analysis fails to recognize initialization in an instance initializer block Feb 21, 2025
@stephan-herrmann
Copy link
Contributor

stephan-herrmann commented Feb 22, 2025

Scratch my first guess, didn't see the instance initializer.
I should look at it in more leisure at another time :)

@stephan-herrmann stephan-herrmann self-assigned this Feb 23, 2025
@stephan-herrmann stephan-herrmann added this to the BETA_JAVA24 RC1 milestone Feb 23, 2025
stephan-herrmann added a commit to stephan-herrmann/eclipse.jdt.core that referenced this issue Feb 23, 2025
initializer block

+ arguments to explicit constructor call are prologue
  - if they are relevant don't skip prologue analysis
+ fine tune creation and usage of flow prologueInfo

Fixes eclipse-jdt#3748
stephan-herrmann added a commit that referenced this issue Feb 23, 2025
…nitializer block (#3749)

+ arguments to explicit constructor call are prologue
  - if they are relevant don't skip prologue analysis
+ fine tune creation and usage of flow prologueInfo

Fixes #3748
@stephan-herrmann
Copy link
Contributor

Fixed by #3749

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