public static boolean containsVersion ( VersionRange allowedRange , ArtifactVersion theVersion ) { boolean matched = false ; ArtifactVersion recommendedVersion = allowedRange . getRecommendedVersion ( ) ; if ( recommendedVersion == null ) { @ SuppressWarnings ( "unchecked" ) List < Restriction > restrictions = allowedRange . getRestrictions ( ) ; for ( Restriction restriction : restrictions ) { if ( restriction . containsVersion ( theVersion ) ) { matched = true ; break ; } } } else { // only singular versions ever have a recommendedVersion @ SuppressWarnings ( "unchecked" ) int compareTo = recommendedVersion . compareTo ( theVersion ) ; matched = ( compareTo <= 0 ) ; } return matched ; }
Copied from Artifact . VersionRange . This is tweaked to handle singular ranges properly . Currently the default containsVersion method assumes a singular version means allow everything . This method assumes that 2 . 0 . 4 == [ 2 . 0 . 4 )