Introduce AnnotationAwareOrderComparator#INSTANCE

Prior to this change, the INSTANCE constant one could refer to on
AnnotationAwareOrderComparator actually referred to the constant
declared in the OrderAwareComparator superclass. Thus
AnnotationAwareOrderComparator#INSTANCE did not actually return an
AnnotationAwareOrderComparator but an OrderAwareComparator instead. This
commit introduces a dedicated constant on AnnotationAwareOrderComparator
to avoid this glitch.

Issue: SPR-10038
This commit is contained in:
Oliver Gierke
2012-11-26 16:34:05 +01:00
committed by Chris Beams
parent 1394050ed2
commit e40e2b7cae
2 changed files with 38 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,12 +27,15 @@ import org.springframework.core.Ordered;
* annotation value (if any).
*
* @author Juergen Hoeller
* @author Oliver Gierke
* @since 2.0.1
* @see org.springframework.core.Ordered
* @see Order
*/
public class AnnotationAwareOrderComparator extends OrderComparator {
public static AnnotationAwareOrderComparator INSTANCE = new AnnotationAwareOrderComparator();
@Override
protected int getOrder(Object obj) {
if (obj instanceof Ordered) {