Replace collection.size() > 0 with not collection.isEmpty() (DataDog/dd-trace-java#1420)
MODIFY
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/Instrumenter.java
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/Instrumenter.java
@@ -82,7 +82,7 @@ public interface Instrumenter {
instrumentationPrimaryName = instrumentationName;
enabled = Config.get().isIntegrationEnabled(instrumentationNames, defaultEnabled());
- if (contextStore().size() > 0) {
+ if (!contextStore().isEmpty()) {
contextProvider = new FieldBackedProvider(this);
} else {
contextProvider = NoopContextProvider.INSTANCE;

MODIFY
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/muzzle/MuzzleVersionScanPlugin.java
agent-tooling/src/main/java/io/opentelemetry/auto/tooling/muzzle/MuzzleVersionScanPlugin.java
@@ -181,7 +181,7 @@ public class MuzzleVersionScanPlugin {
if (ref.getSuperName() != null) {
builder.append(" extends<").append(ref.getSuperName()).append(">");
}
- if (ref.getInterfaces().size() > 0) {
+ if (!ref.getInterfaces().isEmpty()) {
builder.append(" implements ");
for (final String iface : ref.getInterfaces()) {
builder.append(" <").append(iface).append(">");

MODIFY
instrumentation/hibernate/hibernate-common/src/main/java/io/opentelemetry/auto/instrumentation/hibernate/HibernateDecorator.java
instrumentation/hibernate/hibernate-common/src/main/java/io/opentelemetry/auto/instrumentation/hibernate/HibernateDecorator.java
@@ -62,7 +62,7 @@ public class HibernateDecorator extends OrmClientDecorator {
} else if (annotations.contains("javax.persistence.Entity")) {
// We were given an instance of an entity.
name = entity.getClass().getName();
- } else if (entity instanceof List && ((List) entity).size() > 0) {
+ } else if (entity instanceof List && !((List) entity).isEmpty()) {
// We have a list of entities.
name = entityName(((List) entity).get(0));
}

Replace collection.size() > 0 with not collection.isEmpty() (DataDog/dd-trace-java#1420)