1
2
3
4 package joeq.Class;
5
6
7
8 import joeq.Main.jq;
9 import joeq.UTF.Utf8;
10 import jwutil.util.Assert;
11
12
13
14
15
16 public class jq_StaticMethod extends jq_Method {
17
18
19 protected jq_StaticMethod(jq_Class clazz, jq_NameAndDesc nd) {
20 super(clazz, nd);
21 }
22
23 static jq_StaticMethod newStaticMethod(jq_Class clazz, jq_NameAndDesc nd) {
24 return new jq_StaticMethod(clazz, nd);
25 }
26 protected void parseMethodSignature() {
27 Utf8.MethodDescriptorIterator i = nd.getDesc().getParamDescriptors();
28
29 int num = 0, words = 0;
30 while (i.hasNext()) { i.nextUtf8(); ++num; }
31
32 param_types = new jq_Type[num];
33 i = nd.getDesc().getParamDescriptors();
34 for (int j=0; j<num; ++j) {
35 Utf8 pd = i.nextUtf8();
36 param_types[j] = PrimordialClassLoader.getOrCreateType(clazz.getClassLoader(), pd);
37 ++words;
38 if ((param_types[j] == jq_Primitive.LONG) ||
39 (param_types[j] == jq_Primitive.DOUBLE)) ++words;
40 }
41 param_words = words;
42 Utf8 rd = i.getReturnDescriptor();
43 return_type = PrimordialClassLoader.getOrCreateType(clazz.getClassLoader(), rd);
44 }
45
46 public final boolean needsDynamicLink(jq_Method method) {
47 if (getDeclaringClass().needsDynamicLink(method)) return true;
48 if (!jq.RunningNative) return false;
49 return (state < STATE_SFINITIALIZED);
50 }
51
52 public final boolean isStatic() { return true; }
53 public boolean isClassInitializer() { return false; }
54
55 public final jq_Member resolve() { return resolve1(); }
56 public jq_StaticMethod resolve1() {
57 this.clazz.load();
58 if (this.state >= STATE_LOADED) return this;
59
60 jq_StaticMethod m = this.clazz.getStaticMethod(nd);
61 if (m != null) return m;
62 throw new NoSuchMethodError(this.toString());
63 }
64
65 public final void prepare() { Assert._assert(state == STATE_LOADED); state = STATE_PREPARED; }
66
67 public final void unprepare() { Assert._assert(state == STATE_PREPARED); state = STATE_LOADED; }
68
69 public void accept(jq_MethodVisitor mv) {
70 mv.visitStaticMethod(this);
71 super.accept(mv);
72 }
73
74 public static final jq_Class _class;
75 static {
76 _class = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Ljoeq/Class/jq_StaticMethod;");
77 }
78 }