fix: remove unnecessary slf4j and AbstractGoogleClientRequest native image configs #2628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For #2600
Background for removing these to configs:
(1) Build time initialization of SLF4J's LoggerFactory class
The configuration was added in googleapis/java-core#685 to address the following failure in java-bigquerystorage:
However, since this change to initialize netty 4 at run-time, this configuration has no longer been needed. Verified locally that running
mvn clean test -Dtest=com.google.cloud.bigquery.storage.v1beta2.it.ITBigQueryStorageTest -Pnative -Dsurefire.failIfNoSpecifiedTests=false
in java-bigquerystorage without the build-time initialization oforg.slf4j.LoggerFactory
doesn't result in the failure documented above.(2) Run time initialization of
AbstractGoogleClientRequest$ApiClientVersion
The second change addresses the concern in #2600 (comment):
Another item I'm not sure is really needed. This only makes sense if types initialized at build time create instances of ApiClientVersion, but I don't see how that'd be the case
.This configurations was added in 2021 (GoogleCloudPlatform/native-image-support-java#83) when Substitute annotation was used to customize headers. As the name suggests, this feature is used to substitute in existing classes/methods with new classes/methods at native image generation. There have been a few known cases in the past with build time initializations of target classes in substitutions which may have required the configuration. However, in googleapis/gax-java#1678, the use of Substitutions was removed and as shown by this experiment the chosen alternative approach to modify the headers worked as expected without needing an explicit run time initialization of
AbstractGoogleClientRequest$ApiClientVersion
.This PR removes the obsolete configuration.