Only call setAccessible() when member is not accessible

Description

Currently setAccessible() is called for all fields/properties/constructors, also in cases where it isn't needed (the members are public and accessible by ORM). Checking upfront will require users on Java 9 to not open up their entity packages towards ORM, but only to export them.

See the discussion at http://lists.jboss.org/pipermail/hibernate-dev/2017-December/016899.html

Environment

None

Status

Assignee

Unassigned

Reporter

Gunnar Morling

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major