@Test public void testMajorVersion() { assertEquals(6, PlatformDependent0.majorVersion("1.6")); assertEquals(7, PlatformDependent0.majorVersion("1.7")); assertEquals(8, PlatformDependent0.majorVersion("1.8")); assertEquals(8, PlatformDependent0.majorVersion("8")); assertEquals(9, PlatformDependent0.majorVersion("1.9")); assertEquals(9, PlatformDependent0.majorVersion("9")); }
static int majorVersion(final String javaSpecVersion) { final String[] components = javaSpecVersion.split("\\."); final int[] version = new int[components.length]; for (int i = 0; i < components.length; i++) { version[i] = Integer.parseInt(components[i]); } if (version[0] == 1) { assert version[1] >= 6; return version[1]; } else { return version[0]; } }
PlatformDependent0 { static int majorVersion(final String javaSpecVersion) { final String[] components = javaSpecVersion.split("\\."); final int[] version = new int[components.length]; for (int i = 0; i < components.length; i++) { version[i] = Integer.parseInt(components[i]); } if (version[0] == 1) { assert version[1] >= 6; return version[1]; } else { return version[0]; } } }
PlatformDependent0 { static int majorVersion(final String javaSpecVersion) { final String[] components = javaSpecVersion.split("\\."); final int[] version = new int[components.length]; for (int i = 0; i < components.length; i++) { version[i] = Integer.parseInt(components[i]); } if (version[0] == 1) { assert version[1] >= 6; return version[1]; } else { return version[0]; } } private  PlatformDependent0(); }
PlatformDependent0 { static int majorVersion(final String javaSpecVersion) { final String[] components = javaSpecVersion.split("\\."); final int[] version = new int[components.length]; for (int i = 0; i < components.length; i++) { version[i] = Integer.parseInt(components[i]); } if (version[0] == 1) { assert version[1] >= 6; return version[1]; } else { return version[0]; } } private  PlatformDependent0();  }
PlatformDependent0 { static int majorVersion(final String javaSpecVersion) { final String[] components = javaSpecVersion.split("\\."); final int[] version = new int[components.length]; for (int i = 0; i < components.length; i++) { version[i] = Integer.parseInt(components[i]); } if (version[0] == 1) { assert version[1] >= 6; return version[1]; } else { return version[0]; } } private  PlatformDependent0();   }