AxonFramework / AxonFramework

Framework for Evolutionary Message-Driven Microservices on the JVM
https://axoniq.io/
Apache License 2.0
3.34k stars 794 forks source link

Validate necessity of `ReflectionUtils#ensureAccessible(T)` and `ReflectionUtils#isAccessible(AccessibleObject)` #2901

Closed smcvb closed 9 months ago

smcvb commented 11 months ago

Enhancement Description

Axon Framework's ReflectionUtils has two methods that aren't ideal in the world of JDK17+. Namely:

  1. ReflectionUtils#ensureAccessible(T), and
  2. ReflectionUtils#isAccessible(AccessibleObject)

We need to investigate how we will go without these methods entirely to comply with Java's adjustments.

Current Behaviour

The methods ReflectionUtils#ensureAccessible(T) and ReflectionUtils#isAccessible(AccessibleObject) are present and used throughout Axon Framework.

Wanted Behaviour

Another approach is to keep providing a similar integration level without using ReflectionUtils#ensureAccessible(T) and ReflectionUtils#isAccessible(AccessibleObject).

Possible Workarounds

Unclear at this stage.

abuijze commented 9 months ago

I have done some digging. The deprecation has to do with the fact that the JDK will no longer include a SecurityManager. This means that operations to make methods accessible don't need to make use of the AccessController anymore.

abuijze commented 9 months ago

Making the methods accessible for reflection is still required and will not need to undergo any structural changes.