Cannot call public methods in com.google.cloud.firestore.UpdateBuilder via reflection #3580
Labels
api: firestore
Issues related to the Firestore API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
The com.google.cloud.firestore.Transaction and WriteBatch classes are
public but they extend a package-private abstract class
UpdateBuilder. The public methods inherited from
UpdateBuilder cannot be invoked via the Java reflection API due to
long-standing bugs such as JDK-4283544.
This is a serious problem for alternative JVM languages which use
reflection to discover Java methods. For example, Clojure uses
reflection in its compiler, and it cannot invoke these methods at all.
I know at least UpdateBuilder is affected. There may be other
instances of this pattern that I haven't found.
Possible Solution
For this specific case, making UpdateBuilder public will fix the
problem. This should have no impact on other code. The class will
still not be instantiable because it is also abstract.
If there are other package-private classes extended by public API
classes, they would also need to be declared public.
Version: google-cloud-firestore-0.52.0-beta
Java: Oracle JDK 1.8.0_152
The text was updated successfully, but these errors were encountered: