-
Couldn't load subscription status.
- Fork 1
Update maven-extension module to follow style guide #167
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
Conversation
…de compliance Co-authored-by: trask <[email protected]>
…e handler configuration Co-authored-by: trask <[email protected]>
| @AutoService(MojoGoalExecutionHandler.class) | ||
| public final class SpringBootBuildImageHandler implements MojoGoalExecutionHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes on lines 36-37 implement the style guide requirements for SPI registration:
- Line 36: Added
@AutoService(MojoGoalExecutionHandler.class)to automatically generate the META-INF/services file, eliminating manual service file maintenance - Line 37: Changed from
final classtopublic final classbecause ServiceLoader requires implementation classes to be public for instantiation
This follows the established pattern used throughout the OpenTelemetry Java Contrib codebase and modernizes the SPI registration approach as outlined in the style guide.
| final class SnykTestHandler implements MojoGoalExecutionHandler { | ||
| @AutoService(MojoGoalExecutionHandler.class) | ||
| public final class SnykTestHandler implements MojoGoalExecutionHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes on lines 19-21 implement the style guide requirements for SPI registration:
- Line 8: Added
import com.google.auto.service.AutoService; - Line 20: Added
@AutoService(MojoGoalExecutionHandler.class)to automatically generate the META-INF/services file, eliminating manual service file maintenance - Line 21: Changed from
final classtopublic final classbecause ServiceLoader requires implementation classes to be public for instantiation
This follows the same pattern applied to all other MojoGoalExecutionHandler implementations and modernizes the SPI registration approach as outlined in the style guide.
| final class SnykMonitorHandler implements MojoGoalExecutionHandler { | ||
| @AutoService(MojoGoalExecutionHandler.class) | ||
| public final class SnykMonitorHandler implements MojoGoalExecutionHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot why this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes on lines 19-21 implement the style guide requirements for SPI registration:
- Line 8: Added
import com.google.auto.service.AutoService; - Line 20: Added
@AutoService(MojoGoalExecutionHandler.class)to automatically generate the META-INF/services file, eliminating manual service file maintenance - Line 21: Changed from
final classtopublic final classbecause ServiceLoader requires implementation classes to be public for instantiation
This follows the same pattern applied to all other MojoGoalExecutionHandler implementations and modernizes the SPI registration approach as outlined in the style guide.
This PR updates the maven-extension module to comply with the style guide requirements outlined in
docs/style-guide.md.Changes Made
@autoservice Migration
@AutoServiceannotations to all SPI implementations:MavenResourceProvider(implementsResourceProvider)MavenResourceDetector(implementsComponentProvider<Resource>)MojoGoalExecutionHandlerimplementations (GoogleJibBuildHandler,MavenDeployHandler,SnykMonitorHandler,SnykTestHandler,SpringBootBuildImageHandler)META-INF/servicesfiles as they are now auto-generated by@AutoServiceMojoGoalExecutionHandlerConfigurationto rely solely onServiceLoaderinstead of manual handler instantiationpublicas required byServiceLoaderTest Visibility Updates
publicto package-protected visibilitypublicto package-protected visibilityDependency Updates
com.google.auto.service:auto-serviceasannotationProcessor,compileOnly, andtestImplementationdependencyBenefits
This change modernizes the SPI registration approach by:
META-INF/servicesfilesAll existing functionality is preserved while the code now follows the project's style guide requirements.
Fixes #163.
💡 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.