Main m = new Main(); if (m.$opt$TestThisParameter(m) != m) { thrownew Error("Unexpected value returned");
}
if (m.$opt$TestOtherParameter(new Main()) == m) { thrownew Error("Unexpected value returned");
}
if (m.$opt$TestReturnNewObject(m) == m) { thrownew Error("Unexpected value returned");
}
// Loop enough iterations to hope for a crash if no write barrier // is emitted. for (int j = 0; j < 3; j++) {
Main m1 = new Main();
$opt$SetFieldInOldObject(m1); for (int i = 0; i < 1000; ++i) {
Object o = newbyte[1024];
}
}
// Test that we do NPE checks on invokedirect.
Exception exception = null; try {
invokePrivate();
} catch (NullPointerException e) {
exception = e;
}
// Test that we do NPE checks on array length.
exception = null; try {
$opt$ArrayLengthOfNull(null);
} catch (NullPointerException e) {
exception = e;
}
if (exception == null) { thrownew Error("Missing NullPointerException");
}
result = $opt$InvokeVirtualMethod(); if (result != 42) { thrownew Error("Unexpected result: " + result);
}
String s = $opt$StringInit(); if (!s.equals("hello world")) { thrownew Error("Unexpected string: " + s);
}
Object[] array = new Object[1];
Object o = testBranchWithConstZero(array, false); if (o != array) { thrownew Error("Unexpected result: " + o);
}
}
publicstaticvoid invokePrivate() {
Main m = null;
m.privateMethod();
}
privatevoid privateMethod() {
Object o = new Object();
}
publicstaticvoid printStaticMethodWith2Args(int a, int b) {
System.out.println("In static method with 2 args " + a + " " + b);
}
publicstaticvoid printStaticMethodWith5Args(int a, int b, int c, int d, int e) {
System.out.println("In static method with 5 args "
+ a + " " + b + " " + c + " " + d + " " + e);
}
publicstaticvoid printStaticMethodWith7Args(int a, int b, int c, int d, int e, int f, int g) {
System.out.println("In static method with 7 args "
+ a + " " + b + " " + c + " " + d + " " + e + " " + f + " " + g);
}
publicstaticvoid printStaticMethodWithObjectArg(Object a) {
System.out.println("In static method with object arg " + a.getClass());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.