bitstorm commented on code in PR #1722:
URL: https://github.com/apache/wicket/pull/1722#discussion_r4390240308
##########
wicket-ioc/src/main/java/org/apache/wicket/proxy/bytebuddy/ByteBuddyProxyFactory.java:
##########
@@ -147,6 +147,37 @@ private static ClassLoadingStrategy<ClassLoader>
resolveLoadingStrategy(Class<?>
}
}
+ /**
+ * Resolves the class loader the proxy class for the given type is
defined in. It is also the
+ * class loader the proxy class is cached for.
+ * <p>
+ * Unless the type is a <em>java.**</em> one (see
+ * {@link #resolveLoadingStrategy(Class)}), the proxy class is defined
by lookup in the class
+ * loader of the proxied type, no matter which class loader the current
thread resolves. The
+ * cache has to be keyed on that same class loader: if it was keyed on
the class loader of the
+ * current thread, another thread (e.g. a servlet container request
thread, whose context class
+ * loader differs from the one of the thread that initialized the
application) would miss the
+ * cached class and try to define it a second time in the class loader
of the type, failing with
+ * a {@link LinkageError} (duplicate class definition).
+ *
+ * @param type
+ * the type to proxy
+ * @return the class loader the proxy class is defined in and cached for
+ */
+ private static ClassLoader resolveClassLoader(Class<?> type)
Review Comment:
Hi,
some packages like java.sql or java.net.http are loaded in the platform
class loader, not every java.* lives in the bootstrap ClassLoader. So the check
should stay in place.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]