Class loading issue due to the usage of ReflectHelper#classForName()

Description

I stumbled upon this issue while trying to create a test with the BytecodeEnhancerRunner: the class loader set via AvailableSettings.CLASSLOADERS were not consistently applied throughout the code base.

At least the usage in EntityType#determineAssociatedEntityClass() is a real issue as I ended up being unable to execute a JPQL query as the returnedClass was not using the same class loader as the class I passed as a parameter.

Some usage are unfortunately in things that could be considered API (at least the package name does not indicate it's an internal class) so not really sure what to do about it. See the usage in OptimizerFactory for instance.

Not sure either what to do with ClassTypeDescriptor .

Environment

None

Assignee

Unassigned

Reporter

Guillaume Smet

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure