diff options
author | aclement <aclement> | 2006-08-14 14:22:33 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-08-14 14:22:33 +0000 |
commit | ddb5eea1bf53bda27c51750b1966044df97d95a1 (patch) | |
tree | 5d40ba3256c5cd70796ce6b40de11eb5c75ca008 /loadtime/testsrc | |
parent | 0dde33db7477bb59728ad181f15b979d91310388 (diff) | |
download | aspectj-ddb5eea1bf53bda27c51750b1966044df97d95a1.tar.gz aspectj-ddb5eea1bf53bda27c51750b1966044df97d95a1.zip |
133770 'call and ltw': isLocallyDefined() implemented - may not be right for all classloader hierarchies (especially non-delegating ones) - but its a start!
Diffstat (limited to 'loadtime/testsrc')
-rw-r--r-- | loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java index af2e49182..c056b9ee6 100644 --- a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingContextTest.java @@ -142,7 +142,21 @@ public class WeavingContextTest extends TestCase { public Enumeration getResources(String name) throws IOException { return loader.getResources(name); } - + + public boolean isLocallyDefined(String classname) { + String asResource = classname.replace('.', '/').concat(".class"); + + URL localURL = loader.getResource(asResource); + if (localURL == null) return false; + + boolean isLocallyDefined = true; + ClassLoader parent = loader.getParent(); + if (parent != null) { + URL parentURL = parent.getResource(asResource); + if (localURL.equals(parentURL)) isLocallyDefined = false; + } + return isLocallyDefined; + } } protected void setUp() throws Exception { |