Skip to content

Commit 6b2c4ca

Browse files
committed
Inline sole use of internalNames method
1 parent 1994443 commit 6b2c4ca

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

class-match/src/main/java/datadog/instrument/classmatch/InternalMatchers.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ static Predicate<String[]> declaresAnnotation(String name) {
3131

3232
/** Matches when at least one annotation has one of the given names. */
3333
static Predicate<String[]> declaresAnnotationOneOf(Collection<String> names) {
34-
Set<String> internalNames = internalNames(names);
34+
Set<String> internalNames = new HashSet<>((int) (names.size() / 0.75f) + 1);
35+
for (String name : names) {
36+
internalNames.add(internalName(name));
37+
}
3538
// note these annotations are of interest when parsing
3639
ClassFile.annotationsOfInterest(internalNames);
3740
// performance tip: capture this method-ref outside the lambda
@@ -145,15 +148,6 @@ static String internalName(String name) {
145148
return name.replace('.', '/');
146149
}
147150

148-
/** Returns the internal forms of the given names. */
149-
static Set<String> internalNames(Collection<String> names) {
150-
Set<String> internalNames = new HashSet<>((int) (names.size() / 0.75f) + 1);
151-
for (String name : names) {
152-
internalNames.add(internalName(name));
153-
}
154-
return internalNames;
155-
}
156-
157151
/** Returns {@code true} if at least one of the candidates matches. */
158152
static <T> boolean anyMatch(T[] candidates, Predicate<T> matcher) {
159153
for (T c : candidates) {

0 commit comments

Comments
 (0)