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

Building OpenJDK: imported nested, nested private class not visible higher up in hierarchy

Open
#3,803 4 comments 0 reactions 0 assignees View on GitHub
needinfo
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

I am working on building OpenJDK JDK8u using ecj (for speed). This bug occurs building:

`langtools\src\share\classes\com\sun\tools\javac\comp\LambdaToMethod.java`

```
4. ERROR in D:\ikvm\ext\openjdk\langtools\src\share\classes\com\sun\tools\javac\comp\LambdaToMethod.java (at line 93)
private Map> contextMap;
^^^^^^^^^^^^^^^^^^
The type TranslationContext is not visible
```

The `TranslationContext` type is nested within a nested class, in the same file, which is imported at the top of the file by wildcard.

`import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzerPreprocessor.*;`

Simply changing the referencing code to `LambdaAnalyzerPreprocessor.TranslationContext>` solves the issue. Basically, it looks to me, like the top-file import just isn't working. It is pretty odd code. But there it is.

This is on ecj-4.20

Contributor guide

Open the contributing guide

Research direction

Start with langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java, especially the wildcard import of LambdaAnalyzerPreprocessor.* and the TranslationContext reference around line 93. Reproduce the JDK8u build with ecj-4.20, then compare the wildcard reference with the qualified form mentioned in the report. Done means the affected build proceeds without the visibility error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.