diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java')
-rw-r--r-- | bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java index e6eae5bc5..8a4c8b2f8 100644 --- a/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java +++ b/bundles/org.eclipse.equinox.weaving.hook/src/org/eclipse/equinox/weaving/hooks/AspectJBundleFile.java @@ -23,44 +23,50 @@ import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile; public class AspectJBundleFile extends AbstractAJBundleFile { - private URL url; - - public AspectJBundleFile (IAspectJAdaptor aa, BundleFile bundleFile) throws IOException { - super(aa,bundleFile); - this.url = delegate.getBaseFile().toURL(); - } - - public URL getURL () { - return url; - } + private final URL url; - public BundleEntry getEntry(String path) { - if (Debug.DEBUG_BUNDLE) Debug.println("> AspectJBundleFile.getEntry() path=" + path + ", url=" + url); - BundleEntry entry = delegate.getEntry(path); + public AspectJBundleFile(final IAspectJAdaptor aa, + final BundleFile bundleFile) throws IOException { + super(aa, bundleFile); + this.url = delegate.getBaseFile().toURL(); + } - if (path.endsWith(".class")) { - int offset = path.lastIndexOf('.'); - String name = path.substring(0,offset).replace('/','.'); -// byte[] bytes = adaptor.findClass(name,url); - CacheEntry cacheEntry = adaptor.findClass(name,url); - if (cacheEntry == null) { - if (entry != null) { - entry = new AspectJBundleEntry(adaptor, entry, url, false); - if (Debug.DEBUG_BUNDLE) Debug.println("- AspectJBundleFile.getEntry() path=" + path + ", entry=" + entry); - } - } - else { - if (cacheEntry.getCachedBytes() != null) { - entry = new AspectJBundleEntry(adaptor, entry, path, cacheEntry.getCachedBytes(), url); - } - else if (entry != null) { - entry = new AspectJBundleEntry(adaptor, entry, url, cacheEntry.dontWeave()); - } - } - } + public BundleEntry getEntry(final String path) { + if (Debug.DEBUG_BUNDLE) + Debug.println("> AspectJBundleFile.getEntry() path=" + path + + ", url=" + url); + BundleEntry entry = delegate.getEntry(path); - if (Debug.DEBUG_BUNDLE) Debug.println("< AspectJBundleFile.getEntry() entry=" + entry); - return entry; - } + if (path.endsWith(".class")) { + final int offset = path.lastIndexOf('.'); + final String name = path.substring(0, offset).replace('/', '.'); + // byte[] bytes = adaptor.findClass(name,url); + final CacheEntry cacheEntry = adaptor.findClass(name, url); + if (cacheEntry == null) { + if (entry != null) { + entry = new AspectJBundleEntry(adaptor, entry, url, false); + if (Debug.DEBUG_BUNDLE) + Debug.println("- AspectJBundleFile.getEntry() path=" + + path + ", entry=" + entry); + } + } else { + if (cacheEntry.getCachedBytes() != null) { + entry = new AspectJBundleEntry(adaptor, entry, path, + cacheEntry.getCachedBytes(), url); + } else if (entry != null) { + entry = new AspectJBundleEntry(adaptor, entry, url, + cacheEntry.dontWeave()); + } + } + } + + if (Debug.DEBUG_BUNDLE) + Debug.println("< AspectJBundleFile.getEntry() entry=" + entry); + return entry; + } + + public URL getURL() { + return url; + } } |