mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
@@ -241,7 +241,7 @@ public abstract class CacheChangeProcessor extends CacheDiffRequestProcessor<Cac
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return change.hashCode();
|
||||
return ChangeDiffRequestProducer.hashCode(change);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-1
@@ -92,7 +92,7 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer {
|
||||
public static boolean isEquals(@NotNull Change change1, @NotNull Change change2) {
|
||||
if (!Comparing.equal(ChangesUtil.getBeforePath(change1), ChangesUtil.getBeforePath(change2)) ||
|
||||
!Comparing.equal(ChangesUtil.getAfterPath(change1), ChangesUtil.getAfterPath(change2))) {
|
||||
// we use Change.hashCode(), so removing this check might violate comparison contract
|
||||
// we use file paths for hashCode, so removing this check might violate comparison contract
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,6 +123,14 @@ public class ChangeDiffRequestProducer implements DiffRequestProducer {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int hashCode(@NotNull Change change) {
|
||||
return hashCode(change.getBeforeRevision()) + 31 * hashCode(change.getAfterRevision());
|
||||
}
|
||||
|
||||
private static int hashCode(@Nullable ContentRevision revision) {
|
||||
return revision != null ? revision.getFile().hashCode() : 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ChangeDiffRequestProducer create(@Nullable Project project, @NotNull Change change) {
|
||||
return create(project, change, Collections.<Key, Object>emptyMap());
|
||||
|
||||
Reference in New Issue
Block a user