Ensuring annotation processor finds the correct async client method

This commit is contained in:
Adam Lowe 2012-03-28 14:34:15 +01:00
parent fc782dd7ee
commit ffeaa2feb8
1 changed files with 6 additions and 6 deletions

View File

@ -348,7 +348,7 @@ public class RestAnnotationProcessor<T> {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((declaringPackage == null) ? 0 : declaringPackage.hashCode()); result = prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + parametersTypeHashCode; result = prime * result + parametersTypeHashCode;
return result; return result;
@ -363,10 +363,10 @@ public class RestAnnotationProcessor<T> {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
MethodKey other = (MethodKey) obj; MethodKey other = (MethodKey) obj;
if (declaringPackage == null) { if (declaringClass == null) {
if (other.declaringPackage != null) if (other.declaringClass != null)
return false; return false;
} else if (!declaringPackage.equals(other.declaringPackage)) } else if (!declaringClass.equals(other.declaringClass))
return false; return false;
if (name == null) { if (name == null) {
if (other.name != null) if (other.name != null)
@ -380,11 +380,11 @@ public class RestAnnotationProcessor<T> {
private final String name; private final String name;
private final int parametersTypeHashCode; private final int parametersTypeHashCode;
private final Package declaringPackage; private final Class declaringClass;
public MethodKey(Method method) { public MethodKey(Method method) {
this.name = method.getName(); this.name = method.getName();
this.declaringPackage = method.getDeclaringClass().getPackage(); this.declaringClass = method.getDeclaringClass();
int parametersTypeHashCode = 0; int parametersTypeHashCode = 0;
for (Class<?> param : method.getParameterTypes()) for (Class<?> param : method.getParameterTypes())
parametersTypeHashCode += param.hashCode(); parametersTypeHashCode += param.hashCode();