8288368: simplify code in ValueTaglet, remove redundant code

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2022-07-21 16:26:52 +00:00
parent 6346c3338c
commit 4c1cd66d22
2 changed files with 1 additions and 25 deletions

View File

@ -120,11 +120,7 @@ public class ValueTaglet extends BaseTaglet {
}
return writer.valueTagOutput(field,
text,
// TODO: investigate and cleanup
// in the j.l.m world, equals will not be accurate
// !field.equals(tag.holder())
!utils.elementsEqual(field, holder)
);
!field.equals(holder));
} else {
//Referenced field is not a constant.
messages.warning(holder,

View File

@ -1419,26 +1419,6 @@ public class Utils {
return filteredOutClasses;
}
/**
* Compares two elements.
* @param e1 first Element
* @param e2 second Element
* @return a true if they are the same, false otherwise.
*/
public boolean elementsEqual(Element e1, Element e2) {
if (e1.getKind() != e2.getKind()) {
return false;
}
String s1 = getSimpleName(e1);
String s2 = getSimpleName(e2);
if (compareStrings(s1, s2) == 0) {
String f1 = getFullyQualifiedName(e1, true);
String f2 = getFullyQualifiedName(e2, true);
return compareStrings(f1, f2) == 0;
}
return false;
}
/**
* A general purpose case insensitive String comparator, which compares
* two Strings using a Collator strength of "TERTIARY".