Skip to content

Commit

Permalink
8288368: simplify code in ValueTaglet, remove redundant code
Browse files Browse the repository at this point in the history
Reviewed-by: prappo
  • Loading branch information
jonathan-gibbons committed Jul 21, 2022
1 parent 6346c33 commit 4c1cd66
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
Expand Up @@ -120,11 +120,7 @@ public Content getInlineTagOutput(Element holder, DocTree tag, TagletWriter writ
}
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,
Expand Down
Expand Up @@ -1419,26 +1419,6 @@ public SortedSet<TypeElement> filterOutPrivateClasses(Iterable<TypeElement> clas
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".
Expand Down

0 comments on commit 4c1cd66

Please sign in to comment.