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

[NETBEANS-6599] Do not throw a CompletionFailure for empty java.lang package outside of java.base. #6629

Merged
merged 1 commit into from
Oct 28, 2023

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Oct 26, 2023

NBClassFinder throws a customized CompletionFailure when empty java.lang is seen. This is to prevent hard Abort later in case there are no system classes. But, the exception is also thrown when the java.lang that is being completed is not in the java.base module, which leads to false positives. So, the proposal is to limit the CF to only cases where the package is from java.base.

closes #6599


^Add meaningful description above

By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -

  • are all your own work, and you have the right to contribute them.
  • are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).

Please make sure (eg. git log) that all commits have a valid name and email address for you in the Author field.

If you're a first time contributor, see the Contributing guidelines for more information.

If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.

@lahodaj lahodaj added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Oct 26, 2023
@lahodaj lahodaj added this to the NB20 milestone Oct 26, 2023
@lahodaj lahodaj requested a review from dbalek October 26, 2023 20:53
@mbien
Copy link
Member

mbien commented Oct 26, 2023

one test fails atm:

junit.framework.AssertionFailedError: expected:<[]> but was:<[- compiler.note.implicit.annotation.processing]>
at org.netbeans.lib.nbjavac.services.NBClassFinderTest.testEmptyClassPath2(NBClassFinderTest.java:78)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:79)
at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:484)
at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:405)
at java.base/java.lang.Thread.run(Thread.java:829)

@arvindaprameya
Copy link

There is a test failure, is that intermittent ?

@lahodaj
Copy link
Contributor Author

lahodaj commented Oct 27, 2023

Sorry for the test failure - I've started with an older version of the test that didn't have the -Xlint:-options yet. Fixed now.

@neilcsmith-net
Copy link
Member

neilcsmith-net commented Oct 27, 2023

Thanks @lahodaj - will be merged for 20-rc3.

Out of interest, do you have an idea what might have changed in JDK 21 that seems to be triggering this? Or does the test code fail on earlier JDKs too? My one concern is whether this is a symptom of a problem somewhere else that needs looking at?

@lahodaj
Copy link
Contributor Author

lahodaj commented Oct 27, 2023

Thanks @lahodaj - will be merged for 20-rc3.

Out of interest, do you have an idea what might have changed in JDK 21 that seems to be triggering this? Or does the test code fail on earlier JDKs too? My one concern is whether this is a symptom of a problem somewhere else that needs looking at?

No significant change that would come to mind. I suspect that with the appropriate project setup, it can happen for quite some releases. I tried NetBeans 18 on JDK 19, as I can get the error (compile-time error). I might be missing something, though.

@neilcsmith-net
Copy link
Member

Thanks @lahodaj - merging.

For me I'm definitely only seeing this show up on JDK 21, with the exact same project setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error notification - Symbol$CompletionFailure: cannot find symbol java.lang
4 participants