00001 package gov.nasa.arc.ase.jpf.jvm.reflection;
00002
00003 import gov.nasa.arc.ase.jpf.jvm.*;
00004 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction;
00005
00006 public class JavaLangClassReflection extends Reflection {
00007 public Instruction executeMethod(MethodInfo mi) {
00008 String name = mi.getFullName();
00009
00010 if(name.equals("getClassLoader0()Ljava/lang/ClassLoader;")) {
00011
00012 throw new NativeMethodException("getClassLoader0()Ljava/lang/ClassLoader;");
00013 }
00014
00015 if(name.equals("getComponentType()Ljava/lang/Class;")) {
00016
00017 throw new NativeMethodException("getComponentType()Ljava/lang/Class;");
00018 }
00019
00020 if(name.equals("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;")) {
00021
00022 throw new NativeMethodException("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;");
00023 }
00024
00025 if(name.equals("getConstructors0(I)[Ljava/lang/reflect/Constructor;")) {
00026
00027 throw new NativeMethodException("getConstructors0(I)[Ljava/lang/reflect/Constructor;");
00028 }
00029
00030 if(name.equals("getDeclaredClasses0()[Ljava/lang/Class;")) {
00031
00032 throw new NativeMethodException("getDeclaredClasses0()[Ljava/lang/Class;");
00033 }
00034
00035 if(name.equals("getDeclaringClass()Ljava/lang/Class;")) {
00036
00037 throw new NativeMethodException("getDeclaringClass()Ljava/lang/Class;");
00038 }
00039
00040 if(name.equals("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;")) {
00041
00042 throw new NativeMethodException("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;");
00043 }
00044
00045 if(name.equals("getFields0(I)[Ljava/lang/reflect/Field;")) {
00046
00047 throw new NativeMethodException("getFields0(I)[Ljava/lang/reflect/Field;");
00048 }
00049
00050 if(name.equals("getInterfaces()[Ljava/lang/Class;")) {
00051
00052 throw new NativeMethodException("getInterfaces()[Ljava/lang/Class;");
00053 }
00054
00055 if(name.equals("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;")) {
00056
00057 throw new NativeMethodException("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;");
00058 }
00059
00060 if(name.equals("getMethods0(I)[Ljava/lang/reflect/Method;")) {
00061
00062 throw new NativeMethodException("getMethods0(I)[Ljava/lang/reflect/Method;");
00063 }
00064
00065 if(name.equals("getModifiers()I")) {
00066
00067 throw new NativeMethodException("getModifiers()I");
00068 }
00069
00070 if(name.equals("getName()Ljava/lang/String;")) {
00071
00072 throw new NativeMethodException("getName()Ljava/lang/String;");
00073 }
00074
00075 if(name.equals("getProtectionDomain0()Ljava/security/ProtectionDomain;")) {
00076
00077 throw new NativeMethodException("getProtectionDomain0()Ljava/security/ProtectionDomain;");
00078 }
00079
00080 if(name.equals("getSigners()[Ljava/lang/Object;")) {
00081
00082 throw new NativeMethodException("getSigners()[Ljava/lang/Object;");
00083 }
00084
00085 if(name.equals("getSuperclass()Ljava/lang/Class;")) {
00086
00087 throw new NativeMethodException("getSuperclass()Ljava/lang/Class;");
00088 }
00089
00090 if(name.equals("isArray()Z")) {
00091
00092 throw new NativeMethodException("isArray()Z");
00093 }
00094
00095 if(name.equals("isAssignableFrom(Ljava/lang/Class;)Z")) {
00096
00097 throw new NativeMethodException("isAssignableFrom(Ljava/lang/Class;)Z");
00098 }
00099
00100 if(name.equals("isInstance(Ljava/lang/Object;)Z")) {
00101
00102 throw new NativeMethodException("isInstance(Ljava/lang/Object;)Z");
00103 }
00104
00105 if(name.equals("isInterface()Z")) {
00106
00107 throw new NativeMethodException("isInterface()Z");
00108 }
00109
00110 if(name.equals("isPrimitive()Z")) {
00111
00112 throw new NativeMethodException("isPrimitive()Z");
00113 }
00114
00115 if(name.equals("newInstance0()Ljava/lang/Object;")) {
00116
00117 throw new NativeMethodException("newInstance0()Ljava/lang/Object;");
00118 }
00119
00120 if(name.equals("setProtectionDomain0(Ljava/security/ProtectionDomain;)V")) {
00121
00122 throw new NativeMethodException("setProtectionDomain0(Ljava/security/ProtectionDomain;)V");
00123 }
00124
00125 if(name.equals("setSigners([Ljava/lang/Object;)V")) {
00126
00127 throw new NativeMethodException("setSigners([Ljava/lang/Object;)V");
00128 }
00129
00130 return super.executeMethod(mi);
00131 }
00132 public Instruction executeStaticMethod(MethodInfo mi) {
00133 String name = mi.getFullName();
00134
00135 if(name.equals("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")) {
00136
00137 throw new NativeMethodException("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;");
00138 }
00139
00140 if(name.equals("getPrimitiveClass(Ljava/lang/String;)Ljava/lang/Class;")) {
00141 return exitReference(getIntArgument(0));
00142 }
00143
00144 if(name.equals("registerNatives()V"))
00145 return exit();
00146
00147 return super.executeStaticMethod(mi);
00148 }
00149 public boolean isMethodDeterministic(MethodInfo mi) {
00150 String name = mi.getFullName();
00151
00152 if(name.equals("getClassLoader0()Ljava/lang/ClassLoader;")) {
00153
00154 throw new NativeMethodException("getClassLoader0()Ljava/lang/ClassLoader;");
00155 }
00156
00157 if(name.equals("getComponentType()Ljava/lang/Class;")) {
00158
00159 throw new NativeMethodException("getComponentType()Ljava/lang/Class;");
00160 }
00161
00162 if(name.equals("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;")) {
00163
00164 throw new NativeMethodException("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;");
00165 }
00166
00167 if(name.equals("getConstructors0(I)[Ljava/lang/reflect/Constructor;")) {
00168
00169 throw new NativeMethodException("getConstructors0(I)[Ljava/lang/reflect/Constructor;");
00170 }
00171
00172 if(name.equals("getDeclaredClasses0()[Ljava/lang/Class;")) {
00173
00174 throw new NativeMethodException("getDeclaredClasses0()[Ljava/lang/Class;");
00175 }
00176
00177 if(name.equals("getDeclaringClass()Ljava/lang/Class;")) {
00178
00179 throw new NativeMethodException("getDeclaringClass()Ljava/lang/Class;");
00180 }
00181
00182 if(name.equals("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;")) {
00183
00184 throw new NativeMethodException("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;");
00185 }
00186
00187 if(name.equals("getFields0(I)[Ljava/lang/reflect/Field;")) {
00188
00189 throw new NativeMethodException("getFields0(I)[Ljava/lang/reflect/Field;");
00190 }
00191
00192 if(name.equals("getInterfaces()[Ljava/lang/Class;")) {
00193
00194 throw new NativeMethodException("getInterfaces()[Ljava/lang/Class;");
00195 }
00196
00197 if(name.equals("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;")) {
00198
00199 throw new NativeMethodException("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;");
00200 }
00201
00202 if(name.equals("getMethods0(I)[Ljava/lang/reflect/Method;")) {
00203
00204 throw new NativeMethodException("getMethods0(I)[Ljava/lang/reflect/Method;");
00205 }
00206
00207 if(name.equals("getModifiers()I")) {
00208
00209 throw new NativeMethodException("getModifiers()I");
00210 }
00211
00212 if(name.equals("getName()Ljava/lang/String;")) {
00213
00214 throw new NativeMethodException("getName()Ljava/lang/String;");
00215 }
00216
00217 if(name.equals("getProtectionDomain0()Ljava/security/ProtectionDomain;")) {
00218
00219 throw new NativeMethodException("getProtectionDomain0()Ljava/security/ProtectionDomain;");
00220 }
00221
00222 if(name.equals("getSigners()[Ljava/lang/Object;")) {
00223
00224 throw new NativeMethodException("getSigners()[Ljava/lang/Object;");
00225 }
00226
00227 if(name.equals("getSuperclass()Ljava/lang/Class;")) {
00228
00229 throw new NativeMethodException("getSuperclass()Ljava/lang/Class;");
00230 }
00231
00232 if(name.equals("isArray()Z")) {
00233
00234 throw new NativeMethodException("isArray()Z");
00235 }
00236
00237 if(name.equals("isAssignableFrom(Ljava/lang/Class;)Z")) {
00238
00239 throw new NativeMethodException("isAssignableFrom(Ljava/lang/Class;)Z");
00240 }
00241
00242 if(name.equals("isInstance(Ljava/lang/Object;)Z")) {
00243
00244 throw new NativeMethodException("isInstance(Ljava/lang/Object;)Z");
00245 }
00246
00247 if(name.equals("isInterface()Z")) {
00248
00249 throw new NativeMethodException("isInterface()Z");
00250 }
00251
00252 if(name.equals("isPrimitive()Z")) {
00253
00254 throw new NativeMethodException("isPrimitive()Z");
00255 }
00256
00257 if(name.equals("newInstance0()Ljava/lang/Object;")) {
00258
00259 throw new NativeMethodException("newInstance0()Ljava/lang/Object;");
00260 }
00261
00262 if(name.equals("setProtectionDomain0(Ljava/security/ProtectionDomain;)V")) {
00263
00264 throw new NativeMethodException("setProtectionDomain0(Ljava/security/ProtectionDomain;)V");
00265 }
00266
00267 if(name.equals("setSigners([Ljava/lang/Object;)V")) {
00268
00269 throw new NativeMethodException("setSigners([Ljava/lang/Object;)V");
00270 }
00271
00272 return super.isMethodDeterministic(mi);
00273 }
00274 public boolean isMethodExecutable(MethodInfo mi) {
00275 String name = mi.getFullName();
00276
00277 if(name.equals("getClassLoader0()Ljava/lang/ClassLoader;")) {
00278
00279 throw new NativeMethodException("getClassLoader0()Ljava/lang/ClassLoader;");
00280 }
00281
00282 if(name.equals("getComponentType()Ljava/lang/Class;")) {
00283
00284 throw new NativeMethodException("getComponentType()Ljava/lang/Class;");
00285 }
00286
00287 if(name.equals("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;")) {
00288
00289 throw new NativeMethodException("getConstructor0([Ljava/lang/Class;I)Ljava/lang/reflect/Constructor;");
00290 }
00291
00292 if(name.equals("getConstructors0(I)[Ljava/lang/reflect/Constructor;")) {
00293
00294 throw new NativeMethodException("getConstructors0(I)[Ljava/lang/reflect/Constructor;");
00295 }
00296
00297 if(name.equals("getDeclaredClasses0()[Ljava/lang/Class;")) {
00298
00299 throw new NativeMethodException("getDeclaredClasses0()[Ljava/lang/Class;");
00300 }
00301
00302 if(name.equals("getDeclaringClass()Ljava/lang/Class;")) {
00303
00304 throw new NativeMethodException("getDeclaringClass()Ljava/lang/Class;");
00305 }
00306
00307 if(name.equals("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;")) {
00308
00309 throw new NativeMethodException("getField0(Ljava/lang/String;I)Ljava/lang/reflect/Field;");
00310 }
00311
00312 if(name.equals("getFields0(I)[Ljava/lang/reflect/Field;")) {
00313
00314 throw new NativeMethodException("getFields0(I)[Ljava/lang/reflect/Field;");
00315 }
00316
00317 if(name.equals("getInterfaces()[Ljava/lang/Class;")) {
00318
00319 throw new NativeMethodException("getInterfaces()[Ljava/lang/Class;");
00320 }
00321
00322 if(name.equals("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;")) {
00323
00324 throw new NativeMethodException("getMethod0(Ljava/lang/String;[Ljava/lang/Class;I)Ljava/lang/reflect/Method;");
00325 }
00326
00327 if(name.equals("getMethods0(I)[Ljava/lang/reflect/Method;")) {
00328
00329 throw new NativeMethodException("getMethods0(I)[Ljava/lang/reflect/Method;");
00330 }
00331
00332 if(name.equals("getModifiers()I")) {
00333
00334 throw new NativeMethodException("getModifiers()I");
00335 }
00336
00337 if(name.equals("getName()Ljava/lang/String;")) {
00338
00339 throw new NativeMethodException("getName()Ljava/lang/String;");
00340 }
00341
00342 if(name.equals("getProtectionDomain0()Ljava/security/ProtectionDomain;")) {
00343
00344 throw new NativeMethodException("getProtectionDomain0()Ljava/security/ProtectionDomain;");
00345 }
00346
00347 if(name.equals("getSigners()[Ljava/lang/Object;")) {
00348
00349 throw new NativeMethodException("getSigners()[Ljava/lang/Object;");
00350 }
00351
00352 if(name.equals("getSuperclass()Ljava/lang/Class;")) {
00353
00354 throw new NativeMethodException("getSuperclass()Ljava/lang/Class;");
00355 }
00356
00357 if(name.equals("isArray()Z")) {
00358
00359 throw new NativeMethodException("isArray()Z");
00360 }
00361
00362 if(name.equals("isAssignableFrom(Ljava/lang/Class;)Z")) {
00363
00364 throw new NativeMethodException("isAssignableFrom(Ljava/lang/Class;)Z");
00365 }
00366
00367 if(name.equals("isInstance(Ljava/lang/Object;)Z")) {
00368
00369 throw new NativeMethodException("isInstance(Ljava/lang/Object;)Z");
00370 }
00371
00372 if(name.equals("isInterface()Z")) {
00373
00374 throw new NativeMethodException("isInterface()Z");
00375 }
00376
00377 if(name.equals("isPrimitive()Z")) {
00378
00379 throw new NativeMethodException("isPrimitive()Z");
00380 }
00381
00382 if(name.equals("newInstance0()Ljava/lang/Object;")) {
00383
00384 throw new NativeMethodException("newInstance0()Ljava/lang/Object;");
00385 }
00386
00387 if(name.equals("setProtectionDomain0(Ljava/security/ProtectionDomain;)V")) {
00388
00389 throw new NativeMethodException("setProtectionDomain0(Ljava/security/ProtectionDomain;)V");
00390 }
00391
00392 if(name.equals("setSigners([Ljava/lang/Object;)V")) {
00393
00394 throw new NativeMethodException("setSigners([Ljava/lang/Object;)V");
00395 }
00396
00397 return super.isMethodExecutable(mi);
00398 }
00399 public boolean isStaticMethodDeterministic(MethodInfo mi) {
00400 String name = mi.getFullName();
00401
00402 if(name.equals("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")) {
00403
00404 throw new NativeMethodException("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;");
00405 }
00406
00407 return super.isStaticMethodDeterministic(mi);
00408 }
00409 public boolean isStaticMethodExecutable(MethodInfo mi) {
00410 String name = mi.getFullName();
00411
00412 if(name.equals("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")) {
00413
00414 throw new NativeMethodException("forName0(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;");
00415 }
00416
00417 return super.isStaticMethodExecutable(mi);
00418 }
00419 }