Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align class loading in ClassGeneratingEntityInstantiator with ClassGeneratingPropertyAccessorFactory [DATACMNS-1373] #1809

Closed
spring-projects-issues opened this issue Aug 16, 2018 · 2 comments
Assignees
Labels
in: core Issues in core support in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Aug 16, 2018

Mark Paluch opened DATACMNS-1373 and commented

ClassGeneratingEntityInstantiator uses a child classloader to load and define generated EntityInstantiator classes so that these can be used. Using a child classloader imposes a constraint on target class visibility, specifically package-private classes. These can only be accessed by classes that reside in the same package and are loaded by the same class loader.

ClassGeneratingPropertyAccessorFactory uses ReflectUtils.defineClass(…) that allows injection of a class into the classloader that was used to load the entity class.

ReflectUtils.defineClass(…) is deprecated with JDK 9 and newer as the reflectively used methods are encapsulated and cause warnings to be logged on JDK 9.

We should at least use ReflectUtils to enable generated EntityInstantiator use for package-private types


Affects: 2.1 RC1 (Lovelace), 1.13.14 (Ingalls SR14), 2.0.9 (Kay SR9)

Issue Links:

  • SPR-17487 Illegal reflective access by ReflectionUtils

  • SPR-16391 Compatibility with JDK 11

Referenced from: pull request #308

Backported to: 2.0.10 (Kay SR10)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 16, 2018

Steven Pearce commented

Originally logged on SPR-15859, https://jira.spring.io/browse/SPR-15859?focusedCommentId=161629&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-161629

but it's Spring Data related, so am adding it here as well.

This Error was generated using Framework 5.1.0.BUILD-SNAPSHOT and Spring Data 2.1.0.RC1 with --illegal-access=debug on JDK 11.

WARNING: Illegal reflective access by org.springframework.util.ReflectionUtils ([file:/usr/local/share/apache-tomcat-9.0.10/webapps/floodlight/WEB-INF/lib/spring-core-5.1.0.BUILD-SNAPSHOT.jar|file:///usr/local/share/apache-tomcat-9.0.10/webapps/floodlight/WEB-INF/lib/spring-core-5.1.0.BUILD-SNAPSHOT.jar]) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class)WARNING: Illegal reflective access by org.springframework.util.ReflectionUtils ([file:/usr/local/share/apache-tomcat-9.0.10/webapps/floodlight/WEB-INF/lib/spring-core-5.1.0.BUILD-SNAPSHOT.jar|file:///usr/local/share/apache-tomcat-9.0.10/webapps/floodlight/WEB-INF/lib/spring-core-5.1.0.BUILD-SNAPSHOT.jar]) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class) at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:509) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor$MethodHandleLookup.getLookupConstructor(DefaultMethodInvokingMethodInterceptor.java:198) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor$MethodHandleLookup.access$100(DefaultMethodInvokingMethodInterceptor.java:86) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor$MethodHandleLookup$1.<init>(DefaultMethodInvokingMethodInterceptor.java:94) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor$MethodHandleLookup.<clinit>(DefaultMethodInvokingMethodInterceptor.java:92) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.<init>(DefaultMethodInvokingMethodInterceptor.java:45)

 

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Aug 16, 2018

Oliver Drotbohm commented

This looks related but is not actually what this ticket is trying to capture. I've created DATACMNS-1376 and moved the link to the original Spring Framework ticket there

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core support in: mapping Mapping and conversion infrastructure labels Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants