1 // Test for Java 1.5 or newer. 2 // This file is in the public domain. 3 import java.util.*; 4 /** 5 * @author Bruno Haible 6 */ 7 public class Test15 { main(String[] args)8 public static void main (String[] args) { 9 try { 10 foo(); 11 } catch (Throwable e) { 12 System.exit(1); 13 } 14 // Check the JVM version is at least 1.5. 15 String version = System.getProperty("java.specification.version"); 16 int i = 0; 17 while (i < version.length() 18 && (Character.isDigit(version.charAt(i)) || version.charAt(i)=='.')) 19 i++; 20 float fversion = Float.valueOf(version.substring(0,i)); 21 if (!(fversion >= 1.5f)) System.exit(1); 22 // Check the VM is not GNU libgcj. 23 String vm = System.getProperty("java.vm.name"); 24 if (vm.startsWith("GNU")) System.exit(1); 25 System.exit(0); 26 } foo()27 private static List<Integer> foo() { 28 return new ArrayList<Integer>(); 29 } 30 } 31