mirror of
https://github.com/revanced/smali.git
synced 2025-05-02 15:44:30 +02:00
Fix implementation of equals for BaseTypeReference
This fixes the implementation so it matches what is described in the documentation for the TypeReference interface. Specifically, it allows for comparison to a CharSequence
This commit is contained in:
parent
36b6a31685
commit
dda097947f
@ -43,8 +43,13 @@ public abstract class BaseTypeReference implements TypeReference {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o != null && o instanceof TypeReference) {
|
||||
return getType().equals(((TypeReference)o).getType());
|
||||
if (o != null) {
|
||||
if (o instanceof TypeReference) {
|
||||
return getType().equals(((TypeReference)o).getType());
|
||||
}
|
||||
if (o instanceof CharSequence) {
|
||||
return getType().equals(o.toString());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public interface TypeReference extends Reference, CharSequence, Comparable<CharS
|
||||
/**
|
||||
* Compares this TypeReference to another TypeReference, or more generally to another CharSequence for equality.
|
||||
*
|
||||
* This TypeReference is equal to a CharSequence iff this.getType().equals(other.getString()).
|
||||
* This TypeReference is equal to a CharSequence iff this.getType().equals(other.toString()).
|
||||
*
|
||||
* Equivalently, This TypeReference is equal to another TypeReference iff this.getType().equals(other.getType()).
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user