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.impl.statements.expressions.TypesUtil;
|
||||||
import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
|
import org.jetbrains.plugins.groovy.lang.psi.util.GrTraitUtil;
|
||||||
|
|
||||||
|
import static org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils.GET_PREFIX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ven
|
* @author ven
|
||||||
*/
|
*/
|
||||||
@@ -127,8 +129,14 @@ public class GrAccessorMethodImpl extends LightMethodBuilder implements GrAccess
|
|||||||
if (another == this) return true;
|
if (another == this) return true;
|
||||||
if (!(another instanceof GrAccessorMethod)) return false;
|
if (!(another instanceof GrAccessorMethod)) return false;
|
||||||
|
|
||||||
if (!((GrAccessorMethod)another).getName().equals(getName())) return false;
|
GrAccessorMethod anotherAccessor = (GrAccessorMethod)another;
|
||||||
return getManager().areElementsEquivalent(myProperty, ((GrAccessorMethod)another).getProperty());
|
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
|
@NotNull
|
||||||
|
|||||||
+3
@@ -111,6 +111,9 @@ public class GrLightVariable extends GrImplicitVariableImpl implements Navigatab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEquivalentTo(PsiElement another) {
|
public boolean isEquivalentTo(PsiElement another) {
|
||||||
|
if (another instanceof GrLightVariable) {
|
||||||
|
return myDeclarations.equals(((GrLightVariable)another).getDeclarations());
|
||||||
|
}
|
||||||
return myDeclarations.contains(another) || super.isEquivalentTo(another);
|
return myDeclarations.contains(another) || super.isEquivalentTo(another);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user