Check field signature name
This commit is contained in:
+11
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.jet.lang.resolve.java.kotlinSignature;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.util.containers.ComparatorUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptorImpl;
|
||||
@@ -48,6 +50,7 @@ public class AlternativeFieldSignatureData extends ElementAlternativeSignatureDa
|
||||
|
||||
try {
|
||||
checkForSyntaxErrors(altPropertyDeclaration);
|
||||
checkEqualNames(altPropertyDeclaration, field);
|
||||
altReturnType = computeReturnType(originalReturnType, altPropertyDeclaration.getTypeRef(),
|
||||
new HashMap<TypeParameterDescriptor, TypeParameterDescriptorImpl>());
|
||||
}
|
||||
@@ -66,4 +69,12 @@ public class AlternativeFieldSignatureData extends ElementAlternativeSignatureDa
|
||||
public String getSignature() {
|
||||
return field.getPsiField().getText();
|
||||
}
|
||||
|
||||
private static void checkEqualNames(PsiNamedElement namedElement, PsiFieldWrapper fieldWrapper) {
|
||||
if (!ComparatorUtil.equalsNullable(fieldWrapper.getName(), namedElement.getName())) {
|
||||
throw new AlternativeSignatureMismatchException(
|
||||
"Field name mismatch, original: %s, alternative: %s",
|
||||
fieldWrapper.getName(), namedElement.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user