Skip to content
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

Make class com.google.cloud.ServiceOptions$Builder public #1672

Merged

Conversation

rborer
Copy link

@rborer rborer commented Feb 28, 2017

Hi,

I'm trying to use BigQuery client from clojure. Due to a very old JVM bug, the class com.google.cloud.ServiceOptions$Builder need to be flagged public to make configuration methods callable from clojure (clojure uses reflection).

Due to this bug, the following piece of code throws an exception:

(-> (BigQueryOptions/newBuilder)
      (.setProjectId project-id))

=>

IllegalArgumentException Can't call public method of non-public class: public com.google.cloud.ServiceOptions$Builder com.google.cloud.ServiceOptions$Builder.setProjectId(java.lang.String) clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:88)

As replied on the corresponding StackOverflow thread there are work-arounds but they are non-trivial to implement.

Thanks in advance to consider this patch.

Cheers,
Reynald

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 28, 2017
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d590a73 on rborer:public-serviceoptions-builder into ** on GoogleCloudPlatform:master**.

@garrettjonesgoogle
Copy link
Member

This was written before I started work on this project, and I can't figure out what the advantage is of having the Builder class be protected. I guess it's an attempt to prevent people from directly holding references to the ServiceOptions$Builder type? I can't figure out what kind of mistakes or inappropriate dependencies that would prevent.

@aozarov maybe you have some insight here?

@rborer
Copy link
Author

rborer commented Feb 28, 2017

maybe the purpose here was to prevent anyone to directly create an instance of this Builder class, but given that it's abstract I cannot figure out how one would be able to achieve that ;-)

@aozarov
Copy link
Contributor

aozarov commented Feb 28, 2017

Change looks fine.

This class was "internal" as it is nasty from generics perspective and we wanted to force holding a
reference to it and using its API only via its much cleaner sub-classes. Not a big deal though.

@garrettjonesgoogle
Copy link
Member

Thanks, @aozarov !

@garrettjonesgoogle garrettjonesgoogle merged commit 461aa54 into googleapis:master Feb 28, 2017
@rborer
Copy link
Author

rborer commented Feb 28, 2017

Thanks.

github-actions bot pushed a commit that referenced this pull request Nov 3, 2022
…1021)

* chore: [java] synthtool not to create an initial gitignore.

Given that new generated libraries will come to the Java monorepo
going forward and that any new hand-written libraries can get
a new .gitignore from humans, there's no need to automatically
prepare .gitignore file.

* deleting gitignore

* deleting .gitignore from golden
Source-Link: googleapis/synthtool@0baf7e4
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:25a679b48797fcdd98fe339c885d9595a8be5c16a275d1b466ba98e6951a3217

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
suztomo pushed a commit that referenced this pull request Feb 1, 2023
…496)

* chore: [java] synthtool not to create an initial gitignore.

Given that new generated libraries will come to the Java monorepo
going forward and that any new hand-written libraries can get
a new .gitignore from humans, there's no need to automatically
prepare .gitignore file.

* deleting gitignore

* deleting .gitignore from golden
Source-Link: https://togithub.com/googleapis/synthtool/commit/0baf7e4b652fcc7bf77ec341965c62c0b67e722d
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:25a679b48797fcdd98fe339c885d9595a8be5c16a275d1b466ba98e6951a3217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants