//int result = x + y;
//return result;
println "installed() is called!"
- //initialize()
+ initialize()
}
// This function is where you initialize callbacks for event listeners
--- /dev/null
+class Racer implements Runnable {
+ int d = 42
+
+ public void run () {
+ doSomething(1001)
+ d = 0 // (1)
+ }
+
+ static void main (String[] args){
+ Racer racer = new Racer()
+ Thread t = new Thread(racer)
+ t.start()
+
+ doSomething(1000)
+ int c = 420 / racer.d // (2)
+ println c
+ }
+
+ def doSomething (int n) {
+ try {
+ Thread.sleep(n)
+ } catch (InterruptedException ix) {}
+ }
+}
-int rand = Math.random()*10
+class Rand {
+ static void main (String[] args) {
+ println("Groovy model-checking")
+ Random random = new Random(42);
+
+ int a = random.nextInt(2)
+ int b = random.nextInt(3)
+ println("a=" + a)
+ println(" b=" + b)
-if (rand < 5) {
- //println "rand is less than 5: "
- System.out.println(rand)
-} else {
- //println "rand is greater than or equal to 5: "
- System.out.println(rand)
+ int c = a/(b+a -2)
+ println(" c=" + c)
+ }
}
public native TypeVariable<Class<T>>[] getTypeParameters();
public native Type getGenericSuperclass();
- /*public Type getGenericSuperclass() {
- throw new UnsupportedOperationException();
- }*/
public native Type[] getGenericInterfaces();
- /*public Type[] getGenericInterfaces() {
- throw new UnsupportedOperationException();
- }*/
+
+ public native java.security.ProtectionDomain getProtectionDomain();
+
+ transient ClassValue.ClassValueMap classValueMap;
+ // TODO: Fix for Groovy's model-checking
public Object[] getSigners() {
throw new UnsupportedOperationException();
throw new UnsupportedOperationException();
}
- // TODO: Fix for Groovy's model-checking
- public native java.security.ProtectionDomain getProtectionDomain();
- /*public java.security.ProtectionDomain getProtectionDomain() {
- throw new UnsupportedOperationException();
- }*/
-
void setProtectionDomain0(java.security.ProtectionDomain pd) {
pd = null; // Get rid of IDE warning
throw new UnsupportedOperationException();
throw new UnsupportedOperationException();
}
- // TODO: Fix for Groovy's model-checking
- transient ClassValue.ClassValueMap classValueMap;
-
public boolean isSynthetic (){
final int SYNTHETIC = 0x00001000;
return (getModifiers() & SYNTHETIC) != 0;
import sun.security.util.SecurityConstants;
// TODO: Fix for Groovy's model-checking
+// TODO: This model class is a placeholder for future implementation
/**
* MJI model class for java.security.AllPermission library abstraction
*/
import sun.security.util.SecurityConstants;
// TODO: Fix for Groovy's model-checking
+// TODO: This model class is a placeholder for future implementation
/**
* MJI model class for java.security.ProtectionDomain library abstraction
*/
return arrTypeVarNames;
}
- // TODO: Fix for Groovy's model-checking
public static String[] getParameterizedTypes(String signature) {
int pos = signature.indexOf('<', 0);
if (pos == -1)
}
String cleanSig = signature.replaceAll("\\+|-", "");
- // This kind of signature should be a repetition of its class' type parameter, e.g., TT for Class<T>
if (cleanSig.length()%2 != 0) {
// This is probably a class, e.g., +java.lang.Class
return signature;
return typeVarRef;
}
- // TODO: Fix for Groovy's model-checking
@MJI
public int getGenericSuperclass____Ljava_lang_reflect_Type_2 (MJIEnv env, int robj){
ClassInfo ci = env.getReferredClassInfo( robj);
ClassInfo pdci = cli.getResolvedClassInfo("java.security.ProtectionDomain");
int proDomRef = MJIEnv.NULL;
- /* TODO: Defer the following to future implementations
+ /*
+ TODO: Defer the following to future implementations
+ TODO: Currently Groovy runs well without actually instantiating a ProtectionDomain object properly
int proDomRef = env.newObject(pdci);
ElementInfo ei = env.getModifiableElementInfo(proDomRef);
ei.setReferenceField("codesource", MJIEnv.NULL);
int objRef, int groupRef, int runnableRef, int nameRef, long stackSize) {
VM vm = env.getVM();
- // TODO: Fix for Groovy's model-checking
// we only need to create the ThreadInfo - its initialization will take care
// of proper linkage to the java.lang.Thread object (objRef)
vm.createThreadInfo( objRef, groupRef, runnableRef, nameRef);
return retRef;
}
// TODO: Fix for Groovy's model-checking
- // TODO: We have been able to only register the generic class and not yet the parameterized types
int getExceptionTypes(MJIEnv env, MethodInfo mi) {
ThreadInfo ti = env.getThreadInfo();
*/
public class JPF_java_util_ResourceBundle extends NativePeer {
+ /*
+ TODO: Fix for Groovy's model-checking
+ TODO: We comment this out to suppress warnings
@MJI
public int getClassContext_____3Ljava_lang_Class_2 (MJIEnv env, int clsRef){
ThreadInfo ti = env.getThreadInfo();
}
return aRef;
- }
+ }*/
}