Skip to content

Incomplete shading in google-cloud-nio leads to downstream breakage #5127

@droazen

Description

@droazen

The shaded release of google-cloud-nio (we are currently on release 0.81.0-alpha:shaded) does not shade all of its dependencies. In particular, classes in google-cloud-core-* (such as google-cloud-core-http) are not being shaded.

As a result, we run into problems such as this one: com.google.cloud.http.HttpTransportOptions is not itself shaded, but its method getHttpTransportFactory() returns an instance of a shaded class shaded.cloud_nio.com.google.auth.http.HttpTransportFactory, which calling code from outside the library cannot handle. This results in the error below:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.cloud.http.HttpTransportOptions.getHttpTransportFactory()Lcom/google/auth/http/HttpTransportFactory;
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.<init>(HttpBigQueryRpc.java:89)
	at com.google.cloud.bigquery.BigQueryOptions$DefaultBigQueryRpcFactory.create(BigQueryOptions.java:56)
	at com.google.cloud.bigquery.BigQueryOptions$DefaultBigQueryRpcFactory.create(BigQueryOptions.java:50)
	at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:510)
	at com.google.cloud.bigquery.BigQueryOptions.getBigQueryRpcV2(BigQueryOptions.java:123)
	at com.google.cloud.bigquery.BigQueryImpl.<init>(BigQueryImpl.java:150)
	at com.google.cloud.bigquery.BigQueryOptions$DefaultBigQueryFactory.create(BigQueryOptions.java:46)
	at com.google.cloud.bigquery.BigQueryOptions$DefaultBigQueryFactory.create(BigQueryOptions.java:40)
	at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:498)
	at org.broadinstitute.hellbender.tools.examples.ExampleBigQueryReader.traverse(ExampleBigQueryReader.java:108)
	at org.broadinstitute.hellbender.engine.GATKTool.doWork(GATKTool.java:984)
	at org.broadinstitute.hellbender.cmdline.CommandLineProgram.runTool(CommandLineProgram.java:139)
	at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMainPostParseArgs(CommandLineProgram.java:191)
	at org.broadinstitute.hellbender.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:210)
	at org.broadinstitute.hellbender.Main.runCommandLineProgram(Main.java:162)
	at org.broadinstitute.hellbender.Main.mainEntry(Main.java:205)

Would it be possible to shade these classes from google-cloud-core-* in the shaded google-cloud-nio jar?

Metadata

Metadata

Labels

dependenciespriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions