Refuse to process classfiles that are not compiled with target at least 1.6
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 15 Dec 2012 21:37:57 +0100
changeset 32446db65995983
parent 322 3884815c0629
child 325 acba19bef022
Refuse to process classfiles that are not compiled with target at least 1.6
vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java
     1.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Sat Dec 15 08:17:45 2012 +0100
     1.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java	Sat Dec 15 21:37:57 2012 +0100
     1.3 @@ -76,6 +76,11 @@
     1.4      
     1.5      public String compile(InputStream classFile) throws IOException {
     1.6          this.jc = new ClassData(classFile);
     1.7 +        if (jc.getMajor_version() < 50) {
     1.8 +            throw new IOException("Can't compile " + jc.getClassName() + ". Class file version " + jc.getMajor_version() + "."
     1.9 +                + jc.getMinor_version() + " - recompile with -target 1.6 (at least)."
    1.10 +            );
    1.11 +        }
    1.12          byte[] arrData = jc.findAnnotationData(true);
    1.13          String[] arr = findAnnotation(arrData, jc, 
    1.14              "org.apidesign.bck2brwsr.core.ExtraJavaScript",