mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure Value parameter of an index has proper equals and hashcode
This commit is contained in:
@@ -75,4 +75,24 @@ public class PsiJavaFileStubImpl extends PsiFileStubImpl<PsiJavaFile> implements
|
||||
public String toString() {
|
||||
return "PsiJavaFileStub [" + myPackageName + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
PsiJavaFileStubImpl stub = (PsiJavaFileStubImpl)o;
|
||||
|
||||
if (myCompiled != stub.myCompiled) return false;
|
||||
if (myPackageName != null ? !myPackageName.equals(stub.myPackageName) : stub.myPackageName != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = myPackageName != null ? myPackageName.hashCode() : 0;
|
||||
result = 31 * result + (myCompiled ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+23
-1
@@ -105,7 +105,7 @@ public class GroovyTraitFieldsFileIndex
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return 3;
|
||||
return 4;
|
||||
}
|
||||
|
||||
private static Collection<TraitFieldDescriptor> index(FileContent inputData) {
|
||||
@@ -212,5 +212,27 @@ public class GroovyTraitFieldsFileIndex
|
||||
this.typeString = typeString;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
TraitFieldDescriptor that = (TraitFieldDescriptor)o;
|
||||
|
||||
if (flags != that.flags) return false;
|
||||
if (!typeString.equals(that.typeString)) return false;
|
||||
if (!name.equals(that.name)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (int)flags;
|
||||
result = 31 * result + typeString.hashCode();
|
||||
result = 31 * result + name.hashCode();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -76,7 +76,7 @@ public class GroovyTraitMethodsFileIndex extends SingleEntryFileBasedIndexExtens
|
||||
|
||||
@Override
|
||||
public int getVersion() {
|
||||
return ClassFileStubBuilder.STUB_VERSION;
|
||||
return ClassFileStubBuilder.STUB_VERSION + 1;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user