Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ASM AnnotationCollector uses the parent thread's context classloader. #16

Merged
merged 1 commit into from

2 participants

@UrsKR
Collaborator

That way, it should be able to load all classes discovered by the StartupModule.

Note that there seems to be a threading problem in the ASM scanner: Sometimes it picked up my module twice - but never when I had breakpoints enabled to reproduce the problem. I doubt this is connected to the change, though.

@UrsKR UrsKR ASM AnnotationCollector uses the parent thread's context classloader.
That way, it should be able to load all classes discovered by the StartupModule.
74c2655
@UrsKR
Collaborator

This also fixes the problem regarding the sonatype scanner I mention to @manzke.
That one doesn't suffer from threading-trouble.

@manzke manzke merged commit 69e891f into manzke:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 5, 2012
  1. @UrsKR

    ASM AnnotationCollector uses the parent thread's context classloader.

    UrsKR authored
    That way, it should be able to load all classes discovered by the StartupModule.
This page is out of date. Refresh to see the latest.
View
2  scanner/asm/src/main/java/de/devsurf/injection/guice/scanner/asm/AnnotationCollector.java
@@ -118,7 +118,7 @@ public AnnotationVisitor visitAnnotation(String sig, boolean visible) {
String annotationClassStr = sig.replace('/', '.').substring(1, sig.length() - 1);
if (_class == null) {
try {
- _class = getClass().getClassLoader().loadClass(_name);
+ _class = Thread.currentThread().getContextClassLoader().loadClass(_name);
} catch (ClassNotFoundException e) {
_logger.log(Level.WARNING,
"Failure while visitAnnotation. Class could not be loaded.", e);
Something went wrong with that request. Please try again.