java.lang.reflect.InaccessibleObjectException when declaring dependencies to private fields from non-open modules in a bridge

Description

It seems we retrieve value handles when declaring dependencies of bridges, even though we really don't need to.

Retrieving value handles involves a call to Field.setAccessible/Method.setAccessible, which we should avoid unless we really need it. It may even fail in some cases.

For example we shouldn't retrieve the value handle when a user declares a dependency to field Enum.name in a property bridge, through .dependencies().use("name"): we don't need it, and it will fail with recent JDKs since java.lang classes (such as Enum) cannot have their access modified (they're not "open" to the application module).

Environment

None
Fixed

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Fix versions

Priority

Major
Configure