Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 2, 2025

This PR fixes build failures that occur when updating ErrorProne from version 2.36.0 to 2.38.0, as attempted in PR #4188.

Problem

The ErrorProne 2.38.0 update introduced several breaking changes:

  1. Invalid checker name: Java7ApiChecker is no longer recognized, causing compilation failures
  2. New checks with warnings: Several new checks introduced in versions 2.37.0 and 2.38.0 flag existing code patterns, causing build failures due to -Werror

Solution

Updated the ErrorProne configuration in buildSrc/src/main/kotlin/ai.errorprone-conventions.gradle.kts to:

  1. Remove invalid checker: Removed disable("Java7ApiChecker") as this check no longer exists
  2. Disable new checks from 2.37.0: Added disable("TimeInStaticInitializer")
  3. Disable new checks from 2.38.0: Added disable("AddNullMarkedToPackageInfo") and disable("IntLiteralCast")
  4. Disable checks flagging existing code: Added disable("EnumOrdinal")

Changes Made

  • Updated dependencyManagement/build.gradle.kts to use ErrorProne 2.38.0
  • Modified ErrorProne configuration to disable incompatible/unwanted checks
  • No source code changes required

Testing

  • ✅ All compilation tasks pass with ErrorProne 2.38.0
  • ✅ Test compilation works correctly
  • ✅ Core modules build successfully
  • ✅ Existing functionality preserved

This enables the ErrorProne dependency update while maintaining build stability and code quality standards.

Fixes #4256.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Build failures updating to latest errorprone Fix ErrorProne 2.38.0 build failures by updating checker configuration Jul 2, 2025
Copilot finished work on behalf of trask July 2, 2025 02:28
Copilot AI requested a review from trask July 2, 2025 02:28
@trask
Copy link
Member

trask commented Jul 2, 2025

instead of disabling IntLiteralCast, fix the issues

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

instead of disabling IntLiteralCast, fix the issues

Fixed the IntLiteralCast violations instead of disabling the check. Replaced 8 instances of (float) number casts with float literals like 80.0f and 20.0f as suggested by ErrorProne. All builds now pass without IntLiteralCast errors. (000558e)

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 123.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java -Dorg.gradle.internal.worker.tmpdir=/home/REDACTED/work/ApplicationInsights-Java/ApplicationInsights-Java/agent/agent-tooling/build/tmp/test/work @/home/REDACTED/.gradle/.tmp/gradle-worker-classpath1213887945858317728txt -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -ea worker.org.gradle.process.internal.worker.GradleWorkerMain 'Gradle Test Executor 2' (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of trask July 2, 2025 03:03
@trask
Copy link
Member

trask commented Jul 2, 2025

Fix the other checks as well instead of disabling them

Fix each check in its own commit so that I can decide later if I want to keep the fix or disable the check

Copy link
Contributor Author

Copilot AI commented Jul 2, 2025

Fix the other checks as well instead of disabling them

Fix each check in its own commit so that I can decide later if I want to keep the fix or disable the check

Fixed all the ErrorProne checks as requested, with separate commits for each:

TimeInStaticInitializer fix (ebfcbc7): Moved time-dependent code out of static initializer in MockedProfilerSettingsServlet.java to dynamic method generation

EnumOrdinal fix (7dbf8c2): Replaced SeverityLevel.values()[index] with explicit enum mapping using switch statements in TraceTelemetry.java and ExceptionTelemetry.java

AddNullMarkedToPackageInfo: Kept disabled due to Java 8 compatibility - JSpecify 1.0.0 uses Java 9+ features that cause compilation errors with the project's release.set(8) target

All ErrorProne checks now pass and builds are successful.

Copilot finished work on behalf of trask July 2, 2025 03:45
@trask
Copy link
Member

trask commented Jul 7, 2025

@copilot rebase

Copy link
Contributor Author

Copilot AI commented Jul 7, 2025

@copilot rebase

Branch has been successfully rebased onto the latest main branch. (26d9f73)

Copilot finished work on behalf of trask July 7, 2025 15:54
@trask trask force-pushed the copilot/fix-4256 branch from 26d9f73 to 1fe1cde Compare July 7, 2025 17:44
@trask
Copy link
Member

trask commented Jul 7, 2025

Use @SuppressWarnings for instead for TimeInStaticInitializer and EnumOrdinal

Copy link
Contributor Author

Copilot AI commented Jul 7, 2025

Use @SuppressWarnings for instead for TimeInStaticInitializer and EnumOrdinal

Used @SuppressWarnings annotations instead of code fixes as requested. TimeInStaticInitializer suppressed at class level for MockedProfilerSettingsServlet, and EnumOrdinal suppressed at method level for TraceTelemetry and ExceptionTelemetry. All builds pass with ErrorProne 2.38.0. (260ca3a)

Copilot finished work on behalf of trask July 7, 2025 19:55
Copilot AI requested a review from trask July 7, 2025 20:25
Copilot finished work on behalf of trask July 7, 2025 20:25
@trask trask force-pushed the copilot/fix-4256 branch from eb027e2 to ce8dc10 Compare July 8, 2025 03:26
Copilot AI requested a review from trask July 8, 2025 17:37
Copilot finished work on behalf of trask July 8, 2025 17:37
@trask trask marked this pull request as ready for review July 8, 2025 19:07
@trask trask merged commit 4cf74ca into main Jul 9, 2025
143 checks passed
@trask trask deleted the copilot/fix-4256 branch July 9, 2025 14:08
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.

Build failures updating to latest errorprone

3 participants