mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Custom hashCode() implementation semantically identical to Object.hashCode(). This one is much faster since Object.hashCode() is native JNI call.
This commit is contained in:
@@ -23,6 +23,10 @@ public abstract class OrderEntryBaseImpl extends RootModelComponentBase implemen
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.OrderEntryVeryBaseImpl");
|
||||
|
||||
private int myIndex;
|
||||
private static int _hc = 0;
|
||||
|
||||
@SuppressWarnings({"AssignmentToStaticFieldFromInstanceMethod"})
|
||||
private final int hc = _hc++;
|
||||
|
||||
protected OrderEntryBaseImpl(RootModelImpl rootModel) {
|
||||
super(rootModel);
|
||||
@@ -40,4 +44,15 @@ public abstract class OrderEntryBaseImpl extends RootModelComponentBase implemen
|
||||
boolean sameType(OrderEntry that) {
|
||||
return getClass().equals(that.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"EqualsWhichDoesntCheckParameterClass"})
|
||||
public boolean equals(Object obj) {
|
||||
return obj == this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hc;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user