Skip to content

Commit

Permalink
Make the tests pass
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
robstryker committed Dec 5, 2023
1 parent 6b7bb3e commit d4e4bd1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*******************************************************************************/
package org.eclipse.jdt.ls.core.internal.corext.refactoring.rename;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
Expand All @@ -26,6 +27,8 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.refactoring.descriptors.RenameJavaElementDescriptor;
import org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationRefactoringChange;
import org.eclipse.jdt.internal.corext.refactoring.changes.RenameCompilationUnitChange;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.MethodChecks;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor;
Expand All @@ -40,6 +43,8 @@
import org.eclipse.jdt.internal.corext.refactoring.tagging.INameUpdating;
import org.eclipse.jdt.internal.corext.refactoring.tagging.IReferenceUpdating;
import org.eclipse.jdt.internal.corext.refactoring.tagging.ITextUpdating;
import org.eclipse.jdt.internal.corext.refactoring.util.TextChangeManager;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
Expand Down Expand Up @@ -286,7 +291,17 @@ public static RenameSupport create(ICompilationUnit unit, String newName, int fl
* the {@link RenameSupport}.
*/
public static RenameSupport create(IType type, String newName, int flags) throws CoreException {
JavaRenameProcessor processor = new RenameTypeProcessor(type);
JavaRenameProcessor processor = new RenameTypeProcessor(type) {
@Override
protected void createChangeForRenamedCUStandardResource(IType type, TextChangeManager changeManager, IResource resource, DynamicValidationRefactoringChange result) throws CoreException {
addTypeDeclarationUpdate(changeManager);
addConstructorRenames(changeManager);
result.addAll(changeManager.getAllChanges());
String renamedCUName = JavaModelUtil.getRenamedCUName(type.getCompilationUnit(), getNewElementName());
result.add(new RenameCompilationUnitChange(type.getCompilationUnit(), renamedCUName));
}

};
return new RenameSupport(processor, newName, flags);
}

Expand All @@ -305,7 +320,14 @@ public static RenameSupport create(IType type, String newName, int flags) throws
public static RenameSupport create(IMethod method, String newName, int flags) throws CoreException {
JavaRenameProcessor processor;
if (MethodChecks.isVirtual(method)) {
processor= new RenameVirtualMethodProcessor(method);
processor = new RenameVirtualMethodProcessor(method) {
@Override
protected void initializeWithTopMostImplementation(IMethod topmost) {
String newName = getNewElementName();
initialize(topmost);
setNewElementName(newName);
}
};
} else {
processor= new RenameNonVirtualMethodProcessor(method);
}
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/>
<unit id="org.mockito.mockito-core" version="0.0.0"/>
<unit id="org.apache.commons.commons-io" version="0.0.0"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.31-I-builds/I20231130-0550/"/>
<repository location="https://download.eclipse.org/eclipse/updates/4.31-I-builds/I20231203-1800/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.xtext.xbase.lib" version="0.0.0"/>
Expand Down

0 comments on commit d4e4bd1

Please sign in to comment.