Java Code Examples for java.lang.Runtime.Version#parse()

The following examples show how to use java.lang.Runtime.Version#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TaskFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
TaskFactory(JShell state) {
    this.state = state;
    this.compiler = ToolProvider.getSystemJavaCompiler();
    if (compiler == null) {
        throw new UnsupportedOperationException("Compiler not available, must be run with full JDK 9.");
    }
    Version current = Version.parse(System.getProperty("java.specification.version"));
    if (INITIAL_SUPPORTED_VER.compareToIgnoreOptional(current) > 0)  {
        throw new UnsupportedOperationException("Wrong compiler, must be run with full JDK 9.");
    }
    this.fileManager = new MemoryFileManager(
            compiler.getStandardFileManager(null, null, null), state);
}
 
Example 2
Source File: Basic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void tryCatch(String s, Class<? extends Throwable> ex) {
    Throwable t = null;
    try {
        Version.parse(s);
    } catch (Throwable x) {
        if (ex.isAssignableFrom(x.getClass())) {
            t = x;
        } else
            x.printStackTrace();
    }
    if ((t == null) && (ex != null))
        fail(s, ex);
    else
        pass();
}
 
Example 3
Source File: Basic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void testEHC(String s0, String s1, boolean eq, boolean eqNO,
                            int cmp, int cmpNO)
{
    Version v0 = Version.parse(s0);
    Version v1 = Version.parse(s1);

    testEquals(v0, v1, eq);
    testEqualsNO(v0, v1, eqNO);

    testHashCode(v0, v1, eq);

    testCompare(v0, v1, cmp);
    testCompareNO(v0, v1, cmpNO);
}
 
Example 4
Source File: MultiReleaseJarTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name="versions")
public Object[][] createVersions() {
    return new Object[][] {
            {Version.parse("8"),    8},
            {Version.parse("9"),    9},
            {Version.parse("10"),  10},
            {Version.parse("11"),  10},
            {Version.parse("100"), 10}
    };
}
 
Example 5
Source File: Basic.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static Version testParse(String s) {
    Version v = Version.parse(s);
    pass();
    return v;
}