Skip to content

[HotFix] Fix R8 failures due to missing SourceLines annotation in 3.12.0#3642

Merged
abrooksv merged 2 commits into
release/3.12.0from
abrooks/disable-javac-injection-hotfix
Jul 15, 2026
Merged

[HotFix] Fix R8 failures due to missing SourceLines annotation in 3.12.0#3642
abrooksv merged 2 commits into
release/3.12.0from
abrooks/disable-javac-injection-hotfix

Conversation

@abrooksv

Copy link
Copy Markdown
Contributor

Same as #3641, but targeting the release branch

What does this PR do?

In CI, we monitor tests and our build via dd-trace-java. The issue is that for java compile tasks, they inject a javac plugin that adds in a SourceLines and SourcePath annotation. The issue is that this injected annotation is not in our runtime dependencies, so R8 will fail due to the missing annotation

Ramification for us is that our tests in the Test Optimization product may have their line numbers not as accurate due to the standard method line number table only tracks executable lines, so it won't include comments or method declaration in the UI.

Verification

Ran locally with org.gradle.jvmargs=-Xmx4096m -javaagent:/tmp/dd-tracer-repro/dd-java-agent.jar=dd.env=ci,dd.trace.enabled=false,dd.jmx.fetch.enabled=false,dd.trace.debug=true,dd.trace.startup.logs=true

> Task :dd-sdk-android-internal:compileReleaseKotlin

> Task :dd-sdk-android-internal:compileReleaseJavaWithJavac
Dependency verification has been disabled.
Dependency verification has been disabled.
Dependency verification has been disabled.
DatadogCompilerPlugin initialized

> Task :dd-sdk-android-internal:apiBuild

--- 
mkdir -p /tmp/core-aar-check && unzip -p /tmp/dd-sdk-android-3120-repro/dd-sdk-android-core/build/outputs/aar/dd-sdk-android-core-release.aar classes.jar > /tmp/core-aar-check/classes.jar && javap -v -p -classpath /tmp/core-aar-check/classes.jar com.datadog.android.BuildConfig | grep -i "SourceLines\|SourcePath" -A2
  #48 = Utf8               Ldatadog/compiler/annotations/SourceLines;
  #49 = Utf8               start
  #50 = Integer            6
--
  #53 = Utf8               Ldatadog/compiler/annotations/SourcePath;
  #54 = Utf8               value
  #55 = Utf8               /private/tmp/dd-sdk-android-3120-repro/dd-sdk-android-core/build/generated/source/buildConfig/release/com/datadog/android/BuildConfig.java
--
    datadog.compiler.annotations.SourceLines(
      start=6
      end=18
--
    datadog.compiler.annotations.SourcePath(
      value="/private/tmp/dd-sdk-android-3120-repro/dd-sdk-android-core/build/generated/source/buildConfig/release/com/datadog/android/BuildConfig.java"
    )

With proposed fix locally: org.gradle.jvmargs=-Xmx4096m -javaagent:/tmp/dd-tracer-repro/dd-java-agent.jar=dd.env=ci,dd.trace.enabled=false,dd.jmx.fetch.enabled=false,dd.civisibility.compiler.plugin.auto.configuration.enabled=false

mkdir -p /tmp/core-aar-check2 && unzip -p /tmp/dd-sdk-android-3120-repro/dd-sdk-android-core/build/outputs/aar/dd-sdk-android-core-release.aar classes.jar > /tmp/core-aar-check2/classes.jar && (javap -v -p -classpath /tmp/core-aar-check2/classes.jar com.datadog.android.BuildConfig | grep -i "SourceLines\|SourcePath" || echo "not found")

not found

Motivation

Fixes #3639

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

abrooksv added 2 commits July 15, 2026 13:05
In CI, we monitor tests and our build via dd-trace-java. The issue is that for java compile tasks, they inject a javac plugin that adds in a SourceLines and SourcePath annotation. The issue is that this injected annotation is not in our runtime dependencies, so R8 will fail due to the missing annotation
@abrooksv
abrooksv requested review from a team as code owners July 15, 2026 20:06
@abrooksv
abrooksv changed the base branch from develop to release/3.12.0 July 15, 2026 20:07
@abrooksv abrooksv changed the title Abrooks/disable javac injection hotfix Fix R8 failures due to missing SourceLines annotation in 3.12.0 Jul 15, 2026
@abrooksv abrooksv changed the title Fix R8 failures due to missing SourceLines annotation in 3.12.0 [HotFix] Fix R8 failures due to missing SourceLines annotation in 3.12.0 Jul 15, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.33%. Comparing base (3d3ca81) to head (9fb0461).

Additional details and impacted files
@@                Coverage Diff                 @@
##           release/3.12.0    #3642      +/-   ##
==================================================
- Coverage           73.45%   73.33%   -0.12%     
==================================================
  Files                 995      995              
  Lines               36258    36293      +35     
  Branches             6125     6126       +1     
==================================================
- Hits                26631    26614      -17     
- Misses               7949     7968      +19     
- Partials             1678     1711      +33     

see 39 files with indirect coverage changes

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

@abrooksv
abrooksv merged commit baeb2aa into release/3.12.0 Jul 15, 2026
26 of 27 checks passed
@abrooksv
abrooksv deleted the abrooks/disable-javac-injection-hotfix branch July 15, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing classes causing R8 to fail on release builds

4 participants