View Javadoc

1   // jq_ClassInitializer.java, created Mon Feb  5 23:23:20 2001 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Class;
5   
6   //friend jq_ClassLoader;
7   
8   import joeq.UTF.Utf8;
9   import jwutil.util.Assert;
10  
11  /***
12   * @author  John Whaley <jwhaley@alum.mit.edu>
13   * @version $Id: jq_ClassInitializer.java 1931 2004-09-22 22:17:47Z joewhaley $
14   */
15  public final class jq_ClassInitializer extends jq_StaticMethod {
16  
17      // clazz, nd are inherited
18      
19      private jq_ClassInitializer(jq_Class clazz, jq_NameAndDesc nd) {
20          super(clazz, nd);
21      }
22      // ONLY TO BE CALLED BY jq_ClassLoader!!!
23      static jq_ClassInitializer newClassInitializer(jq_Class clazz, jq_NameAndDesc nd) {
24          Assert._assert(nd.getName() == Utf8.get("<clinit>"));
25          Assert._assert(nd.getDesc() == Utf8.get("()V"));
26          return new jq_ClassInitializer(clazz, nd);
27      }
28  
29      protected final void parseMethodSignature() {
30          // no need to parse anything
31          param_types = new jq_Type[0];
32          return_type = jq_Primitive.VOID;
33      }
34      
35      public final jq_StaticMethod resolve1() {
36          this.clazz.load();
37          if (this.state >= STATE_LOADED) return this;
38          throw new NoSuchMethodError(this.toString());
39      }
40      
41      public final boolean isClassInitializer() { return true; }
42  
43      public final void accept(jq_MethodVisitor mv) {
44          mv.visitClassInitializer(this);
45          super.accept(mv);
46      }
47      
48      public static final jq_Class _class;
49      static {
50          _class = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Class/jq_ClassInitializer;");
51      }
52  }