...
 
Commits (4)
class ArrayLength {
public static void main(String[] args) {
int[] x = new int[23];
/* use of .length is invalid in MiniJava */
int y = x.length;
}
}
/* String shadows the default String class.
* However, Java only detects the lack of a main() at runtime,
* failing with 'error: Main method not found'
*/
class String { }
class MainWithLocalStringShadowingJavaString {
public static void main(String[] args) {}
}
class SystemShadowing {
public SystemShadowing System;
public SystemShadowing out;
public void println(int x) { }
public void nonstatic() {
System.out.println(23);
}
public static void main(String[] args) {
SystemShadowing x = new SystemShadowing();
x.nonstatic(); /* expected to throw NullPointerException at runtime due to shadowing */
}
}