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

[quickfix] Selecting multiple warnings with the same quickfix shows "The selected components do not have a common applicable quick fix" #1967

Open
jubax opened this issue Jan 23, 2025 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jubax
Copy link

jubax commented Jan 23, 2025

If you have a class

public class CanBeDeclaredAsStatic {
    
    public void test() {
	String x = "foo";
	String y = toUpper(x);
	String z = toLower(y);
	System.err.println(z);
    }

    
    public String toUpper(String string) {
	return string.toUpperCase(Locale.ROOT);
    }
    
    public String toLower(String string) {
	return string.toLowerCase(Locale.ROOT);
    }
    
}

and activated the corresponding warnings you see

Image

When you choose one of those two warnings you get a quickfix dialog which allows you to fix the problem:

Image

But when you choose both warnings then you get "The selected components do not have a common applicable quick fix":

Image

I would have expected that the UI allows me to get both warnings fixed at the same time because they both have the same quick fix.

@jukzi
Copy link
Contributor

jukzi commented Jan 23, 2025

I dislike this also. it seems depend on the quickfix - for some it works

@jukzi
Copy link
Contributor

jukzi commented Jan 23, 2025

@jukzi
Copy link
Contributor

jukzi commented Jan 23, 2025

In the reproducer given it is an ASTRewriteCorrectionProposal which is not an FixCorrectionProposal so it fails the instanceof FixCorrectionProposal in org.eclipse.jdt.internal.ui.text.correction.CorrectionMarkerResolutionGenerator.CorrectionMarkerResolution.findOtherMarkers(IMarker[]). One would have to refactor to use FixCorrectionProposalCore instead of ASTRewriteCorrectionProposalCore

@jukzi
Copy link
Contributor

jukzi commented Jan 23, 2025

Both classes have been submitted with #815 @robstryker can you help?

@jukzi jukzi added enhancement New feature or request help wanted Extra attention is needed labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants