Ignore:
Timestamp:
2014-05-18T15:47:10+02:00 (10 years ago)
Author:
Don-vip
Message:

fix compilation warnings with JDK8 - equals() and hashcode() must be overriden in pairs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSRule.java

    r7138 r7140  
    99/**
    1010 * A MapCSS rule.
    11  * 
     11 *
    1212 * A MapCSS style is simply a list of MapCSS rules. Each rule has a selector
    1313 * and a declaration. Whenever the selector matches the primitive, the
     
    2828            this.idx = idx;
    2929        }
    30        
     30
    3131        /**
    3232         * <p>Executes the instructions against the environment {@code env}</p>
     
    3939            }
    4040        }
     41
     42        @Override
     43        public int hashCode() {
     44            final int prime = 31;
     45            int result = 1;
     46            result = prime * result + idx;
     47            result = prime * result + ((instructions == null) ? 0 : instructions.hashCode());
     48            return result;
     49        }
     50
     51        @Override
     52        public boolean equals(Object obj) {
     53            if (this == obj)
     54                return true;
     55            if (obj == null)
     56                return false;
     57            if (!(obj instanceof Declaration))
     58                return false;
     59            Declaration other = (Declaration) obj;
     60            if (idx != other.idx)
     61                return false;
     62            if (instructions == null) {
     63                if (other.instructions != null)
     64                    return false;
     65            } else if (!instructions.equals(other.instructions))
     66                return false;
     67            return true;
     68        }
    4169    }
    42    
     70
    4371    public MapCSSRule(Selector selector, Declaration declaration) {
    4472        this.selector = selector;
Note: See TracChangeset for help on using the changeset viewer.