@@ -91,7 +91,7 @@ public class ValidationContext<T> {
91
91
/**
92
92
* The set of already processed unit of works. See {@link ProcessedUnit}.
93
93
*/
94
- private final Set <ProcessedUnit > processedUnits ;
94
+ private final Set <Object > processedUnits ;
95
95
96
96
/**
97
97
* Maps an object to a list of paths in which it has been validated. The objects are the bean instances.
@@ -573,14 +573,12 @@ public <T> ValidationContext<T> forValidateReturnValue(
573
573
}
574
574
}
575
575
576
- private interface ProcessedUnit {
577
- }
578
-
579
- private static class BeanGroupProcessedUnit implements ProcessedUnit {
576
+ private static final class BeanGroupProcessedUnit {
580
577
581
- private final Object bean ;
582
- private final Class <?> group ;
583
- private final int hashCode ;
578
+ // these fields are final but we don't mark them as final as an optimization
579
+ private Object bean ;
580
+ private Class <?> group ;
581
+ private int hashCode ;
584
582
585
583
private BeanGroupProcessedUnit (Object bean , Class <?> group ) {
586
584
this .bean = bean ;
@@ -593,7 +591,7 @@ public boolean equals(Object o) {
593
591
if ( this == o ) {
594
592
return true ;
595
593
}
596
- if ( o == null || getClass () != o . getClass () ) {
594
+ if ( o == null || getClass () != BeanGroupProcessedUnit . class ) {
597
595
return false ;
598
596
}
599
597
@@ -621,12 +619,13 @@ private int createHashCode() {
621
619
}
622
620
}
623
621
624
- private static class BeanPathMetaConstraintProcessedUnit implements ProcessedUnit {
622
+ private static final class BeanPathMetaConstraintProcessedUnit {
625
623
626
- private final Object bean ;
627
- private final Path path ;
628
- private final MetaConstraint <?> metaConstraint ;
629
- private final int hashCode ;
624
+ // these fields are final but we don't mark them as final as an optimization
625
+ private Object bean ;
626
+ private Path path ;
627
+ private MetaConstraint <?> metaConstraint ;
628
+ private int hashCode ;
630
629
631
630
private BeanPathMetaConstraintProcessedUnit (Object bean , Path path , MetaConstraint <?> metaConstraint ) {
632
631
this .bean = bean ;
@@ -640,7 +639,7 @@ public boolean equals(Object o) {
640
639
if ( this == o ) {
641
640
return true ;
642
641
}
643
- if ( o == null || getClass () != o . getClass () ) {
642
+ if ( o == null || getClass () != BeanPathMetaConstraintProcessedUnit . class ) {
644
643
return false ;
645
644
}
646
645
0 commit comments