This commit is contained in:
Manu Sridharan 2017-04-16 16:56:28 -07:00
parent 5ecbba95ff
commit 0c424e12b3
2 changed files with 34 additions and 2 deletions

View File

@ -127,12 +127,15 @@ public class Annotation {
return sb.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(unnamedArguments);
result = prime * result + ((namedArguments == null) ? 0 : namedArguments.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + Arrays.hashCode(unnamedArguments);
return result;
}
@ -145,13 +148,18 @@ public class Annotation {
if (getClass() != obj.getClass())
return false;
Annotation other = (Annotation) obj;
if (!Arrays.equals(unnamedArguments, other.unnamedArguments))
if (namedArguments == null) {
if (other.namedArguments != null)
return false;
} else if (!namedArguments.equals(other.namedArguments))
return false;
if (type == null) {
if (other.type != null)
return false;
} else if (!type.equals(other.type))
return false;
if (!Arrays.equals(unnamedArguments, other.unnamedArguments))
return false;
return true;
}

View File

@ -100,6 +100,30 @@ public class AnnotationsReader extends AttributeReader {
return String.valueOf(val);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((val == null) ? 0 : val.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ConstantElementValue other = (ConstantElementValue) obj;
if (val == null) {
if (other.val != null)
return false;
} else if (!val.equals(other.val))
return false;
return true;
}
}
/**