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/src | |
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/src')
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 3 | ||||
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 47b9368c6..161c8f62f 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -130,7 +130,8 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { } bcelWorld = new LTWWorld( - classLoader, getMessageHandler(), new ICrossReferenceHandler() { + classLoader, weavingContext, // TODO when the world works in terms of the context, we can remove the loader... + getMessageHandler(), new ICrossReferenceHandler() { public void addCrossReference(ISourceLocation from, ISourceLocation to, IRelationship.Kind kind, boolean runtimeTest) { ;// for tools only } diff --git a/loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java b/loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java index 2ec089253..bd4c3280f 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/DefaultWeavingContext.java @@ -78,4 +78,19 @@ public class DefaultWeavingContext implements IWeavingContext { public String getSuffix () { return getClassLoaderName(); } + + 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; + } } |