Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

JavaLangClassReflection.java

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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00068       throw new NativeMethodException("java.lang.Class.getModifiers()I");
00069     }
00070 
00071     if(name.equals("java.lang.Class.getName()Ljava/lang/String;")) {
00072       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00088       throw new NativeMethodException("java.lang.Class.getSuperclass()Ljava/lang/Class;");
00089     }
00090 
00091     if(name.equals("java.lang.Class.isArray()Z")) {
00092       // throws a runtime exception for now
00093       throw new NativeMethodException("java.lang.Class.isArray()Z");
00094     }
00095 
00096     if(name.equals("java.lang.Class.isAssignableFrom(Ljava/lang/Class;)Z")) {
00097       // throws a runtime exception for now
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       // throws a runtime exception for now
00103       throw new NativeMethodException("java.lang.Class.isInstance(Ljava/lang/Object;)Z");
00104     }
00105 
00106     if(name.equals("java.lang.Class.isInterface()Z")) {
00107       // throws a runtime exception for now
00108       throw new NativeMethodException("java.lang.Class.isInterface()Z");
00109     }
00110 
00111     if(name.equals("java.lang.Class.isPrimitive()Z")) {
00112       // throws a runtime exception for now
00113       throw new NativeMethodException("java.lang.Class.isPrimitive()Z");
00114     }
00115 
00116     if(name.equals("java.lang.Class.newInstance0()Ljava/lang/Object;")) {
00117       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00209       throw new NativeMethodException("java.lang.Class.getModifiers()I");
00210     }
00211 
00212     if(name.equals("java.lang.Class.getName()Ljava/lang/String;")) {
00213       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00229       throw new NativeMethodException("java.lang.Class.getSuperclass()Ljava/lang/Class;");
00230     }
00231 
00232     if(name.equals("java.lang.Class.isArray()Z")) {
00233       // throws a runtime exception for now
00234       throw new NativeMethodException("java.lang.Class.isArray()Z");
00235     }
00236 
00237     if(name.equals("java.lang.Class.isAssignableFrom(Ljava/lang/Class;)Z")) {
00238       // throws a runtime exception for now
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       // throws a runtime exception for now
00244       throw new NativeMethodException("java.lang.Class.isInstance(Ljava/lang/Object;)Z");
00245     }
00246 
00247     if(name.equals("java.lang.Class.isInterface()Z")) {
00248       // throws a runtime exception for now
00249       throw new NativeMethodException("java.lang.Class.isInterface()Z");
00250     }
00251 
00252     if(name.equals("java.lang.Class.isPrimitive()Z")) {
00253       // throws a runtime exception for now
00254       throw new NativeMethodException("java.lang.Class.isPrimitive()Z");
00255     }
00256 
00257     if(name.equals("java.lang.Class.newInstance0()Ljava/lang/Object;")) {
00258       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00334       throw new NativeMethodException("java.lang.Class.getModifiers()I");
00335     }
00336 
00337     if(name.equals("java.lang.Class.getName()Ljava/lang/String;")) {
00338       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
00354       throw new NativeMethodException("java.lang.Class.getSuperclass()Ljava/lang/Class;");
00355     }
00356 
00357     if(name.equals("java.lang.Class.isArray()Z")) {
00358       // throws a runtime exception for now
00359       throw new NativeMethodException("java.lang.Class.isArray()Z");
00360     }
00361 
00362     if(name.equals("java.lang.Class.isAssignableFrom(Ljava/lang/Class;)Z")) {
00363       // throws a runtime exception for now
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       // throws a runtime exception for now
00369       throw new NativeMethodException("java.lang.Class.isInstance(Ljava/lang/Object;)Z");
00370     }
00371 
00372     if(name.equals("java.lang.Class.isInterface()Z")) {
00373       // throws a runtime exception for now
00374       throw new NativeMethodException("java.lang.Class.isInterface()Z");
00375     }
00376 
00377     if(name.equals("java.lang.Class.isPrimitive()Z")) {
00378       // throws a runtime exception for now
00379       throw new NativeMethodException("java.lang.Class.isPrimitive()Z");
00380     }
00381 
00382     if(name.equals("java.lang.Class.newInstance0()Ljava/lang/Object;")) {
00383       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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       // throws a runtime exception for now
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 }

Generated at Thu Feb 7 06:48:17 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001