MCPcopy Create free account
hub / github.com/java-native-access/jna / isCompatibleVersion

Method isCompatibleVersion

src/com/sun/jna/Native.java:207–228  ·  view source on GitHub ↗

Version string must have the structure . . a bugfix change in the native code increments revision, the minor is incremented for backwards compatible changes and the major version is changed for backwards incompatbile changes. @param expectedVersion @param nativeVersion @retur

(String expectedVersion, String nativeVersion)

Source from the content-addressed store, hash-verified

205 * @return true if nativeVersion describes a version compatible to expectedVersion
206 */
207 static boolean isCompatibleVersion(String expectedVersion, String nativeVersion) {
208 String[] expectedVersionParts = expectedVersion.split("\\.");
209 String[] nativeVersionParts = nativeVersion.split("\\.");
210 if(expectedVersionParts.length < 3 || nativeVersionParts.length < 3) {
211 return false;
212 }
213
214 int expectedMajor = Integer.parseInt(expectedVersionParts[0]);
215 int nativeMajor = Integer.parseInt(nativeVersionParts[0]);
216 int expectedMinor = Integer.parseInt(expectedVersionParts[1]);
217 int nativeMinor = Integer.parseInt(nativeVersionParts[1]);
218
219 if(expectedMajor != nativeMajor) {
220 return false;
221 }
222
223 if(expectedMinor > nativeMinor) {
224 return false;
225 }
226
227 return true;
228 }
229
230 static {
231 loadNativeDispatchLibrary();

Callers 2

testVersionComparisonMethod · 0.95
NativeClass · 0.95

Calls

no outgoing calls

Tested by 1

testVersionComparisonMethod · 0.76