mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] tweak isEquivalentTo() in accessors and light variables
This commit is contained in:
+10
-2
@@ -33,6 +33,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrAc
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
|
||||
|
||||
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils.GET_PREFIX;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@@ -127,8 +129,14 @@ public class GrAccessorMethodImpl extends LightMethodBuilder implements GrAccess
|
||||
if (another == this) return true;
|
||||
if (!(another instanceof GrAccessorMethod)) return false;
|
||||
|
||||
if (!((GrAccessorMethod)another).getName().equals(getName())) return false;
|
||||
return getManager().areElementsEquivalent(myProperty, ((GrAccessorMethod)another).getProperty());
|
||||
GrAccessorMethod anotherAccessor = (GrAccessorMethod)another;
|
||||
if (isSetter()) {
|
||||
if (!anotherAccessor.isSetter()) return false;
|
||||
}
|
||||
else {
|
||||
if (!getName().startsWith(GET_PREFIX) == anotherAccessor.getName().startsWith(GET_PREFIX)) return false;
|
||||
}
|
||||
return getManager().areElementsEquivalent(myProperty, anotherAccessor.getProperty());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+3
@@ -111,6 +111,9 @@ public class GrLightVariable extends GrImplicitVariableImpl implements Navigatab
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
if (another instanceof GrLightVariable) {
|
||||
return myDeclarations.equals(((GrLightVariable)another).getDeclarations());
|
||||
}
|
||||
return myDeclarations.contains(another) || super.isEquivalentTo(another);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user