Skip to content

Commit

Permalink
Changed resolution order of method signatures to begin with a method'…
Browse files Browse the repository at this point in the history
…s defined shape.
  • Loading branch information
Rafael Winterhalter committed Jul 30, 2015
1 parent 2853a4a commit 2b4a7b6
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -408,7 +408,7 @@ public String toString() {
protected static class Identifying<V extends Identifier> extends Key<V> { protected static class Identifying<V extends Identifier> extends Key<V> {


public static <Q extends Identifier> Key.Identifying<Q> of(MethodDescription methodDescription, Identifier.Factory<Q> factory) { public static <Q extends Identifier> Key.Identifying<Q> of(MethodDescription methodDescription, Identifier.Factory<Q> factory) {
return new Key.Identifying<Q>(methodDescription.getInternalName(), Collections.singleton(factory.wrap(methodDescription.asToken()))); return new Key.Identifying<Q>(methodDescription.getInternalName(), Collections.singleton(factory.wrap(methodDescription.asDefined().asToken())));
} }


protected Identifying(String internalName, V identifier) { protected Identifying(String internalName, V identifier) {
Expand All @@ -427,7 +427,7 @@ protected Key<MethodDescription.Token> asTokenKey() {
return new Key<MethodDescription.Token>(internalName, identifiers); return new Key<MethodDescription.Token>(internalName, identifiers);
} }


protected Key.Identifying<V> expandWith(MethodDescription.InDefinedShape methodDescription, Identifier.Factory<V> factory) { protected Key.Identifying<V> expandWith(MethodDescription methodDescription, Identifier.Factory<V> factory) {
Set<V> keys = new HashSet<V>(this.identifiers); Set<V> keys = new HashSet<V>(this.identifiers);
keys.add(factory.wrap(methodDescription.asToken())); keys.add(factory.wrap(methodDescription.asToken()));
return new Key.Identifying<V>(internalName, keys); return new Key.Identifying<V>(internalName, keys);
Expand Down Expand Up @@ -593,7 +593,7 @@ public Key.Identifying<U> getKey() {


@Override @Override
public Entry<U> expandWith(MethodDescription methodDescription, Identifier.Factory<U> identifierFactory) { public Entry<U> expandWith(MethodDescription methodDescription, Identifier.Factory<U> identifierFactory) {
Key.Identifying<U> key = this.key.expandWith(methodDescription.asDefined(), identifierFactory); Key.Identifying<U> key = this.key.expandWith(methodDescription, identifierFactory);
if (methodDescription.getDeclaringType().asRawType().equals(declaringType)) { if (methodDescription.getDeclaringType().asRawType().equals(declaringType)) {
return methodToken.isBridge() ^ methodDescription.isBridge() return methodToken.isBridge() ^ methodDescription.isBridge()
? methodToken.isBridge() ? new ForMethod<U>(key, methodDescription) : new Ambiguous<U>(key, declaringType, methodToken) ? methodToken.isBridge() ? new ForMethod<U>(key, methodDescription) : new Ambiguous<U>(key, declaringType, methodToken)
Expand Down Expand Up @@ -725,7 +725,7 @@ protected ForMethod(Key.Identifying<U> key, MethodDescription methodDescription,


@Override @Override
public Entry<U> expandWith(MethodDescription methodDescription, Identifier.Factory<U> identifierFactory) { public Entry<U> expandWith(MethodDescription methodDescription, Identifier.Factory<U> identifierFactory) {
Key.Identifying<U> key = this.key.expandWith(methodDescription.asDefined(), identifierFactory); Key.Identifying<U> key = this.key.expandWith(methodDescription, identifierFactory);
return methodDescription.getDeclaringType().equals(this.methodDescription.getDeclaringType()) return methodDescription.getDeclaringType().equals(this.methodDescription.getDeclaringType())
? Ambiguous.of(key, methodDescription, this.methodDescription) ? Ambiguous.of(key, methodDescription, this.methodDescription)
: new ForMethod<U>(key, methodDescription.isBridge() ? this.methodDescription : methodDescription, true); : new ForMethod<U>(key, methodDescription.isBridge() ? this.methodDescription : methodDescription, true);
Expand Down

0 comments on commit 2b4a7b6

Please sign in to comment.