File: Test15.java

package info (click to toggle)
gettext 0.23.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 168,104 kB
  • sloc: ansic: 532,579; sh: 68,252; perl: 28,011; makefile: 9,066; lisp: 3,184; yacc: 1,055; java: 615; cs: 589; cpp: 397; objc: 343; sed: 79; tcl: 63; xml: 40; pascal: 11; php: 7; awk: 7
file content (30 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Test for Java 1.5 or newer.
// This file is in the public domain.
import java.util.*;
/**
 * @author Bruno Haible
 */
public class Test15 {
  public static void main (String[] args) {
    try {
      foo();
    } catch (Throwable e) {
      System.exit(1);
    }
    // Check the JVM version is at least 1.5.
    String version = System.getProperty("java.specification.version");
    int i = 0;
    while (i < version.length()
           && (Character.isDigit(version.charAt(i)) || version.charAt(i)=='.'))
      i++;
    float fversion = Float.valueOf(version.substring(0,i));
    if (!(fversion >= 1.5f)) System.exit(1);
    // Check the VM is not GNU libgcj.
    String vm = System.getProperty("java.vm.name");
    if (vm.startsWith("GNU")) System.exit(1);
    System.exit(0);
  }
  private static List<Integer> foo() {
    return new ArrayList<Integer>();
  }
}