Skip to content

Commit

Permalink
8253879: Simplify redundant code in IndexBuilder
Browse files Browse the repository at this point in the history
Reviewed-by: ksrini
  • Loading branch information
jonathan-gibbons committed Oct 2, 2020
1 parent dffe9db commit 87d77eb
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -165,7 +165,7 @@ private void indexElements(Iterable<? extends Element> elements, TypeElement typ
String name = utils.getSimpleName(element);
Character ch = keyCharacter(name);
SortedSet<IndexItem> set = indexMap.computeIfAbsent(ch, c -> new TreeSet<>(comparator));
set.add(new IndexItem(element, typeElement, configuration.utils));
set.add(new IndexItem(element, typeElement, utils));
}
}
}
Expand All @@ -181,7 +181,7 @@ private void indexTypeElements(Iterable<TypeElement> elements) {
String name = utils.getSimpleName(typeElement);
Character ch = keyCharacter(name);
SortedSet<IndexItem> set = indexMap.computeIfAbsent(ch, c -> new TreeSet<>(comparator));
set.add(new IndexItem(typeElement, configuration.utils));
set.add(new IndexItem(typeElement, utils));
}
}
}
Expand All @@ -197,7 +197,7 @@ private void indexModules() {
for (ModuleElement m : configuration.modules) {
Character ch = keyCharacter(m.getQualifiedName().toString());
SortedSet<IndexItem> set = indexMap.computeIfAbsent(ch, c -> new TreeSet<>(comparator));
set.add(new IndexItem(m, configuration.utils));
set.add(new IndexItem(m, utils));
}
}

Expand All @@ -210,7 +210,7 @@ private void indexPackage(PackageElement packageElement) {
if (shouldIndex(packageElement)) {
Character ch = keyCharacter(utils.getPackageName(packageElement));
SortedSet<IndexItem> set = indexMap.computeIfAbsent(ch, c -> new TreeSet<>(comparator));
set.add(new IndexItem(packageElement, configuration.utils));
set.add(new IndexItem(packageElement, utils));
}
}

Expand All @@ -225,14 +225,14 @@ private boolean shouldIndex(Element element) {
if (utils.isPackage(element)) {
// Do not add to index map if -nodeprecated option is set and the
// package is marked as deprecated.
return !(noDeprecated && configuration.utils.isDeprecated(element));
return !(noDeprecated && utils.isDeprecated(element));
} else {
// Do not add to index map if -nodeprecated option is set and if the
// element is marked as deprecated or the containing package is marked as
// deprecated.
return !(noDeprecated &&
(configuration.utils.isDeprecated(element) ||
configuration.utils.isDeprecated(utils.containingPackage(element))));
(utils.isDeprecated(element) ||
utils.isDeprecated(utils.containingPackage(element))));
}
}

Expand Down

1 comment on commit 87d77eb

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on 87d77eb Oct 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.