1   /***************************************************************************************
2    * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved.                 *
3    * http://aspectwerkz.codehaus.org                                                    *
4    * ---------------------------------------------------------------------------------- *
5    * The software in this package is published under the terms of the LGPL license      *
6    * a copy of which has been included with this distribution in the license.txt file.  *
7    **************************************************************************************/
8   package test.clapp;
9   
10  import java.net.URL;
11  import java.net.URLClassLoader;
12  
13  /***
14   * fake class <p/>The clinit will load another class thru a custom classloader
15   * 
16   * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
17   */
18  public class DummyClass {
19      static {
20          try {
21              // create a URLClassLoader with NO delegation
22              ClassLoader tmp = new URLClassLoader(new URL[] {
23                  new java.io.File(CrazyClassLoaderApp.DUMMYCLASS_LOCATION).toURL()
24              }, null);
25  
26              // load another class in this clinit DummyClass
27              Class re = Class.forName("test.clapp.DummyReentrantClass", true, tmp);
28              Object reI = re.newInstance();
29              System.out.println("DummyReentrantClass.hashcode=" + re.hashCode());
30          } catch (Exception e) {
31              e.printStackTrace();
32          }
33      }
34  
35      public static void main(String[] args) {
36          System.out.println("Hello DummyClass");
37          System.exit(0);
38      }
39  }