Skip to content

Fix Illegal Access Error #2334

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

Merged
merged 4 commits into from
Apr 25, 2025
Merged

Fix Illegal Access Error #2334

merged 4 commits into from
Apr 25, 2025

Conversation

kanderson250
Copy link
Contributor

Resolves #2290

This PR resolves the Illegal Access Error that has plagued environments using the agent with Scala 2.12 and JDK 11.

The fix is to avoid bumping class file versions to the runtime version, as the agent does normally, for apps that have Scala 2.12 in the environment. Since Scala 2.12 is not always detectable by the agent (we check the system classloader for this - notably, sbt will load Scala classes into custom Scala loaders), there is also a feature flag to manually enable the fix via system property -Dnewrelic.config.class_transformer.illegal_access_fix=true.

I added an AIT for the IllegalAccessError. The branch for that is here with AITs run results here.

@codecov-commenter
Copy link

codecov-commenter commented Apr 24, 2025

Codecov Report

Attention: Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.

Project coverage is 70.48%. Comparing base (a0d08e3) to head (17766ec).

Files with missing lines Patch % Lines
...main/java/com/newrelic/weave/utils/WeaveUtils.java 42.85% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2334      +/-   ##
============================================
- Coverage     70.58%   70.48%   -0.10%     
+ Complexity    10042    10025      -17     
============================================
  Files           844      844              
  Lines         40750    40627     -123     
  Branches       6191     6160      -31     
============================================
- Hits          28762    28637     -125     
+ Misses         9210     9201       -9     
- Partials       2778     2789      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kanderson250 kanderson250 merged commit 82e6c1a into main Apr 25, 2025
113 checks passed
@kanderson250 kanderson250 deleted the class-version-patch-212 branch April 25, 2025 20:52
@github-project-automation github-project-automation bot moved this from Triage to Code Complete/Done in Java Engineering Board Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Fix IllegalAccessError for Scala 2.12
4 participants