diff graal/com.oracle.truffle.object/src/com/oracle/truffle/object/PropertyImpl.java @ 21733:27943aac2e3c

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 04 Jun 2015 11:08:12 -0700
parents 5f3dda39d205
children
line wrap: on
line diff
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/PropertyImpl.java	Thu Jun 04 10:46:23 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/PropertyImpl.java	Thu Jun 04 11:08:12 2015 -0700
@@ -42,6 +42,8 @@
      * Generic, usual-case constructor for properties storing at least a name.
      *
      * @param key the name of the property
+     * @param location the storage location used to access the property
+     * @param flags property flags (optional)
      */
     protected PropertyImpl(Object key, Location location, int flags, boolean shadow, boolean relocatable) {
         this.key = Objects.requireNonNull(key);
@@ -67,8 +69,8 @@
 
     @Override
     public Property relocate(Location newLocation) {
-        if ((getLocation() == null || !getLocation().equals(newLocation)) && relocatable) {
-            return construct(getKey(), newLocation, getFlags());
+        if (!getLocation().equals(newLocation) && relocatable) {
+            return construct(key, newLocation, flags);
         }
         return this;
     }
@@ -163,8 +165,7 @@
         }
 
         PropertyImpl other = (PropertyImpl) obj;
-        return key.equals(other.key) && ((location == null && other.location == null) || (location != null && location.equals(other.location))) && flags == other.flags && shadow == other.shadow &&
-                        relocatable == other.relocatable;
+        return key.equals(other.key) && location.equals(other.location) && flags == other.flags && shadow == other.shadow && relocatable == other.relocatable;
     }
 
     @Override
@@ -189,7 +190,7 @@
         int result = 1;
         result = prime * result + getClass().hashCode();
         result = prime * result + key.hashCode();
-        result = prime * result + (location != null ? location.hashCode() : 0);
+        result = prime * result + location.hashCode();
         result = prime * result + flags;
         return result;
     }
@@ -240,7 +241,7 @@
 
     private Property relocateShadow(Location newLocation) {
         assert !isShadow() && getLocation() instanceof DeclaredLocation && relocatable;
-        return new PropertyImpl(getKey(), newLocation, flags, true, relocatable);
+        return new PropertyImpl(key, newLocation, flags, true, relocatable);
     }
 
     @SuppressWarnings("hiding")