Community
Participate
Working Groups
I'm writing a plugin to add quickfix support for creating mock objects with mockito, and I'm discovering that it is quite difficult to supply a correct IJavaCompletionProposal. ASTRewriteCorrectionProposal looks like a very simple API to achieve the functionality I want, but of course it is internal. Could it be made public?
Looks doable, tentatively targeting 3.6. Would have to clean up Javadocs a little (add where it's missing), and make sure methods are final where possible or add @nooverride or @noreference. The only bigger issue is LinkedProposalModel, LinkedProposalPositionGroup, etc., which documentation and look too complicated in their current form.
Sweet. I'd be happy to work on this. I can give about 5 hours/week to it. If this becomes public API, could we try to simplify the QuickFixProcessor as well? Unless there are performance concerns, QuickFixProcessor seems like it could be broken into one extension per problem.
> The only bigger issue is LinkedProposalModel, LinkedProposalPositionGroup, > etc., which documentation and look too complicated in their current form. ^ are lacking > Sweet. I'd be happy to work on this. I can give about 5 hours/week to it. Great, thanks. Please start with fixing Javadocs and see which members could be made less visible and where we could add @nooverride, etc. > Unless there are performance concerns, QuickFixProcessor seems like it > could be broken into one extension per problem. That would have to go to a separate bug. But actually, I like it the way it currently is. We don't want multiple contributions to the same extension point, and having everything in one "gatekeeper" also simplifies debugging and keeping the overview over what's already handled and how.
Created attachment 201456 [details] first draft (In reply to comment #1) > The only bigger issue is LinkedProposalModel, LinkedProposalPositionGroup, > etc., which documentation and look too complicated in their current form. One solution could be to not make linked mode API, at least not in first go. The patch takes this approach. CUCorrectionProposal shouldn't really be doing anything with linked mode. Linked mode is better handled in LinkedCorrectionProposal. But linked mode is also required in FixCorrectionProposal and RefactoringCorrectionProposal, for the lack of a better idea I created CULinkedCorrectionProposal. Once we apply this patch, it should be trivial to make ASTRewriteCorrectionProposal and its parents API.
I have pushed branch - dazad/bug287136-Make-ASTRewriteCorrectionProposal-API. - In the first few commits on the branch I refactor the code to get it ready to be made API. The last commits moves 4 types - ASTRewriteCorrectionProposal, ChangeCorrectionProposal, CUCorrectionProposal, ICommandAccess - to a public package. (A large number of files are touched on the last commit as the import declarations need to be updated) (In reply to comment #4) > One solution could be to not make linked mode API, at least not in first go. - I stick to this approach, however I have gotten rid of CULinkedCorrectionProposal mentioned in comment 4. Everything related to linked mode is now only in LinkedCorrectionProposal, which looks cleaner to me. - I have also added constructors to the three 'proposal' types which use a default image (the green arrow). I think this is useful as JavaPluginImages.IMG_CORRECTION_CHANGE and others are not API. - I also tried to contribute a quick assist from outside o.e.jdt.ui, and I think (almost) everything that is needed to do that is API with these changes. Markus, the changes look good to you?
Ping!
I rebased the branch onto master and started the review (looks good so far). Deepak, you created a new package "org.eclipse.jdt.ui.text.correction.proposals" for the new APIs: ASTRewriteCorrectionProposal.java ChangeCorrectionProposal.java CUCorrectionProposal.java ICommandAccess.java I would either put them into "org.eclipse.jdt.ui.text.java" or at least call the package "org.eclipse.jdt.ui.text.java.correction".
(In reply to comment #7) > I would either put them into "org.eclipse.jdt.ui.text.java" or at least call > the package "org.eclipse.jdt.ui.text.java.correction". Sure, we can call the package "org.eclipse.jdt.ui.text.java.correction".
Pushed as http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=97f91896bd1a409a8d219bc43d88f5c330faecf5 and http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=dea32cd2a16959fb8826482bac58a18582ea2479
Thanks Markus! Did you make any significant changes? (Though I did not notice anything so far...)