@@ -91,7 +91,7 @@ public class ValidationContext<T> {
9191 /**
9292 * The set of already processed unit of works. See {@link ProcessedUnit}.
9393 */
94- private final Set <ProcessedUnit > processedUnits ;
94+ private final Set <Object > processedUnits ;
9595
9696 /**
9797 * 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(
573573 }
574574 }
575575
576- private interface ProcessedUnit {
577- }
578-
579- private static class BeanGroupProcessedUnit implements ProcessedUnit {
576+ private static final class BeanGroupProcessedUnit {
580577
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 ;
584582
585583 private BeanGroupProcessedUnit (Object bean , Class <?> group ) {
586584 this .bean = bean ;
@@ -593,7 +591,7 @@ public boolean equals(Object o) {
593591 if ( this == o ) {
594592 return true ;
595593 }
596- if ( o == null || getClass () != o . getClass () ) {
594+ if ( o == null || getClass () != BeanGroupProcessedUnit . class ) {
597595 return false ;
598596 }
599597
@@ -621,12 +619,13 @@ private int createHashCode() {
621619 }
622620 }
623621
624- private static class BeanPathMetaConstraintProcessedUnit implements ProcessedUnit {
622+ private static final class BeanPathMetaConstraintProcessedUnit {
625623
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 ;
630629
631630 private BeanPathMetaConstraintProcessedUnit (Object bean , Path path , MetaConstraint <?> metaConstraint ) {
632631 this .bean = bean ;
@@ -640,7 +639,7 @@ public boolean equals(Object o) {
640639 if ( this == o ) {
641640 return true ;
642641 }
643- if ( o == null || getClass () != o . getClass () ) {
642+ if ( o == null || getClass () != BeanPathMetaConstraintProcessedUnit . class ) {
644643 return false ;
645644 }
646645
0 commit comments