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

Polish ClassLoaderLimiter #42974

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
public final class ClassLoaderLimiter implements ClassLoaderEventListener {

//Store which classloader (by name) has loaded each resource as it helps diagnostics
private final ConcurrentMap<String, String> atMostOnceResourcesLoaded = new ConcurrentHashMap();
private final ConcurrentMap<String, String> allResourcesLoaded = new ConcurrentHashMap();
private final ConcurrentMap<String, String> atMostOnceResourcesLoaded = new ConcurrentHashMap<>();
private final ConcurrentMap<String, String> allResourcesLoaded = new ConcurrentHashMap<>();

private final Set<String> vetoedResources;
private final Set<String> vetoedClasses;
Expand Down Expand Up @@ -96,7 +96,7 @@ private Builder() {
* List a resource name as one that you don't expect to be loaded ever.
* If there is an attempt of loading the matched resource, a runtime exception will be thrown instead:
* useful for running integration tests to verify your assumptions.
*
* <p>
* Limitations: if the resource is being loaded using the bootstrap classloader we
* can't check it; some frameworks explicitly request using the base classloader
* for resource loading (or even use the Filesystem API), so they can't be tested via this method.
Expand All @@ -122,10 +122,10 @@ public Builder neverLoadedResource(String resourceFullName) {
* List a fully qualified class name as one that you don't expect to be loaded ever.
* If there is an attempt of loading the matched class, a runtime exception will be thrown instead:
* useful for running integration tests to verify your assumptions.
*
* <p>
* DO NOT list the name by doing using <code>literal.class.getName()</code> as this will implicitly get you
* to load the class during the test, and produce a failure.
*
* <p>
* Limitations: if the class is being loaded using the bootstrap classloader we
* can't check it. Most Quarkus extensions and frameworks will not use the bootstrap classloader,
* but some code could make use of it explicitly.
Expand All @@ -146,10 +146,10 @@ public Builder neverLoadedClassName(String vetoedClassName) {
* List a fully qualified class name as one that you don't expect to be loaded at runtime.
* If there is an attempt of loading the matched class, a runtime exception will be thrown instead:
* useful for running integration tests to verify your assumptions.
*
* <p>
* DO NOT list the name by doing using <code>literal.class.getName()</code> as this will implicitly get you
* to load the class during the test, and produce a failure.
*
* <p>
* Limitations: if the class is being loaded using the bootstrap classloader we
* can't check it. Most Quarkus extensions and frameworks will not use the bootstrap classloader,
* but some code could make use of it explicitly.
Expand All @@ -170,7 +170,7 @@ public Builder neverLoadedRuntimeClassName(String vetoedClassName) {
* Useful to check that a resource is being loaded only once, or never.
* If there is an attempt of loading the matched resource more than once, a runtime exception will be thrown instead:
* useful for running integration tests to verify your assumptions.
*
* <p>
* Limitations: if the resource is being loaded using the bootstrap classloader we
* can't check it; some frameworks explicitly request using the base classloader
* for resource loading (or even use the Filesystem API), so they can't be tested via this method.
Expand Down
Loading