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