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

Remove dependency of decl. hints on hints UI; UI plugs into hints SPI. #5671

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

sdedic
Copy link
Member

@sdedic sdedic commented Mar 17, 2023

The original idea was to ditch java.hints.ui from the LSP server, as it is Swing-based, but I've realized that java.hints.declarative depend on the ui directly just because of one call.
I made a SPI to plug hints UI implemented in java.hints.ui and (private) API in spiimpl that displays the UI - so now java.hints.declarative only (implementation-)depends on spi.java.hints.

@sdedic sdedic added enhancement Code cleanup Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests labels Mar 17, 2023
@sdedic sdedic added this to the NB18 milestone Mar 17, 2023
@sdedic sdedic self-assigned this Mar 17, 2023
Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

Looks sane to me. I don't think this is strictly an API change - the documented change is not part of the exposed API, but that is a side discussion. I also think some methods could have lower visibility (for example openRefactoringUI), but as this is not API, I think it is ok.

@sdedic
Copy link
Member Author

sdedic commented Mar 26, 2023

Looks sane to me. I don't think this is strictly an API change - the documented change is not part of the exposed API,

I'ts not, but the spiimpl package is a semi-api (or this is how it is used by other hint modules). An API should have been created ages ago from the package...

I also think some methods could have lower visibility (for example openRefactoringUI), but as this is not API, I think it is ok.

Please elaborate. Speaking about org.netbeans.modules.java.hints.spiimpl.Utilities::openRefactoringUI - the intention was to expose a helper ("api") method that would locate & call the plugged SPI implementation or fail; the method is likely to be called from different packages, hence it should be public ...

@matthiasblaesing
Copy link
Contributor

Looks sane to me. I don't think this is strictly an API change - the documented change is not part of the exposed API,

I'ts not, but the spiimpl package is a semi-api (or this is how it is used by other hint modules). An API should have been created ages ago from the package...

Understood.

I also think some methods could have lower visibility (for example openRefactoringUI), but as this is not API, I think it is ok.

Please elaborate. Speaking about org.netbeans.modules.java.hints.spiimpl.Utilities::openRefactoringUI - the intention was to expose a helper ("api") method that would locate & call the plugged SPI implementation or fail; the method is likely to be called from different packages, hence it should be public ...

Yeah I noticed, that openRefactoringUI is only called from openRefactoringUIOrWarn, so could be private. But I think it is ok to keep as is, as it might satisfy other usecases where the caller wants to handle missing UI implementations.

So I still think this is ok to merge.

@sdedic sdedic merged commit c5d1612 into apache:master Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code cleanup enhancement Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants