Skip to content

Commit 539cba3

Browse files
authored
Code review sweep (run 25098914929) (#18406)
Co-authored-by: otelbot <197425009+otelbot@users.noreply.github.com>
1 parent 8b4f89d commit 539cba3

10 files changed

Lines changed: 57 additions & 62 deletions

File tree

instrumentation/wicket-8.0/wicket8-testing/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ dependencies {
66
library("org.apache.wicket:wicket:8.0.0")
77

88
testImplementation(project(":instrumentation:wicket-8.0:common-testing"))
9-
testImplementation("org.jsoup:jsoup:1.13.1")
109
testImplementation("org.eclipse.jetty:jetty-server:8.0.0.v20110901")
1110
testImplementation("org.eclipse.jetty:jetty-servlet:8.0.0.v20110901")
1211

instrumentation/xxl-job/xxl-job-1.9.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/xxljob/v1_9_2/XxlJobSingletons.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class XxlJobSingletons {
2020
XxlJobHelper.create(
2121
instrumenter,
2222
object -> {
23-
if (object != null && (object instanceof ReturnT)) {
23+
if (object instanceof ReturnT) {
2424
ReturnT<?> result = (ReturnT<?>) object;
2525
return result.getCode() == ReturnT.FAIL_CODE;
2626
}

instrumentation/xxl-job/xxl-job-2.3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/xxljob/v2_3_0/XxlJobTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,21 @@ class XxlJobTest extends AbstractXxlJobTest {
3030
METHOD_JOB_HANDLER_INIT_METHOD,
3131
METHOD_JOB_HANDLER_DESTROY_METHOD);
3232

33-
private static final IJobHandler groovyHandler;
33+
private static final IJobHandler groovyHandler = createGroovyHandler();
34+
private static final GlueJobHandler glueJobHandler =
35+
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
36+
private static final ScriptJobHandler scriptJobHandler =
37+
new ScriptJobHandler(
38+
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);
3439

35-
static {
40+
private static IJobHandler createGroovyHandler() {
3641
try {
37-
groovyHandler = GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
42+
return GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
3843
} catch (Exception e) {
3944
throw new RuntimeException(e);
4045
}
4146
}
4247

43-
private static final GlueJobHandler glueJobHandler =
44-
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
45-
46-
private static final ScriptJobHandler scriptJobHandler =
47-
new ScriptJobHandler(
48-
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);
49-
5048
@Override
5149
protected String getPackageName() {
5250
return "io.opentelemetry.javaagent.instrumentation.xxljob.v2_3_0";

instrumentation/xxl-job/xxl-job-2.3.0/javaagent/src/xxlJob33Test/java/io/opentelemetry/javaagent/instrumentation/xxljob/v3_3_0/ReflectiveMethodsFactory.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@
1010

1111
class ReflectiveMethodsFactory {
1212

13-
private ReflectiveMethodsFactory() {}
14-
15-
public static class ReflectObject {
16-
17-
private ReflectObject() {}
18-
19-
public void initMethod() {}
20-
21-
public void destroyMethod() {}
22-
23-
public Response<String> echo(String param) {
24-
Response<String> result = new Response<>();
25-
result.setData("echo: " + param);
26-
return result;
27-
}
28-
}
29-
3013
private static final Object singletonObject = new ReflectObject();
3114

3215
static Object getTarget() {
@@ -52,4 +35,21 @@ private static Method getRequiredMethod(String name, Class<?>... parameterTypes)
5235
throw new IllegalStateException("Failed to resolve reflective method: " + name, e);
5336
}
5437
}
38+
39+
private ReflectiveMethodsFactory() {}
40+
41+
public static class ReflectObject {
42+
43+
private ReflectObject() {}
44+
45+
public void initMethod() {}
46+
47+
public void destroyMethod() {}
48+
49+
public Response<String> echo(String param) {
50+
Response<String> result = new Response<>();
51+
result.setData("echo: " + param);
52+
return result;
53+
}
54+
}
5555
}

instrumentation/xxl-job/xxl-job-2.3.0/javaagent/src/xxlJob33Test/java/io/opentelemetry/javaagent/instrumentation/xxljob/v3_3_0/XxlJobTest.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,21 @@ class XxlJobTest extends AbstractXxlJobTest {
2828
ReflectiveMethodsFactory.getInitMethod(),
2929
ReflectiveMethodsFactory.getDestroyMethod());
3030

31-
private static final IJobHandler groovyHandler;
31+
private static final IJobHandler groovyHandler = createGroovyHandler();
32+
private static final GlueJobHandler glueJobHandler =
33+
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
34+
private static final ScriptJobHandler scriptJobHandler =
35+
new ScriptJobHandler(
36+
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);
3237

33-
static {
38+
private static IJobHandler createGroovyHandler() {
3439
try {
35-
groovyHandler = GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
40+
return GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
3641
} catch (Exception e) {
3742
throw new IllegalStateException(e);
3843
}
3944
}
4045

41-
private static final GlueJobHandler glueJobHandler =
42-
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
43-
44-
private static final ScriptJobHandler scriptJobHandler =
45-
new ScriptJobHandler(
46-
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);
47-
4846
@Override
4947
protected String getPackageName() {
5048
return "io.opentelemetry.javaagent.instrumentation.xxljob.v3_3_0";

instrumentation/xxl-job/xxl-job-common/testing/src/main/java/io/opentelemetry/instrumentation/xxljob/ExperimentalTestHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
import javax.annotation.Nullable;
99

1010
class ExperimentalTestHelper {
11-
private static final boolean isEnabled =
11+
private static final boolean EXPERIMENTAL_ATTRIBUTES =
1212
Boolean.getBoolean("otel.instrumentation.xxl-job.experimental-span-attributes");
1313

1414
@Nullable
1515
static <T> T experimental(T value) {
16-
if (isEnabled) {
16+
if (EXPERIMENTAL_ATTRIBUTES) {
1717
return value;
1818
}
1919
return null;

instrumentation/xxl-job/xxl-job-common/testing/src/main/java/io/opentelemetry/instrumentation/xxljob/ReflectiveMethodsFactory.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@
1111

1212
class ReflectiveMethodsFactory {
1313

14-
private ReflectiveMethodsFactory() {}
15-
16-
public static class ReflectObject {
17-
18-
private ReflectObject() {}
19-
20-
public void initMethod() {}
21-
22-
public void destroyMethod() {}
23-
24-
public ReturnT<String> echo(String param) {
25-
ReturnT<String> result = new ReturnT<>();
26-
result.setContent("echo: " + param);
27-
return result;
28-
}
29-
}
30-
3114
private static final Object singletonObject = new ReflectObject();
3215

3316
static Object getTarget() {
@@ -60,4 +43,21 @@ static Method getDestroyMethod() {
6043
return null;
6144
}
6245
}
46+
47+
private ReflectiveMethodsFactory() {}
48+
49+
public static class ReflectObject {
50+
51+
private ReflectObject() {}
52+
53+
public void initMethod() {}
54+
55+
public void destroyMethod() {}
56+
57+
public ReturnT<String> echo(String param) {
58+
ReturnT<String> result = new ReturnT<>();
59+
result.setContent("echo: " + param);
60+
return result;
61+
}
62+
}
6363
}

instrumentation/xxl-job/xxl-job-common/testing/src/main/java/io/opentelemetry/instrumentation/xxljob/XxlJobTestingConstants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
public class XxlJobTestingConstants {
1212

13-
private XxlJobTestingConstants() {}
14-
1513
public static final String GLUE_JOB_SHELL_SCRIPT = "echo 'hello'";
1614

1715
public static final long DEFAULT_GLUE_UPDATE_TIME = System.currentTimeMillis();
@@ -47,4 +45,6 @@ private XxlJobTestingConstants() {}
4745
+ " void execute() throws Exception {\n"
4846
+ " }\n"
4947
+ "}\n";
48+
49+
private XxlJobTestingConstants() {}
5050
}

instrumentation/zio/zio-2.0/javaagent/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies {
3333
}
3434

3535
tasks {
36-
withType<Test>().configureEach {
36+
test {
3737
jvmArgs("-Dio.opentelemetry.javaagent.shaded.io.opentelemetry.context.enableStrictContext=false")
3838
}
3939
}

instrumentation/zio/zio-http-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/ziohttp/v3_0/RoutePatternInstrumentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void transform(TypeTransformer transformer) {
3232
}
3333

3434
@SuppressWarnings("unused")
35-
public static final class CreateRouteAdvice {
35+
public static class CreateRouteAdvice {
3636

3737
@Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
3838
@Advice.AssignReturned.ToArguments(@ToArgument(0))

0 commit comments

Comments
 (0)