/*
 * Copyright 2016 requery.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.requery.util;

/**
 * Similar to {@link javax.lang.model.SourceVersion} but also works on Android.
 *
 * @author Nikhil Purushe
 */
public enum LanguageVersion {

    JAVA_1_5,
    JAVA_1_6,
    JAVA_1_7,
    JAVA_1_8;

    private static LanguageVersion version;

    static {
        try {
            String specificationVersion = System.getProperty("java.specification.version");
            switch (specificationVersion) {
                case "0.9":
                    // version returned by Android which can be treated as 1.7 language level as of
                    // KitKat
                    version = JAVA_1_7;
                    break;
                case "1.5":
                    version = JAVA_1_5;
                    break;
                case "1.6":
                    version = JAVA_1_6;
                    break;
                case "1.7":
                    version = JAVA_1_7;
                    break;
                case "1.8":
                    version = JAVA_1_8;
                    break;
                default:
                    // assume latest (anything below 1.5 is not supported anyway)
                    version = JAVA_1_8;
            }
        } catch (SecurityException se) {
            version = JAVA_1_7;
        }
    }

    public static LanguageVersion current() {
        return version;
    }

    public boolean atLeast(LanguageVersion version) {
        return ordinal() >= version.ordinal();
    }
}

@@ -816,16 +816,30 @@
 JAVA_1_8
+,%0A    JAVA_1_9
 ;%0A%0A    p
@@ -1638,32 +1638,127 @@
          break;%0A
+                case %221.9%22:%0A                    version = JAVA_1_9;%0A                    break;%0A
                 
@@ -1966,32 +1966,52 @@
 sion = JAVA_1_7;
+ // lowest supported
 %0A        %7D%0A    %7D

Include Java 9 in LanguageVersion