@Test public void testComparison() throws Exception { assertThat(new ClassFileVersion(Opcodes.V1_1).compareTo(new ClassFileVersion(Opcodes.V1_1)), is(0)); assertThat(new ClassFileVersion(Opcodes.V1_1).compareTo(new ClassFileVersion(Opcodes.V1_2)), is(-1)); assertThat(new ClassFileVersion(Opcodes.V1_2).compareTo(new ClassFileVersion(Opcodes.V1_1)), is(1)); assertThat(new ClassFileVersion(Opcodes.V1_2).compareTo(new ClassFileVersion(Opcodes.V1_2)), is(0)); assertThat(new ClassFileVersion(Opcodes.V1_3).compareTo(new ClassFileVersion(Opcodes.V1_2)), is(1)); assertThat(new ClassFileVersion(Opcodes.V1_2).compareTo(new ClassFileVersion(Opcodes.V1_3)), is(-1)); }
public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); }
ClassFileVersion implements Comparable<ClassFileVersion> { public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); } }
ClassFileVersion implements Comparable<ClassFileVersion> { public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); } protected  ClassFileVersion(int versionNumber); }
ClassFileVersion implements Comparable<ClassFileVersion> { public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); } protected  ClassFileVersion(int versionNumber); static ClassFileVersion ofMinorMajor(int versionNumber); static ClassFileVersion ofJavaVersionString(String javaVersionString); static ClassFileVersion ofJavaVersion(int javaVersion); @CachedReturnPlugin.Enhance static ClassFileVersion ofThisVm(); @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Exception should not be rethrown but trigger a fallback") static ClassFileVersion ofThisVm(ClassFileVersion fallback); static ClassFileVersion of(Class<?> type); static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator); static ClassFileVersion of(TypeDescription typeDescription, ClassFileLocator classFileLocator); static ClassFileVersion ofClassFile(byte[] binaryRepresentation); int getMinorMajorVersion(); short getMajorVersion(); short getMinorVersion(); int getJavaVersion(); boolean isAtLeast(ClassFileVersion classFileVersion); boolean isGreaterThan(ClassFileVersion classFileVersion); boolean isAtMost(ClassFileVersion classFileVersion); boolean isLessThan(ClassFileVersion classFileVersion); ClassFileVersion asPreviewVersion(); boolean isPreviewVersion(); int compareTo(ClassFileVersion other); @Override String toString(); }
ClassFileVersion implements Comparable<ClassFileVersion> { public int compareTo(ClassFileVersion other) { return Integer.signum(getMajorVersion() == other.getMajorVersion() ? getMinorVersion() - other.getMinorVersion() : getMajorVersion() - other.getMajorVersion()); } protected  ClassFileVersion(int versionNumber); static ClassFileVersion ofMinorMajor(int versionNumber); static ClassFileVersion ofJavaVersionString(String javaVersionString); static ClassFileVersion ofJavaVersion(int javaVersion); @CachedReturnPlugin.Enhance static ClassFileVersion ofThisVm(); @SuppressFBWarnings(value = "REC_CATCH_EXCEPTION", justification = "Exception should not be rethrown but trigger a fallback") static ClassFileVersion ofThisVm(ClassFileVersion fallback); static ClassFileVersion of(Class<?> type); static ClassFileVersion of(Class<?> type, ClassFileLocator classFileLocator); static ClassFileVersion of(TypeDescription typeDescription, ClassFileLocator classFileLocator); static ClassFileVersion ofClassFile(byte[] binaryRepresentation); int getMinorMajorVersion(); short getMajorVersion(); short getMinorVersion(); int getJavaVersion(); boolean isAtLeast(ClassFileVersion classFileVersion); boolean isGreaterThan(ClassFileVersion classFileVersion); boolean isAtMost(ClassFileVersion classFileVersion); boolean isLessThan(ClassFileVersion classFileVersion); ClassFileVersion asPreviewVersion(); boolean isPreviewVersion(); int compareTo(ClassFileVersion other); @Override String toString(); static final ClassFileVersion JAVA_V1; static final ClassFileVersion JAVA_V2; static final ClassFileVersion JAVA_V3; static final ClassFileVersion JAVA_V4; static final ClassFileVersion JAVA_V5; static final ClassFileVersion JAVA_V6; static final ClassFileVersion JAVA_V7; static final ClassFileVersion JAVA_V8; static final ClassFileVersion JAVA_V9; static final ClassFileVersion JAVA_V10; static final ClassFileVersion JAVA_V11; static final ClassFileVersion JAVA_V12; static final ClassFileVersion JAVA_V13; static final ClassFileVersion JAVA_V14; static final ClassFileVersion JAVA_V15; static final ClassFileVersion JAVA_V16; }