Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScalaAdapterTest is not compatible with Java 11+ #438

Closed
XiXiaPdx opened this issue Sep 15, 2021 · 2 comments
Closed

ScalaAdapterTest is not compatible with Java 11+ #438

XiXiaPdx opened this issue Sep 15, 2021 · 2 comments
Assignees
Labels
bug Something isn't working as designed/intended scala

Comments

@XiXiaPdx
Copy link
Contributor

After introducing Java 11 HttpClient instrumentation to the agent, the ScalaAdapterTest will fail for Java 11+ test runs.

The test that fails is in the newrelic-weaver-scala module. It is ScalaAdapterTest.weaveObjectTest()

Here are some lines of the stacktrace

java.lang.IllegalAccessError: Update to static final field com.nr.weave.weavepackage.language.scala.testclasses.SomeObject$.MODULE$ attempted from a different method (<init>) than the initializer method <clinit> 
	at com.nr.weave.weavepackage.language.scala.testclasses.SomeObject$.<init>(ScalaAdapterTest.scala:62)
	at com.nr.weave.weavepackage.language.scala.testclasses.SomeObject$.<clinit>(ScalaAdapterTest.scala)
	at com.nr.weave.weavepackage.language.scala.ScalaAdapterTest.weaveObjectTest(ScalaAdapterTest.scala:32)

This test fails because of this change in the Weave.Utils class. The agent now instruments the Java 11 HttpClient so the max byte code supported with Java 11+ is version 55. This causes the test to fail.

       double jvmSpecVersion = Double.valueOf(System.getProperty("java.specification.version"));
            if (jvmSpecVersion >=11) {
                return 55;
            } else if (jvmSpecVersion >= 1.8) {
                return 52;

To reproduce, run the test (assuming it has not been disabled with annotations) from the command line at the root of the project.

./gradlew :newrelic-weaver-scala:test --tests --parallel --stacktrace -Ptest11 ScalaAdapterTest

@XiXiaPdx XiXiaPdx added the bug Something isn't working as designed/intended label Sep 15, 2021
@richard-gibson richard-gibson self-assigned this Dec 17, 2021
@jasonjkeller
Copy link
Contributor

Related to: #483

@jasonjkeller
Copy link
Contributor

Related to #620

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as designed/intended scala
Projects
Archived in project
Development

No branches or pull requests

4 participants