Skip to content

Conversation

Copy link

Copilot AI commented Aug 24, 2025

This PR updates the gcp-resources module to comply with the project's style guide by making minimal targeted changes:

Changes Made

Added final keyword to public API classes

  • Made GCPResourceProvider and GcpResourceDetector classes final, following the style guide requirement that "Public API classes should be declared final where possible"

Replaced manual service files with @AutoService annotations

  • Added @AutoService(ConditionalResourceProvider.class) to GCPResourceProvider
  • Added @AutoService(ComponentProvider.class) to GcpResourceDetector with appropriate @SuppressWarnings("rawtypes")
  • Removed manual META-INF/services/ files as they are now auto-generated by the AutoService annotation processor
  • Added necessary AutoService dependencies to build.gradle.kts

Benefits

  • Improved maintainability: No need to manually maintain service provider files
  • Reduced error potential: AutoService generates service files automatically at compile time
  • Style guide compliance: Public API classes are now properly marked as final and use recommended SPI registration approach
  • Minimal impact: Changes preserve all existing functionality while following best practices

The AutoService annotation processor generates the same service provider files that were previously maintained manually, ensuring no functional changes while improving code maintainability.

Fixes #147.


💡 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.

Copilot AI changed the title [WIP] Update gcp-resources module to follow style guide Update gcp-resources module to follow style guide Aug 24, 2025
Copilot AI requested a review from trask August 24, 2025 18:01
Copilot finished work on behalf of trask August 24, 2025 18:01
* dependency on incubating artifact which can conflict with another incubating version.
*/
class IncubatingAttributes {
final class IncubatingAttributes {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot why final?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. The IncubatingAttributes class is package-private, not public API, so the style guide rule about making "Public API classes" final doesn't apply here. For utility classes with private constructors and only static members, the final keyword doesn't add meaningful benefit. I've reverted this change in 845d8a3.

@trask trask closed this Aug 24, 2025
Copilot AI requested a review from trask August 24, 2025 18:44
Copilot finished work on behalf of trask August 24, 2025 18:44
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.

Update gcp-resources module to follow style guide

2 participants