Skip to content

Commit

Permalink
HV-373 Fixing executable builder to merge metadata from different pro…
Browse files Browse the repository at this point in the history
…viders for one constructor
  • Loading branch information
gunnarmorling authored and hferentschik committed Feb 18, 2013
1 parent 2650b72 commit f80fb93
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ public boolean accepts(ConstrainedElement constrainedElement) {
ExecutableElement executableElement = ( (ConstrainedExecutable) constrainedElement ).getLocation()
.getExecutableElement();

//are the locations equal (created by different builders) or
//does one of the executables override the other one?
return location.getExecutableElement()
.overrides( executableElement ) || executableElement.overrides(
location.getExecutableElement()
return
location.getExecutableElement().equals(executableElement) ||
location.getExecutableElement().overrides( executableElement ) ||
executableElement.overrides( location.getExecutableElement()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,38 @@ private <T> T[] paddedLeft(T[] src, T[] dest, T fillElement) {

return dest;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ( ( constructor == null ) ? 0 : constructor.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;
}
ConstructorElement other = (ConstructorElement) obj;
if ( constructor == null ) {
if ( other.constructor != null ) {
return false;
}
}
else if ( !constructor.equals( other.constructor ) ) {
return false;
}
return true;
}
}

private static class MethodElement extends ExecutableElement {
Expand Down Expand Up @@ -342,6 +374,38 @@ public boolean isGetterMethod() {
public String toString() {
return method.toGenericString();
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ( ( method == null ) ? 0 : method.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;
}
MethodElement other = (MethodElement) obj;
if ( method == null ) {
if ( other.method != null ) {
return false;
}
}
else if ( !method.equals( other.method ) ) {
return false;
}
return true;
}
}

/**
Expand Down

0 comments on commit f80fb93

Please sign in to comment.