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

Allow invocation of annotation Processor's getCompletions even if process fails. #6956

Merged

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Jan 15, 2024

Writing code along these lines:

@ServiceProvider(service=|)
public class Test implements Runnable {
...
}

Code completion invoked at the place | does not contain options like Runnable. The reason is that the ServiceProviderProcessor.process will fail (due to the incomplete code), and then APTUtils.ErrorToleratingProcessor ignores even the getCompletions invocation.

The proposal is to split the valid flag in APTUtils.ErrorToleratingProcessor into two: one will be set if init fails, and this will block all the methods of the target processor, and one will be set when process fails, and that will only block the process method. As long as init passes, the getCompletions method may still be able to produce meaningful results, I think.

@lahodaj lahodaj added the Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) label Jan 15, 2024
@lahodaj lahodaj added this to the NB22 milestone Jan 15, 2024
@lahodaj lahodaj requested a review from dbalek January 15, 2024 15:28
Copy link
Contributor

@dbalek dbalek left a comment

Choose a reason for hiding this comment

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

Looks fine.

@lahodaj lahodaj merged commit 6a9d501 into apache:master Feb 16, 2024
36 checks passed
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.

None yet

2 participants