eclipse-jdt / eclipse-jdt/eclipse.jdt.core
[BETA_JAVA28] Implement `identity` warnings for value classes (and value bases classes)
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 49
Description
https://openjdk.org/jeps/401 reads:
`The garbage collection APIs in the [java.lang.ref](https://download.java.net/java/early_access/jdk28/docs/api/java.base/java/lang/ref/package-summary.html) package and the [java.util.WeakHashMap](https://download.java.net/java/early_access/jdk28/docs/api/java.base/java/util/WeakHashMap.html) class cannot be used with value objects. Attempting to create Reference objects for value objects will cause an IdentityException to be thrown.
Since JDK 25, javac has issued [identity warnings](https://bugs.openjdk.org/browse/JDK-8354556) when value-based classes are used with these APIs. As of JDK 28, javac also issues identity warnings when value classes are used with these APIs.`
ECJ should consider implementing similar warnings.
See that this is not a language compliance issue. A compliant Java compiler is _not_ mandated to issue these warnings. The draft JLS specification is silent about these warnings - see https://download.java.net/java/early_access/jdk28/docs/specs/value-objects-jls.html
Contributor guide
Research direction
Start by reading JEP 401, the draft value-objects JLS specification, and the linked JDK-8354556 issue to understand the identity-warning behavior. Then locate ECJ's diagnostics for java.lang.ref APIs and WeakHashMap; done means ECJ emits comparable warnings for value-based and value classes without treating them as language-compliance errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100