use of com.intellij.refactoring.changeSignature.ParameterInfoImpl in project intellij-community by JetBrains.
the class IntroduceParameterObjectTest method doTestExistingClass.
private void doTestExistingClass(final String existingClassName, final String existingClassPackage, final boolean generateAccessors, final String newVisibility, final Function<PsiMethod, ParameterInfoImpl[]> function) throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
if (aClass == null) {
aClass = myJavaFacade.findClass("p2.Test", GlobalSearchScope.projectScope(getProject()));
}
assertNotNull("Class Test not found", aClass);
final PsiMethod method = aClass.findMethodsByName("foo", false)[0];
final ParameterInfoImpl[] mergedParams = function.fun(method);
final JavaIntroduceParameterObjectClassDescriptor classDescriptor = new JavaIntroduceParameterObjectClassDescriptor(existingClassName, existingClassPackage, null, true, false, newVisibility, mergedParams, method, generateAccessors);
final List<ParameterInfoImpl> parameters = new JavaMethodDescriptor(method).getParameters();
IntroduceParameterObjectProcessor processor = new IntroduceParameterObjectProcessor<>(method, classDescriptor, parameters, false);
processor.run();
LocalFileSystem.getInstance().refresh(false);
FileDocumentManager.getInstance().saveAllDocuments();
});
}
use of com.intellij.refactoring.changeSignature.ParameterInfoImpl in project intellij-community by JetBrains.
the class IntroduceParameterObjectTest method testCopyJavadoc1.
public void testCopyJavadoc1() throws Exception {
doTest(false, true, method -> {
final PsiParameter[] parameters = method.getParameterList().getParameters();
final ParameterInfoImpl[] datas = new ParameterInfoImpl[parameters.length - 1];
for (int i = 0; i < parameters.length - 1; i++) {
PsiParameter parameter = parameters[i];
datas[i] = new ParameterInfoImpl(i, parameter.getName(), parameter.getType());
}
return datas;
});
}
use of com.intellij.refactoring.changeSignature.ParameterInfoImpl in project intellij-community by JetBrains.
the class IntroduceParameterObjectTest method testTypeParametersWithChosenSubtype.
public void testTypeParametersWithChosenSubtype() throws Exception {
doTest(false, true, psiMethod -> {
final PsiParameter parameter = psiMethod.getParameterList().getParameters()[0];
final PsiClass collectionClass = getJavaFacade().findClass(CommonClassNames.JAVA_UTIL_COLLECTION);
final ParameterInfoImpl variableData = new ParameterInfoImpl(0, parameter.getName(), JavaPsiFacade.getElementFactory(getProject()).createType(collectionClass));
return new ParameterInfoImpl[] { variableData };
});
}
use of com.intellij.refactoring.changeSignature.ParameterInfoImpl in project intellij-community by JetBrains.
the class ChangeSignaturePropagationTest method generateParameterInfos.
private static ParameterInfoImpl[] generateParameterInfos(PsiMethod method, ParameterInfoImpl[] newParameters) {
final PsiParameter[] parameters = method.getParameterList().getParameters();
ParameterInfoImpl[] result = new ParameterInfoImpl[parameters.length + newParameters.length];
for (int i = 0; i < parameters.length; i++) {
result[i] = new ParameterInfoImpl(i);
}
System.arraycopy(newParameters, 0, result, parameters.length, newParameters.length);
return result;
}
use of com.intellij.refactoring.changeSignature.ParameterInfoImpl in project intellij-community by JetBrains.
the class ChangeSignatureTest method testDuplicatedSignatureInInheritor.
public void testDuplicatedSignatureInInheritor() throws Exception {
try {
doTest(null, new ParameterInfoImpl[] { new ParameterInfoImpl(-1, "i", PsiType.INT) }, true);
fail("Conflict expected");
} catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) {
}
}
Aggregations