@@ -29,14 +29,13 @@ abstract class AbstractJreRangeCondition<A extends Annotation> extends BooleanEx
2929 private static final JRE DEFAULT_MINIMUM_JRE = JRE .JAVA_17 ;
3030 private static final JRE DEFAULT_MAXIMUM_JRE = JRE .OTHER ;
3131
32- private final String annotationName ;
33-
3432 AbstractJreRangeCondition (Class <A > annotationType , Function <A , String > customDisabledReason ) {
3533 super (annotationType , ENABLED_ON_CURRENT_JRE , DISABLED_ON_CURRENT_JRE , customDisabledReason );
36- this .annotationName = annotationType .getSimpleName ();
3734 }
3835
3936 protected final boolean isCurrentVersionWithinRange (JRE minJre , JRE maxJre , int minVersion , int maxVersion ) {
37+ String annotationName = super .annotationType .getSimpleName ();
38+
4039 boolean minJreSet = minJre != JRE .UNDEFINED ;
4140 boolean maxJreSet = maxJre != JRE .UNDEFINED ;
4241 boolean minVersionSet = minVersion != JRE .UNDEFINED_VERSION ;
@@ -45,17 +44,17 @@ protected final boolean isCurrentVersionWithinRange(JRE minJre, JRE maxJre, int
4544 // Users must choose between JRE enum constants and version numbers.
4645 Preconditions .condition (!minJreSet || !minVersionSet ,
4746 () -> "@%s's minimum value must be configured with either a JRE enum constant or numeric version, but not both" .formatted (
48- this . annotationName ));
47+ annotationName ));
4948 Preconditions .condition (!maxJreSet || !maxVersionSet ,
5049 () -> "@%s's maximum value must be configured with either a JRE enum constant or numeric version, but not both" .formatted (
51- this . annotationName ));
50+ annotationName ));
5251
5352 // Users must supply valid values for minVersion and maxVersion.
5453 Preconditions .condition (!minVersionSet || (minVersion >= JRE .MINIMUM_VERSION ),
55- () -> "@%s's minVersion [%d] must be greater than or equal to %d" .formatted (this . annotationName , minVersion ,
54+ () -> "@%s's minVersion [%d] must be greater than or equal to %d" .formatted (annotationName , minVersion ,
5655 JRE .MINIMUM_VERSION ));
5756 Preconditions .condition (!maxVersionSet || (maxVersion >= JRE .MINIMUM_VERSION ),
58- () -> "@%s's maxVersion [%d] must be greater than or equal to %d" .formatted (this . annotationName , maxVersion ,
57+ () -> "@%s's maxVersion [%d] must be greater than or equal to %d" .formatted (annotationName , maxVersion ,
5958 JRE .MINIMUM_VERSION ));
6059
6160 // Now that we have checked the basic preconditions, we need to ensure that we are
@@ -72,10 +71,10 @@ protected final boolean isCurrentVersionWithinRange(JRE minJre, JRE maxJre, int
7271
7372 // Finally, we need to validate the effective minimum and maximum values.
7473 Preconditions .condition ((min != DEFAULT_MINIMUM_JRE .version () || max != DEFAULT_MAXIMUM_JRE .version ()),
75- () -> "You must declare a non-default value for the minimum or maximum value in @" + this . annotationName );
74+ () -> "You must declare a non-default value for the minimum or maximum value in @" + annotationName );
7675 Preconditions .condition (min <= max ,
7776 () -> "@%s's minimum value [%d] must be less than or equal to its maximum value [%d]" .formatted (
78- this . annotationName , min , max ));
77+ annotationName , min , max ));
7978
8079 return JRE .isCurrentVersionWithinRange (min , max );
8180 }
0 commit comments