eclipse-jdt / eclipse-jdt/eclipse.jdt.core

ECJ fails to complain about a flexible constructor failing to initialize a blank final variable.

Open
#5,378 9 comments 0 reactions 1 assignee Claimed by @srikanth-sankaran View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

4.40, 4.41 M2 and master/HEAD all compile the following illegal program:

```
public class X {
final String s;

X(String s0) {
s = s0;
super();
}

X() {
System.out.println("Blah");
super();
}

public static void main(String... args) {
System.out.print(new X("OK").s);
}
}
```

Javac 26 and 28 EA versions correctly reject this with: `X.java:12: error: variable s might not have been initialized`

Note: both constructors are required to reproduce the problem.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.