Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Must ensure javac is initialized before attempting any lookups. #1573

Merged

Conversation

jlahoda
Copy link
Contributor

@jlahoda jlahoda commented Oct 16, 2019

tzezula reported that the Navigate/Go to Symbol feature does not work properly for Java:
-the entries in the list are missing the icon
-pressing Enter does not jump to the actual entry

I believe the reason is that ElementUtils.getTypeElementByBinaryName is called on an javac instance, that is not sufficiently initialized (since JDK 9, javac must be initialized a little bit more that before to work). This is particularly problem since this feature uses the javac internal directly. The proposed patch is to force the proper initialization. There are multiple ways to do that, but JavacTask.getElements().getTypeElement("java.lang.Object") feels like the cleanest. (Alternative would be "jt.ensureEntered()", but that is yet another call to an javac internal method, while getTypeElement is public.)

@jlahoda jlahoda added this to the 11.3 milestone Oct 17, 2019
Copy link
Member

@geertjanw geertjanw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@jlahoda jlahoda merged commit 37fa789 into apache:master Nov 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants