Skip to content

Commit 12af215

Browse files
eamonnmcmanusGoogle Java Core Libraries
authored and
Google Java Core Libraries
committed
Invokable no longer inherits from java.lang.reflect.AccessibleObject.
There was no strong reason for this inheritance. Additionally, it is an accident that `AccessibleObject` is subclassable at all outside its class; its constructor is `protected` but should really have been package-private. That's an API mistake that was made in Java 1.2 and is hard to correct now, but the protected constructor is [being deprecated](openjdk/jdk#4133). (My related rant from 15 years ago is [here](https://www.artima.com/weblogs/viewpost.jsp?thread=164042).) `Invokable` also no longer implements `GenericDeclaration`. `Invokable` does continue to provide instance methods with the same signatures as the ones inherited from `AccessibleObject` and `GenericDeclaration`, as they stood in Java 8. This change is technically a breaking API change. In principle users could have assigned an instance of `Invokable` to a variable of type `AccessibleObject`. No code does that in Google's giant code base so it seems unlikely in practice. (In fact we only have a couple of dozen uses of `Invokable` overall.) Also, this API is `@Beta` so a hypothetical-but-very-unlikely breakage is acceptable. RELNOTES=`Invokable` no longer inherits from `AccessibleObject` or `GenericDeclaration`, though it continues to define instance methods with the same signatures as the formerly-inherited ones. This is technically a breaking API change to this `@Beta` API. We think it very unlikely that anyone is affected in practice. PiperOrigin-RevId: 375566405
1 parent 10f1853 commit 12af215

File tree

8 files changed

+686
-870
lines changed

8 files changed

+686
-870
lines changed

android/guava-tests/test/com/google/common/reflect/ElementTest.java

-247
This file was deleted.

0 commit comments

Comments
 (0)