eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Bad redundant cast removal for @Nullable array
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 49
Description
Using Eclipse 4.25, the following code when saved by the JDT editor wth redundant cast removal active loses its cast and consequently acquires a compilation error.
```
package bug;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
public class NonNullBug
{
class InstanceClass
{
InstanceClass(@NonNull Object @NonNull [] boxedValues) {}
}
class FactoryClass
{
@SuppressWarnings("null")
Object newInstance(@Nullable Object @NonNull [] boxedValues) {
return new InstanceClass((@NonNull Object @NonNull [])boxedValues);
}
}
}
```
Contributor guide
Research direction
Reproduce the example in Eclipse 4.25 with the JDT editor's redundant cast removal enabled, focusing on the @Nullable array and redundant-cast cleanup path. Verify that saving preserves a cast needed for compilation; the issue is fixed when the saved example still compiles and the cleanup does not remove that cast.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100