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 a quick fix that removes both annotations when the two are mutually exclusive #539

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion jakarta.jdt/org.eclipse.lsp4jakarta.jdt.core/plugin.xml
turkeylurkey marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,14 @@
<codeAction kind="quickfix"
targetDiagnostic="jakarta-cdi#InvalidProducerMethodParamAnnotation"
class="org.eclipse.lsp4jakarta.jdt.internal.cdi.RemoveProduceAnnotationQuickFix" />
<!-- These quick fixes remove remove the @Disposes annotation as well as the @Observes annotation.
They are mutually exclusive and only one needs to go.
<codeAction kind="quickfix"
targetDiagnostic="jakarta-cdi#InvalidDisposesAnnotationOnMultipleMethodParams"
class="org.eclipse.lsp4jakarta.jdt.internal.cdi.RemoveInvalidProducerParamAnnotationQuickFix" />
<codeAction kind="quickfix"
<codeAction kind="quickfix"
targetDiagnostic="jakarta-cdi#InvalidDisposerMethodParamAnnotation"
class="org.eclipse.lsp4jakarta.jdt.internal.cdi.RemoveInvalidProducerParamAnnotationQuickFix" />
-->
</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -438,42 +438,45 @@ public void producesAndDisposesObservesObservesAsync() throws Exception {

assertJavaCodeAction(codeActionParams8, IJDT_UTILS, ca20, ca21);

JakartaJavaCodeActionParams codeActionParams9 = createCodeActionParams(uri, d9);

TextEdit te22 = te(30, 40, 30, 50, "");
TextEdit te23 = te(30, 64, 30, 74, "");
CodeAction ca22 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d9, te22);
CodeAction ca23 = ca(uri, "Remove the '@Observes' modifier from parameter 'name2'", d9, te23);

assertJavaCodeAction(codeActionParams9, IJDT_UTILS, ca22, ca23);

JakartaJavaCodeActionParams codeActionParams10 = createCodeActionParams(uri, d10);

TextEdit te24 = te(42, 45, 42, 55, "");
TextEdit te25 = te(42, 69, 42, 84, "");
CodeAction ca24 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d10, te24);
CodeAction ca25 = ca(uri, "Remove the '@ObservesAsync' modifier from parameter 'name2'", d10, te25);

assertJavaCodeAction(codeActionParams10, IJDT_UTILS, ca24, ca25);

JakartaJavaCodeActionParams codeActionParams11 = createCodeActionParams(uri, d11);

TextEdit te26 = te(48, 53, 48, 63, "");
TextEdit te27 = te(48, 77, 48, 87, "");
TextEdit te28 = te(48, 101, 48, 116, "");
CodeAction ca26 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d11, te26);
CodeAction ca27 = ca(uri, "Remove the '@Observes' modifier from parameter 'name2'", d11, te27);
CodeAction ca28 = ca(uri, "Remove the '@ObservesAsync' modifier from parameter 'name3'", d11, te28);

assertJavaCodeAction(codeActionParams11, IJDT_UTILS, ca26, ca27, ca28);

JakartaJavaCodeActionParams codeActionParams12 = createCodeActionParams(uri, d12);

TextEdit te30 = te(54, 54, 54, 89, "");
CodeAction ca30 = ca(uri,
"Remove the '@Disposes', '@Observes', '@ObservesAsync' modifier from parameter 'name'", d12, te30);

assertJavaCodeAction(codeActionParams12, IJDT_UTILS, ca30);
/*
* These code actions are disabled until they are fixed
* JakartaJavaCodeActionParams codeActionParams9 = createCodeActionParams(uri, d9);
*
* TextEdit te22 = te(30, 40, 30, 50, "");
* TextEdit te23 = te(30, 64, 30, 74, "");
* CodeAction ca22 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d9, te22);
* CodeAction ca23 = ca(uri, "Remove the '@Observes' modifier from parameter 'name2'", d9, te23);
*
* assertJavaCodeAction(codeActionParams9, IJDT_UTILS, ca22, ca23);
*
* JakartaJavaCodeActionParams codeActionParams10 = createCodeActionParams(uri, d10);
*
* TextEdit te24 = te(42, 45, 42, 55, "");
* TextEdit te25 = te(42, 69, 42, 84, "");
* CodeAction ca24 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d10, te24);
* CodeAction ca25 = ca(uri, "Remove the '@ObservesAsync' modifier from parameter 'name2'", d10, te25);
*
* assertJavaCodeAction(codeActionParams10, IJDT_UTILS, ca24, ca25);
*
* JakartaJavaCodeActionParams codeActionParams11 = createCodeActionParams(uri, d11);
*
* TextEdit te26 = te(48, 53, 48, 63, "");
* TextEdit te27 = te(48, 77, 48, 87, "");
* TextEdit te28 = te(48, 101, 48, 116, "");
* CodeAction ca26 = ca(uri, "Remove the '@Disposes' modifier from parameter 'name1'", d11, te26);
* CodeAction ca27 = ca(uri, "Remove the '@Observes' modifier from parameter 'name2'", d11, te27);
* CodeAction ca28 = ca(uri, "Remove the '@ObservesAsync' modifier from parameter 'name3'", d11, te28);
*
* assertJavaCodeAction(codeActionParams11, IJDT_UTILS, ca26, ca27, ca28);
*
* JakartaJavaCodeActionParams codeActionParams12 = createCodeActionParams(uri, d12);
*
* TextEdit te30 = te(54, 54, 54, 89, "");
* CodeAction ca30 = ca(uri,
* "Remove the '@Disposes', '@Observes', '@ObservesAsync' modifier from parameter 'name'", d12, te30);
*
* assertJavaCodeAction(codeActionParams12, IJDT_UTILS, ca30);
*/
}

@Test
Expand Down
Loading