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

Nested class cannot be constructed through outer class reference when in outer class

Open
#937 1 comment 0 reactions 0 assignees View on GitHub
compiler rawtypes
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

When trying to compile this using ecj and javac only javac successfully compiles.
Replacing `new Outer.Inner();` with `this.new Inner();` fixes the compile error along with specifying the `.Inner>` as a generic in the `mapToObj` method call.
```java
public class Outer {
public void main(String[] args) {
Stream.Inner> stream = IntStream.range(0, 10).mapToObj((num) -> {
return new Outer.Inner();
});
}

public class Inner {
}
}
```

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.