Niclas Hedhman created POLYGENE-246:
---------------------------------------

             Summary: Intercept calls to static methods, via classloading 
control
                 Key: POLYGENE-246
                 URL: https://issues.apache.org/jira/browse/POLYGENE-246
             Project: Polygene
          Issue Type: Bug
            Reporter: Niclas Hedhman


Say that I want to replace SLF4J's LoggerFactory.getLogger() with my own 
implementation. To do that now, I would need to replace the slf4j jar with my 
own compiled one, and possibly maintain that diff.

IF, on the other hand, Polygene can apply its interception techniques to 
classloading as well (which we do for loading fragments to redirect in-class 
method calls), it should be possible to intercept arbitrary static method calls.

For this to work well, the classloader would need to be able to investigate 
"where" the invocation context is, i.e. figure out the "current module" which 
is currently not possible, so some serious thought needs to go into this, if at 
all possible to inject all our injection scopes available via builders.

Potentially, take a look at PowerMock, which I think is doing this.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to