Skip to content

Commit 9c9d4c3

Browse files
committed
Correct problem and quick fix labels
1 parent aca47bc commit 9c9d4c3

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/reconcilers/ImplicitWebAnnotationNamesReconciler.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
public class ImplicitWebAnnotationNamesReconciler implements JdtAstReconciler {
3232

33-
private static final String LABEL = "Remove Implicit Web Annotation Names";
33+
private static final String PROBLEM_LABEL = "Implicit Web Annotation Name";
34+
private static final String FIX_LABEL = "Remove Implicit Web Annotation Name";
35+
private static final String FIX_LABEL_PLURAL = "Remove Implicit Web Annotation Names";
3436

3537
private static final Set<String> PARAM_ANNOTATIONS = new HashSet<>(
3638
Arrays.asList(
@@ -79,18 +81,18 @@ public boolean visit(SingleMemberAnnotation node) {
7981

8082
private void processWebAnnotation(Annotation a) {
8183
if (isApplicableWebAnnotation(a)) {
82-
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), LABEL, a.getStartPosition(), a.getLength());
84+
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), PROBLEM_LABEL, a.getStartPosition(), a.getLength());
8385
String uri = docUri.toASCIIString();
8486
Range range = ReconcileUtils.createOpenRewriteRange(cu, a);
8587
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
86-
new FixDescriptor(org.openrewrite.java.spring.ImplicitWebAnnotationNames.class.getName(), List.of(uri), "Remove Implicit Web Annotation Name")
88+
new FixDescriptor(org.openrewrite.java.spring.ImplicitWebAnnotationNames.class.getName(), List.of(uri), FIX_LABEL)
8789
.withRangeScope(range)
8890
.withRecipeScope(RecipeScope.NODE),
8991
new FixDescriptor(org.openrewrite.java.spring.ImplicitWebAnnotationNames.class.getName(), List.of(uri),
90-
ReconcileUtils.buildLabel(LABEL, RecipeScope.FILE))
92+
ReconcileUtils.buildLabel(FIX_LABEL_PLURAL, RecipeScope.FILE))
9193
.withRecipeScope(RecipeScope.FILE),
9294
new FixDescriptor(org.openrewrite.java.spring.ImplicitWebAnnotationNames.class.getName(), List.of(uri),
93-
ReconcileUtils.buildLabel(LABEL, RecipeScope.PROJECT))
95+
ReconcileUtils.buildLabel(FIX_LABEL_PLURAL, RecipeScope.PROJECT))
9496
.withRecipeScope(RecipeScope.PROJECT)
9597
));
9698
problemCollector.accept(problem);

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/reconcilers/NoAutowiredOnConstructorReconciler.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636

3737
public class NoAutowiredOnConstructorReconciler implements JdtAstReconciler {
3838

39-
private static final String LABEL = "Remove Unnecessary @Autowired";
39+
private static final String PROBLEM_LABEL = "Unnecessary @Autowired";
40+
private static final String FIX_LABEL = "Remove Unnecessary @Autowired";
4041

4142
private QuickfixRegistry registry;
4243

@@ -82,10 +83,10 @@ public boolean visit(TypeDeclaration typeDecl) {
8283
Annotation autowiredAnnotation = ReconcileUtils.findAnnotation(constructor,
8384
Annotations.AUTOWIRED, false);
8485
if (autowiredAnnotation != null) {
85-
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), LABEL,
86+
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), PROBLEM_LABEL,
8687
autowiredAnnotation.getStartPosition(), autowiredAnnotation.getLength());
8788
ReconcileUtils.setRewriteFixes(registry, problem,
88-
List.of(new FixDescriptor(NoAutowiredOnConstructor.class.getName(), List.of(docUri.toASCIIString()), LABEL)
89+
List.of(new FixDescriptor(NoAutowiredOnConstructor.class.getName(), List.of(docUri.toASCIIString()), FIX_LABEL)
8990
.withRecipeScope(RecipeScope.NODE)
9091
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl))));
9192
problemCollector.accept(problem);

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/reconcilers/NoRepoAnnotationReconciler.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434

3535
public class NoRepoAnnotationReconciler implements JdtAstReconciler {
3636

37-
private static final String LABEL = "Remove Unnecessary @Repository";
37+
private static final String PROBLEM_LABEL = "Unnecessary @Repository";
38+
private static final String FIX_LABEL = "Remove Unnecessary @Repository";
3839
private static final String INTERFACE_REPOSITORY = "org.springframework.data.repository.Repository";
3940

4041
private QuickfixRegistry registry;
@@ -67,18 +68,18 @@ public boolean visit(TypeDeclaration typeDecl) {
6768
if (isApplicableRepoAnnotation(a)) {
6869
ITypeBinding type = typeDecl.resolveBinding();
6970
if (type != null && isRepo(type)) {
70-
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), LABEL, a.getStartPosition(), a.getLength());
71+
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), PROBLEM_LABEL, a.getStartPosition(), a.getLength());
7172
String uri = docUri.toASCIIString();
7273
String id = NoRepoAnnotationOnRepoInterface.class.getName();
7374
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
74-
// new FixDescriptor(ID, List.of(uri), LABEL)
75+
// new FixDescriptor(ID, List.of(uri), FIX_LABEL)
7576
// .withRangeScope(RewriteQuickFixUtils.createOpenRewriteRange(cu, typeDecl))
7677
// .withRecipeScope(RecipeScope.NODE),
7778
new FixDescriptor(id, List.of(uri),
78-
ReconcileUtils.buildLabel(LABEL, RecipeScope.FILE))
79+
ReconcileUtils.buildLabel(FIX_LABEL, RecipeScope.FILE))
7980
.withRecipeScope(RecipeScope.FILE),
8081
new FixDescriptor(id, List.of(uri),
81-
ReconcileUtils.buildLabel(LABEL, RecipeScope.PROJECT))
82+
ReconcileUtils.buildLabel(FIX_LABEL, RecipeScope.PROJECT))
8283
.withRecipeScope(RecipeScope.PROJECT)
8384
));
8485
problemCollector.accept(problem);

0 commit comments

Comments
 (0)