Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions utils/src/main/java/datadog/instrument/utils/ClassNameTrie.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public final class ClassNameTrie {
* @return the number the class-name maps to; {@code -1} if not mapped
*/
public int apply(String key) {
return apply(trieData, longJumps, key);
return apply(trieData, longJumps, key, 0);
}

/**
Expand All @@ -143,18 +143,6 @@ public int apply(String key, int fromIndex) {
return apply(trieData, longJumps, key, fromIndex);
}

/**
* Returns the number in the given trie the class-name maps to.
*
* @param data the encoded trie data
* @param longJumps the long-jumps table
* @param key the class-name key
* @return the number the class-name maps to; {@code -1} if not mapped
*/
public static int apply(char[] data, int[] longJumps, String key) {
return apply(data, longJumps, key, 0);
}

/**
* Returns the number in the given trie the class-name maps to.
*
Expand Down Expand Up @@ -291,11 +279,6 @@ public static ClassNameTrie readFrom(DataInput in) throws IOException {
/** Builds an in-memory trie that represents a mapping of {class-name} to {number}. */
public static class Builder {

/**
* @deprecated use {@link ClassNameTrie#EMPTY_TRIE} instead.
*/
@Deprecated public static final ClassNameTrie EMPTY_TRIE = ClassNameTrie.EMPTY_TRIE;

private static final Pattern MAPPING_LINE = Pattern.compile("^\\s*(?:([0-9]+)\\s+)?([^\\s#]+)");

private char[] trieData;
Expand Down Expand Up @@ -334,7 +317,7 @@ public boolean isEmpty() {
* @return the number the class-name maps to; {@code -1} if not mapped
*/
public int apply(String key) {
return trieLength > 0 ? ClassNameTrie.apply(trieData, longJumps, key) : -1;
return trieLength > 0 ? ClassNameTrie.apply(trieData, longJumps, key, 0) : -1;
}

/**
Expand Down Expand Up @@ -935,9 +918,9 @@ private static void generateJavaFile(
lines.add("");
lines.add(" public static int apply(String key) {");
if (hasLongJumps) {
lines.add(" return ClassNameTrie.apply(TRIE_DATA, LONG_JUMPS, key);");
lines.add(" return ClassNameTrie.apply(TRIE_DATA, LONG_JUMPS, key, 0);");
} else {
lines.add(" return ClassNameTrie.apply(TRIE_DATA, null, key);");
lines.add(" return ClassNameTrie.apply(TRIE_DATA, null, key, 0);");
}
lines.add(" }");
lines.add("");
Expand Down
Loading