mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
equals of PropertyGroup node shouldn't depend on PsiType (EA-99891 - INRE: FileBasedIndexImpl.handleDumbMode)
plus cleanup, remove test-only code
This commit is contained in:
@@ -26,7 +26,6 @@ import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PropertyUtil;
|
||||
@@ -40,8 +39,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class PropertyGroup implements Group, ColoredItemPresentation, AccessLevelProvider, WeighedItem {
|
||||
private final String myPropertyName;
|
||||
private final SmartTypePointer myPropertyType;
|
||||
@NotNull private final String myPropertyName;
|
||||
@NotNull private final String myTypeText;
|
||||
|
||||
private SmartPsiElementPointer myFieldPointer;
|
||||
private SmartPsiElementPointer myGetterPointer;
|
||||
@@ -56,9 +55,9 @@ public class PropertyGroup implements Group, ColoredItemPresentation, AccessLeve
|
||||
private final Project myProject;
|
||||
private final Collection<TreeElement> myChildren = new ArrayList<>();
|
||||
|
||||
private PropertyGroup(String propertyName, PsiType propertyType, boolean isStatic, @NotNull Project project) {
|
||||
private PropertyGroup(@NotNull String propertyName, @NotNull PsiType propertyType, boolean isStatic, @NotNull Project project) {
|
||||
myPropertyName = propertyName;
|
||||
myPropertyType = SmartTypePointerManager.getInstance(project).createSmartTypePointer(propertyType);
|
||||
myTypeText = propertyType.getPresentableText();
|
||||
myIsStatic = isStatic;
|
||||
myProject = project;
|
||||
}
|
||||
@@ -143,8 +142,7 @@ public class PropertyGroup implements Group, ColoredItemPresentation, AccessLeve
|
||||
|
||||
@Override
|
||||
public String getPresentableText() {
|
||||
final PsiType type = getPropertyType();
|
||||
return myPropertyName + (type != null ? ": " + type.getPresentableText() : "");
|
||||
return myPropertyName + ": " + myTypeText;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
@@ -156,32 +154,11 @@ public class PropertyGroup implements Group, ColoredItemPresentation, AccessLeve
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PropertyGroup)) return false;
|
||||
|
||||
final PropertyGroup propertyGroup = (PropertyGroup)o;
|
||||
|
||||
if (myPropertyName != null ? !myPropertyName.equals(propertyGroup.myPropertyName) : propertyGroup.myPropertyName != null) return false;
|
||||
|
||||
final PsiType propertyType = getPropertyType();
|
||||
final PsiType otherPropertyType = propertyGroup.getPropertyType();
|
||||
|
||||
if (!Comparing.equal(propertyType, otherPropertyType)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return myPropertyName.equals(((PropertyGroup)o).myPropertyName) && myTypeText.equals(((PropertyGroup)o).myTypeText);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return myPropertyName != null ? myPropertyName.hashCode() : 0;
|
||||
}
|
||||
|
||||
public String getGetterName() {
|
||||
return PropertyUtil.suggestGetterName(myPropertyName, getPropertyType());
|
||||
}
|
||||
|
||||
private PsiType getPropertyType() {
|
||||
if (myPropertyType == null) {
|
||||
return null;
|
||||
}
|
||||
return myPropertyType.getType();
|
||||
return myPropertyName.hashCode() * 31 + myTypeText.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user