diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/Checks.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/Checks.java deleted file mode 100644 index 12c4c22355..0000000000 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/Checks.java +++ /dev/null @@ -1,955 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Originally copied from org.eclipse.jdt.internal.corext.refactoring.Checks - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.ls.core.internal.corext.refactoring; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourceAttributes; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaModelMarker; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.ILocalVariable; -import org.eclipse.jdt.core.IMember; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.IVariableBinding; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jdt.core.dom.SwitchCase; -import org.eclipse.jdt.core.dom.VariableDeclaration; -import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; -import org.eclipse.jdt.internal.corext.dom.ASTNodes; -import org.eclipse.jdt.internal.corext.dom.Bindings; -import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; -import org.eclipse.jdt.internal.corext.util.JavaModelUtil; -import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; -import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.RefactoringStatusCodes; -import org.eclipse.jdt.ls.core.internal.corext.util.JavaConventionsUtil; -import org.eclipse.jdt.ls.core.internal.corext.util.JavaElementUtil; -import org.eclipse.jdt.ls.core.internal.corext.util.JdtFlags; -import org.eclipse.jdt.ls.core.internal.corrections.ASTResolving; -import org.eclipse.jdt.ls.core.internal.hover.JavaElementLabels; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.ltk.core.refactoring.resource.Resources; - -/** - * This class defines a set of reusable static checks methods. - */ -public class Checks { - - /* - * no instances - */ - private Checks() { - } - - /* Constants returned by checkExpressionIsRValue */ - public static final int IS_RVALUE = 0; - public static final int NOT_RVALUE_MISC = 1; - public static final int NOT_RVALUE_VOID = 2; - - /** - * @since 3.6 - */ - public static final int IS_RVALUE_GUESSED = 3; - - /** - * Checks if method will have a constructor name after renaming. - * - * @param method - * @param newMethodName - * @param newTypeName - * @return RefactoringStatus with WARNING severity if - * the give method will have a constructor name after renaming - * null otherwise. - */ - public static RefactoringStatus checkIfConstructorName(IMethod method, String newMethodName, String newTypeName) { - if (!newMethodName.equals(newTypeName)) { - return null; - } else { - return RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.Checks_constructor_name, - new Object[] { JavaElementUtil.createMethodSignature(method), JavaElementLabels.getElementLabel(method.getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED) })); - } - } - - /** - * Checks if the given name is a valid Java field name. - * - * @param name - * the java field name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is not - * a valid java field name. - */ - public static RefactoringStatus checkFieldName(String name, IJavaElement context) { - return checkName(name, JavaConventionsUtil.validateFieldName(name, context)); - } - - /** - * Checks if the given name is a valid Java type parameter name. - * - * @param name - * the java type parameter name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is not - * a valid java type parameter name. - */ - public static RefactoringStatus checkTypeParameterName(String name, IJavaElement context) { - return checkName(name, JavaConventionsUtil.validateTypeVariableName(name, context)); - } - - /** - * Checks if the given name is a valid Java identifier. - * - * @param name - * the java identifier. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is - * not a valid java identifier. - */ - public static RefactoringStatus checkIdentifier(String name, IJavaElement context) { - return checkName(name, JavaConventionsUtil.validateIdentifier(name, context)); - } - - /** - * Checks if the given name is a valid Java method name. - * - * @param name - * the java method name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is - * not a valid java method name. - */ - public static RefactoringStatus checkMethodName(String name, IJavaElement context) { - RefactoringStatus status = checkName(name, JavaConventionsUtil.validateMethodName(name, context)); - if (status.isOK() && !startsWithLowerCase(name)) { - return RefactoringStatus.createWarningStatus(RefactoringCoreMessages.Checks_method_names_lowercase); - } else { - return status; - } - } - - /** - * Checks if the given name is a valid Java type name. - * - * @param name - * the java method name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is not - * a valid java type name. - */ - public static RefactoringStatus checkTypeName(String name, IJavaElement context) { - //fix for: 1GF5Z0Z: ITPJUI:WINNT - assertion failed after renameType refactoring - if (name.indexOf(".") != -1) { - return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_no_dot); - } else { - return checkName(name, JavaConventionsUtil.validateJavaTypeName(name, context)); - } - } - - /** - * Checks if the given name is a valid Java package name. - * - * @param name - * the java package name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is not - * a valid java package name. - */ - public static RefactoringStatus checkPackageName(String name, IJavaElement context) { - return checkName(name, JavaConventionsUtil.validatePackageName(name, context)); - } - - /** - * Checks if the given name is a valid compilation unit name. - * - * @param name - * the compilation unit name. - * @param context - * an {@link IJavaElement} or null - * @return a refactoring status containing the error message if the name is not - * a valid compilation unit name. - */ - public static RefactoringStatus checkCompilationUnitName(String name, IJavaElement context) { - return checkName(name, JavaConventionsUtil.validateCompilationUnitName(name, context)); - } - - /** - * Returns OK status if the new name is OK, i.e. when no file with that name - * exists. The name of the given CU is not OK. - * - * @param cu - * CU to rename - * @param newBareName - * the new name of the CU (without extension) - * @return the status: FATAL if the CU already exists, OK if OK - */ - public static RefactoringStatus checkCompilationUnitNewName(ICompilationUnit cu, String newBareName) { - String newCUName = JavaModelUtil.getRenamedCUName(cu, newBareName); - IPath renamedResourcePath = cu.getParent().getPath().append(newCUName); - if (resourceExists(renamedResourcePath)) { - return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.Checks_cu_name_used, BasicElementLabels.getResourceName(newCUName))); - } else { - return new RefactoringStatus(); - } - } - - public static boolean startsWithLowerCase(String s) { - if (s == null) { - return false; - } else if ("".equals(s)) { - return false; - } else { - //workaround for JDK bug (see 26529) - return s.charAt(0) == Character.toLowerCase(s.charAt(0)); - } - } - - public static boolean resourceExists(IPath resourcePath) { - return ResourcesPlugin.getWorkspace().getRoot().findMember(resourcePath) != null; - } - - public static boolean isTopLevel(IType type) { - return type.getDeclaringType() == null; - } - - public static boolean isAnonymous(IType type) throws JavaModelException { - return type.isAnonymous(); - } - - public static boolean isTopLevelType(IMember member) { - return member.getElementType() == IJavaElement.TYPE && isTopLevel((IType) member); - } - - public static boolean isInsideLocalType(IType type) throws JavaModelException { - while (type != null) { - if (type.isLocal()) { - return true; - } - type = type.getDeclaringType(); - } - return false; - } - - public static boolean isAlreadyNamed(IJavaElement element, String name) { - return name.equals(element.getElementName()); - } - - //-------------- main and native method checks ------------------ - public static RefactoringStatus checkForMainAndNativeMethods(ICompilationUnit cu) throws JavaModelException { - return checkForMainAndNativeMethods(cu.getTypes()); - } - - public static RefactoringStatus checkForMainAndNativeMethods(IType[] types) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - for (int i = 0; i < types.length; i++) { - result.merge(checkForMainAndNativeMethods(types[i])); - } - return result; - } - - public static RefactoringStatus checkForMainAndNativeMethods(IType type) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - result.merge(checkForMainAndNativeMethods(type.getMethods())); - result.merge(checkForMainAndNativeMethods(type.getTypes())); - return result; - } - - private static RefactoringStatus checkForMainAndNativeMethods(IMethod[] methods) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - for (int i = 0; i < methods.length; i++) { - if (JdtFlags.isNative(methods[i])) { - String typeName = JavaElementLabels.getElementLabel(methods[i].getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED); - String methodName = JavaElementLabels.getElementLabel(methods[i], JavaElementLabels.ALL_DEFAULT); - String msg = Messages.format(RefactoringCoreMessages.Checks_method_native, new String[] { typeName, methodName, "UnsatisfiedLinkError" });//$NON-NLS-1$ - result.addEntry(RefactoringStatus.ERROR, msg, JavaStatusContext.create(methods[i]), JavaLanguageServerPlugin.PLUGIN_ID, RefactoringStatusCodes.NATIVE_METHOD); - } - if (methods[i].isMainMethod()) { - String msg = Messages.format(RefactoringCoreMessages.Checks_has_main, JavaElementLabels.getElementLabel(methods[i].getDeclaringType(), JavaElementLabels.ALL_FULLY_QUALIFIED)); - result.addEntry(RefactoringStatus.WARNING, msg, JavaStatusContext.create(methods[i]), JavaLanguageServerPlugin.PLUGIN_ID, RefactoringStatusCodes.MAIN_METHOD); - } - } - return result; - } - - //---- New method name checking ------------------------------------------------------------- - - /** - * Checks if the new method is already used in the given type. - * - * @param type - * @param methodName - * @param parameters - * @return the status - */ - public static RefactoringStatus checkMethodInType(ITypeBinding type, String methodName, ITypeBinding[] parameters) { - RefactoringStatus result = new RefactoringStatus(); - IMethodBinding method = org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInType(type, methodName, parameters); - if (method != null) { - if (method.isConstructor()) { - result.addWarning(Messages.format(RefactoringCoreMessages.Checks_methodName_constructor, new Object[] { BasicElementLabels.getJavaElementName(type.getName()) })); - } else { - result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_exists, new Object[] { BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(type.getName()) }), - JavaStatusContext.create(method)); - } - } - return result; - } - - /** - * Checks if the new method somehow conflicts with an already existing - * method in the hierarchy. The following checks are done: - * - * - * @param type - * @param methodName - * @param returnType - * @param parameters - * @return the status - */ - public static RefactoringStatus checkMethodInHierarchy(ITypeBinding type, String methodName, ITypeBinding returnType, ITypeBinding[] parameters) { - RefactoringStatus result = new RefactoringStatus(); - IMethodBinding method = Bindings.findMethodInHierarchy(type, methodName, parameters); - if (method != null) { - boolean returnTypeClash = false; - ITypeBinding methodReturnType = method.getReturnType(); - if (returnType != null && methodReturnType != null) { - String returnTypeKey = returnType.getKey(); - String methodReturnTypeKey = methodReturnType.getKey(); - if (returnTypeKey == null && methodReturnTypeKey == null) { - returnTypeClash = returnType != methodReturnType; - } else if (returnTypeKey != null && methodReturnTypeKey != null) { - returnTypeClash = !returnTypeKey.equals(methodReturnTypeKey); - } - } - ITypeBinding dc = method.getDeclaringClass(); - if (returnTypeClash) { - result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_returnTypeClash, new Object[] { BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(dc.getName()) }), - JavaStatusContext.create(method)); - } else { - if (method.isConstructor()) { - result.addWarning(Messages.format(RefactoringCoreMessages.Checks_methodName_constructor, new Object[] { BasicElementLabels.getJavaElementName(dc.getName()) })); - } else { - result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_overrides, new Object[] { BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(dc.getName()) }), - JavaStatusContext.create(method)); - } - } - } - return result; - } - - //---- Selection checks -------------------------------------------------------------------- - - public static boolean isExtractableExpression(ASTNode[] selectedNodes, ASTNode coveringNode) { - ASTNode node = coveringNode; - if (isEnumCase(node)) { - return false; - } - if (selectedNodes != null && selectedNodes.length == 1) { - node = selectedNodes[0]; - } - return isExtractableExpression(node); - } - - public static boolean isEnumCase(ASTNode node) { - if (node instanceof SwitchCase) { - final SwitchCase caze = (SwitchCase) node; - final Expression expression = caze.getExpression(); - if (expression instanceof Name) { - final Name name = (Name) expression; - final IBinding binding = name.resolveBinding(); - if (binding instanceof IVariableBinding) { - IVariableBinding variableBinding = (IVariableBinding) binding; - return variableBinding.isEnumConstant(); - } - } - } - return false; - } - - public static boolean isExtractableExpression(ASTNode node) { - if (!(node instanceof Expression)) { - return false; - } - if (node instanceof Name) { - IBinding binding = ((Name) node).resolveBinding(); - return binding == null || binding instanceof IVariableBinding; - } - return true; - } - - public static boolean isInsideJavadoc(ASTNode node) { - do { - if (node.getNodeType() == ASTNode.JAVADOC) { - return true; - } - node = node.getParent(); - } while (node != null); - return false; - } - - /** - * Returns a fatal error in case the name is empty. In all other cases, an - * error based on the given status is returned. - * - * @param name - * a name - * @param status - * a status - * @return RefactoringStatus based on the given status or the name, if - * empty. - */ - public static RefactoringStatus checkName(String name, IStatus status) { - RefactoringStatus result = new RefactoringStatus(); - if ("".equals(name)) { - return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_Choose_name); - } - - if (status.isOK()) { - return result; - } - - switch (status.getSeverity()) { - case IStatus.ERROR: - return RefactoringStatus.createFatalErrorStatus(status.getMessage()); - case IStatus.WARNING: - return RefactoringStatus.createWarningStatus(status.getMessage()); - case IStatus.INFO: - return RefactoringStatus.createInfoStatus(status.getMessage()); - default: //no nothing - return new RefactoringStatus(); - } - } - - /** - * Finds a method in a type This searches for a method with the same name and - * signature. Parameter types are only compared by the simple name, no resolving - * for the fully qualified type name is done - * - * @param name - * @param parameterCount - * @param isConstructor - * @param type - * @return The first found method or null, if nothing found - * @throws JavaModelException - */ - public static IMethod findMethod(String name, int parameterCount, boolean isConstructor, IType type) throws JavaModelException { - return findMethod(name, parameterCount, isConstructor, type.getMethods()); - } - - /** - * Finds a method in a type. Searches for a method with the same name and the - * same parameter count. Parameter types are not compared. - * - * @param method - * @param type - * @return The first found method or null, if nothing found - * @throws JavaModelException - */ - public static IMethod findMethod(IMethod method, IType type) throws JavaModelException { - return findMethod(method.getElementName(), method.getParameterTypes().length, method.isConstructor(), type.getMethods()); - } - - /** - * Finds a method in an array of methods. Searches for a method with the same - * name and the same parameter count. Parameter types are not compared. - * - * @param method - * @param methods - * @return The first found method or null, if nothing found - * @throws JavaModelException - */ - public static IMethod findMethod(IMethod method, IMethod[] methods) throws JavaModelException { - return findMethod(method.getElementName(), method.getParameterTypes().length, method.isConstructor(), methods); - } - - public static IMethod findMethod(String name, int parameters, boolean isConstructor, IMethod[] methods) throws JavaModelException { - for (int i = methods.length - 1; i >= 0; i--) { - IMethod curr = methods[i]; - if (name.equals(curr.getElementName())) { - if (isConstructor == curr.isConstructor()) { - if (parameters == curr.getParameterTypes().length) { - return curr; - } - } - } - } - return null; - } - - /** - * Finds a method in a type. This searches for a method with the same name and - * signature. Parameter types are only compared by the simple name, no resolving - * for the fully qualified type name is done - * - * @param method - * @param type - * @return The first found method or null, if nothing found - * @throws JavaModelException - */ - public static IMethod findSimilarMethod(IMethod method, IType type) throws JavaModelException { - return findSimilarMethod(method, type.getMethods()); - } - - /** - * Finds a method in an array of methods. This searches for a method with the - * same name and signature. Parameter types are only compared by the simple - * name, no resolving for the fully qualified type name is done - * - * @param method - * @param methods - * @return The first found method or null, if nothing found - * @throws JavaModelException - */ - public static IMethod findSimilarMethod(IMethod method, IMethod[] methods) throws JavaModelException { - boolean isConstructor = method.isConstructor(); - for (int i = 0; i < methods.length; i++) { - IMethod otherMethod = methods[i]; - if (otherMethod.isConstructor() == isConstructor && method.isSimilar(otherMethod)) { - return otherMethod; - } - } - return null; - } - - /* - * Compare two parameter signatures - */ - public static boolean compareParamTypes(String[] paramTypes1, String[] paramTypes2) { - if (paramTypes1.length == paramTypes2.length) { - int i = 0; - while (i < paramTypes1.length) { - String t1 = Signature.getSimpleName(Signature.toString(paramTypes1[i])); - String t2 = Signature.getSimpleName(Signature.toString(paramTypes2[i])); - if (!t1.equals(t2)) { - return false; - } - i++; - } - return true; - } - return false; - } - - //--------------------- - - public static RefactoringStatus checkIfCuBroken(IMember member) throws JavaModelException { - ICompilationUnit cu = (ICompilationUnit) JavaCore.create(member.getCompilationUnit().getResource()); - if (cu == null) { - return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_cu_not_created); - } else if (!cu.isStructureKnown()) { - return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.Checks_cu_not_parsed); - } - return new RefactoringStatus(); - } - // - /** - * From SearchResultGroup[] passed as the parameter this method removes all - * those that correspond to a non-parsable ICompilationUnit and returns it as a - * result. - * - * @param grouped - * the array of search result groups from which non parsable - * compilation units are to be removed. - * @param status - * a refactoring status to collect errors and problems - * @return the array of search result groups - * @throws JavaModelException - */ - public static SearchResultGroup[] excludeCompilationUnits(SearchResultGroup[] grouped, RefactoringStatus status) throws JavaModelException { - List result = new ArrayList<>(); - boolean wasEmpty = grouped.length == 0; - for (int i = 0; i < grouped.length; i++) { - IResource resource = grouped[i].getResource(); - IJavaElement element = JavaCore.create(resource); - if (!(element instanceof ICompilationUnit)) { - continue; - } - //XXX this is a workaround for a jcore feature that shows errors in cus only when you get the original element - ICompilationUnit cu = (ICompilationUnit) JavaCore.create(resource); - if (!cu.isStructureKnown()) { - status.addError(Messages.format(RefactoringCoreMessages.Checks_cannot_be_parsed, BasicElementLabels.getPathLabel(cu.getPath(), false))); - continue; //removed, go to the next one - } - result.add(grouped[i]); - } - - if ((!wasEmpty) && result.isEmpty()) { - status.addFatalError(RefactoringCoreMessages.Checks_all_excluded); - } - - return result.toArray(new SearchResultGroup[result.size()]); - } - - public static RefactoringStatus checkCompileErrorsInAffectedFiles(SearchResultGroup[] grouped) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - for (int i = 0; i < grouped.length; i++) { - checkCompileErrorsInAffectedFile(result, grouped[i].getResource()); - } - return result; - } - - public static void checkCompileErrorsInAffectedFile(RefactoringStatus result, IResource resource) throws JavaModelException { - if (hasCompileErrors(resource)) { - result.addWarning(Messages.format(RefactoringCoreMessages.Checks_cu_has_compile_errors, BasicElementLabels.getPathLabel(resource.getFullPath(), false))); - } - } - - public static RefactoringStatus checkCompileErrorsInAffectedFiles(SearchResultGroup[] references, IResource declaring) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - for (int i = 0; i < references.length; i++) { - IResource resource = references[i].getResource(); - if (resource.equals(declaring)) { - declaring = null; - } - checkCompileErrorsInAffectedFile(result, resource); - } - if (declaring != null) { - checkCompileErrorsInAffectedFile(result, declaring); - } - return result; - } - - private static boolean hasCompileErrors(IResource resource) throws JavaModelException { - try { - IMarker[] problemMarkers = resource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); - for (int i = 0; i < problemMarkers.length; i++) { - if (problemMarkers[i].getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) { - return true; - } - } - return false; - } catch (JavaModelException e) { - throw e; - } catch (CoreException e) { - throw new JavaModelException(e); - } - } - - //------ - public static boolean isReadOnly(Object element) throws JavaModelException { - if (element instanceof IResource) { - return isReadOnly((IResource) element); - } - - if (element instanceof IJavaElement) { - if ((element instanceof IPackageFragmentRoot) && isClasspathDelete((IPackageFragmentRoot) element)) { - return false; - } - return isReadOnly(((IJavaElement) element).getResource()); - } - - Assert.isTrue(false, "not expected to get here"); //$NON-NLS-1$ - return false; - } - - public static boolean isReadOnly(IResource res) throws JavaModelException { - ResourceAttributes attributes = res.getResourceAttributes(); - if (attributes != null && attributes.isReadOnly()) { - return true; - } - - if (!(res instanceof IContainer)) { - return false; - } - - IContainer container = (IContainer) res; - try { - IResource[] children = container.members(); - for (int i = 0; i < children.length; i++) { - if (isReadOnly(children[i])) { - return true; - } - } - return false; - } catch (JavaModelException e) { - throw e; - } catch (CoreException e) { - throw new JavaModelException(e); - } - } - - public static boolean isClasspathDelete(IPackageFragmentRoot pkgRoot) { - IResource res = pkgRoot.getResource(); - if (res == null) { - return true; - } - IProject definingProject = res.getProject(); - if (res.getParent() != null && pkgRoot.isArchive() && !res.getParent().equals(definingProject)) { - return true; - } - - IProject occurringProject = pkgRoot.getJavaProject().getProject(); - return !definingProject.equals(occurringProject); - } - - //-------- validateEdit checks ---- - - public static RefactoringStatus validateModifiesFiles(IFile[] filesToModify, Object context) { - RefactoringStatus result = new RefactoringStatus(); - IStatus status = Resources.checkInSync(filesToModify); - if (!status.isOK()) { - result.merge(RefactoringStatus.create(status)); - } - status = Resources.makeCommittable(filesToModify, context); - if (!status.isOK()) { - result.merge(RefactoringStatus.create(status)); - if (!result.hasFatalError()) { - result.addFatalError(RefactoringCoreMessages.Checks_validateEdit); - } - } - return result; - } - - public static void addModifiedFilesToChecker(IFile[] filesToModify, CheckConditionsContext context) { - ResourceChangeChecker checker = context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (int i = 0; i < filesToModify.length; i++) { - deltaFactory.change(filesToModify[i]); - } - } - - public static RefactoringStatus validateEdit(ICompilationUnit unit, Object context) { - IResource resource = unit.getPrimary().getResource(); - RefactoringStatus result = new RefactoringStatus(); - if (resource == null) { - return result; - } - IStatus status = Resources.checkInSync(resource); - if (!status.isOK()) { - result.merge(RefactoringStatus.create(status)); - } - status = Resources.makeCommittable(resource, context); - if (!status.isOK()) { - result.merge(RefactoringStatus.create(status)); - if (!result.hasFatalError()) { - result.addFatalError(RefactoringCoreMessages.Checks_validateEdit); - } - } - return result; - } - - /** - * Checks whether it is possible to modify the given IJavaElement. - * The IJavaElement must exist and be non read-only to be - * modifiable. Moreover, if it is a IMember it must not be binary. - * The returned RefactoringStatus has ERROR severity - * if it is not possible to modify the element. - * - * @param javaElement - * @return the status - * @throws JavaModelException - * - * @see IJavaElement#exists - * @see IJavaElement#isReadOnly - * @see IMember#isBinary - * @see RefactoringStatus - */ - public static RefactoringStatus checkAvailability(IJavaElement javaElement) throws JavaModelException { - RefactoringStatus result = new RefactoringStatus(); - if (!javaElement.exists()) { - result.addFatalError(Messages.format(RefactoringCoreMessages.Refactoring_not_in_model, getJavaElementName(javaElement))); - } - if (javaElement.isReadOnly()) { - result.addFatalError(Messages.format(RefactoringCoreMessages.Refactoring_read_only, getJavaElementName(javaElement))); - } - if (javaElement.exists() && !javaElement.isStructureKnown()) { - result.addFatalError(Messages.format(RefactoringCoreMessages.Refactoring_unknown_structure, getJavaElementName(javaElement))); - } - if (javaElement instanceof IMember && ((IMember) javaElement).isBinary()) { - result.addFatalError(Messages.format(RefactoringCoreMessages.Refactoring_binary, getJavaElementName(javaElement))); - } - return result; - } - - private static String getJavaElementName(IJavaElement element) { - return JavaElementLabels.getElementLabel(element, JavaElementLabels.ALL_DEFAULT); - } - - public static boolean isAvailable(IJavaElement javaElement) throws JavaModelException { - if (javaElement == null) { - return false; - } - if (!javaElement.exists()) { - return false; - } - if (javaElement.isReadOnly()) { - return false; - } - // work around for https://bugs.eclipse.org/bugs/show_bug.cgi?id=48422 - // the Java project is now cheating regarding its children so we shouldn't - // call isStructureKnown if the project isn't open. - // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=52474 - if (!(javaElement instanceof IJavaProject) && !(javaElement instanceof ILocalVariable) && !javaElement.isStructureKnown()) { - return false; - } - if (javaElement instanceof IMember && ((IMember) javaElement).isBinary()) { - return false; - } - return true; - } - - public static IType findTypeInPackage(IPackageFragment pack, String elementName) throws JavaModelException { - Assert.isTrue(pack.exists()); - Assert.isTrue(!pack.isReadOnly()); - - String packageName = pack.getElementName(); - elementName = packageName.length() > 0 ? packageName + '.' + elementName : elementName; - - return pack.getJavaProject().findType(elementName, (IProgressMonitor) null); - } - - public static RefactoringStatus checkTempName(String newName, IJavaElement context) { - RefactoringStatus result = Checks.checkIdentifier(newName, context); - if (result.hasFatalError()) { - return result; - } - if (!Checks.startsWithLowerCase(newName)) { - result.addWarning(RefactoringCoreMessages.ExtractTempRefactoring_convention); - } - return result; - } - - public static RefactoringStatus checkEnumConstantName(String newName, IJavaElement context) { - RefactoringStatus result = Checks.checkFieldName(newName, context); - if (result.hasFatalError()) { - return result; - } - for (int i = 0; i < newName.length(); i++) { - char c = newName.charAt(i); - if (Character.isLetter(c) && !Character.isUpperCase(c)) { - result.addWarning(RefactoringCoreMessages.RenameEnumConstRefactoring_convention); - break; - } - } - return result; - } - - public static RefactoringStatus checkConstantName(String newName, IJavaElement context) { - RefactoringStatus result = Checks.checkFieldName(newName, context); - if (result.hasFatalError()) { - return result; - } - for (int i = 0; i < newName.length(); i++) { - char c = newName.charAt(i); - if (Character.isLetter(c) && !Character.isUpperCase(c)) { - result.addWarning(RefactoringCoreMessages.ExtractConstantRefactoring_convention); - break; - } - } - return result; - } - - // public static boolean isException(IType iType, IProgressMonitor pm) throws JavaModelException { - // try { - // if (!iType.isClass()) { - // return false; - // } - // IType[] superTypes = iType.newSupertypeHierarchy(pm).getAllSupertypes(iType); - // for (int i = 0; i < superTypes.length; i++) { - // if ("java.lang.Throwable".equals(superTypes[i].getFullyQualifiedName())) { - // return true; - // } - // } - // return false; - // } finally { - // pm.done(); - // } - // } - // - /** - * @param e - * @return int Checks.IS_RVALUE if e is an rvalue Checks.IS_RVALUE_GUESSED if e - * is guessed as an rvalue Checks.NOT_RVALUE_VOID if e is not an rvalue - * because its type is void Checks.NOT_RVALUE_MISC if e is not an rvalue - * for some other reason - */ - public static int checkExpressionIsRValue(Expression e) { - if (e instanceof Name) { - if (!(((Name) e).resolveBinding() instanceof IVariableBinding)) { - return NOT_RVALUE_MISC; - } - } - if (e instanceof Annotation) { - return NOT_RVALUE_MISC; - } - - ITypeBinding tb = e.resolveTypeBinding(); - boolean guessingRequired = false; - if (tb == null) { - guessingRequired = true; - tb = ASTResolving.guessBindingForReference(e); - } - if (tb == null) { - return NOT_RVALUE_MISC; - } else if (tb.getName().equals("void")) { - return NOT_RVALUE_VOID; - } - - return guessingRequired ? IS_RVALUE_GUESSED : IS_RVALUE; - } - - public static boolean isDeclaredIn(VariableDeclaration tempDeclaration, Class astNodeClass) { - ASTNode initializer = ASTNodes.getParent(tempDeclaration, astNodeClass); - if (initializer == null) { - return false; - } - ASTNode anonymous = ASTNodes.getParent(tempDeclaration, AnonymousClassDeclaration.class); - if (anonymous == null) { - return true; - } - // stupid code. Is to find out if the variable declaration isn't a field. - if (ASTNodes.isParent(anonymous, initializer)) { - return false; - } - return true; - } -} diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JDTRefactoringDescriptorComment.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JDTRefactoringDescriptorComment.java deleted file mode 100644 index 4dfb7cf541..0000000000 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JDTRefactoringDescriptorComment.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2016 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Originally copied from org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.ls.core.internal.corext.refactoring; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; -import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; -import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.RenamingNameSuggestor; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.reorg.IReorgPolicy; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.IDelegateUpdating; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.INameUpdating; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.IQualifiedNameUpdating; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.IReferenceUpdating; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.ISimilarDeclarationUpdating; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.ITextUpdating; -import org.eclipse.jdt.ls.core.internal.hover.JavaElementLabels; -import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor; - -public final class JDTRefactoringDescriptorComment { - - /** The element delimiter */ - private static final String ELEMENT_DELIMITER = RefactoringCoreMessages.JavaRefactoringDescriptorComment_element_delimiter; - - /** The line delimiter */ - private static final String LINE_DELIMITER = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$ - - /** - * Creates a composite setting. - * - * @param caption - * the caption - * @param settings - * the settings - * @return the composite setting - */ - public static String createCompositeSetting(final String caption, final String[] settings) { - Assert.isNotNull(caption); - Assert.isNotNull(settings); - final StringBuffer buffer = new StringBuffer(128); - for (int index = 0; index < settings.length; index++) { - if (settings[index] != null && !"".equals(settings[index])) { //$NON-NLS-1$ - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(settings[index]); - } else { - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(RefactoringCoreMessages.JavaRefactoringDescriptor_not_available); - } - } - if (buffer.length() > 0) { - buffer.insert(0, caption); - } - return buffer.toString(); - } - - /** The header of the comment */ - private final String fHeader; - - /** The project name, or null */ - private final String fProject; - - /** The settings list */ - private final List fSettings = new ArrayList<>(6); - - /** - * Creates a new JDT refactoring descriptor comment. - * - * @param project - * the project name, or null - * @param object - * the refactoring object to generate a comment for - * @param header - * the header of the comment (typically the unique description of - * the refactoring with fully qualified element names) - */ - public JDTRefactoringDescriptorComment(final String project, final Object object, final String header) { - Assert.isNotNull(object); - Assert.isNotNull(header); - fProject = project; - fHeader = header; - initializeInferredSettings(object); - } - - /** - * Adds the specified setting to this comment. - * - * @param index - * the index - * @param setting - * the setting to add - */ - public void addSetting(final int index, final String setting) { - Assert.isTrue(index >= 0); - Assert.isNotNull(setting); - Assert.isTrue(!"".equals(setting)); //$NON-NLS-1$ - fSettings.add(index, setting); - } - - /** - * Adds the specified setting to this comment. - * - * @param setting - * the setting to add, or null for no setting - */ - public void addSetting(final String setting) { - if (setting != null && !"".equals(setting)) { - fSettings.add(setting); - } - } - - /** - * Returns this comment in a human-readable string representation. - * - * @return this comment in string representation - */ - public String asString() { - final StringBuffer buffer = new StringBuffer(256); - buffer.append(fHeader); - if (fProject != null && !"".equals(fProject)) { //$NON-NLS-1$ - buffer.append(LINE_DELIMITER); - buffer.append(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptorComment_original_project, BasicElementLabels.getResourceName(fProject))); - } - for (final Iterator iterator = fSettings.iterator(); iterator.hasNext();) { - final String setting = iterator.next(); - buffer.append(LINE_DELIMITER); - buffer.append(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_inferred_setting_pattern, setting)); - } - return buffer.toString(); - } - - /** - * Returns the number of settings. - * - * @return the number of settings - */ - public int getCount() { - return fSettings.size(); - } - - /** - * Initializes the inferred settings. - * - * @param object - * the refactoring object - */ - private void initializeInferredSettings(final Object object) { - if (object instanceof INameUpdating) { - final INameUpdating updating = (INameUpdating) object; - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_original_element_pattern, JavaElementLabels.getTextLabel(updating.getElements()[0], JavaElementLabels.ALL_FULLY_QUALIFIED))); - try { - final Object element = updating.getNewElement(); - if (element != null) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_renamed_element_pattern, JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_FULLY_QUALIFIED))); - } else { - final String newLabel = BasicElementLabels.getJavaElementName(updating.getCurrentElementName()); - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_renamed_element_pattern, newLabel)); - } - } catch (CoreException exception) { - JavaLanguageServerPlugin.logException("Problem with JDTRefactoringDescriptorComment ", exception); - } - } else if (object instanceof RefactoringProcessor) { - final RefactoringProcessor processor = (RefactoringProcessor) object; - final Object[] elements = processor.getElements(); - if (elements != null) { - if (elements.length == 1 && elements[0] != null) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_original_element_pattern, JavaElementLabels.getTextLabel(elements[0], JavaElementLabels.ALL_FULLY_QUALIFIED))); - } else if (elements.length > 1) { - final StringBuffer buffer = new StringBuffer(128); - buffer.append(RefactoringCoreMessages.JavaRefactoringDescriptor_original_elements); - for (int index = 0; index < elements.length; index++) { - if (elements[index] != null) { - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(JavaElementLabels.getTextLabel(elements[index], JavaElementLabels.ALL_FULLY_QUALIFIED)); - } else { - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(RefactoringCoreMessages.JavaRefactoringDescriptor_not_available); - } - } - fSettings.add(buffer.toString()); - } - } - } else if (object instanceof IReorgPolicy) { - final IReorgPolicy policy = (IReorgPolicy) object; - Object destination = policy.getJavaElementDestination(); - if (destination != null) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptorComment_destination_pattern, JavaElementLabels.getTextLabel(destination, JavaElementLabels.ALL_FULLY_QUALIFIED))); - } else { - destination = policy.getResourceDestination(); - if (destination != null) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptorComment_destination_pattern, JavaElementLabels.getTextLabel(destination, JavaElementLabels.ALL_FULLY_QUALIFIED))); - } - } - final List list = new ArrayList<>(); - list.addAll(Arrays.asList(policy.getJavaElements())); - list.addAll(Arrays.asList(policy.getResources())); - final Object[] elements = list.toArray(); - if (elements != null) { - if (elements.length == 1 && elements[0] != null) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_original_element_pattern, JavaElementLabels.getTextLabel(elements[0], JavaElementLabels.ALL_FULLY_QUALIFIED))); - } else if (elements.length > 1) { - final StringBuffer buffer = new StringBuffer(128); - buffer.append(RefactoringCoreMessages.JavaRefactoringDescriptor_original_elements); - for (int index = 0; index < elements.length; index++) { - if (elements[index] != null) { - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(JavaElementLabels.getTextLabel(elements[index], JavaElementLabels.ALL_FULLY_QUALIFIED)); - } else { - buffer.append(LINE_DELIMITER); - buffer.append(ELEMENT_DELIMITER); - buffer.append(RefactoringCoreMessages.JavaRefactoringDescriptor_not_available); - } - } - fSettings.add(buffer.toString()); - } - } - if (object instanceof IMovePolicy) { - final IMovePolicy extended = (IMovePolicy) object; - if (extended.isTextualMove()) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptorComment_textual_move_only); - } - } - } - if (object instanceof IReferenceUpdating) { - final IReferenceUpdating updating = (IReferenceUpdating) object; - if (updating.getUpdateReferences()) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references); - } - } - if (object instanceof ISimilarDeclarationUpdating) { - final ISimilarDeclarationUpdating updating = (ISimilarDeclarationUpdating) object; - if (updating.canEnableSimilarDeclarationUpdating() && updating.getUpdateSimilarDeclarations()) { - final int strategy = updating.getMatchStrategy(); - if (strategy == RenamingNameSuggestor.STRATEGY_EXACT) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_rename_similar); - } else if (strategy == RenamingNameSuggestor.STRATEGY_EMBEDDED) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_rename_similar_embedded); - } else if (strategy == RenamingNameSuggestor.STRATEGY_SUFFIX) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_rename_similar_suffix); - } - } - } - if (object instanceof IQualifiedNameUpdating) { - final IQualifiedNameUpdating updating = (IQualifiedNameUpdating) object; - if (updating.canEnableQualifiedNameUpdating() && updating.getUpdateQualifiedNames()) { - final String patterns = updating.getFilePatterns(); - if (patterns != null && !"".equals(patterns)) { - fSettings.add(Messages.format(RefactoringCoreMessages.JavaRefactoringDescriptor_qualified_names_pattern, BasicElementLabels.getFilePattern(patterns.trim()))); - } else { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_qualified_names); - } - } - } - if (object instanceof ITextUpdating) { - final ITextUpdating updating = (ITextUpdating) object; - if (updating.canEnableTextUpdating()) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_textual_occurrences); - } - } - if (object instanceof IDelegateUpdating) { - final IDelegateUpdating updating = (IDelegateUpdating) object; - if (updating.canEnableDelegateUpdating() && updating.getDelegateUpdating()) { - if (updating.getDeprecateDelegates()) { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_keep_original_deprecated); - } else { - fSettings.add(RefactoringCoreMessages.JavaRefactoringDescriptor_keep_original); - } - } - } - } - - /** - * Removes the setting at the specified index. - * - * @param index - * the index - */ - public void removeSetting(final int index) { - Assert.isTrue(index >= 0); - fSettings.remove(index); - } -} diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringArguments.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringArguments.java deleted file mode 100644 index 884d539337..0000000000 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringArguments.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Originally copied from org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.ls.core.internal.corext.refactoring; - -import java.util.Map; - -import org.eclipse.jdt.core.refactoring.descriptors.JavaRefactoringDescriptor; - -/** - * A wrapper around the Map received from {@link JavaRefactoringDescriptor} to - * access and convert the options. - */ -public final class JavaRefactoringArguments { - - /** The attribute map (element type: <String, String>) */ - private final Map fAttributes; - - /** The name of the project, or null for the workspace */ - private String fProject; - - /** - * Creates a new java refactoring arguments from arguments - * - * @param project - * the project, or null for the workspace - * @param arguments - * the arguments - */ - public JavaRefactoringArguments(String project, Map arguments) { - fProject = project; - fAttributes = arguments; - } - - /** - * Returns the attribute with the specified name. - * - * @param name - * the name of the attribute - * @return the attribute value, or null - */ - public String getAttribute(final String name) { - return fAttributes.get(name); - } - - /** - * Returns the name of the project. - * - * @return the name of the project, or null for the workspace - */ - public String getProject() { - return fProject; - } - - @Override - public String toString() { - return getClass().getName() + fAttributes.toString(); - } -} diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringDescriptorUtil.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringDescriptorUtil.java deleted file mode 100644 index 5a06f5d9ff..0000000000 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/JavaRefactoringDescriptorUtil.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Originally copied from org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.ls.core.internal.corext.refactoring; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.WorkingCopyOwner; -import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.hover.JavaElementLabels; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; - -public class JavaRefactoringDescriptorUtil { - /* TODO: share implementation with - * org.eclipse.jdt.internal.core.refactoring.descriptors.JavaRefactoringDescriptorUtil - */ - - private JavaRefactoringDescriptorUtil() { - } - - /** - * Predefined argument called element<Number>. - *

- * This argument should be used to describe the elements being refactored. - * The value of this argument does not necessarily have to uniquely identify - * the elements. However, it must be possible to uniquely identify the - * elements using the value of this argument in conjunction with the values - * of the other user-defined attributes. - *

- *

- * The element arguments are simply distinguished by appending a number to - * the argument name, e.g. element1. The indices of this argument are non - * zero-based. - *

- */ - public static final String ATTRIBUTE_ELEMENT = "element"; //$NON-NLS-1$ - - /** - * Predefined argument called input. - *

- * This argument should be used to describe the element being refactored. - * The value of this argument does not necessarily have to uniquely identify - * the input element. However, it must be possible to uniquely identify the - * input element using the value of this argument in conjunction with the - * values of the other user-defined attributes. - *

- */ - public static final String ATTRIBUTE_INPUT = "input"; //$NON-NLS-1$ - - /** - * Predefined argument called name. - *

- * This argument should be used to name the element being refactored. The - * value of this argument may be shown in the user interface. - *

- */ - public static final String ATTRIBUTE_NAME = "name"; //$NON-NLS-1$ - - /** - * Predefined argument called references. - *

- * This argument should be used to describe whether references to the - * elements being refactored should be updated as well. - *

- */ - public static final String ATTRIBUTE_REFERENCES = "references"; //$NON-NLS-1$ - - /** - * Predefined argument called selection. - *

- * This argument should be used to describe user input selections within a - * text file. The value of this argument has the format "offset length". - *

- */ - public static final String ATTRIBUTE_SELECTION = "selection"; //$NON-NLS-1$ - - /** - * Converts the specified element to an input handle. - * - * @param project - * the project, or null for the workspace - * @param element - * the element - * @return a corresponding input handle Note: if the given project is not - * the element's project, then the full handle is returned - */ - public static String elementToHandle(final String project, final IJavaElement element) { - final String handle = element.getHandleIdentifier(); - if (project != null && !(element instanceof IJavaProject)) { - IJavaProject javaProject = element.getJavaProject(); - if (project.equals(javaProject.getElementName())) { - final String id = javaProject.getHandleIdentifier(); - return handle.substring(id.length()); - } - } - return handle; - } - - /** - * Converts an input handle back to the corresponding java element. - * - * @param project - * the project, or null for the workspace - * @param handle - * the input handle - * @return the corresponding java element, or null if no such - * element exists - */ - public static IJavaElement handleToElement(final String project, final String handle) { - return handleToElement(project, handle, true); - } - - /** - * Converts an input handle back to the corresponding java element. - * - * @param project - * the project, or null for the workspace - * @param handle - * the input handle - * @param check - * true to check for existence of the element, - * false otherwise - * @return the corresponding java element, or null if no such - * element exists - */ - public static IJavaElement handleToElement(final String project, final String handle, final boolean check) { - return handleToElement(null, project, handle, check); - } - - /** - * Converts an input handle back to the corresponding java element. - * - * @param owner - * the working copy owner - * @param project - * the project, or null for the workspace - * @param handle - * the input handle - * @param check - * true to check for existence of the element, - * false otherwise - * @return the corresponding java element, or null if no such - * element exists - */ - public static IJavaElement handleToElement(final WorkingCopyOwner owner, final String project, final String handle, final boolean check) { - IJavaElement element = null; - if (owner != null) { - element = JavaCore.create(handle, owner); - } else { - element = JavaCore.create(handle); - } - if (element == null && project != null) { - final IJavaProject javaProject = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProject(project); - final String identifier = javaProject.getHandleIdentifier(); - if (owner != null) { - element = JavaCore.create(identifier + handle, owner); - } else { - element = JavaCore.create(identifier + handle); - } - } - if (check && element instanceof IMethod) { - /* - * Resolve the method based on simple names of parameter types - * (to accommodate for different qualifications when refactoring is e.g. - * recorded in source but applied on binary method): - */ - final IMethod method = (IMethod) element; - final IMethod[] methods = method.getDeclaringType().findMethods(method); - if (methods != null && methods.length > 0) { - element = methods[0]; - } - } - if (element != null && (!check || element.exists())) { - return element; - } - return null; - } - - /** - * Converts an input handle with the given prefix back to the corresponding - * resource. - * - * @param project - * the project, or null for the workspace - * @param handle - * the input handle - * - * @return the corresponding resource, or null if no such - * resource exists. Note: if the given handle is absolute, the - * project is not used to resolve. - */ - public static IResource handleToResource(final String project, final String handle) { - final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - if ("".equals(handle)) { - return null; - } - final IPath path = Path.fromPortableString(handle); - if (path == null) { - return null; - } - if (project != null && !"".equals(project) && !path.isAbsolute()) { - return root.getProject(project).findMember(path); - } - return root.findMember(path); - } - - /** - * Converts the specified resource to an input handle. - * - * @param project - * the project, or null for the workspace - * @param resource - * the resource - * - * @return the input handle. Note: if the given project is not the - * resource's project, then the full handle is returned. - */ - public static String resourceToHandle(final String project, final IResource resource) { - if (project != null && !"".equals(project) && project.equals(resource.getProject().getName())) { - return resource.getProjectRelativePath().toPortableString(); - } - return resource.getFullPath().toPortableString(); - } - - /** - * Creates a fatal error status telling that the input element does not - * exist. - * - * @param element - * the input element, or null - * @param name - * the name of the refactoring - * @param id - * the id of the refactoring - * @return the refactoring status - */ - public static RefactoringStatus createInputFatalStatus(final Object element, final String name, final String id) { - Assert.isNotNull(name); - Assert.isNotNull(id); - if (element != null) { - return RefactoringStatus - .createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_input_not_exists, new String[] { JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_FULLY_QUALIFIED), name, id })); - } else { - return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_inputs_do_not_exist, new String[] { name, id })); - } - } - - /** - * Creates a warning status telling that the input element does not exist. - * - * @param element - * the input element, or null - * @param name - * the name of the refactoring - * @param id - * the id of the refactoring - * @return the refactoring status - */ - public static RefactoringStatus createInputWarningStatus(final Object element, final String name, final String id) { - Assert.isNotNull(name); - Assert.isNotNull(id); - if (element != null) { - return RefactoringStatus - .createWarningStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_input_not_exists, new String[] { JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_FULLY_QUALIFIED), name, id })); - } else { - return RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_inputs_do_not_exist, new String[] { name, id })); - } - } - -} diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringAvailabilityTester.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringAvailabilityTester.java index 529f5523d0..b346174aaf 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringAvailabilityTester.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringAvailabilityTester.java @@ -47,6 +47,7 @@ import org.eclipse.jdt.core.dom.Statement; import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; import org.eclipse.jdt.core.dom.SuperMethodInvocation; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.internal.corext.util.JdtFlags; import org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.MethodChecks; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine.java index 67d6f47370..d6062d5f1e 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine.java @@ -34,6 +34,7 @@ import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.core.search.SearchRequestor; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.util.SearchUtils; import org.eclipse.ltk.core.refactoring.IRefactoringStatusEntryComparator; import org.eclipse.ltk.core.refactoring.RefactoringStatus; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine2.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine2.java index a0067c4b37..f9d7853fd0 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine2.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/RefactoringSearchEngine2.java @@ -42,6 +42,7 @@ import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.core.search.SearchRequestor; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.util.SearchUtils; import org.eclipse.ltk.core.refactoring.RefactoringStatus; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/SearchResultGroup.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/SearchResultGroup.java deleted file mode 100644 index baa563abae..0000000000 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/SearchResultGroup.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Originally copied from org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jdt.ls.core.internal.corext.refactoring; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.search.SearchMatch; -import org.eclipse.jdt.ls.core.internal.corext.util.SearchUtils; - -public class SearchResultGroup { - - private final IResource fResouce; - private final List fSearchMatches; - - public SearchResultGroup(IResource res, SearchMatch[] matches){ - Assert.isNotNull(matches); - fResouce= res; - fSearchMatches= new ArrayList<>(Arrays.asList(matches)); - } - - public void add(SearchMatch match) { - Assert.isNotNull(match); - fSearchMatches.add(match); - } - - public IResource getResource() { - return fResouce; - } - - public SearchMatch[] getSearchResults() { - return fSearchMatches.toArray(new SearchMatch[fSearchMatches.size()]); - } - - public static IResource[] getResources(SearchResultGroup[] searchResultGroups){ - Set resourceSet= new HashSet<>(searchResultGroups.length); - for (int i= 0; i < searchResultGroups.length; i++) { - resourceSet.add(searchResultGroups[i].getResource()); - } - return resourceSet.toArray(new IResource[resourceSet.size()]); - } - - public ICompilationUnit getCompilationUnit(){ - if (getSearchResults() == null || getSearchResults().length == 0) { - return null; - } - return SearchUtils.getCompilationUnit(getSearchResults()[0]); - } - - @Override - public String toString() { - StringBuffer buf= new StringBuffer(fResouce.getFullPath().toString()); - buf.append('\n'); - for (int i= 0; i < fSearchMatches.size(); i++) { - SearchMatch match= fSearchMatches.get(i); - buf.append(" ").append(match.getOffset()).append(", ").append(match.getLength()); //$NON-NLS-1$//$NON-NLS-2$ - buf.append(match.getAccuracy() == SearchMatch.A_ACCURATE ? "; acc" : "; inacc"); //$NON-NLS-1$//$NON-NLS-2$ - if (match.isInsideDocComment()) - { - buf.append("; inDoc"); //$NON-NLS-1$ - } - if (match.getElement() instanceof IJavaElement) - { - buf.append("; in: ").append(((IJavaElement) match.getElement()).getElementName()); //$NON-NLS-1$ - } - buf.append('\n'); - } - return buf.toString(); - } -} diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractConstantRefactoring.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractConstantRefactoring.java index bbb504b582..7672bff3f0 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractConstantRefactoring.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractConstantRefactoring.java @@ -75,6 +75,10 @@ import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer; import org.eclipse.jdt.internal.corext.fix.LinkedProposalModelCore; import org.eclipse.jdt.internal.corext.fix.LinkedProposalPositionGroupCore; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.internal.corext.util.JdtFlags; @@ -86,10 +90,6 @@ import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.ASTFragmentFactory; import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IASTFragment; import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IExpressionFragment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.JavaStringStatusContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.RefactoringStatusCodes; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodAnalyzer.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodAnalyzer.java index 8c71105d7a..f33e95b7e0 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodAnalyzer.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodAnalyzer.java @@ -80,6 +80,7 @@ import org.eclipse.jdt.internal.corext.dom.Bindings; import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.dom.TokenScanner; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.internal.corext.refactoring.util.CodeAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; @@ -87,7 +88,6 @@ import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; import org.eclipse.jdt.ls.core.internal.corext.dom.LocalVariableIndex; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.code.flow.FlowContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.code.flow.FlowInfo; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodRefactoring.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodRefactoring.java index 7ca40a9673..02b3f774d2 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodRefactoring.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractMethodRefactoring.java @@ -101,6 +101,10 @@ import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.fix.LinkedProposalModelCore; import org.eclipse.jdt.internal.corext.fix.LinkedProposalPositionGroupCore; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.internal.corext.util.JdtFlags; import org.eclipse.jdt.ls.core.internal.BindingLabelProvider; @@ -108,10 +112,6 @@ import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.CodeGeneration; import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; import org.eclipse.jdt.ls.core.internal.corext.dom.StatementRewrite; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.ParameterInfo; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.code.SnippetFinder.Match; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractTempRefactoring.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractTempRefactoring.java index b14e6384f9..7f7a0e3a82 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractTempRefactoring.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/code/ExtractTempRefactoring.java @@ -104,6 +104,10 @@ import org.eclipse.jdt.internal.corext.dom.ScopeAnalyzer; import org.eclipse.jdt.internal.corext.fix.LinkedProposalModelCore; import org.eclipse.jdt.internal.corext.fix.LinkedProposalPositionGroupCore; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; @@ -115,10 +119,6 @@ import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.ASTFragmentFactory; import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IASTFragment; import org.eclipse.jdt.ls.core.internal.corext.dom.fragments.IExpressionFragment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.JavaStringStatusContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.RefactoringStatusCodes; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/MethodChecks.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/MethodChecks.java index 1354f3bee7..79bd0cc26e 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/MethodChecks.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/MethodChecks.java @@ -21,11 +21,11 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.Modifier; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.util.JdtFlags; import org.eclipse.jdt.internal.corext.util.MethodOverrideTester; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.RefactoringStatusCodes; import org.eclipse.jdt.ls.core.internal.corext.util.JavaElementUtil; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameAnalyzeUtil.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameAnalyzeUtil.java index 6310345085..9e485ca7f2 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameAnalyzeUtil.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameAnalyzeUtil.java @@ -49,12 +49,12 @@ import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.IASTSharedValues; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.SourceRangeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.JavaStringStatusContext; import org.eclipse.jdt.ls.core.internal.corext.util.SearchUtils; import org.eclipse.jdt.ls.core.internal.corext.util.TextChangeManager; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameCompilationUnitProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameCompilationUnitProcessor.java index 1978f09265..df9c994905 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameCompilationUnitProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameCompilationUnitProcessor.java @@ -29,12 +29,12 @@ import org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameEnumConstProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameEnumConstProcessor.java index 58d66592e0..b6ee399c4f 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameEnumConstProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameEnumConstProcessor.java @@ -24,12 +24,12 @@ import org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.hover.JavaElementLabels; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameFieldProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameFieldProcessor.java index 7c0286642e..2e0a3cf7fd 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameFieldProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameFieldProcessor.java @@ -47,6 +47,11 @@ import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; @@ -55,16 +60,11 @@ import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.GetterSetterUtil; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.CollectingSearchRequestor; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.ReferencesInBinaryContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.delegates.DelegateCreator; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java index bd508c575b..98efd571fa 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameLocalVariableProcessor.java @@ -37,15 +37,15 @@ import org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.participants.JavaProcessors; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameMethodProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameMethodProcessor.java index 95dfd640c7..2b30764397 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameMethodProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameMethodProcessor.java @@ -51,6 +51,10 @@ import org.eclipse.jdt.core.search.SearchRequestor; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; @@ -58,13 +62,9 @@ import org.eclipse.jdt.internal.corext.util.JdtFlags; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.ReferencesInBinaryContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.delegates.DelegateCreator; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameNonVirtualMethodProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameNonVirtualMethodProcessor.java index 3f2cbc98b5..3e52879c34 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameNonVirtualMethodProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameNonVirtualMethodProcessor.java @@ -24,14 +24,14 @@ import org.eclipse.jdt.core.search.MethodDeclarationMatch; import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.delegates.DelegateMethodCreator; import org.eclipse.jdt.ls.core.internal.corext.refactoring.structure.ASTNodeSearchUtil; import org.eclipse.jdt.ls.core.internal.corext.util.TextChangeManager; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenamePackageProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenamePackageProcessor.java index 3196e343b1..b81d3c11be 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenamePackageProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenamePackageProcessor.java @@ -57,21 +57,21 @@ import org.eclipse.jdt.internal.core.manipulation.StubUtility; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.util.CommentAnalyzer; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.CollectingSearchRequestor; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.ReferencesInBinaryContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.RenamePackageChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeParameterProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeParameterProcessor.java index 22bd482210..6988c6d75b 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeParameterProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeParameterProcessor.java @@ -37,16 +37,16 @@ import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; import org.eclipse.jdt.internal.corext.dom.HierarchicalASTVisitor; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.SourceRangeFactory; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeProcessor.java index eaafad93b0..a66001bb89 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameTypeProcessor.java @@ -69,6 +69,11 @@ import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; import org.eclipse.jdt.internal.core.refactoring.descriptors.RefactoringSignatureDescriptorFactory; import org.eclipse.jdt.internal.corext.dom.IASTSharedValues; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; @@ -76,15 +81,10 @@ import org.eclipse.jdt.internal.corext.util.JdtFlags; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.ReferencesInBinaryContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationRefactoringChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.RenameCompilationUnitChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java index 722ad30e42..414d1ded34 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/RenameVirtualMethodProcessor.java @@ -27,10 +27,10 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringAvailabilityTester; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.util.JdtFlags; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/TextMatchUpdater.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/TextMatchUpdater.java index c7fc51a85a..1ba4de8ec9 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/TextMatchUpdater.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/rename/TextMatchUpdater.java @@ -35,9 +35,9 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.SearchMatch; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.RefactoringScanner.TextMatch; import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.ITextUpdating; import org.eclipse.jdt.ls.core.internal.corext.util.TextChangeManager; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/CreateCopyOfCompilationUnitChange.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/CreateCopyOfCompilationUnitChange.java index a0e48c69dc..9b97d796d6 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/CreateCopyOfCompilationUnitChange.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/CreateCopyOfCompilationUnitChange.java @@ -31,6 +31,7 @@ import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; @@ -39,7 +40,6 @@ import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine2; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.nls.changes.CreateTextFileChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.rename.TypeOccurrenceCollector; import org.eclipse.jdt.ls.core.internal.corext.util.JavaElementResourceMapping; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/DeleteChangeCreator.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/DeleteChangeCreator.java index e9e9bf0bd3..032d451677 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/DeleteChangeCreator.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/DeleteChangeCreator.java @@ -33,10 +33,10 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.ClasspathChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DeletePackageFragmentRootChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/IReorgPolicy.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/IReorgPolicy.java index 2d51cd52de..daf240c310 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/IReorgPolicy.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/IReorgPolicy.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.IQualifiedNameUpdating; import org.eclipse.jdt.ls.core.internal.corext.refactoring.tagging.IReferenceUpdating; import org.eclipse.ltk.core.refactoring.Change; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/JavaMoveProcessor.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/JavaMoveProcessor.java index 18e97b25cd..f35a1bbd73 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/JavaMoveProcessor.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/JavaMoveProcessor.java @@ -26,7 +26,7 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.DynamicValidationStateChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.participants.JavaProcessors; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/LoggedCreateTargetChange.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/LoggedCreateTargetChange.java index 6249eee09f..fd7652ea55 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/LoggedCreateTargetChange.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/LoggedCreateTargetChange.java @@ -17,8 +17,8 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.Messages; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.hover.JavaElementLabels; import org.eclipse.ltk.core.refactoring.Change; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/MoveCuUpdateCreator.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/MoveCuUpdateCreator.java index 3c886cab38..96d9897e25 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/MoveCuUpdateCreator.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/MoveCuUpdateCreator.java @@ -46,6 +46,7 @@ import org.eclipse.jdt.core.search.TypeReferenceMatch; import org.eclipse.jdt.internal.core.manipulation.StubUtility; import org.eclipse.jdt.internal.core.manipulation.util.BasicElementLabels; +import org.eclipse.jdt.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.internal.corext.refactoring.changes.TextChangeCompatibility; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; @@ -54,7 +55,6 @@ import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.SearchResultGroup; import org.eclipse.jdt.ls.core.internal.corext.refactoring.base.ReferencesInBinaryContext; import org.eclipse.jdt.ls.core.internal.corext.refactoring.structure.ReferenceFinderUtil; import org.eclipse.jdt.ls.core.internal.corext.util.SearchUtils; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/ReorgPolicyFactory.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/ReorgPolicyFactory.java index 2aa62dea36..2a3a8238b5 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/ReorgPolicyFactory.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/reorg/ReorgPolicyFactory.java @@ -96,16 +96,16 @@ import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.BodyDeclarationRewrite; import org.eclipse.jdt.internal.corext.dom.IASTSharedValues; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin; import org.eclipse.jdt.ls.core.internal.Messages; import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.CopyCompilationUnitChange; import org.eclipse.jdt.ls.core.internal.corext.refactoring.changes.CopyPackageChange; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/sef/SelfEncapsulateFieldRefactoring.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/sef/SelfEncapsulateFieldRefactoring.java index 742d4dfc17..bb13dc5898 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/sef/SelfEncapsulateFieldRefactoring.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/sef/SelfEncapsulateFieldRefactoring.java @@ -79,6 +79,10 @@ import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.Bindings; import org.eclipse.jdt.internal.corext.dom.IASTSharedValues; +import org.eclipse.jdt.internal.corext.refactoring.Checks; +import org.eclipse.jdt.internal.corext.refactoring.JDTRefactoringDescriptorComment; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments; +import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.internal.corext.refactoring.util.JavaStatusContext; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.internal.corext.util.JavaModelUtil; @@ -90,10 +94,6 @@ import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.GetterSetterUtil; import org.eclipse.jdt.ls.core.internal.corext.dom.DimensionRewrite; import org.eclipse.jdt.ls.core.internal.corext.dom.VariableDeclarationRewrite; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JDTRefactoringDescriptorComment; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringArguments; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.JavaRefactoringDescriptorUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringScopeFactory; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringSearchEngine; diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/surround/SurroundWithTryCatchRefactoring.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/surround/SurroundWithTryCatchRefactoring.java index ce4d2f3194..3ef70d5bc6 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/surround/SurroundWithTryCatchRefactoring.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/corext/refactoring/surround/SurroundWithTryCatchRefactoring.java @@ -59,10 +59,10 @@ import org.eclipse.jdt.internal.corext.dom.IASTSharedValues; import org.eclipse.jdt.internal.corext.dom.Selection; import org.eclipse.jdt.internal.corext.fix.LinkedProposalModelCore; +import org.eclipse.jdt.internal.corext.refactoring.Checks; import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser; import org.eclipse.jdt.ls.core.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext; import org.eclipse.jdt.ls.core.internal.corext.dom.CodeScopeBuilder; -import org.eclipse.jdt.ls.core.internal.corext.refactoring.Checks; import org.eclipse.jdt.ls.core.internal.corext.refactoring.RefactoringCoreMessages; import org.eclipse.jdt.ls.core.internal.corext.refactoring.util.ResourceUtil; import org.eclipse.jdt.ls.core.internal.corext.refactoring.util.SelectionAwareSourceRangeComputer;