Skip to content

Commit

Permalink
Invokable no longer inherits from `java.lang.reflect.AccessibleObje…
Browse files Browse the repository at this point in the history
…ct`.

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
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed May 24, 2021
1 parent 10f1853 commit 12af215
Show file tree
Hide file tree
Showing 8 changed files with 686 additions and 870 deletions.
247 changes: 0 additions & 247 deletions android/guava-tests/test/com/google/common/reflect/ElementTest.java

This file was deleted.

Loading

0 comments on commit 12af215

Please sign in to comment.