eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Message "is not valid for an anonymous class with '<>'" may not be helpful
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
Follow-up from https://github.com/eclipse-jdt/eclipse.jdt.core/issues/4810#issuecomment-3837943457, where we saw this error message:
> `Type MyCallable inferred for MyCallable<>, is not valid for an anonymous class with '<>'`
**This error message doesn't make any sense**, independent of context: type `MyCallable` would be valid! But internally the type actually was something like `MyCallable`, where the second type argument is a CaptureBinding18. Its method shortReadableName() as used in the ProblemReporter hides the unspeakable type name, which however is essential for this error message.
The message should probably be rephrased to abstractly describe the offending type (smth like "an undenotable type variable"), in which case we might have to unfold the different reasons why a type is not denotable.
Starting point would be `ProblemReporter.anonymousDiamondWithNonDenotableTypeArguments()`
Contributor guide
Assessment
This issue has not been assessed yet.