Do not compute unnecessary UUID for Range
This commit is contained in:
@@ -50,7 +50,7 @@ public abstract class AbstractSecurityLamdaDslReconciler implements JdtAstReconc
|
||||
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
|
||||
new FixDescriptor(getRecipeId(), List.of(uri),
|
||||
ReconcileUtils.buildLabel(getFixLabel(), RecipeScope.NODE))
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, topMethodInvocation))
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, topMethodInvocation, null))
|
||||
.withRecipeScope(RecipeScope.NODE),
|
||||
new FixDescriptor(getRecipeId(), List.of(uri),
|
||||
ReconcileUtils.buildLabel(getFixLabel(), RecipeScope.FILE))
|
||||
|
||||
@@ -137,7 +137,7 @@ public class AutowiredFieldIntoConstructorParameterReconciler implements JdtAstR
|
||||
: "") + typeDecl.getName().getFullyQualifiedName();
|
||||
ReconcileUtils.setRewriteFixes(registry, problem,
|
||||
List.of(new FixDescriptor(ConvertAutowiredFieldIntoConstructorParameter.class.getName(), List.of(docUri.toASCIIString()), LABEL)
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl))
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl, null))
|
||||
.withParameters(Map.of("classFqName", typeFqName, "fieldName", fieldName))
|
||||
.withRecipeScope(RecipeScope.NODE)));
|
||||
return problem;
|
||||
|
||||
@@ -151,9 +151,9 @@ public class BeanMethodNotPublicReconciler implements JdtAstReconciler {
|
||||
|
||||
FixDescriptor fix1 = new FixDescriptor(id, List.of(docUri.toASCIIString()), LABEL)
|
||||
.withRecipeScope(RecipeScope.NODE)
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, method));
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, method, null));
|
||||
|
||||
Range methodRange = ReconcileUtils.createOpenRewriteRange(cu, method);
|
||||
Range methodRange = ReconcileUtils.createOpenRewriteRange(cu, method, null);
|
||||
fix1 = fix1.withRangeScope(methodRange);
|
||||
|
||||
FixDescriptor fix2 = new FixDescriptor(id, List.of(docUri.toASCIIString()), ReconcileUtils.buildLabel(LABEL, RecipeScope.FILE))
|
||||
|
||||
@@ -96,7 +96,7 @@ public class BeanPostProcessingIgnoreInAotReconciler implements JdtAstReconciler
|
||||
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), LABEL, typeDecl.getName().getStartPosition(), typeDecl.getName().getLength());
|
||||
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
|
||||
new FixDescriptor(BeanPostProcessingIgnoreInAot.class.getName(), List.of(docUri.toASCIIString()), ReconcileUtils.buildLabel(LABEL, RecipeScope.NODE))
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl))
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl, null))
|
||||
.withRecipeScope(RecipeScope.NODE)
|
||||
));
|
||||
problemCollector.accept(problem);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ImplicitWebAnnotationNamesReconciler implements JdtAstReconciler {
|
||||
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), PROBLEM_LABEL, nodeForProblemRange.getStartPosition(), nodeForProblemRange.getLength());
|
||||
|
||||
String uri = docUri.toASCIIString();
|
||||
Range range = ReconcileUtils.createOpenRewriteRange(cu, a);
|
||||
Range range = ReconcileUtils.createOpenRewriteRange(cu, a, null);
|
||||
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
|
||||
new FixDescriptor(org.openrewrite.java.spring.ImplicitWebAnnotationNames.class.getName(), List.of(uri), FIX_LABEL)
|
||||
.withRangeScope(range)
|
||||
|
||||
@@ -90,7 +90,7 @@ public class NoAutowiredOnConstructorReconciler implements JdtAstReconciler {
|
||||
ReconcileUtils.setRewriteFixes(registry, problem,
|
||||
List.of(new FixDescriptor(NoAutowiredOnConstructor.class.getName(), List.of(docUri.toASCIIString()), FIX_LABEL)
|
||||
.withRecipeScope(RecipeScope.NODE)
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl))));
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, typeDecl, null))));
|
||||
problemCollector.accept(problem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class NoRequestMappingAnnotationReconciler implements JdtAstReconciler {
|
||||
List<String> requestMethods = getRequestMethods(cu, a);
|
||||
if (!requestMethods.isEmpty() && !requestMethods.contains(UNSUPPORTED_REQUEST_METHOD)) {
|
||||
String uri = docUri.toASCIIString();
|
||||
Range range = ReconcileUtils.createOpenRewriteRange(cu, a);
|
||||
Range range = ReconcileUtils.createOpenRewriteRange(cu, a, null);
|
||||
if (requestMethods.size() == 1 && SUPPORTED_REQUEST_METHODS.contains(requestMethods.get(0))) {
|
||||
ReconcileProblemImpl problem = new ReconcileProblemImpl(getProblemType(), PROBLEM_LABEL, a.getStartPosition(), a.getLength());
|
||||
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PreciseBeanTypeReconciler implements JdtAstReconciler {
|
||||
ReconcileUtils.setRewriteFixes(registry, problem, List.of(
|
||||
new FixDescriptor(recipeId, List.of(uri), ReconcileUtils.buildLabel("Replace return type with '" + replacementType + "'", RecipeScope.NODE))
|
||||
.withRecipeScope(RecipeScope.NODE)
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, method)),
|
||||
.withRangeScope(ReconcileUtils.createOpenRewriteRange(cu, method, null)),
|
||||
new FixDescriptor(recipeId, List.of(uri), ReconcileUtils.buildLabel(LABEL, RecipeScope.FILE))
|
||||
.withRecipeScope(RecipeScope.FILE),
|
||||
new FixDescriptor(recipeId, List.of(uri), ReconcileUtils.buildLabel(LABEL, RecipeScope.PROJECT))
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.java.reconcilers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.eclipse.jdt.core.dom.ASTNode;
|
||||
@@ -23,7 +24,6 @@ import org.eclipse.jdt.core.dom.ITypeBinding;
|
||||
import org.eclipse.jdt.core.dom.ImportDeclaration;
|
||||
import org.eclipse.jdt.core.dom.Name;
|
||||
import org.eclipse.jdt.core.dom.SimpleType;
|
||||
import org.openrewrite.Tree;
|
||||
import org.openrewrite.marker.Range;
|
||||
import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchies;
|
||||
import org.springframework.ide.vscode.boot.java.rewrite.RewriteRefactorings;
|
||||
@@ -36,7 +36,7 @@ import org.springframework.ide.vscode.commons.rewrite.java.FixDescriptor;
|
||||
|
||||
public class ReconcileUtils {
|
||||
|
||||
public static Range createOpenRewriteRange(CompilationUnit cu, ASTNode node) {
|
||||
public static Range createOpenRewriteRange(CompilationUnit cu, ASTNode node, UUID id) {
|
||||
|
||||
int startOffset = node.getStartPosition();
|
||||
int startLine = cu.getLineNumber(startOffset);
|
||||
@@ -49,7 +49,7 @@ public class ReconcileUtils {
|
||||
Range.Position startPosition = new Range.Position(startOffset, startLine, startColumn);
|
||||
Range.Position endPosition = new Range.Position(endOffset, endLine, endColumn);
|
||||
|
||||
return new Range(Tree.randomId(), startPosition, endPosition);
|
||||
return new Range(id, startPosition, endPosition);
|
||||
}
|
||||
|
||||
public static QuickfixType getRewriteQuickFixType(QuickfixRegistry registry) {
|
||||
|
||||
Reference in New Issue
Block a user