< prev index next >
langtools/test/tools/javac/options/modes/SourceTargetTest.java
Print this page
*** 43,53 ****
}
@Test
void testSourceTarget() throws IOException {
String v = System.getProperty("java.specification.version");
! String latest = v.substring(v.lastIndexOf(".") + 1);
String prev = String.valueOf(Integer.valueOf(latest) - 1);
writeFile("C.java", "class C { }");
String[] opts = { "-source", latest, "-target", prev };
--- 43,56 ----
}
@Test
void testSourceTarget() throws IOException {
String v = System.getProperty("java.specification.version");
! String[] va = v.split("\\.");
! int major = Integer.parseInt(va[0]);
! boolean newVersion = major > 8;
! String latest = (newVersion) ? va[0] : va[1];
String prev = String.valueOf(Integer.valueOf(latest) - 1);
writeFile("C.java", "class C { }");
String[] opts = { "-source", latest, "-target", prev };
< prev index next >