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

ecj ignores error "cannot select a static class from a parameterized type"

Open
#4,702 25 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

Here's a minimal demo:

```java
public class OuterStaticNestedDemo {
class Outer {
static class StaticNested {}
}

void qualifiedNew(Outer outer) {
new Outer.StaticNested();
}
}
```

When I compile with javac, it raises an error (using version 25 here, but it's the same for versions 11, 17 and 21) :

```
javac -g -source 25 -target 25 OuterStaticNestedDemo.java
OuterStaticNestedDemo.java:8: error: cannot select a static class from a parameterized type
new Outer.StaticNested();
^
1 error
```

When I compile with ecj, it compiles :

`java -jar ecj-3.44.0.jar -g -source 25 -target 25 OuterStaticNestedDemo.java`

Could you please fix to raise the same error as javac ?

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.