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

Possibly bogus warning for public exported types when the export target contains those types

Open
#3,067 3 comments 0 reactions 0 assignees View on GitHub
enhancement jpms
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

Suppose a `module dep` that exports `package dep` with class `dep.D`. And suppose another module:

```java
module App {
requires dep;

exports app to dep;
}
```
then
```java
package app;

public class A {
public dep.D d;
}
```
emits a warning:
```
The type D from module dep may not be accessible to clients due to missing 'requires transitive'
```
While it's true that it *may* not be accessible, since the module exposes the package (and class) to the module that defines that class, we can know that it will be accessible.

Can the compiler be smarter and check if the targets of an export have access to the exposed types?

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.