| Home >> All |
Source code: Clazz/jq_ClassInitializer.java
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 Clazz; 5 6 //friend jq_ClassLoader; 7 8 import Bootstrap.PrimordialClassLoader; 9 import Compil3r.Quad.AndersenInterface.AndersenClassInitializer; 10 import UTF.Utf8; 11 import Util.Assert; 12 13 /** 14 * @author John Whaley <jwhaley@alum.mit.edu> 15 * @version $Id: jq_ClassInitializer.java,v 1.10 2003/05/12 10:05:09 joewhaley Exp $ 16 */ 17 public final class jq_ClassInitializer extends jq_StaticMethod implements AndersenClassInitializer { 18 19 // clazz, nd are inherited 20 21 private jq_ClassInitializer(jq_Class clazz, jq_NameAndDesc nd) { 22 super(clazz, nd); 23 } 24 // ONLY TO BE CALLED BY jq_ClassLoader!!! 25 static jq_ClassInitializer newClassInitializer(jq_Class clazz, jq_NameAndDesc nd) { 26 Assert._assert(nd.getName() == Utf8.get("<clinit>")); 27 Assert._assert(nd.getDesc() == Utf8.get("()V")); 28 return new jq_ClassInitializer(clazz, nd); 29 } 30 31 protected final void parseMethodSignature() { 32 // no need to parse anything 33 param_types = new jq_Type[0]; 34 return_type = jq_Primitive.VOID; 35 } 36 37 public final jq_StaticMethod resolve1() { 38 this.clazz.load(); 39 if (this.state >= STATE_LOADED) return this; 40 throw new NoSuchMethodError(this.toString()); 41 } 42 43 public final boolean isClassInitializer() { return true; } 44 45 public final void accept(jq_MethodVisitor mv) { 46 mv.visitClassInitializer(this); 47 super.accept(mv); 48 } 49 50 public static final jq_Class _class; 51 static { 52 _class = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("LClazz/jq_ClassInitializer;"); 53 } 54 }