-
Notifications
You must be signed in to change notification settings - Fork 38.5k
CGLIB does not allow packages to start with "java" #27622
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
Comments
Wouldn't the package name be
Do you have a concrete use case that results in such a crash? Also, what version of the JDK/JRE are you using? |
I mean the example was just meant to be demonstrative... Full version info for my java binary: Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing) It does work under java 11.. but yea i find it kind of odd that cglib implies these restrictions and doesn't make it clear that it does in fact not support these usecases. Example.jar and sources: |
Thanks for the feedback. It sounds like you're saying it's only a result of enforcement of strong encapsulation since JDK 16/17 -- right? And in that case, there is in fact a workaround as you've mentioned with As for the reason why CGLIB prepends |
Do you have a stack trace and/or reproducer at hand? |
@sbrannen i think the fallback method using a reflective call to ClassLoader::defineClass is a separate design issue of the CGLIB... @vlsi Hey! Can you access the google drive link I posted? It should contain a jar and sources to the sample that reproduces the exception under java 16+. |
@MuellerMP , I've never worked with maven-based spring boot project, and it would take me ages to start. Could you please share the stack trace related to |
I have to admit debugging this sort of error handling is non-trivial and using a reassignable temporary variable that is thrown somewhere else instead of using the Throwable(Throwable cause) constructor first and throwing after is very evil... =(
IMO calling Throwable::addSurpressed would be a better alternative if you really dont want to throw... |
net.sf.cglib.core.DefaultNamingPolicy
, which is also used by theSpringNamingPolicy
of the Spring Framework checks explicitly for ajava
prefix.A problem that might occur here is that someone tries to build a
javabeat.net
Spring example. This would cause a crash during any CGLIB define class due to the prepended dollar sign ($
).Wouldn't it therefore make sense to check for
java.
as a prefix instead ofjava
?The text was updated successfully, but these errors were encountered: