diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java index 0d3d8da0ccf4..ac7803c9dc63 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,12 +31,12 @@ public class VFilePropertyChangeEvent extends VFileEvent { private final Object myOldValue; private final Object myNewValue; - public VFilePropertyChangeEvent(final Object requestor, - @NotNull final VirtualFile file, - @NotNull final String propertyName, - final Object oldValue, - final Object newValue, - final boolean isFromRefresh) { + public VFilePropertyChangeEvent(Object requestor, + @NotNull VirtualFile file, + @NotNull String propertyName, + @Nullable Object oldValue, + @Nullable Object newValue, + boolean isFromRefresh) { super(requestor, isFromRefresh); myFile = file; myPropertyName = propertyName; @@ -63,12 +63,6 @@ public class VFilePropertyChangeEvent extends VFileEvent { return myPropertyName; } - @NotNull - @NonNls - public String toString() { - return "VfsEvent[property( " + myPropertyName + ") changed for '" + myFile + "': oldValue = " + myOldValue + ", newValue = " + myNewValue + "]"; - } - @Override public String getPath() { return myFile.getPath(); @@ -85,26 +79,34 @@ public class VFilePropertyChangeEvent extends VFileEvent { return myFile.isValid(); } - public boolean equals(@Nullable final Object o) { + @Override + public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - final VFilePropertyChangeEvent event = (VFilePropertyChangeEvent)o; + VFilePropertyChangeEvent event = (VFilePropertyChangeEvent)o; if (!myFile.equals(event.myFile)) return false; - if (!myNewValue.equals(event.myNewValue)) return false; - if (!myOldValue.equals(event.myOldValue)) return false; + if (myNewValue != null ? !myNewValue.equals(event.myNewValue) : event.myNewValue != null) return false; + if (myOldValue != null ? !myOldValue.equals(event.myOldValue) : event.myOldValue != null) return false; if (!myPropertyName.equals(event.myPropertyName)) return false; return true; } + @Override public int hashCode() { - int result; - result = myFile.hashCode(); + int result = myFile.hashCode(); result = 31 * result + myPropertyName.hashCode(); - result = 31 * result + myOldValue.hashCode(); - result = 31 * result + myNewValue.hashCode(); + result = 31 * result + (myOldValue != null ? myOldValue.hashCode() : 0); + result = 31 * result + (myNewValue != null ? myNewValue.hashCode() : 0); return result; } + + @NotNull + @NonNls + public String toString() { + return "VfsEvent[property(" + myPropertyName + ") changed for '" + myFile + "':" + + " oldValue = " + myOldValue + ", newValue = " + myNewValue + "]"; + } }