eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

Misleading text "Access to a non-accessible member of an enclosing type"

Open
#456 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

Java - Compiler - Errors/Warnings - Code style has the option

_Access to a non-accessible member of an enclosing type_

When this option is on, you get a warning (or error, or info) in

```java
class Foo {
static void foo() {
run(() -> Bar.privateMethod());
run(Bar::privateMethod); // <-- warning here
}

static class Bar {
private static void privateMethod() { /**/ }
}

static void run(Runnable r) { r.run(); }
}
```
The compiler does generate an accessor method for some reason. The reason, however, is neither because the method is not accessible (because it is, as the line before the warning shows), nor because "privateMethod" is in an enclos**ing** type (Bar is an enclos**ed** type).

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.