Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import javax.annotation.Nullable;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
Expand Down Expand Up @@ -244,11 +245,12 @@ static final class InjectGlue implements ClassFileTransformer {
}

@Override
@Nullable
public byte[] transform(
ClassLoader loader,
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
@Nullable ClassLoader loader,
@Nullable String className,
@Nullable Class<?> classBeingRedefined,
@Nullable ProtectionDomain protectionDomain,
byte[] bytecode) {
if (targetClass.equals(className)) {
ClassReader cr = new ClassReader(bytecode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.CheckForNull;

/**
* Parses <a href="https://docs.oracle.com/javase/specs/jvms/se24/html/jvms-4.html">class-file</a>
Expand Down Expand Up @@ -518,7 +519,7 @@ public int hashCode() {
}

@Override
public boolean equals(Object obj) {
public boolean equals(@CheckForNull Object obj) {
if (obj instanceof UtfKey) {
UtfKey other = (UtfKey) obj;
if (len == other.len) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.NoSuchElementException;
import javax.annotation.Nullable;

/**
* Immutable set of internal names using linear probing. A parallel array of cached hashes lets
Expand Down Expand Up @@ -90,7 +91,7 @@ private static int hash(int hashCode) {
// ----------------------------------------------------------------------------------------------

@Override
public boolean contains(Object o) {
public boolean contains(@Nullable Object o) {
return o instanceof CharSequence && containsType((CharSequence) o);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package datadog.instrument.classmatch;

import javax.annotation.CheckForNull;

/**
* Provides {@link String}-like access to type-strings inside method and field descriptors without
* allocating a completely separate {@link String}. Hashes are precomputed because type-strings are
Expand Down Expand Up @@ -70,7 +72,7 @@ public int hashCode() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof CharSequence) {
CharSequence cs = (CharSequence) o;
if (len != cs.length()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.function.Function;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;

/**
Expand Down Expand Up @@ -349,7 +350,7 @@ public int hashCode() {

@Override
@SuppressFBWarnings("Eq") // symmetric because it mirrors LookupKey.equals
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof LookupKey) {
LookupKey lookupKey = (LookupKey) o;
return storeId == lookupKey.storeId && get() == lookupKey.key;
Expand Down Expand Up @@ -402,7 +403,7 @@ public int hashCode() {

@Override
@SuppressFBWarnings("Eq") // symmetric because it mirrors StoreKey.equals
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof StoreKey) {
StoreKey storeKey = (StoreKey) o;
return storeId == storeKey.storeId && key == storeKey.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import java.util.Arrays;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.CheckForNull;

/**
* Shares class information from multiple classloaders in a single cache.
Expand Down Expand Up @@ -266,7 +267,7 @@ public int hashCode() {
}

@Override
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof SharedInfo) {
// shared class information is indexed by class-name
return className.equals(((SharedInfo) o).className);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.CheckForNull;

/**
* Reference key used to weakly associate a class-loader with a computed value.
Expand Down Expand Up @@ -69,7 +70,7 @@ public int hashCode() {

@Override
@SuppressFBWarnings("Eq") // symmetric because it mirrors LookupKey.equals
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof LookupKey) {
return get() == ((LookupKey) o).cl;
} else if (o instanceof ClassLoaderKey) {
Expand All @@ -96,7 +97,7 @@ public int hashCode() {

@Override
@SuppressFBWarnings("Eq") // symmetric because it mirrors ClassLoaderKey.equals
public boolean equals(Object o) {
public boolean equals(@CheckForNull Object o) {
if (o instanceof ClassLoaderKey) {
return cl == ((ClassLoaderKey) o).get();
} else if (o instanceof LookupKey) {
Expand Down