From 6c16211be9f2b566d4b21e2eba7e97da795a3acc Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Thu, 8 Feb 2024 02:51:09 -0500 Subject: [PATCH] Consume jdt.ui interface deletion Part 1 Signed-off-by: Rob Stryker --- .../corrections/InnovationContext.java | 4 +- .../corrections/InvertBooleanUtility.java | 12 ++-- .../corrections/QuickFixProcessor.java | 16 ++--- .../corrections/RefactorProcessor.java | 48 +++++++------- .../corrections/ReturnTypeSubProcessor.java | 12 ++-- .../SerialVersionSubProcessor.java | 10 +-- .../SuppressWarningsSubProcessor.java | 10 +-- .../UnInitializedFinalFieldSubProcessor.java | 8 +-- .../GetterSetterCorrectionSubProcessor.java | 8 +-- .../GradleCompatibilityProcessor.java | 12 ++-- .../proposals/JavadocTagsSubProcessor.java | 22 +++---- .../LocalCorrectionsSubProcessor.java | 46 +++++++------- .../proposals/ProblemLocationWrapper.java | 8 +-- .../ReorgCorrectionsSubProcessor.java | 28 ++++----- .../proposals/TypeMismatchSubProcessor.java | 20 +++--- .../UnresolvedElementsSubProcessor.java | 22 +++---- .../internal/handlers/CodeActionHandler.java | 18 +++--- .../handlers/GenerateConstructorsHandler.java | 4 +- .../handlers/GetRefactorEditHandler.java | 12 ++-- .../ModifierCorrectionSubProcessor.java | 40 ++++++------ .../correction/NonProjectFixProcessor.java | 8 +-- .../text/correction/QuickAssistProcessor.java | 60 +++++++++--------- .../correction/RefactorProposalUtility.java | 62 +++++++++---------- .../correction/SourceAssistProcessor.java | 32 +++++----- .../org.eclipse.jdt.ls.tp.target | 2 +- 25 files changed, 262 insertions(+), 262 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InnovationContext.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InnovationContext.java index c3b13284d1..f08403e9d8 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InnovationContext.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InnovationContext.java @@ -17,9 +17,9 @@ import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.NodeFinder; import org.eclipse.jdt.internal.core.manipulation.dom.ASTResolving; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; -public class InnovationContext implements IInvocationContextCore { +public class InnovationContext implements IInvocationContext { private final ICompilationUnit fCompilationUnit; private CompilationUnit fASTRoot; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InvertBooleanUtility.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InvertBooleanUtility.java index 2012f6a61b..f27a544013 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InvertBooleanUtility.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/InvertBooleanUtility.java @@ -66,7 +66,7 @@ import org.eclipse.jdt.internal.core.manipulation.dom.OperatorPrecedence; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.LinkedNodeFinder; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposalCore; import org.eclipse.jdt.ls.core.internal.Messages; @@ -84,7 +84,7 @@ public class InvertBooleanUtility { public static final String INVERT_VARIABLE_COMMAND = "invertVariable"; - public static ProposalKindWrapper getInvertVariableProposal(CodeActionParams params, IInvocationContextCore context, ASTNode covering, boolean returnAsCommand) { + public static ProposalKindWrapper getInvertVariableProposal(CodeActionParams params, IInvocationContext context, ASTNode covering, boolean returnAsCommand) { // cursor should be placed on variable name if (!(covering instanceof SimpleName)) { return null; @@ -232,13 +232,13 @@ public SimpleName getRenamed(SimpleName simpleName) { return CodeActionHandler.wrap(proposal, CodeActionKind.Refactor); } - public static boolean getInverseConditionProposals(CodeActionParams params, IInvocationContextCore context, ASTNode covering, Collection proposals) { + public static boolean getInverseConditionProposals(CodeActionParams params, IInvocationContext context, ASTNode covering, Collection proposals) { ArrayList coveredNodes = QuickAssistProcessor.getFullyCoveredNodes(context, covering); return getInverseConditionProposals(params, context, covering, coveredNodes, proposals); } - private static boolean getInverseConditionProposals(CodeActionParams params, IInvocationContextCore context, ASTNode covering, ArrayList coveredNodes, Collection proposals) { + private static boolean getInverseConditionProposals(CodeActionParams params, IInvocationContext context, ASTNode covering, ArrayList coveredNodes, Collection proposals) { if (proposals == null) { return false; } @@ -491,7 +491,7 @@ private static Expression getInversedExpression(ASTRewrite rewrite, Expression e return prefixExpression; } - public static boolean getSplitAndConditionProposals(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + public static boolean getSplitAndConditionProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) { Operator andOperator = InfixExpression.Operator.CONDITIONAL_AND; // check that user invokes quick assist on infix expression if (!(node instanceof InfixExpression)) { @@ -561,7 +561,7 @@ public static boolean getSplitAndConditionProposals(IInvocationContextCore conte return true; } - public static boolean getSplitOrConditionProposals(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + public static boolean getSplitOrConditionProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) { Operator orOperator = InfixExpression.Operator.CONDITIONAL_OR; // check that user invokes quick assist on infix expression if (!(node instanceof InfixExpression)) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/QuickFixProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/QuickFixProcessor.java index 61c21c3111..c5c1aa2f2d 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/QuickFixProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/QuickFixProcessor.java @@ -41,8 +41,6 @@ import org.eclipse.jdt.core.manipulation.CUCorrectionProposalCore; import org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.UnInitializedFinalFieldBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.proposals.AddImportCorrectionProposalCore; @@ -58,6 +56,8 @@ import org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler; import org.eclipse.jdt.ls.core.internal.handlers.OrganizeImportsHandler; import org.eclipse.jdt.ls.core.internal.text.correction.ModifierCorrectionSubProcessor; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.lsp4j.CodeActionKind; import org.eclipse.lsp4j.CodeActionParams; @@ -80,14 +80,14 @@ private static int moveBack(int offset, int start, String ignoreCharacters, ICom return start; } - public List getCorrections(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore[] locations) throws CoreException { + public List getCorrections(CodeActionParams params, IInvocationContext context, IProblemLocation[] locations) throws CoreException { if (locations == null || locations.length == 0) { return Collections.emptyList(); } ArrayList resultingCollections = new ArrayList<>(); Set handledProblems = new HashSet<>(locations.length); for (int i = 0; i < locations.length; i++) { - IProblemLocationCore curr = locations[i]; + IProblemLocation curr = locations[i]; if (handledProblems(curr, locations, handledProblems)) { process(params, context, curr, resultingCollections); } @@ -95,14 +95,14 @@ public List getCorrections(CodeActionParams params, IInvoca return resultingCollections; } - private static boolean handledProblems(IProblemLocationCore location, IProblemLocationCore[] locations, Set handledProblems) { + private static boolean handledProblems(IProblemLocation location, IProblemLocation[] locations, Set handledProblems) { int problemId = location.getProblemId(); if (handledProblems.contains(problemId)) { return false; } if (problemId == IProblem.UndefinedName) { // skip different problems with the same resolution - for (IProblemLocationCore l : locations) { + for (IProblemLocation l : locations) { if (l.getProblemId() == IProblem.UndefinedType && Arrays.deepEquals(l.getProblemArguments(), location.getProblemArguments())) { handledProblems.add(problemId); return false; @@ -112,7 +112,7 @@ private static boolean handledProblems(IProblemLocationCore location, IProblemLo return handledProblems.add(problemId); } - private void process(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + private void process(CodeActionParams params, IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { int id = problem.getProblemId(); if (id == 0) { // no proposals for none-problem locations return; @@ -686,7 +686,7 @@ private void process(CodeActionParams params, IInvocationContextCore context, IP // problem, proposals); } - public void addAddAllMissingImportsProposal(IInvocationContextCore context, Collection proposals) { + public void addAddAllMissingImportsProposal(IInvocationContext context, Collection proposals) { if (proposals.size() == 0) { return; } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/RefactorProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/RefactorProcessor.java index bfd7359fe5..365144c77e 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/RefactorProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/RefactorProcessor.java @@ -94,8 +94,8 @@ import org.eclipse.jdt.internal.ui.fix.AbstractCleanUpCore; import org.eclipse.jdt.internal.ui.fix.LambdaExpressionsCleanUpCore; import org.eclipse.jdt.internal.ui.fix.MultiFixMessages; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.proposals.ASTRewriteRemoveImportsCorrectionProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposalCore; @@ -125,7 +125,7 @@ public RefactorProcessor(PreferenceManager preferenceManager) { this.preferenceManager = preferenceManager; } - public List getProposals(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore[] locations) throws CoreException { + public List getProposals(CodeActionParams params, IInvocationContext context, IProblemLocation[] locations) throws CoreException { ASTNode coveringNode = context.getCoveringNode(); if (coveringNode != null) { ArrayList proposals = new ArrayList<>(); @@ -164,7 +164,7 @@ public List getProposals(CodeActionParams params, IInvocati return Collections.emptyList(); } - private boolean getIntroduceParameterProposals(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, IProblemLocationCore[] locations, ArrayList resultingCollections) throws CoreException { + private boolean getIntroduceParameterProposals(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, IProblemLocation[] locations, ArrayList resultingCollections) throws CoreException { if (resultingCollections == null) { return false; } @@ -176,7 +176,7 @@ private boolean getIntroduceParameterProposals(CodeActionParams params, IInvocat return false; } - private boolean getInverseLocalVariableProposals(CodeActionParams params, IInvocationContextCore context, ASTNode covering, Collection proposals) { + private boolean getInverseLocalVariableProposals(CodeActionParams params, IInvocationContext context, ASTNode covering, Collection proposals) { if (proposals == null) { return false; } @@ -196,7 +196,7 @@ private boolean getInverseLocalVariableProposals(CodeActionParams params, IInvoc return true; } - private boolean getMoveRefactoringProposals(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getMoveRefactoringProposals(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections == null) { return false; } @@ -213,12 +213,12 @@ private boolean getMoveRefactoringProposals(CodeActionParams params, IInvocation } - static boolean noErrorsAtLocation(IProblemLocationCore[] locations, ASTNode coveringNode) { + static boolean noErrorsAtLocation(IProblemLocation[] locations, ASTNode coveringNode) { if (locations != null) { int start = coveringNode.getStartPosition(); int length = coveringNode.getLength(); for (int i = 0; i < locations.length; i++) { - IProblemLocationCore location = locations[i]; + IProblemLocation location = locations[i]; if (location.getOffset() > start + length || (location.getOffset() + location.getLength()) < start) { continue; } @@ -235,7 +235,7 @@ static boolean noErrorsAtLocation(IProblemLocationCore[] locations, ASTNode cove } - private boolean getExtractVariableProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Collection proposals) throws CoreException { + private boolean getExtractVariableProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Collection proposals) throws CoreException { if (proposals == null) { return false; } @@ -255,7 +255,7 @@ private boolean getExtractVariableProposal(CodeActionParams params, IInvocationC return true; } - private boolean getAssignToVariableProposals(IInvocationContextCore context, ASTNode node, IProblemLocationCore[] locations, Collection resultingCollections, CodeActionParams params) { + private boolean getAssignToVariableProposals(IInvocationContext context, ASTNode node, IProblemLocation[] locations, Collection resultingCollections, CodeActionParams params) { try { Map formatterOptions = null; ProposalKindWrapper proposal = RefactorProposalUtility.getAssignVariableProposal(params, context, locations != null && locations.length != 0, formatterOptions, @@ -274,7 +274,7 @@ private boolean getAssignToVariableProposals(IInvocationContextCore context, AST return true; } - private boolean getExtractMethodProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, Collection proposals) throws CoreException { + private boolean getExtractMethodProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, Collection proposals) throws CoreException { if (proposals == null) { return false; } @@ -294,7 +294,7 @@ private boolean getExtractMethodProposal(CodeActionParams params, IInvocationCon return true; } - private boolean getExtractFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Collection proposals) throws CoreException { + private boolean getExtractFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Collection proposals) throws CoreException { if (proposals == null) { return false; } @@ -311,7 +311,7 @@ private boolean getExtractFieldProposal(CodeActionParams params, IInvocationCont } - private boolean getInlineProposal(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + private boolean getInlineProposal(IInvocationContext context, ASTNode node, Collection resultingCollections) { if (resultingCollections == null) { return false; } @@ -396,7 +396,7 @@ private boolean getInlineProposal(IInvocationContextCore context, ASTNode node, } - private boolean getConvertAnonymousToNestedProposals(CodeActionParams params, IInvocationContextCore context, ASTNode node, Collection proposals) throws CoreException { + private boolean getConvertAnonymousToNestedProposals(CodeActionParams params, IInvocationContext context, ASTNode node, Collection proposals) throws CoreException { if (proposals == null) { return false; } @@ -416,7 +416,7 @@ private boolean getConvertAnonymousToNestedProposals(CodeActionParams params, II return true; } - public static ProposalKindWrapper getConvertAnonymousToNestedProposal(CodeActionParams params, IInvocationContextCore context, final ASTNode node, boolean returnAsCommand) throws CoreException { + public static ProposalKindWrapper getConvertAnonymousToNestedProposal(CodeActionParams params, IInvocationContext context, final ASTNode node, boolean returnAsCommand) throws CoreException { String label = CorrectionMessages.QuickAssistProcessor_convert_anonym_to_nested; ClassInstanceCreation cic = getClassInstanceCreation(node); if (cic == null) { @@ -478,7 +478,7 @@ private static ClassInstanceCreation getClassInstanceCreation(ASTNode node) { } } - private static boolean getConvertAnonymousClassCreationsToLambdaProposals(IInvocationContextCore context, ASTNode covering, Collection resultingCollections) { + private static boolean getConvertAnonymousClassCreationsToLambdaProposals(IInvocationContext context, ASTNode covering, Collection resultingCollections) { ClassInstanceCreation cic = getClassInstanceCreation(covering); if (cic == null) { return false; @@ -501,7 +501,7 @@ private static boolean getConvertAnonymousClassCreationsToLambdaProposals(IInvoc return true; } - private static boolean getConvertLambdaToAnonymousClassCreationsProposals(IInvocationContextCore context, ASTNode covering, Collection resultingCollections) { + private static boolean getConvertLambdaToAnonymousClassCreationsProposals(IInvocationContext context, ASTNode covering, Collection resultingCollections) { if (resultingCollections == null) { return true; } @@ -529,7 +529,7 @@ private static boolean getConvertLambdaToAnonymousClassCreationsProposals(IInvoc return true; } - private static boolean getConvertVarTypeToResolvedTypeProposal(IInvocationContextCore context, ASTNode node, Collection proposals) { + private static boolean getConvertVarTypeToResolvedTypeProposal(IInvocationContext context, ASTNode node, Collection proposals) { CompilationUnit astRoot = context.getASTRoot(); IJavaElement root = astRoot.getJavaElement(); if (root == null) { @@ -607,7 +607,7 @@ private static SimpleName getSimpleNameForVariable(ASTNode node) { return name; } - private static boolean getConvertResolvedTypeToVarTypeProposal(IInvocationContextCore context, ASTNode node, Collection proposals) { + private static boolean getConvertResolvedTypeToVarTypeProposal(IInvocationContext context, ASTNode node, Collection proposals) { CompilationUnit astRoot = context.getASTRoot(); IJavaElement root = astRoot.getJavaElement(); if (root == null) { @@ -722,7 +722,7 @@ private static boolean getConvertResolvedTypeToVarTypeProposal(IInvocationContex * @return {@code true} if the operation could or has been performed, * {@code false otherwise} */ - private static boolean getAddStaticImportProposals(IInvocationContextCore context, ASTNode node, Collection proposals) { + private static boolean getAddStaticImportProposals(IInvocationContext context, ASTNode node, Collection proposals) { if (!(node instanceof SimpleName)) { return false; } @@ -894,7 +894,7 @@ private static boolean isDirectlyAccessible(ASTNode nameNode, ITypeBinding decla return false; } - private static boolean getConvertForLoopProposal(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + private static boolean getConvertForLoopProposal(IInvocationContext context, ASTNode node, Collection resultingCollections) { ForStatement forStatement = getEnclosingForStatementHeader(node); if (forStatement == null) { return false; @@ -994,7 +994,7 @@ private static T getEnclosingHeader(ASTNode node, Class h return null; } - private boolean getExtractInterfaceProposal(CodeActionParams params, IInvocationContextCore context, Collection proposals) { + private boolean getExtractInterfaceProposal(CodeActionParams params, IInvocationContext context, Collection proposals) { if (proposals == null) { return false; } @@ -1013,7 +1013,7 @@ private boolean getExtractInterfaceProposal(CodeActionParams params, IInvocation return true; } - private boolean getChangeSignatureProposal(CodeActionParams params, IInvocationContextCore context, Collection proposals) { + private boolean getChangeSignatureProposal(CodeActionParams params, IInvocationContext context, Collection proposals) { if (proposals == null) { return false; } @@ -1028,7 +1028,7 @@ private boolean getChangeSignatureProposal(CodeActionParams params, IInvocationC return true; } - private boolean getSurroundWithTryCatchProposal(IInvocationContextCore context, Collection proposals) { + private boolean getSurroundWithTryCatchProposal(IInvocationContext context, Collection proposals) { if (proposals == null) { return false; } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/ReturnTypeSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/ReturnTypeSubProcessor.java index c8cc71566e..4440d29071 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/ReturnTypeSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/ReturnTypeSubProcessor.java @@ -49,8 +49,8 @@ import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.Bindings; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.JavadocTagsSubProcessorCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposalCore; @@ -119,7 +119,7 @@ public boolean visit(AnnotationTypeDeclaration node) { } - public static void addVoidMethodReturnsProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addVoidMethodReturnsProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); @@ -188,7 +188,7 @@ public static void addVoidMethodReturnsProposals(IInvocationContextCore context, - public static void addMissingReturnTypeProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addMissingReturnTypeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ICompilationUnit cu= context.getCompilationUnit(); CompilationUnit astRoot= context.getASTRoot(); @@ -260,7 +260,7 @@ public static void addMissingReturnTypeProposals(IInvocationContextCore context, } } - public static void addMissingReturnStatementProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addMissingReturnStatementProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); @@ -304,7 +304,7 @@ public static void addMissingReturnStatementProposals(IInvocationContextCore con } } - public static void addMethodReturnsVoidProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws JavaModelException { + public static void addMethodReturnsVoidProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws JavaModelException { CompilationUnit astRoot= context.getASTRoot(); ASTNode selectedNode= problem.getCoveringNode(astRoot); if (!(selectedNode instanceof ReturnStatement)) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SerialVersionSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SerialVersionSubProcessor.java index 02979f48e1..51e12ab119 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SerialVersionSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SerialVersionSubProcessor.java @@ -17,8 +17,8 @@ import java.util.Collection; import org.eclipse.jdt.internal.corext.fix.IProposableFix; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.SerialVersionBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.SerialVersionProposalCore; import org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler; @@ -41,15 +41,15 @@ public final class SerialVersionSubProcessor extends SerialVersionBaseSubProcess * @param proposals * the proposal collection to extend */ - public static final void getSerialVersionProposals(final IInvocationContextCore context, final IProblemLocationCore location, final Collection proposals) { + public static final void getSerialVersionProposals(final IInvocationContext context, final IProblemLocation location, final Collection proposals) { new SerialVersionSubProcessor().addSerialVersionProposals(context, location, proposals); } /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.text.correction.SerialVersionBaseSubProcessor#createSerialVersionProposal(org.eclipse.jdt.internal.corext.fix.IProposableFix, int, org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore, boolean) + * @see org.eclipse.jdt.internal.ui.text.correction.SerialVersionBaseSubProcessor#createSerialVersionProposal(org.eclipse.jdt.internal.corext.fix.IProposableFix, int, org.eclipse.jdt.ui.text.java.IInvocationContext, boolean) */ @Override - protected ProposalKindWrapper createSerialVersionProposal(IProposableFix iProposableFix, int missingSerialVersion, IInvocationContextCore context, boolean b) { + protected ProposalKindWrapper createSerialVersionProposal(IProposableFix iProposableFix, int missingSerialVersion, IInvocationContext context, boolean b) { return CodeActionHandler.wrap(new SerialVersionProposalCore(iProposableFix, missingSerialVersion, context, b), CodeActionKind.QuickFix); } } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SuppressWarningsSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SuppressWarningsSubProcessor.java index c72d1ae4fa..3e3c5883f0 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SuppressWarningsSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/SuppressWarningsSubProcessor.java @@ -18,8 +18,8 @@ import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor; import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.SuppressWarningsBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.SuppressWarningsProposalCore; import org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler; @@ -28,15 +28,15 @@ public class SuppressWarningsSubProcessor extends SuppressWarningsBaseSubProcessor { - public static void addSuppressWarningsProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addSuppressWarningsProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new SuppressWarningsSubProcessor().getSuppressWarningsProposals(context, problem, proposals); } - public static void addUnknownSuppressWarningProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addUnknownSuppressWarningProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new SuppressWarningsSubProcessor().getUnknownSuppressWarningProposals(context, problem, proposals); } - public static void addRemoveUnusedSuppressWarningProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addRemoveUnusedSuppressWarningProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new SuppressWarningsSubProcessor().getRemoveUnusedSuppressWarningProposals(context, problem, proposals); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/UnInitializedFinalFieldSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/UnInitializedFinalFieldSubProcessor.java index e49c2aba03..c497a17c60 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/UnInitializedFinalFieldSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/UnInitializedFinalFieldSubProcessor.java @@ -17,7 +17,7 @@ import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.UnInitializedFinalFieldBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.proposals.InitializeFinalFieldProposalCore; @@ -31,19 +31,19 @@ public class UnInitializedFinalFieldSubProcessor extends UnInitializedFinalFieldBaseSubProcessor { @Override - protected ProposalKindWrapper createInitializeFinalFieldProposal(IProblemLocationCore problem, ICompilationUnit targetCU, SimpleName node, IVariableBinding targetBinding, int createConstructor) { + protected ProposalKindWrapper createInitializeFinalFieldProposal(IProblemLocation problem, ICompilationUnit targetCU, SimpleName node, IVariableBinding targetBinding, int createConstructor) { InitializeFinalFieldProposalCore proposal = new InitializeFinalFieldProposalCore(problem, targetCU, node, targetBinding, IProposalRelevance.CREATE_CONSTRUCTOR); return CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix); } @Override - protected ProposalKindWrapper createInitializeFinalFieldProposal(IProblemLocationCore problem, ICompilationUnit targetCU, MethodDeclaration node, int createConstructor, int updateAtConstructor) { + protected ProposalKindWrapper createInitializeFinalFieldProposal(IProblemLocation problem, ICompilationUnit targetCU, MethodDeclaration node, int createConstructor, int updateAtConstructor) { InitializeFinalFieldProposalCore proposal = new InitializeFinalFieldProposalCore(problem, targetCU, node, IProposalRelevance.CREATE_CONSTRUCTOR, InitializeFinalFieldProposalCore.UPDATE_AT_CONSTRUCTOR); return CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix); } @Override - protected ProposalKindWrapper conditionallyCreateInitializeFinalFieldProposal(IProblemLocationCore problem, ICompilationUnit targetCU, MethodDeclaration node, int createConstructor, int updateAtConstructor) { + protected ProposalKindWrapper conditionallyCreateInitializeFinalFieldProposal(IProblemLocation problem, ICompilationUnit targetCU, MethodDeclaration node, int createConstructor, int updateAtConstructor) { InitializeFinalFieldProposalCore initializeFinalFieldProposal = new InitializeFinalFieldProposalCore(problem, targetCU, node, IProposalRelevance.CREATE_CONSTRUCTOR, InitializeFinalFieldProposalCore.UPDATE_CONSTRUCTOR_NEW_PARAMETER); try { if (initializeFinalFieldProposal.hasProposal()) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GetterSetterCorrectionSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GetterSetterCorrectionSubProcessor.java index d0c2f02f56..86d3022bf9 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GetterSetterCorrectionSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GetterSetterCorrectionSubProcessor.java @@ -23,8 +23,8 @@ import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; import org.eclipse.jdt.internal.corext.refactoring.sef.SelfEncapsulateFieldRefactoring; import org.eclipse.jdt.internal.ui.text.correction.GetterSetterCorrectionBaseSubProcessor; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.corrections.ProposalKindWrapper; import org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler; @@ -67,11 +67,11 @@ public static Change getRefactoringChange(IField field) { * the resulting proposals * @return true if the quick assist is applicable at this offset */ - public static boolean addGetterSetterProposal(IInvocationContextCore context, ASTNode coveringNode, IProblemLocationCore[] locations, ArrayList resultingCollections) { + public static boolean addGetterSetterProposal(IInvocationContext context, ASTNode coveringNode, IProblemLocation[] locations, ArrayList resultingCollections) { return new GetterSetterCorrectionSubProcessor().addGetterSetterProposals(context, coveringNode, locations, resultingCollections); } - public static void addGetterSetterProposal(IInvocationContextCore context, IProblemLocationCore location, Collection proposals, int relevance) { + public static void addGetterSetterProposal(IInvocationContext context, IProblemLocation location, Collection proposals, int relevance) { new GetterSetterCorrectionSubProcessor().addGetterSetterProposals(context, location.getCoveringNode(context.getASTRoot()), proposals, relevance); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GradleCompatibilityProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GradleCompatibilityProcessor.java index 234c641594..2de44f1f61 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GradleCompatibilityProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/GradleCompatibilityProcessor.java @@ -28,8 +28,8 @@ import org.eclipse.jdt.core.IModuleDescription; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.internal.core.JarPackageFragmentRoot; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.ProjectUtils; @@ -47,7 +47,7 @@ public class GradleCompatibilityProcessor { private static String UPGRADE_GRADLE_COMMAND_ADVANCED = "java.project.upgradeGradle.command"; private static String UPGRADE_GRADLE_COMMAND = "java.project.upgradeGradle"; - public static void getGradleCompatibilityProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void getGradleCompatibilityProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { IJavaProject javaProject = context.getCompilationUnit().getJavaProject(); if (javaProject == null) { return; @@ -98,7 +98,7 @@ public static void getGradleCompatibilityProposals(IInvocationContextCore contex * @param proposals * the current proposals */ - private static void addProposalForNonModulerProject(ClasspathResult result, IInvocationContextCore context, URI uri, Collection proposals) { + private static void addProposalForNonModulerProject(ClasspathResult result, IInvocationContext context, URI uri, Collection proposals) { if (result.modulepaths.length > 0) { addProposal(context, uri, proposals); } @@ -122,7 +122,7 @@ private static void addProposalForNonModulerProject(ClasspathResult result, IInv * @param proposals * the current proposals */ - private static void addProposalForModulerProject(IJavaProject javaProject, ClasspathResult result, IInvocationContextCore context, URI uri, Collection proposals) { + private static void addProposalForModulerProject(IJavaProject javaProject, ClasspathResult result, IInvocationContext context, URI uri, Collection proposals) { for (String classpath : result.classpaths) { try { IPackageFragmentRoot packageFragmentRoot = javaProject.findPackageFragmentRoot(new Path(classpath)); @@ -144,7 +144,7 @@ private static void addProposalForModulerProject(IJavaProject javaProject, Class } } - private static void addProposal(IInvocationContextCore context, URI uri, Collection proposals) { + private static void addProposal(IInvocationContext context, URI uri, Collection proposals) { String cmdId = JavaLanguageServerPlugin.getPreferencesManager().getClientPreferences().isAdvancedUpgradeGradleSupport() ? UPGRADE_GRADLE_COMMAND_ADVANCED : UPGRADE_GRADLE_COMMAND; CUCorrectionCommandProposal c = new CUCorrectionCommandProposal(CorrectionMessages.NotAccessibleType_upgrade_Gradle_label, context.getCompilationUnit(), IProposalRelevance.CONFIGURE_BUILD_PATH, cmdId, Arrays.asList(uri.toString(), GradleUtils.JPMS_SUPPORTED_VERSION)); diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/JavadocTagsSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/JavadocTagsSubProcessor.java index da4eb3b66e..6e49f58608 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/JavadocTagsSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/JavadocTagsSubProcessor.java @@ -31,8 +31,8 @@ import org.eclipse.jdt.internal.ui.text.correction.AddJavadocCommentProposalCore; import org.eclipse.jdt.internal.ui.text.correction.AddMissingJavadocTagProposalCore; import org.eclipse.jdt.internal.ui.text.correction.AddMissingModuleJavadocTagProposalCore; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.JavadocTagsBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.ProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.proposals.ReplaceCorrectionProposalCore; @@ -46,21 +46,21 @@ * */ public class JavadocTagsSubProcessor extends JavadocTagsBaseSubProcessor { - public static void getMissingJavadocTagProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void getMissingJavadocTagProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new JavadocTagsSubProcessor().addMissingJavadocTagProposals(context, problem, proposals); } - public static void getUnusedAndUndocumentedParameterOrExceptionProposals(IInvocationContextCore context, - IProblemLocationCore problem, Collection proposals) { + public static void getUnusedAndUndocumentedParameterOrExceptionProposals(IInvocationContext context, + IProblemLocation problem, Collection proposals) { new JavadocTagsSubProcessor().addUnusedAndUndocumentedParameterOrExceptionProposals(context, problem, proposals); } - public static void getMissingJavadocCommentProposals(IInvocationContextCore context, ASTNode coveringNode, + public static void getMissingJavadocCommentProposals(IInvocationContext context, ASTNode coveringNode, Collection proposals, String kind) throws CoreException { ArrayList tmp = new ArrayList<>(); // TODO this should be fixed upstream. // We should be able to pass the node, not only a problem - IProblemLocationCore stub = new ProblemLocation(0, 0, 0, null, false, kind) { + IProblemLocation stub = new ProblemLocation(0, 0, 0, null, false, kind) { @Override public ASTNode getCoveringNode(CompilationUnit astRoot) { return coveringNode; @@ -73,7 +73,7 @@ public ASTNode getCoveringNode(CompilationUnit astRoot) { } @Override - public void addMissingJavadocCommentProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + public void addMissingJavadocCommentProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { ASTNode node = problem.getCoveringNode(context.getASTRoot()); ASTNode node2 = ASTNodes.getNormalizedNode(node); BodyDeclaration bodyDeclaration = ASTResolving.findParentBodyDeclaration(node2); @@ -86,7 +86,7 @@ public void addMissingJavadocCommentProposals(IInvocationContextCore context, IP } @Override - public void addMissingJavadocTagProposals(IInvocationContextCore context, ASTNode node, Collection proposals) { + public void addMissingJavadocTagProposals(IInvocationContext context, ASTNode node, Collection proposals) { ASTNode node2 = ASTNodes.getNormalizedNode(node); BodyDeclaration bodyDeclaration = ASTResolving.findParentBodyDeclaration(node2); if (bodyDeclaration != null) { @@ -97,12 +97,12 @@ public void addMissingJavadocTagProposals(IInvocationContextCore context, ASTNod } } - public static void getRemoveJavadocTagProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getRemoveJavadocTagProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new JavadocTagsSubProcessor().addRemoveJavadocTagProposals(context, problem, proposals); } - public static void getInvalidQualificationProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getInvalidQualificationProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new JavadocTagsSubProcessor().addInvalidQualificationProposals(context, problem, proposals); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/LocalCorrectionsSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/LocalCorrectionsSubProcessor.java index dcdd02ff9f..6e6e64ae03 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/LocalCorrectionsSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/LocalCorrectionsSubProcessor.java @@ -102,8 +102,8 @@ import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUpCore; import org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUpCore; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposalCore.ChangeDescription; import org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeMethodSignatureProposalCore.InsertDescription; @@ -128,7 +128,7 @@ public class LocalCorrectionsSubProcessor { private static final String ADD_STATIC_ACCESS_ID = "org.eclipse.jdt.ui.correction.changeToStatic"; //$NON-NLS-1$ - public static void addUncaughtExceptionProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + public static void addUncaughtExceptionProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { ICompilationUnit cu = context.getCompilationUnit(); CompilationUnit astRoot = context.getASTRoot(); @@ -407,7 +407,7 @@ private static boolean isSubtype(ITypeBinding curr, ITypeBinding[] addedExceptio return false; } - public static void addUnreachableCatchProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addUnreachableCatchProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; @@ -416,7 +416,7 @@ public static void addUnreachableCatchProposals(IInvocationContextCore context, QuickAssistProcessor.getCatchClauseToThrowsProposals(context, selectedNode, proposals); } - public static void addUnimplementedMethodsProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addUnimplementedMethodsProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { IProposableFix fix = UnimplementedCodeFixCore.createAddUnimplementedMethodsFix(context.getASTRoot(), problem); if (fix != null) { @@ -430,7 +430,7 @@ public static void addUnimplementedMethodsProposals(IInvocationContextCore conte } } - public static void addUnusedMemberProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addUnusedMemberProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { int problemId = problem.getProblemId(); UnusedCodeFixCore fix = UnusedCodeFixCore.createUnusedMemberFix(context.getASTRoot(), problem, false); @@ -472,7 +472,7 @@ public static void addUnusedMemberProposal(IInvocationContextCore context, IProb } } - public static void getUnreachableCodeProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void getUnreachableCodeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { CompilationUnit root = context.getASTRoot(); ASTNode selectedNode = problem.getCoveringNode(root); if (selectedNode == null) { @@ -578,7 +578,7 @@ public static void getUnreachableCodeProposals(IInvocationContextCore context, I } } - private static void addRemoveProposal(IInvocationContextCore context, ASTNode selectedNode, Collection proposals) { + private static void addRemoveProposal(IInvocationContext context, ASTNode selectedNode, Collection proposals) { ASTRewrite rewrite = ASTRewrite.create(selectedNode.getAST()); rewrite.remove(selectedNode, null); @@ -586,7 +586,7 @@ private static void addRemoveProposal(IInvocationContextCore context, ASTNode se addRemoveProposal(context, rewrite, label, proposals); } - private static void addRemoveIncludingConditionProposal(IInvocationContextCore context, ASTNode toRemove, ASTNode replacement, Collection proposals) { + private static void addRemoveIncludingConditionProposal(IInvocationContext context, ASTNode toRemove, ASTNode replacement, Collection proposals) { String label = CorrectionMessages.LocalCorrectionsSubProcessor_removeunreachablecode_including_condition_description; AST ast = toRemove.getAST(); ASTRewrite rewrite = ASTRewrite.create(ast); @@ -635,12 +635,12 @@ private static void addRemoveIncludingConditionProposal(IInvocationContextCore c proposals.add(CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix)); } - private static void addRemoveProposal(IInvocationContextCore context, ASTRewrite rewrite, String label, Collection proposals) { + private static void addRemoveProposal(IInvocationContext context, ASTRewrite rewrite, String label, Collection proposals) { ASTRewriteCorrectionProposalCore proposal = new ASTRewriteCorrectionProposalCore(label, context.getCompilationUnit(), rewrite, 10); proposals.add(CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix)); } - public static void addConstructorFromSuperclassProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + public static void addConstructorFromSuperclassProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (selectedNode == null) { return; @@ -673,7 +673,7 @@ public static void addConstructorFromSuperclassProposal(IInvocationContextCore c } - public static void addUnnecessaryCastProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addUnnecessaryCastProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { IProposableFix fix = UnusedCodeFixCore.createRemoveUnusedCastFix(context.getASTRoot(), problem); if (fix != null) { Map options = new Hashtable<>(); @@ -686,7 +686,7 @@ public static void addUnnecessaryCastProposal(IInvocationContextCore context, IP /* * Fix instance accesses and indirect (static) accesses to static fields/methods */ - public static void addCorrectAccessToStaticProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + public static void addCorrectAccessToStaticProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { IProposableFix fix = CodeStyleFixCore.createIndirectAccessToStaticFix(context.getASTRoot(), problem); if (fix != null) { @@ -722,7 +722,7 @@ public static void addCorrectAccessToStaticProposals(IInvocationContextCore cont ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_STATIC, IProposalRelevance.REMOVE_STATIC_MODIFIER); } - public static void addRedundantSuperInterfaceProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addRedundantSuperInterfaceProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (!(selectedNode instanceof Name)) { return; @@ -735,7 +735,7 @@ public static void addRedundantSuperInterfaceProposal(IInvocationContextCore con proposals.add(CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix)); } - public static void getMissingEnumConstantCaseProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void getMissingEnumConstantCaseProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { for (ProposalKindWrapper proposal : proposals) { if (CorrectionMessages.LocalCorrectionsSubProcessor_add_missing_cases_description.equals(proposal.getProposal().getName())) { return; @@ -813,7 +813,7 @@ public static boolean evaluateMissingSwitchCases(ITypeBinding enumBindings, List } @SuppressWarnings("deprecation") - public static void createMissingCaseProposals(IInvocationContextCore context, ASTNode parent, ArrayList enumConstNames, Collection proposals) { + public static void createMissingCaseProposals(IInvocationContext context, ASTNode parent, ArrayList enumConstNames, Collection proposals) { List statements; Expression expression; if (parent instanceof SwitchStatement switchStatement) { @@ -939,7 +939,7 @@ private static ThrowStatement getThrowForUnsupportedCase(Expression switchExpr, return newThrowStatement; } - public static void addMissingDefaultCaseProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addMissingDefaultCaseProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (selectedNode instanceof Expression) { StructuralPropertyDescriptor locationInParent = selectedNode.getLocationInParent(); @@ -964,7 +964,7 @@ public static void addMissingDefaultCaseProposal(IInvocationContextCore context, } @SuppressWarnings("deprecation") - private static void createMissingDefaultProposal(IInvocationContextCore context, ASTNode parent, Collection proposals) { + private static void createMissingDefaultProposal(IInvocationContext context, ASTNode parent, Collection proposals) { List statements; Expression expression; if (parent instanceof SwitchStatement switchStatement) { @@ -1029,7 +1029,7 @@ private static ThrowStatement getThrowForUnexpectedDefault(Expression switchExpr return newThrowStatement; } - public static void addCasesOmittedProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addCasesOmittedProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); if (selectedNode instanceof Expression && selectedNode.getLocationInParent() == SwitchStatement.EXPRESSION_PROPERTY) { AST ast = selectedNode.getAST(); @@ -1054,7 +1054,7 @@ public static void addCasesOmittedProposals(IInvocationContextCore context, IPro } } - public static void getTryWithResourceProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void getTryWithResourceProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ASTNode coveringNode = problem.getCoveringNode(context.getASTRoot()); if (coveringNode != null) { try { @@ -1066,7 +1066,7 @@ public static void getTryWithResourceProposals(IInvocationContextCore context, I } } - public static void addTypeAsPermittedSubTypeProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addTypeAsPermittedSubTypeProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { SealedClassFixCore fix = SealedClassFixCore.addTypeAsPermittedSubTypeProposal(context.getASTRoot(), problem); if (fix != null) { String label = fix.getDisplayString(); @@ -1085,7 +1085,7 @@ public static void addTypeAsPermittedSubTypeProposal(IInvocationContextCore cont } } - public static void addSealedAsDirectSuperTypeProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addSealedAsDirectSuperTypeProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { SealedClassFixCore fix = SealedClassFixCore.addSealedAsDirectSuperTypeProposal(context.getASTRoot(), problem); if (fix != null) { String label = fix.getDisplayString(); @@ -1104,7 +1104,7 @@ public static void addSealedAsDirectSuperTypeProposal(IInvocationContextCore con } } - public static void addValueForAnnotationProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addValueForAnnotationProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { MissingAnnotationAttributesFixCore fix = MissingAnnotationAttributesFixCore.addMissingAnnotationAttributesProposal(context.getASTRoot(), problem); if (fix != null) { String label = fix.getDisplayString(); diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ProblemLocationWrapper.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ProblemLocationWrapper.java index 6b148c0402..d3197c2d57 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ProblemLocationWrapper.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ProblemLocationWrapper.java @@ -14,12 +14,12 @@ import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IProblemLocation; -public class ProblemLocationWrapper implements IProblemLocationCore { - private IProblemLocationCore delegate; +public class ProblemLocationWrapper implements IProblemLocation { + private IProblemLocation delegate; - public ProblemLocationWrapper(IProblemLocationCore del) { + public ProblemLocationWrapper(IProblemLocation del) { this.delegate = del; } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ReorgCorrectionsSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ReorgCorrectionsSubProcessor.java index 7267725279..db29c9bbdd 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ReorgCorrectionsSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/ReorgCorrectionsSubProcessor.java @@ -32,8 +32,8 @@ import org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange; import org.eclipse.jdt.internal.corext.util.Messages; import org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.UnresolvedElementsBaseSubProcessor; @@ -50,17 +50,17 @@ public class ReorgCorrectionsSubProcessor extends ReorgCorrectionsBaseSubProcessor { - public static void getWrongTypeNameProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getWrongTypeNameProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new ReorgCorrectionsSubProcessor().addWrongTypeNameProposals(context, problem, proposals); } - public static void getWrongPackageDeclNameProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getWrongPackageDeclNameProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new ReorgCorrectionsSubProcessor().addWrongPackageDeclNameProposals(context, problem, proposals); } - public static void removeImportStatementProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void removeImportStatementProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new ReorgCorrectionsSubProcessor().addRemoveImportStatementProposals(context, problem, proposals); } @@ -75,20 +75,20 @@ public ProposalKindWrapper createRenameCUProposal(String label, RenameCompilatio } /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createCorrectMainTypeNameProposal(org.eclipse.jdt.core.ICompilationUnit, org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore, java.lang.String, java.lang.String, int) + * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createCorrectMainTypeNameProposal(org.eclipse.jdt.core.ICompilationUnit, org.eclipse.jdt.ui.text.java.IInvocationContext, java.lang.String, java.lang.String, int) */ @Override - public ProposalKindWrapper createCorrectMainTypeNameProposal(ICompilationUnit cu, IInvocationContextCore context, String currTypeName, String newTypeName, int relevance) { + public ProposalKindWrapper createCorrectMainTypeNameProposal(ICompilationUnit cu, IInvocationContext context, String currTypeName, String newTypeName, int relevance) { String title = Messages.format(CorrectionMessages.ReorgCorrectionsSubProcessor_renametype_description, BasicElementLabels.getJavaElementName(newTypeName)); CorrectMainTypeNameProposalCore p = new CorrectMainTypeNameProposalCore(title, cu, null, context, currTypeName, newTypeName, relevance); return CodeActionHandler.wrap(p, CodeActionKind.QuickFix); } /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createCorrectPackageDeclarationProposal(org.eclipse.jdt.core.ICompilationUnit, org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore, int) + * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createCorrectPackageDeclarationProposal(org.eclipse.jdt.core.ICompilationUnit, org.eclipse.jdt.internal.ui.text.correction.IProblemLocation, int) */ @Override - protected ProposalKindWrapper createCorrectPackageDeclarationProposal(ICompilationUnit cu, IProblemLocationCore problem, int relevance) { + protected ProposalKindWrapper createCorrectPackageDeclarationProposal(ICompilationUnit cu, IProblemLocation problem, int relevance) { return CodeActionHandler.wrap(new CorrectPackageDeclarationProposalCore(cu, problem, relevance), CodeActionKind.QuickFix); } @@ -110,7 +110,7 @@ protected ProposalKindWrapper createOrganizeImportsProposal(String name, Change } @Override - public void addRemoveImportStatementProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public void addRemoveImportStatementProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { super.addRemoveImportStatementProposals(context, problem, proposals); ICleanUpFixCore removeAllUnusedImportsFix = UnusedCodeFixCore.createCleanUp(context.getASTRoot(), false, false, false, false, false, true, false, false); if (removeAllUnusedImportsFix != null) { @@ -125,10 +125,10 @@ public void addRemoveImportStatementProposals(IInvocationContextCore context, IP } /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createRemoveUnusedImportProposal(org.eclipse.jdt.internal.corext.fix.IProposableFix, org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp, int, org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore) + * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createRemoveUnusedImportProposal(org.eclipse.jdt.internal.corext.fix.IProposableFix, org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp, int, org.eclipse.jdt.ui.text.java.IInvocationContext) */ @Override - protected ProposalKindWrapper createRemoveUnusedImportProposal(IProposableFix fix, UnusedCodeCleanUp unusedCodeCleanUp, int relevance, IInvocationContextCore context) { + protected ProposalKindWrapper createRemoveUnusedImportProposal(IProposableFix fix, UnusedCodeCleanUp unusedCodeCleanUp, int relevance, IInvocationContext context) { if (fix != null) { try { CompilationUnitChange change = fix.createChange(null); @@ -142,10 +142,10 @@ protected ProposalKindWrapper createRemoveUnusedImportProposal(IProposableFix fi } /* (non-Javadoc) - * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createProjectSetupFixProposal(org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore, org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore, java.lang.String, java.util.Collection) + * @see org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor#createProjectSetupFixProposal(org.eclipse.jdt.ui.text.java.IInvocationContext, org.eclipse.jdt.internal.ui.text.correction.IProblemLocation, java.lang.String, java.util.Collection) */ @Override - public ProposalKindWrapper createProjectSetupFixProposal(IInvocationContextCore context, IProblemLocationCore problem, String missingType, Collection proposals) { + public ProposalKindWrapper createProjectSetupFixProposal(IInvocationContext context, IProblemLocation problem, String missingType, Collection proposals) { // Not yet implemented in jdt.ls, jdt.ui impl is UI-based return null; } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/TypeMismatchSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/TypeMismatchSubProcessor.java index 8253674ab8..7b976fdb98 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/TypeMismatchSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/TypeMismatchSubProcessor.java @@ -40,8 +40,8 @@ import org.eclipse.jdt.internal.core.manipulation.dom.ASTResolving; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.TypeMismatchBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.proposals.CastCorrectionProposalCore; @@ -64,7 +64,7 @@ public class TypeMismatchSubProcessor extends TypeMismatchBaseSubProcessor proposals) throws CoreException { new TypeMismatchSubProcessor().collectTypeMismatchProposals(context, problem, proposals); } @@ -73,34 +73,34 @@ public static ITypeBinding boxUnboxPrimitives(ITypeBinding castType, ITypeBindin return TypeMismatchSubProcessor.boxOrUnboxPrimitives(castType, toCast, ast); } - public static void addChangeSenderTypeProposals(IInvocationContextCore context, Expression nodeToCast, + public static void addChangeSenderTypeProposals(IInvocationContext context, Expression nodeToCast, ITypeBinding castTypeBinding, boolean isAssignedNode, int relevance, Collection proposals) throws JavaModelException { new TypeMismatchSubProcessor().collectChangeSenderTypeProposals(context, nodeToCast, castTypeBinding, isAssignedNode, relevance, proposals); } - public static ProposalKindWrapper createCastProposal(IInvocationContextCore context, ITypeBinding castTypeBinding, Expression nodeToCast, int relevance) { + public static ProposalKindWrapper createCastProposal(IInvocationContext context, ITypeBinding castTypeBinding, Expression nodeToCast, int relevance) { return new TypeMismatchSubProcessor().collectCastProposals(context, castTypeBinding, nodeToCast, relevance); } - public static void addIncompatibleReturnTypeProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void addIncompatibleReturnTypeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws JavaModelException { new TypeMismatchSubProcessor().collectIncompatibleReturnTypeProposals(context, problem, proposals); } - public static void addIncompatibleThrowsProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void addIncompatibleThrowsProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws JavaModelException { new TypeMismatchSubProcessor().collectIncompatibleThrowsProposals(context, problem, proposals); } - public static void addTypeMismatchInForEachProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void addTypeMismatchInForEachProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new TypeMismatchSubProcessor().collectTypeMismatchInForEachProposals(context, problem, proposals); } @Override - public void collectTypeMismatchProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { - IProblemLocationCore wrapped = new ProblemLocationWrapper(problem) { + public void collectTypeMismatchProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { + IProblemLocation wrapped = new ProblemLocationWrapper(problem) { @Override public String[] getProblemArguments() { // This is a hack to get around superclass restrictions diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/UnresolvedElementsSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/UnresolvedElementsSubProcessor.java index 740a84c3b0..176baab103 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/UnresolvedElementsSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corrections/proposals/UnresolvedElementsSubProcessor.java @@ -29,8 +29,8 @@ import org.eclipse.jdt.core.dom.NodeFinder; import org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore; import org.eclipse.jdt.core.manipulation.TypeKinds; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.TypeMismatchBaseSubProcessor; import org.eclipse.jdt.internal.ui.text.correction.UnresolvedElementsBaseSubProcessor; @@ -55,12 +55,12 @@ public class UnresolvedElementsSubProcessor extends UnresolvedElementsBaseSubProcessor { - public static void getVariableProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getVariableProposals(IInvocationContext context, IProblemLocation problem, IVariableBinding resolvedField, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectVariableProposals(context, problem, resolvedField, proposals); } - public static void getTypeProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getTypeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectTypeProposals(context, problem, proposals); } @@ -70,27 +70,27 @@ public static void addNewTypeProposals(ICompilationUnit cu, Name refNode, int ki new UnresolvedElementsSubProcessor().collectNewTypeProposals(cu, refNode, kind, relevance, null); } - public static void getMethodProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getMethodProposals(IInvocationContext context, IProblemLocation problem, boolean isOnlyParameterMismatch, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectMethodProposals(context, problem, isOnlyParameterMismatch, proposals); } - public static void getConstructorProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getConstructorProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectConstructorProposals(context, problem, proposals); } - public static void getAmbiguousTypeReferenceProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getAmbiguousTypeReferenceProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectAmbiguosTypeReferenceProposals(context, problem, proposals); } - public static void getArrayAccessProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getArrayAccessProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { new UnresolvedElementsSubProcessor().collectArrayAccessProposals(context, problem, proposals); } - public static void getAnnotationMemberProposals(IInvocationContextCore context, IProblemLocationCore problem, + public static void getAnnotationMemberProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { new UnresolvedElementsSubProcessor().collectAnnotationMemberProposals(context, problem, proposals); } @@ -282,9 +282,9 @@ protected ProposalKindWrapper renameNodeProposalToT(RenameNodeCorrectionProposal } @Override - public void collectTypeProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + public void collectTypeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { // This is a hack because upstream does not behave as we expect. - IProblemLocationCore wrap = new ProblemLocationWrapper(problem) { + IProblemLocation wrap = new ProblemLocationWrapper(problem) { @Override public ASTNode getCoveringNode(CompilationUnit astRoot) { ICompilationUnit cu = context.getCompilationUnit(); diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java index 66847fdd42..2159ae25d1 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CodeActionHandler.java @@ -36,9 +36,7 @@ import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; import org.eclipse.jdt.core.manipulation.ChangeCorrectionProposalCore; import org.eclipse.jdt.core.manipulation.CoreASTProvider; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; -import org.eclipse.jdt.internal.ui.text.correction.ProblemLocationCore; +import org.eclipse.jdt.internal.ui.text.correction.ProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.proposals.NewAnnotationMemberProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.NewMethodCorrectionProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.NewVariableCorrectionProposalCore; @@ -61,6 +59,8 @@ import org.eclipse.jdt.ls.core.internal.text.correction.QuickAssistProcessor; import org.eclipse.jdt.ls.core.internal.text.correction.RefactoringCorrectionCommandProposal; import org.eclipse.jdt.ls.core.internal.text.correction.SourceAssistProcessor; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.lsp4j.CodeAction; import org.eclipse.lsp4j.CodeActionContext; import org.eclipse.lsp4j.CodeActionKind; @@ -141,11 +141,11 @@ public List> getCodeActionCommands(CodeActionParams return Collections.emptyList(); } - IInvocationContextCore context = getContext(unit, astRoot, params.getRange()); + IInvocationContext context = getContext(unit, astRoot, params.getRange()); List diagnostics = params.getContext().getDiagnostics().stream().filter((d) -> { return JavaLanguageServerPlugin.SERVER_SOURCE_ID.equals(d.getSource()); }).collect(Collectors.toList()); - IProblemLocationCore[] locations = getProblemLocationCores(unit, diagnostics); + IProblemLocation[] locations = getProblemLocationCores(unit, diagnostics); if (monitor.isCanceled()) { return Collections.emptyList(); } @@ -318,8 +318,8 @@ private Optional> getCodeActionFromProposal(String u } } - public static IProblemLocationCore[] getProblemLocationCores(ICompilationUnit unit, List diagnostics) { - IProblemLocationCore[] locations = new IProblemLocationCore[diagnostics.size()]; + public static IProblemLocation[] getProblemLocationCores(ICompilationUnit unit, List diagnostics) { + IProblemLocation[] locations = new IProblemLocation[diagnostics.size()]; for (int i = 0; i < diagnostics.size(); i++) { Diagnostic diagnostic = diagnostics.get(i); int start = DiagnosticsHelper.getStartOffset(unit, diagnostic.getRange()); @@ -337,7 +337,7 @@ public static IProblemLocationCore[] getProblemLocationCores(ICompilationUnit un arguments.add(s); } } - locations[i] = new ProblemLocationCore(start, end - start, problemId, arguments.toArray(new String[0]), isError, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); + locations[i] = new ProblemLocation(start, end - start, problemId, arguments.toArray(new String[0]), isError, IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER); } return locations; } @@ -367,7 +367,7 @@ public static CompilationUnit getASTRoot(ICompilationUnit unit, IProgressMonitor return CoreASTProvider.getInstance().getAST(unit, CoreASTProvider.WAIT_YES, monitor); } - public static IInvocationContextCore getContext(ICompilationUnit unit, CompilationUnit astRoot, Range range) { + public static IInvocationContext getContext(ICompilationUnit unit, CompilationUnit astRoot, Range range) { int start = DiagnosticsHelper.getStartOffset(unit, range); int end = DiagnosticsHelper.getEndOffset(unit, range); InnovationContext context = new InnovationContext(unit, start, end - start); diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateConstructorsHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateConstructorsHandler.java index 90cdc47577..fe9a1cf1fa 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateConstructorsHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateConstructorsHandler.java @@ -44,7 +44,7 @@ import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2Core; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.Bindings; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.corrections.DiagnosticsHelper; import org.eclipse.jdt.ls.core.internal.handlers.JdtDomModels.LspMethodBinding; @@ -225,7 +225,7 @@ private static List getFieldNames(ICompilationUnit unit, CompilationUnit if (range == null) { return Collections.emptyList(); } - IInvocationContextCore context = CodeActionHandler.getContext(unit, astRoot, range); + IInvocationContext context = CodeActionHandler.getContext(unit, astRoot, range); ArrayList coveredNodes = QuickAssistProcessor.getFullyCoveredNodes(context, context.getCoveringNode()); return CodeActionUtility.getFieldNames(coveredNodes, context.getCoveringNode()); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GetRefactorEditHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GetRefactorEditHandler.java index 9fb3699a1e..cced2e9c04 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GetRefactorEditHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GetRefactorEditHandler.java @@ -33,8 +33,8 @@ import org.eclipse.jdt.internal.corext.fix.LinkedProposalPositionGroupCore.PositionInformation; import org.eclipse.jdt.internal.corext.refactoring.ParameterInfo; import org.eclipse.jdt.internal.corext.refactoring.code.IntroduceParameterRefactoring; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.RefactoringCorrectionProposalCore; import org.eclipse.jdt.ls.core.internal.ChangeUtil; @@ -74,7 +74,7 @@ public static RefactorWorkspaceEdit getEditsForRefactor(GetRefactorEditParams pa return null; } context.setASTRoot(ast); - IProblemLocationCore[] locations = CodeActionHandler.getProblemLocationCores(unit, params.context.getContext().getDiagnostics()); + IProblemLocation[] locations = CodeActionHandler.getProblemLocationCores(unit, params.context.getContext().getDiagnostics()); boolean problemsAtLocation = locations.length != 0; String positionKey = DEFAULT_POSITION_KEY; @@ -240,7 +240,7 @@ private static PositionInformation getFirstTrackedNodePositionBySequenceRank(Lin return targetPosition; } - private static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, String refactorType, Map formatterOptions) throws CoreException { + private static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, String refactorType, Map formatterOptions) throws CoreException { if (RefactorProposalUtility.EXTRACT_VARIABLE_ALL_OCCURRENCE_COMMAND.equals(refactorType)) { return RefactorProposalUtility.getExtractVariableAllOccurrenceProposal(params, context, problemsAtLocation, formatterOptions, false); } @@ -256,7 +256,7 @@ private static ProposalKindWrapper getExtractVariableProposal(CodeActionParams p return null; } - private static ProposalKindWrapper getAssignVariableProposal(GetRefactorEditParams params, IInvocationContextCore context, boolean problemsAtLocation, String refactorType, Map formatterOptions, IProblemLocationCore[] locations) + private static ProposalKindWrapper getAssignVariableProposal(GetRefactorEditParams params, IInvocationContext context, boolean problemsAtLocation, String refactorType, Map formatterOptions, IProblemLocation[] locations) throws CoreException { if (RefactorProposalUtility.ASSIGN_VARIABLE_COMMAND.equals(refactorType)) { return RefactorProposalUtility.getAssignVariableProposal(params.context, context, problemsAtLocation, formatterOptions, false, locations); @@ -267,7 +267,7 @@ private static ProposalKindWrapper getAssignVariableProposal(GetRefactorEditPara return null; } - private static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, Map formatterOptions) throws CoreException { + private static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, Map formatterOptions) throws CoreException { return RefactorProposalUtility.getExtractMethodProposal(params, context, coveringNode, problemsAtLocation, formatterOptions, false); } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/ModifierCorrectionSubProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/ModifierCorrectionSubProcessor.java index 7e84bcea3f..e3ea815f6b 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/ModifierCorrectionSubProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/ModifierCorrectionSubProcessor.java @@ -68,8 +68,8 @@ import org.eclipse.jdt.internal.corext.fix.UnimplementedCodeFixCore.MakeTypeAbstractOperation; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.corext.util.JdtFlags; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.ModifierChangeCorrectionProposalCore; @@ -99,7 +99,7 @@ public class ModifierCorrectionSubProcessor { public static final int TO_NON_STATIC = 4; public static final int TO_NON_FINAL = 5; - public static void addNonAccessibleReferenceProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals, int kind, int relevance) throws CoreException { + public static void addNonAccessibleReferenceProposal(IInvocationContext context, IProblemLocation problem, Collection proposals, int kind, int relevance) throws CoreException { ICompilationUnit cu = context.getCompilationUnit(); ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -229,7 +229,7 @@ public static void addNonAccessibleReferenceProposal(IInvocationContextCore cont } } - public static void addChangeOverriddenModifierProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals, int kind) throws JavaModelException { + public static void addChangeOverriddenModifierProposal(IInvocationContext context, IProblemLocation problem, Collection proposals, int kind) throws JavaModelException { ICompilationUnit cu = context.getCompilationUnit(); ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -325,7 +325,7 @@ public static void addChangeOverriddenModifierProposal(IInvocationContextCore co } } // - // public static void addNonFinalLocalProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addNonFinalLocalProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // ICompilationUnit cu = context.getCompilationUnit(); // // ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -342,7 +342,7 @@ public static void addChangeOverriddenModifierProposal(IInvocationContextCore co // } // } // - public static void addRemoveInvalidModifiersProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals, int relevance) { + public static void addRemoveInvalidModifiersProposal(IInvocationContext context, IProblemLocation problem, Collection proposals, int relevance) { ICompilationUnit cu = context.getCompilationUnit(); ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -511,7 +511,7 @@ private static int getNeededVisibility(ASTNode currNode, ITypeBinding targetType return Modifier.PUBLIC; } - public static void addAbstractMethodProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addAbstractMethodProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { ICompilationUnit cu = context.getCompilationUnit(); CompilationUnit astRoot = context.getASTRoot(); @@ -621,7 +621,7 @@ private static Modifier removeModifier(final MethodDeclaration decl, final ASTRe return modifierNode; } - private static void addMakeTypeAbstractProposal(IInvocationContextCore context, TypeDeclaration parentTypeDecl, Collection proposals) { + private static void addMakeTypeAbstractProposal(IInvocationContext context, TypeDeclaration parentTypeDecl, Collection proposals) { MakeTypeAbstractOperation operation = new UnimplementedCodeFixCore.MakeTypeAbstractOperation(parentTypeDecl); String label = Messages.format(CorrectionMessages.ModifierCorrectionSubProcessor_addabstract_description, BasicElementLabels.getJavaElementName(parentTypeDecl.getName().getIdentifier())); @@ -631,7 +631,7 @@ private static void addMakeTypeAbstractProposal(IInvocationContextCore context, proposals.add(CodeActionHandler.wrap(proposal, CodeActionKind.QuickFix)); } - public static void addAbstractTypeProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addAbstractTypeProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { CompilationUnit astRoot = context.getASTRoot(); ASTNode selectedNode = problem.getCoveringNode(astRoot); @@ -656,7 +656,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro addMakeTypeAbstractProposal(context, parentTypeDecl, proposals); } - // public static void addNativeMethodProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addNativeMethodProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { // ICompilationUnit cu = context.getCompilationUnit(); // // CompilationUnit astRoot = context.getASTRoot(); @@ -711,7 +711,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // // } // - // public static void addMethodRequiresBodyProposals(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addMethodRequiresBodyProposals(IInvocationContext context, IProblemLocation problem, Collection proposals) { // ICompilationUnit cu = context.getCompilationUnit(); // AST ast = context.getASTRoot().getAST(); // @@ -761,7 +761,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // // } // - // public static void addNeedToEmulateProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addNeedToEmulateProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // ICompilationUnit cu = context.getCompilationUnit(); // // ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -778,7 +778,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // } // } // - // public static void addOverrideAnnotationProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addOverrideAnnotationProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // IProposableFix fix = Java50Fix.createAddOverrideAnnotationFix(context.getASTRoot(), problem); // if (fix != null) { // Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); @@ -791,7 +791,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // } // } // - // public static void addDeprecatedAnnotationProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addDeprecatedAnnotationProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // IProposableFix fix = Java50Fix.createAddDeprectatedAnnotation(context.getASTRoot(), problem); // if (fix != null) { // Image image = JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); @@ -803,7 +803,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // } // } // - // public static void addOverridingDeprecatedMethodProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addOverridingDeprecatedMethodProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // // ICompilationUnit cu = context.getCompilationUnit(); // @@ -837,7 +837,7 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // proposals.add(proposal); // } // - // public static void removeOverrideAnnotationProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) throws CoreException { + // public static void removeOverrideAnnotationProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) throws CoreException { // ICompilationUnit cu = context.getCompilationUnit(); // // ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -858,15 +858,15 @@ public static void addAbstractTypeProposals(IInvocationContextCore context, IPro // } // } // - // public static void addSynchronizedMethodProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addSynchronizedMethodProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // addAddMethodModifierProposal(context, problem, proposals, Modifier.SYNCHRONIZED, CorrectionMessages.ModifierCorrectionSubProcessor_addsynchronized_description); // } // - // public static void addStaticMethodProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + // public static void addStaticMethodProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { // addAddMethodModifierProposal(context, problem, proposals, Modifier.STATIC, CorrectionMessages.ModifierCorrectionSubProcessor_addstatic_description); // } // - // private static void addAddMethodModifierProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals, int modifier, String label) { + // private static void addAddMethodModifierProposal(IInvocationContext context, IProblemLocation problem, Collection proposals, int modifier, String label) { // ICompilationUnit cu = context.getCompilationUnit(); // // ASTNode selectedNode = problem.getCoveringNode(context.getASTRoot()); @@ -973,7 +973,7 @@ private static Modifier findVisibilityModifier(List modifiers return null; } - public static void addSealedMissingModifierProposal(IInvocationContextCore context, IProblemLocationCore problem, Collection proposals) { + public static void addSealedMissingModifierProposal(IInvocationContext context, IProblemLocation problem, Collection proposals) { if (proposals == null) { return; } diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/NonProjectFixProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/NonProjectFixProcessor.java index fddf2e1cd7..fbde95382e 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/NonProjectFixProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/NonProjectFixProcessor.java @@ -18,8 +18,8 @@ import java.util.Collections; import java.util.List; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.ls.core.internal.DiagnosticsState; import org.eclipse.jdt.ls.core.internal.JDTUtils; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; @@ -42,7 +42,7 @@ public NonProjectFixProcessor(PreferenceManager preferenceManager) { this.nonProjectDiagnosticsState = JavaLanguageServerPlugin.getNonProjectDiagnosticsState(); } - public List> getCorrections(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore[] locations) { + public List> getCorrections(CodeActionParams params, IInvocationContext context, IProblemLocation[] locations) { if (locations == null || locations.length == 0) { return Collections.emptyList(); } @@ -50,7 +50,7 @@ public List> getCorrections(CodeActionParams params, List> $ = new ArrayList<>(); String uri = JDTUtils.toURI(context.getCompilationUnit()); for (int i = 0; i < locations.length; i++) { - IProblemLocationCore curr = locations[i]; + IProblemLocation curr = locations[i]; Integer id = Integer.valueOf(curr.getProblemId()); if (id == DiagnosticsHandler.NON_PROJECT_JAVA_FILE || id == DiagnosticsHandler.NOT_ON_CLASSPATH) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/QuickAssistProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/QuickAssistProcessor.java index e724896e3e..e3d32f60e2 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/QuickAssistProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/QuickAssistProcessor.java @@ -125,8 +125,8 @@ import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryWithResourcesAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.surround.SurroundWithTryWithResourcesRefactoringCore; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.QuickAssistProcessorUtil; import org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.LinkedCorrectionProposalCore; @@ -168,7 +168,7 @@ public QuickAssistProcessor(PreferenceManager preferenceManager) { this.preferenceManager = preferenceManager; } - public List getAssists(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore[] locations) throws CoreException { + public List getAssists(CodeActionParams params, IInvocationContext context, IProblemLocation[] locations) throws CoreException { ASTNode coveringNode = context.getCoveringNode(); if (coveringNode != null) { // ArrayList coveredNodes = getFullyCoveredNodes(context, coveringNode); @@ -243,7 +243,7 @@ public List getAssists(CodeActionParams params, IInvocation return Collections.emptyList(); } - private static boolean getExtractMethodFromLambdaProposal(IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, Collection proposals) throws CoreException { + private static boolean getExtractMethodFromLambdaProposal(IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, Collection proposals) throws CoreException { if (coveringNode instanceof Block && coveringNode.getLocationInParent() == LambdaExpression.BODY_PROPERTY) { return false; } @@ -274,7 +274,7 @@ private static boolean getExtractMethodFromLambdaProposal(IInvocationContextCore return false; } - private static boolean getConvertLambdaExpressionAndMethodRefCleanUpProposal(IInvocationContextCore context, ASTNode coveringNode, Collection proposals) throws CoreException { + private static boolean getConvertLambdaExpressionAndMethodRefCleanUpProposal(IInvocationContext context, ASTNode coveringNode, Collection proposals) throws CoreException { if (coveringNode instanceof Block && coveringNode.getLocationInParent() == LambdaExpression.BODY_PROPERTY) { return false; } @@ -300,7 +300,7 @@ private static boolean getConvertLambdaExpressionAndMethodRefCleanUpProposal(IIn return true; } - private static boolean getAssignParamToFieldProposals(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + private static boolean getAssignParamToFieldProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) { node = ASTNodes.getNormalizedNode(node); ASTNode parent = node.getParent(); if (!(parent instanceof SingleVariableDeclaration) || !(parent.getParent() instanceof MethodDeclaration)) { @@ -350,7 +350,7 @@ private static boolean getAssignParamToFieldProposals(IInvocationContextCore con return true; } - private static boolean getAssignAllParamsToFieldsProposals(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + private static boolean getAssignAllParamsToFieldsProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) { node = ASTNodes.getNormalizedNode(node); ASTNode parent = node.getParent(); if (!(parent instanceof SingleVariableDeclaration) || !(parent.getParent() instanceof MethodDeclaration)) { @@ -383,7 +383,7 @@ private static boolean getAssignAllParamsToFieldsProposals(IInvocationContextCor return true; } - public static ArrayList getFullyCoveredNodes(IInvocationContextCore context, ASTNode coveringNode) { + public static ArrayList getFullyCoveredNodes(IInvocationContext context, ASTNode coveringNode) { final ArrayList coveredNodes = new ArrayList<>(); final int selectionBegin = context.getSelectionOffset(); final int selectionEnd = selectionBegin + context.getSelectionLength(); @@ -739,7 +739,7 @@ private static Block getBlockBodyForLambda(Expression bodyExpr, ITypeBinding ret return blockBody; } - public static boolean getCatchClauseToThrowsProposals(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + public static boolean getCatchClauseToThrowsProposals(IInvocationContext context, ASTNode node, Collection resultingCollections) { if (resultingCollections == null) { return true; } @@ -883,7 +883,7 @@ private static boolean isNotYetThrown(ITypeBinding binding, List thrownExc return true; } - private static boolean getConvertMethodReferenceToLambdaProposal(IInvocationContextCore context, ASTNode covering, Collection resultingCollections) throws JavaModelException { + private static boolean getConvertMethodReferenceToLambdaProposal(IInvocationContext context, ASTNode covering, Collection resultingCollections) throws JavaModelException { MethodReference methodReference; if (covering instanceof MethodReference ref) { methodReference = ref; @@ -916,7 +916,7 @@ private static boolean getConvertMethodReferenceToLambdaProposal(IInvocationCont return true; } - public static boolean getTryWithResourceProposals(IProblemLocationCore[] locations, IInvocationContextCore context, ASTNode node, Collection resultingCollections) throws IllegalArgumentException, CoreException { + public static boolean getTryWithResourceProposals(IProblemLocation[] locations, IInvocationContext context, ASTNode node, Collection resultingCollections) throws IllegalArgumentException, CoreException { final List exceptionProblems = Arrays.asList(IProblem.UnclosedCloseable, IProblem.UnclosedCloseable, IProblem.PotentiallyUnclosedCloseable, IProblem.UnhandledException); if (problemExists(locations, exceptionProblems)) { return false; @@ -926,12 +926,12 @@ public static boolean getTryWithResourceProposals(IProblemLocationCore[] locatio return getTryWithResourceProposals(context, node, coveredNodes, resultingCollections); } - public static boolean problemExists(IProblemLocationCore[] locations, List problems) { + public static boolean problemExists(IProblemLocation[] locations, List problems) { return findProblemLocation(locations, problems) != null; } - public static IProblemLocationCore findProblemLocation(IProblemLocationCore[] locations, List problems) { - for (IProblemLocationCore location : locations) { + public static IProblemLocation findProblemLocation(IProblemLocation[] locations, List problems) { + for (IProblemLocation location : locations) { if (problems.contains(location.getProblemId())) { return location; } @@ -939,7 +939,7 @@ public static IProblemLocationCore findProblemLocation(IProblemLocationCore[] lo return null; } - public static boolean getTryWithResourceProposals(IInvocationContextCore context, ASTNode node, ArrayList coveredNodes, Collection resultingCollections) throws IllegalArgumentException, CoreException { + public static boolean getTryWithResourceProposals(IInvocationContext context, ASTNode node, ArrayList coveredNodes, Collection resultingCollections) throws IllegalArgumentException, CoreException { if (!JavaModelUtil.is1d8OrHigher(context.getCompilationUnit().getJavaProject())) { return false; } @@ -1177,7 +1177,7 @@ public static boolean getTryWithResourceProposals(IInvocationContextCore context return true; } - private static boolean getConvertToSwitchExpressionProposals(IInvocationContextCore context, ASTNode covering, Collection resultingCollections) { + private static boolean getConvertToSwitchExpressionProposals(IInvocationContext context, ASTNode covering, Collection resultingCollections) { if (covering instanceof Block block) { List statements = block.statements(); int startIndex = QuickAssistProcessorUtil.getIndex(context.getSelectionOffset(), statements); @@ -1219,7 +1219,7 @@ private static boolean getConvertToSwitchExpressionProposals(IInvocationContextC return true; } - private static boolean getStringConcatToTextBlockProposal(IInvocationContextCore context, ASTNode node, Collection resultingCollections) { + private static boolean getStringConcatToTextBlockProposal(IInvocationContext context, ASTNode node, Collection resultingCollections) { if (resultingCollections == null) { return false; } @@ -1253,7 +1253,7 @@ private static boolean getStringConcatToTextBlockProposal(IInvocationContextCore return false; } - private boolean getJoinVariableProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getJoinVariableProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { SplitVariableFixCore fix = SplitVariableFixCore.createSplitVariableFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1269,7 +1269,7 @@ private boolean getJoinVariableProposal(IInvocationContextCore context, ASTNode return false; } - private boolean getSplitVariableProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getSplitVariableProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { JoinVariableFixCore fix = JoinVariableFixCore.createJoinVariableFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1285,7 +1285,7 @@ private boolean getSplitVariableProposal(IInvocationContextCore context, ASTNode return false; } - private boolean getInvertEqualsProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getInvertEqualsProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = InvertEqualsExpressionFixCore.createInvertEqualsFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1301,7 +1301,7 @@ private boolean getInvertEqualsProposal(IInvocationContextCore context, ASTNode return false; } - private boolean getAddInferredLambdaParameterTypesProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getAddInferredLambdaParameterTypesProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = AddInferredLambdaParameterTypesFixCore.createAddInferredLambdaParameterTypesFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1317,7 +1317,7 @@ private boolean getAddInferredLambdaParameterTypesProposal(IInvocationContextCor return false; } - private boolean getAddVarLambdaParameterTypesProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getAddVarLambdaParameterTypesProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = AddVarLambdaParameterTypesFixCore.createAddVarLambdaParameterTypesFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1333,7 +1333,7 @@ private boolean getAddVarLambdaParameterTypesProposal(IInvocationContextCore con return false; } - private boolean getChangeLambdaBodyToBlockProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getChangeLambdaBodyToBlockProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ChangeLambdaBodyToBlockFixCore.createChangeLambdaBodyToBlockFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1349,7 +1349,7 @@ private boolean getChangeLambdaBodyToBlockProposal(IInvocationContextCore contex return false; } - private boolean getChangeLambdaBodyToExpressionProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getChangeLambdaBodyToExpressionProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ChangeLambdaBodyToExpressionFixCore.createChangeLambdaBodyToBlockFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1365,7 +1365,7 @@ private boolean getChangeLambdaBodyToExpressionProposal(IInvocationContextCore c return false; } - private boolean getRemoveVarOrInferredLambdaParameterTypesProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getRemoveVarOrInferredLambdaParameterTypesProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = RemoveVarOrInferredLambdaParameterTypesFixCore.createRemoveVarOrInferredLambdaParameterTypesFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1381,7 +1381,7 @@ private boolean getRemoveVarOrInferredLambdaParameterTypesProposal(IInvocationCo return false; } - private boolean getConvertLambdaToMethodReferenceProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getConvertLambdaToMethodReferenceProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ConvertLambdaToMethodReferenceFixCore.createConvertLambdaToMethodReferenceFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1397,7 +1397,7 @@ private boolean getConvertLambdaToMethodReferenceProposal(IInvocationContextCore return false; } - private boolean getConvertToMessageFormatProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getConvertToMessageFormatProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ConvertToMessageFormatFixCore.createConvertToMessageFormatFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1413,7 +1413,7 @@ private boolean getConvertToMessageFormatProposal(IInvocationContextCore context return false; } - private boolean getConvertToStringBufferProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getConvertToStringBufferProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ConvertToStringBufferFixCore.createConvertToStringBufferFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1429,7 +1429,7 @@ private boolean getConvertToStringBufferProposal(IInvocationContextCore context, return false; } - private boolean getConvertToStringFormatProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getConvertToStringFormatProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = ConvertToStringFormatFixCore.createConvertToStringFormatFix(context.getASTRoot(), coveringNode); if (fix != null) { @@ -1445,7 +1445,7 @@ private boolean getConvertToStringFormatProposal(IInvocationContextCore context, return false; } - private boolean getAddMissingMethodDeclarationProposal(IInvocationContextCore context, ASTNode coveringNode, ArrayList resultingCollections) { + private boolean getAddMissingMethodDeclarationProposal(IInvocationContext context, ASTNode coveringNode, ArrayList resultingCollections) { if (resultingCollections != null) { var fix = AddMissingMethodDeclarationFixCore.createAddMissingMethodDeclaration(context.getASTRoot(), coveringNode); if (fix != null) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/RefactorProposalUtility.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/RefactorProposalUtility.java index 33161b5808..fa958e3123 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/RefactorProposalUtility.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/RefactorProposalUtility.java @@ -76,8 +76,8 @@ import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor; import org.eclipse.jdt.internal.corext.refactoring.structure.ExtractInterfaceProcessor; import org.eclipse.jdt.internal.corext.util.JdtFlags; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.proposals.AssignToVariableAssistProposalCore; import org.eclipse.jdt.internal.ui.text.correction.proposals.RefactoringCorrectionProposalCore; import org.eclipse.jdt.ls.core.internal.JDTUtils; @@ -114,7 +114,7 @@ public class RefactorProposalUtility { public static final String MOVE_TYPE_COMMAND = "moveType"; public static final String INTRODUCE_PARAMETER_COMMAND = "introduceParameter"; - public static List getMoveRefactoringProposals(CodeActionParams params, IInvocationContextCore context) { + public static List getMoveRefactoringProposals(CodeActionParams params, IInvocationContext context) { int relevance = IProposalRelevance.MOVE_REFACTORING; List kindOfActions = params.getContext().getOnly(); boolean alwaysShowMove = kindOfActions != null && kindOfActions.contains(CodeActionKind.Refactor); @@ -280,23 +280,23 @@ private static String getEnclosingType(ASTNode declaration) { return type == null ? null : type.getQualifiedName(); } - public static List getExtractVariableProposals(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { + public static List getExtractVariableProposals(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { return getExtractVariableProposals(params, context, problemsAtLocation, false, inferSelectionSupport); } - public static List getExtractVariableCommandProposals(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { + public static List getExtractVariableCommandProposals(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { return getExtractVariableProposals(params, context, problemsAtLocation, true, inferSelectionSupport); } - public static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { + public static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { return getExtractMethodProposal(params, context, coveringNode, problemsAtLocation, null, false, inferSelectionSupport); } - public static ProposalKindWrapper getExtractMethodCommandProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { + public static ProposalKindWrapper getExtractMethodCommandProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, boolean inferSelectionSupport) throws CoreException { return getExtractMethodProposal(params, context, coveringNode, problemsAtLocation, null, true, inferSelectionSupport); } - private static List getExtractVariableProposals(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { + private static List getExtractVariableProposals(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { if (!supportsExtractVariable(context)) { return null; } @@ -320,7 +320,7 @@ private static List getExtractVariableProposals(CodeActionP return proposals; } - private static boolean supportsExtractVariable(IInvocationContextCore context) { + private static boolean supportsExtractVariable(IInvocationContext context) { ASTNode node = context.getCoveredNode(); if (!(node instanceof Expression)) { if (context.getSelectionLength() != 0) { @@ -342,11 +342,11 @@ private static boolean supportsExtractVariable(IInvocationContextCore context) { return true; } - public static ProposalKindWrapper getExtractVariableAllOccurrenceProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { + public static ProposalKindWrapper getExtractVariableAllOccurrenceProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { return getExtractVariableAllOccurrenceProposal(params, context, problemsAtLocation, formatterOptions, returnAsCommand, false); } - private static ProposalKindWrapper getExtractVariableAllOccurrenceProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, + private static ProposalKindWrapper getExtractVariableAllOccurrenceProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { final ICompilationUnit cu = context.getCompilationUnit(); String label = CorrectionMessages.QuickAssistProcessor_extract_to_local_all_description; @@ -399,11 +399,11 @@ protected void init(Refactoring refactoring) throws CoreException { return null; } - public static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { + public static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { return getExtractVariableProposal(params, context, problemsAtLocation, formatterOptions, returnAsCommand, false); } - private static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, boolean inferSelectionSupport) + private static ProposalKindWrapper getExtractVariableProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { final ICompilationUnit cu = context.getCompilationUnit(); String label = CorrectionMessages.QuickAssistProcessor_extract_to_local_description; @@ -456,9 +456,9 @@ protected void init(Refactoring refactoring) throws CoreException { return null; } - public static boolean containsMatchingProblem(IProblemLocationCore[] locations, int problemId) { + public static boolean containsMatchingProblem(IProblemLocation[] locations, int problemId) { if (locations != null) { - for (IProblemLocationCore location : locations) { + for (IProblemLocation location : locations) { if (IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER.equals(location.getMarkerType()) && location.getProblemId() == problemId) { return true; } @@ -467,8 +467,8 @@ public static boolean containsMatchingProblem(IProblemLocationCore[] locations, return false; } - public static ProposalKindWrapper getAssignVariableProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, - IProblemLocationCore[] locations) + public static ProposalKindWrapper getAssignVariableProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, + IProblemLocation[] locations) throws CoreException { ASTNode node = context.getCoveringNode(); Statement statement = ASTResolving.findParentStatement(node); @@ -508,8 +508,8 @@ public static ProposalKindWrapper getAssignVariableProposal(CodeActionParams par } } - public static ProposalKindWrapper getAssignFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, - IProblemLocationCore[] locations) throws CoreException { + public static ProposalKindWrapper getAssignFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, + IProblemLocation[] locations) throws CoreException { ASTNode node = context.getCoveringNode(); Statement statement = ASTResolving.findParentStatement(node); if (!(statement instanceof ExpressionStatement)) { @@ -555,7 +555,7 @@ public static ProposalKindWrapper getAssignFieldProposal(CodeActionParams params * Merge the "Extract to Field" and "Convert Local Variable to Field" to a * generic "Extract to Field". */ - public static ProposalKindWrapper getGenericExtractFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand, + public static ProposalKindWrapper getGenericExtractFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { ProposalKindWrapper proposal = getConvertVariableToFieldProposal(params, context, problemsAtLocation, formatterOptions, initializeIn, returnAsCommand); @@ -566,12 +566,12 @@ public static ProposalKindWrapper getGenericExtractFieldProposal(CodeActionParam return getExtractFieldProposal(params, context, problemsAtLocation, formatterOptions, initializeIn, returnAsCommand, inferSelectionSupport); } - public static ProposalKindWrapper getExtractFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand) + public static ProposalKindWrapper getExtractFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand) throws CoreException { return getExtractFieldProposal(params, context, problemsAtLocation, formatterOptions, initializeIn, returnAsCommand, false); } - private static ProposalKindWrapper getExtractFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand, + private static ProposalKindWrapper getExtractFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { if (!supportsExtractVariable(context)) { return null; @@ -653,11 +653,11 @@ public static List getInitializeScopes(ExtractFieldRefactoring refactori return scopes; } - public static ProposalKindWrapper getExtractConstantProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { + public static ProposalKindWrapper getExtractConstantProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand) throws CoreException { return getExtractConstantProposal(params, context, problemsAtLocation, formatterOptions, returnAsCommand, false); } - private static ProposalKindWrapper getExtractConstantProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, boolean inferSelectionSupport) + private static ProposalKindWrapper getExtractConstantProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { final ICompilationUnit cu = context.getCompilationUnit(); String label = CorrectionMessages.QuickAssistProcessor_extract_to_constant_description; @@ -709,7 +709,7 @@ protected void init(Refactoring refactoring) throws CoreException { return null; } - public static ProposalKindWrapper getConvertVariableToFieldProposal(CodeActionParams params, IInvocationContextCore context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand) + public static ProposalKindWrapper getConvertVariableToFieldProposal(CodeActionParams params, IInvocationContext context, boolean problemsAtLocation, Map formatterOptions, String initializeIn, boolean returnAsCommand) throws CoreException { ASTNode node = context.getCoveredNode(); if (!(node instanceof SimpleName)) { @@ -785,12 +785,12 @@ protected void init(Refactoring refactoring) throws CoreException { return null; } - public static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, Map formattingOptions, boolean returnAsCommand) + public static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, Map formattingOptions, boolean returnAsCommand) throws CoreException { return getExtractMethodProposal(params, context, coveringNode, problemsAtLocation, formattingOptions, returnAsCommand, false); } - private static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean problemsAtLocation, Map formattingOptions, boolean returnAsCommand, + private static ProposalKindWrapper getExtractMethodProposal(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean problemsAtLocation, Map formattingOptions, boolean returnAsCommand, boolean inferSelectionSupport) throws CoreException { if (!(coveringNode instanceof Expression) && !(coveringNode instanceof Statement) && !(coveringNode instanceof Block)) { return null; @@ -848,7 +848,7 @@ private static ProposalKindWrapper getExtractMethodProposal(CodeActionParams par return null; } - private static String proposeMethodNameHeuristic(IInvocationContextCore context, ASTNode coveringNode) { + private static String proposeMethodNameHeuristic(IInvocationContext context, ASTNode coveringNode) { int selStart = context.getSelectionOffset(); int selEnd = context.getSelectionOffset() + context.getSelectionLength(); @@ -892,7 +892,7 @@ private static String proposeMethodNameHeuristic(IInvocationContextCore context, return "extracted"; } - public static ProposalKindWrapper getIntroduceParameterRefactoringProposals(CodeActionParams params, IInvocationContextCore context, ASTNode coveringNode, boolean returnAsCommand, IProblemLocationCore[] problemLocations) + public static ProposalKindWrapper getIntroduceParameterRefactoringProposals(CodeActionParams params, IInvocationContext context, ASTNode coveringNode, boolean returnAsCommand, IProblemLocation[] problemLocations) throws CoreException { final ICompilationUnit cu = context.getCompilationUnit(); final IntroduceParameterRefactoring introduceParameterRefactoring = new IntroduceParameterRefactoring(cu, context.getSelectionOffset(), context.getSelectionLength()); @@ -913,7 +913,7 @@ public static ProposalKindWrapper getIntroduceParameterRefactoringProposals(Code return null; } - public static ProposalKindWrapper getExtractInterfaceProposal(CodeActionParams params, IInvocationContextCore context) { + public static ProposalKindWrapper getExtractInterfaceProposal(CodeActionParams params, IInvocationContext context) { ICompilationUnit cu = context.getCompilationUnit(); if (cu == null) { return null; @@ -936,7 +936,7 @@ public static ProposalKindWrapper getExtractInterfaceProposal(CodeActionParams p return null; } - public static ProposalKindWrapper getChangeSignatureProposal(CodeActionParams params, IInvocationContextCore context) { + public static ProposalKindWrapper getChangeSignatureProposal(CodeActionParams params, IInvocationContext context) { ICompilationUnit cu = context.getCompilationUnit(); if (cu == null) { return null; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistProcessor.java index c4cb123b9d..3068d61f4c 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/text/correction/SourceAssistProcessor.java @@ -55,8 +55,8 @@ import org.eclipse.jdt.internal.corext.fix.IProposableFix; import org.eclipse.jdt.internal.corext.fix.VariableDeclarationFixCore; import org.eclipse.jdt.internal.corext.util.JdtFlags; -import org.eclipse.jdt.internal.ui.text.correction.IInvocationContextCore; -import org.eclipse.jdt.internal.ui.text.correction.IProblemLocationCore; +import org.eclipse.jdt.ui.text.java.IInvocationContext; +import org.eclipse.jdt.ui.text.java.IProblemLocation; import org.eclipse.jdt.internal.ui.text.correction.IProposalRelevance; import org.eclipse.jdt.internal.ui.text.correction.proposals.FixCorrectionProposalCore; import org.eclipse.jdt.ls.core.internal.ChangeUtil; @@ -116,7 +116,7 @@ public SourceAssistProcessor(PreferenceManager preferenceManager) { this.preferenceManager = preferenceManager; } - public List> getSourceActionCommands(CodeActionParams params, IInvocationContextCore context, IProblemLocationCore[] locations, IProgressMonitor monitor) { + public List> getSourceActionCommands(CodeActionParams params, IInvocationContext context, IProblemLocation[] locations, IProgressMonitor monitor) { List> $ = new ArrayList<>(); ICompilationUnit cu = context.getCompilationUnit(); IType type = getSelectionType(context); @@ -267,7 +267,7 @@ public List> getSourceActionCommands(CodeActionParam return $; } - private void addGenerateAccessorsSourceActionCommand(CodeActionParams params, IInvocationContextCore context, List> $, IType type, List fieldNames, boolean isInTypeDeclaration) throws JavaModelException { + private void addGenerateAccessorsSourceActionCommand(CodeActionParams params, IInvocationContext context, List> $, IType type, List fieldNames, boolean isInTypeDeclaration) throws JavaModelException { AccessorField[] accessors = GenerateGetterSetterOperation.getUnimplementedAccessors(type, AccessorKind.BOTH); AccessorField[] getters = GenerateGetterSetterOperation.getUnimplementedAccessors(type, AccessorKind.GETTER); AccessorField[] setters = GenerateGetterSetterOperation.getUnimplementedAccessors(type, AccessorKind.SETTER); @@ -338,7 +338,7 @@ private void addSourceActionCommand(List> result, Co result.add(targetAction); } - private TextEdit getOrganizeImportsTextEdit(IInvocationContextCore context, boolean restoreExistingImports, boolean isAdvancedOrganizeImportsSupported, IProgressMonitor monitor) { + private TextEdit getOrganizeImportsTextEdit(IInvocationContext context, boolean restoreExistingImports, boolean isAdvancedOrganizeImportsSupported, IProgressMonitor monitor) { ICompilationUnit cu = context.getCompilationUnit(); if (cu == null) { return null; @@ -372,7 +372,7 @@ private Optional> getOverrideMethodsAction(CodeActio } } - private Optional> getGetterSetterAction(CodeActionParams params, IInvocationContextCore context, IType type, String kind, boolean isInTypeDeclaration, AccessorField[] accessors, AccessorKind accessorKind) { + private Optional> getGetterSetterAction(CodeActionParams params, IInvocationContext context, IType type, String kind, boolean isInTypeDeclaration, AccessorField[] accessors, AccessorKind accessorKind) { boolean isQuickAssist = kind.equals(JavaCodeActionKind.QUICK_ASSIST); try { if (accessors == null || accessors.length == 0) { @@ -434,7 +434,7 @@ private Optional> getGetterSetterAction(CodeActionPa } } - private boolean supportsHashCodeEquals(IInvocationContextCore context, IType type, IProgressMonitor monitor) { + private boolean supportsHashCodeEquals(IInvocationContext context, IType type, IProgressMonitor monitor) { try { if (type == null || type.isAnnotation() || type.isInterface() || type.isEnum() || type.getCompilationUnit() == null) { return false; @@ -498,7 +498,7 @@ private Optional> getGenerateToStringAction(CodeActi } } - private Optional> getGenerateConstructorsAction(CodeActionParams params, IInvocationContextCore context, IType type, String kind, IProgressMonitor monitor) { + private Optional> getGenerateConstructorsAction(CodeActionParams params, IInvocationContext context, IType type, String kind, IProgressMonitor monitor) { try { if (type == null || type.isAnnotation() || type.isInterface() || type.isAnonymous() || type.getCompilationUnit() == null) { return Optional.empty(); @@ -542,7 +542,7 @@ private Optional> getGenerateConstructorsAction(Code return Optional.empty(); } - private Optional> getGenerateDelegateMethodsAction(CodeActionParams params, IInvocationContextCore context, IType type) { + private Optional> getGenerateDelegateMethodsAction(CodeActionParams params, IInvocationContext context, IType type) { try { if (!preferenceManager.getClientPreferences().isGenerateDelegateMethodsPromptSupported() || !GenerateDelegateMethodsHandler.supportsGenerateDelegateMethods(type)) { return Optional.empty(); @@ -564,12 +564,12 @@ private Optional> getGenerateDelegateMethodsAction(C } } - private Optional> addFinalModifierWherePossibleAction(IInvocationContextCore context) { + private Optional> addFinalModifierWherePossibleAction(IInvocationContext context) { IProposableFix fix = (IProposableFix) VariableDeclarationFixCore.createCleanUp(context.getASTRoot(), true, true, true); return getFinalModifierWherePossibleAction(context, fix, ActionMessages.GenerateFinalModifiersAction_label, JavaCodeActionKind.SOURCE_GENERATE_FINAL_MODIFIERS); } - private Optional> addFinalModifierWherePossibleQuickAssist(IInvocationContextCore context) { + private Optional> addFinalModifierWherePossibleQuickAssist(IInvocationContext context) { ASTNode coveringNode = context.getCoveringNode(); List coveredNodes = QuickAssistProcessor.getFullyCoveredNodes(context, coveringNode); List possibleASTNodes = getPossibleASTNodesForFinalModifier(coveredNodes); @@ -605,7 +605,7 @@ private List getPossibleASTNodesForFinalModifier(List targetNo return results; } - private Optional> getFinalModifierWherePossibleAction(IInvocationContextCore context, IProposableFix fix, String actionMessage, String kind) { + private Optional> getFinalModifierWherePossibleAction(IInvocationContext context, IProposableFix fix, String actionMessage, String kind) { if (fix == null) { return Optional.empty(); } @@ -642,7 +642,7 @@ private Optional> getFinalModifierWherePossibleActio } } - private Optional> getSortMembersProposal(IInvocationContextCore context, CodeActionParams params, String kind, String label, boolean avoidVolatileChanges) { + private Optional> getSortMembersProposal(IInvocationContext context, CodeActionParams params, String kind, String label, boolean avoidVolatileChanges) { CategorizedTextEditGroup group = new CategorizedTextEditGroup(label, new GroupCategorySet(new GroupCategory(label, label, label))); try { TextEdit edit = CompilationUnitSorter.sort(context.getASTRoot(), new DefaultJavaElementComparator(avoidVolatileChanges), 0, group, null); @@ -658,7 +658,7 @@ private Optional> getSortMembersProposal(IInvocation } } - private Optional> getSortMembersForSelectionProposal(IInvocationContextCore context, CodeActionParams params, List coveredNodes, boolean avoidVolatileChanges) { + private Optional> getSortMembersForSelectionProposal(IInvocationContext context, CodeActionParams params, List coveredNodes, boolean avoidVolatileChanges) { CategorizedTextEditGroup group = new CategorizedTextEditGroup(ActionMessages.SortMembers_selectionLabel, new GroupCategorySet(new GroupCategory(ActionMessages.SortMembers_selectionLabel, ActionMessages.SortMembers_selectionLabel, ActionMessages.SortMembers_selectionLabel))); PartialSortMembersOperation operation = new PartialSortMembersOperation(new IJavaElement[] { context.getASTRoot().getJavaElement() }, new DefaultJavaElementComparator(avoidVolatileChanges)); try { @@ -675,7 +675,7 @@ private Optional> getSortMembersForSelectionProposal } } - private Optional> getSortMembersAction(IInvocationContextCore context, CodeActionParams params, String kind, boolean avoidVolatileChanges) { + private Optional> getSortMembersAction(IInvocationContext context, CodeActionParams params, String kind, boolean avoidVolatileChanges) { CompilationUnit unit = context.getASTRoot(); if (unit != null) { ITypeRoot typeRoot = unit.getTypeRoot(); @@ -741,7 +741,7 @@ public static WorkspaceEdit convertToWorkspaceEdit(ICompilationUnit cu, TextEdit return workspaceEdit; } - public static IType getSelectionType(IInvocationContextCore context) { + public static IType getSelectionType(IInvocationContext context) { ICompilationUnit unit = context.getCompilationUnit(); ASTNode node = context.getCoveredNode(); if (node == null) { diff --git a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target index 1df8829b78..2124805582 100644 --- a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target +++ b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target @@ -25,7 +25,7 @@ - +