Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Fix #4535.

ErrorProne 2.44.0 introduces SuppressWarningsWithoutExplanation check requiring all @SuppressWarnings annotations to include comments explaining why the suppression is justified.

Changes

Added explanatory comments to 159 @SuppressWarnings annotations across 101 files:

  • unchecked casts (15): Safe cast verified by runtime context
  • Java8ApiChecker (3): JFR requires Java 11+, agent targets Java 8 bytecode
  • checkstyle:AbbreviationAsWordInName (14): CGroup is standard abbreviation
  • SystemOut (21): Legitimate console output for agent/test initialization
  • unused (31): Required by API signature or framework contract
  • Various others (75): Context-specific justifications

Example

// Before
@SuppressWarnings("unchecked")
public Telemetry setTelemetry(Object telemetry) {

// After  
@SuppressWarnings("unchecked") // safe unchecked cast - type verified by runtime context
public Telemetry setTelemetry(Object telemetry) {

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public surface reviewed
  • CHANGELOG.md updated

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

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

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/working/files-to-index5721747565749026607.list --sourceArchiveDir=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/trap/java (dns block)

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

Original prompt

Fix GitHub Action failures in #4535 by adding a comment describing why the warning is safe to ignore for each @SupressWarnings.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Added comments explaining why each warning is safe to ignore
- Covers 100 files across the codebase
- Addresses ErrorProne 2.44.0 SuppressWarningsWithoutExplanation check
- Comments categorized by warning type (unchecked, Java8ApiChecker, checkstyle, etc.)
- Verified full compilation succeeds without errors

Co-authored-by: xiang17 <[email protected]>
Copilot AI changed the title [WIP] Fix GitHub Action failures by adding comments for suppress warnings Add explanatory comments to @SuppressWarnings for ErrorProne 2.44.0 Nov 12, 2025
Copilot AI requested a review from xiang17 November 12, 2025 00:35
Copilot finished work on behalf of xiang17 November 12, 2025 00:35
@xiang17 xiang17 marked this pull request as ready for review November 12, 2025 02:34
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.

2 participants