@Test public void testCompilerTargetCompatibility() throws Exception { assertTrue(j2SE14Environment.isCompatibleCompilerTargetLevel("1.1")); assertTrue(j2SE14Environment.isCompatibleCompilerTargetLevel("1.2")); assertFalse(j2SE14Environment.isCompatibleCompilerTargetLevel("1.3")); assertTrue(j2SE5Enviroment.isCompatibleCompilerTargetLevel("5")); assertTrue(j2SE5Enviroment.isCompatibleCompilerTargetLevel("5.0")); assertTrue(javaSE6Enviroment.isCompatibleCompilerTargetLevel("6")); assertTrue(javaSE6Enviroment.isCompatibleCompilerTargetLevel("6.0")); assertTrue(javaSE7Enviroment.isCompatibleCompilerTargetLevel("7")); assertTrue(javaSE7Enviroment.isCompatibleCompilerTargetLevel("7.0")); assertTrue(javaSE8Environment.isCompatibleCompilerTargetLevel("8")); assertTrue(javaSE8Environment.isCompatibleCompilerTargetLevel("8.0")); assertTrue(javaSE9Environment.isCompatibleCompilerTargetLevel("9")); assertTrue(javaSE9Environment.isCompatibleCompilerTargetLevel("9.0")); assertTrue(javaSE11Environment.isCompatibleCompilerTargetLevel("11.0")); assertTrue(javaSE14Environment.isCompatibleCompilerTargetLevel("14.0")); assertTrue(javaSE15Environment.isCompatibleCompilerTargetLevel("15.0")); assertTrue(javaSE16Environment.isCompatibleCompilerTargetLevel("16.0")); }
@Override public boolean isCompatibleCompilerTargetLevel(String target) { if (target == null) { throw new IllegalArgumentException(); } if (compilerTargetLevel == null) { return true; } try { Version thisTargetVersion = toTargetVersion(compilerTargetLevel); Version targetVersion = toTargetVersion(target); return thisTargetVersion.compareTo(targetVersion) >= 0; } catch (IllegalArgumentException e) { return false; } }
StandardExecutionEnvironment implements Comparable<StandardExecutionEnvironment>, ExecutionEnvironment { @Override public boolean isCompatibleCompilerTargetLevel(String target) { if (target == null) { throw new IllegalArgumentException(); } if (compilerTargetLevel == null) { return true; } try { Version thisTargetVersion = toTargetVersion(compilerTargetLevel); Version targetVersion = toTargetVersion(target); return thisTargetVersion.compareTo(targetVersion) >= 0; } catch (IllegalArgumentException e) { return false; } } }
StandardExecutionEnvironment implements Comparable<StandardExecutionEnvironment>, ExecutionEnvironment { @Override public boolean isCompatibleCompilerTargetLevel(String target) { if (target == null) { throw new IllegalArgumentException(); } if (compilerTargetLevel == null) { return true; } try { Version thisTargetVersion = toTargetVersion(compilerTargetLevel); Version targetVersion = toTargetVersion(target); return thisTargetVersion.compareTo(targetVersion) >= 0; } catch (IllegalArgumentException e) { return false; } } @Deprecated  StandardExecutionEnvironment(@Nonnull Properties profileProperties);   StandardExecutionEnvironment(@Nonnull Properties profileProperties, @Nullable Toolchain toolchain,
            @Nullable Logger logger); }
StandardExecutionEnvironment implements Comparable<StandardExecutionEnvironment>, ExecutionEnvironment { @Override public boolean isCompatibleCompilerTargetLevel(String target) { if (target == null) { throw new IllegalArgumentException(); } if (compilerTargetLevel == null) { return true; } try { Version thisTargetVersion = toTargetVersion(compilerTargetLevel); Version targetVersion = toTargetVersion(target); return thisTargetVersion.compareTo(targetVersion) >= 0; } catch (IllegalArgumentException e) { return false; } } @Deprecated  StandardExecutionEnvironment(@Nonnull Properties profileProperties);   StandardExecutionEnvironment(@Nonnull Properties profileProperties, @Nullable Toolchain toolchain,
            @Nullable Logger logger); @Override String getProfileName(); @Override String getCompilerSourceLevelDefault(); @Override String getCompilerTargetLevelDefault(); @Override String toString(); @Override Collection<SystemPackageEntry> getSystemPackages(); @Override int compareTo(StandardExecutionEnvironment otherEnv); @Override int hashCode(); @Override boolean equals(Object obj); @Override Properties getProfileProperties(); @Override boolean isCompatibleCompilerTargetLevel(String target); }
StandardExecutionEnvironment implements Comparable<StandardExecutionEnvironment>, ExecutionEnvironment { @Override public boolean isCompatibleCompilerTargetLevel(String target) { if (target == null) { throw new IllegalArgumentException(); } if (compilerTargetLevel == null) { return true; } try { Version thisTargetVersion = toTargetVersion(compilerTargetLevel); Version targetVersion = toTargetVersion(target); return thisTargetVersion.compareTo(targetVersion) >= 0; } catch (IllegalArgumentException e) { return false; } } @Deprecated  StandardExecutionEnvironment(@Nonnull Properties profileProperties);   StandardExecutionEnvironment(@Nonnull Properties profileProperties, @Nullable Toolchain toolchain,
            @Nullable Logger logger); @Override String getProfileName(); @Override String getCompilerSourceLevelDefault(); @Override String getCompilerTargetLevelDefault(); @Override String toString(); @Override Collection<SystemPackageEntry> getSystemPackages(); @Override int compareTo(StandardExecutionEnvironment otherEnv); @Override int hashCode(); @Override boolean equals(Object obj); @Override Properties getProfileProperties(); @Override boolean isCompatibleCompilerTargetLevel(String target);  }