01: /**************************************************************************************
02: * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved. *
03: * http://aspectwerkz.codehaus.org *
04: * ---------------------------------------------------------------------------------- *
05: * The software in this package is published under the terms of the LGPL license *
06: * a copy of which has been included with this distribution in the license.txt file. *
07: **************************************************************************************/package org.codehaus.aspectwerkz.compiler;
08:
09: import java.net.URL;
10: import java.net.URLClassLoader;
11:
12: /**
13: * VerifierClassLoader does not follow parent delegation model. <p/>It allow to run the -verify option of offline mode
14: * on aspectwerkz itself.
15: *
16: * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
17: */
18: public class VerifierClassLoader extends URLClassLoader {
19: public VerifierClassLoader(URL[] urls, ClassLoader parent) {
20: super (urls, parent);
21: }
22:
23: protected synchronized Class loadClass(String name, boolean resolve)
24: throws ClassNotFoundException {
25: // First, check if the class has already been loaded
26: Class c = findLoadedClass(name);
27: if (c == null) {
28: try {
29: // try to load the class localy
30: c = findClass(name);
31: } catch (ClassNotFoundException e) {
32: // delegate to parent
33: c = getParent().loadClass(name);
34: }
35: }
36: if (resolve) {
37: resolveClass(c);
38: }
39: return c;
40: }
41: }
|