1
2
3
4 package joeq.ClassLib.sun15_win32;
5
6 import java.util.Iterator;
7 import joeq.Class.PrimordialClassLoader;
8 import joeq.Class.jq_Class;
9 import joeq.Class.jq_InstanceField;
10 import joeq.Class.jq_StaticField;
11 import joeq.ClassLib.ClassLibInterface;
12 import joeq.Main.jq;
13 import joeq.Runtime.ObjectTraverser;
14 import jwutil.collections.AppendIterator;
15
16
17
18
19
20 public class Interface extends joeq.ClassLib.sun142_win32.Interface {
21
22 /*** Creates new Interface */
23 public Interface() {}
24
25 public Iterator getImplementationClassDescs(joeq.UTF.Utf8 desc) {
26 if (ClassLibInterface.USE_JOEQ_CLASSLIB &&
27 (desc.toString().startsWith("Ljava/") ||
28 desc.toString().startsWith("Lsun/misc/"))) {
29 joeq.UTF.Utf8 u = joeq.UTF.Utf8.get("Ljoeq/ClassLib/sun15_win32/"+desc.toString().substring(1));
30 return new AppendIterator(super.getImplementationClassDescs(desc),
31 java.util.Collections.singleton(u).iterator());
32 }
33 return super.getImplementationClassDescs(desc);
34 }
35
36 public ObjectTraverser getObjectTraverser() {
37 return sun15_win32ObjectTraverser.INSTANCE;
38 }
39
40 public static class sun15_win32ObjectTraverser extends sun142_win32ObjectTraverser {
41 public static sun15_win32ObjectTraverser INSTANCE = new sun15_win32ObjectTraverser();
42 protected sun15_win32ObjectTraverser() {}
43 public void initialize() {
44 super.initialize();
45
46 jq_Class k;
47
48
49 k = (jq_Class) PrimordialClassLoader.getJavaLangClass();
50 nullInstanceFields.add(k.getOrCreateInstanceField("name", "Ljava/lang/String;"));
51
52
53 k = (jq_Class) PrimordialClassLoader.getJavaLangReflectField();
54 nullInstanceFields.add(k.getOrCreateInstanceField("fieldAccessor", "Lsun/reflect/FieldAccessor;"));
55 nullInstanceFields.add(k.getOrCreateInstanceField("overrideFieldAccessor", "Lsun/reflect/FieldAccessor;"));
56
57
58 k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Lsun/reflect/UnsafeStaticFieldAccessorImpl;");
59 nullInstanceFields.add(k.getOrCreateInstanceField("base", "Ljava/lang/Object;"));
60
61
62 k = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Lsun/security/jca/Providers;");
63 nullStaticFields.add(k.getOrCreateStaticField("threadLists", "Ljava/lang/ThreadLocal;"));
64 nullStaticFields.add(k.getOrCreateStaticField("providerList", "Lsun/security/jca/ProviderList;"));
65
66
67 k = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Lsun/net/www/protocol/jar/JarFileFactory;");
68 nullStaticFields.add(k.getOrCreateStaticField("fileCache", "Ljava/util/HashMap;"));
69 nullStaticFields.add(k.getOrCreateStaticField("urlCache", "Ljava/util/HashMap;"));
70
71
72 if (jq.on_vm_startup != null) {
73 Object[] args = { } ;
74 k = (jq_Class)PrimordialClassLoader.loader.getOrCreateBSType("Ljava/io/FileDescriptor;");
75 joeq.Class.jq_Method init_fd = k.getOrCreateStaticMethod("init", "()V");
76 joeq.Bootstrap.MethodInvocation mi = new joeq.Bootstrap.MethodInvocation(init_fd, args);
77 jq.on_vm_startup.add(mi);
78 System.out.println("Added call to reinitialize in/out/err file descriptors on joeq startup: "+mi);
79 }
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 public static final jq_StaticField valueOffsetField;
98
99 static {
100 jq_Class k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljava/util/concurrent/atomic/AtomicLong;");
101 valueOffsetField = k.getOrCreateStaticField("valueOffset", "J");
102 }
103
104 public java.lang.Object mapStaticField(jq_StaticField f) {
105
106 if (f == valueOffsetField) {
107 jq_Class k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljava/util/concurrent/atomic/AtomicLong;");
108 k.prepare();
109 int offset = ((jq_InstanceField) k.getDeclaredMember("value", "J")).getOffset();
110 return new Long(offset);
111 }
112 return super.mapStaticField(f);
113 }
114 }
115 }