Changeset 3069


Ignore:
Timestamp:
01/19/12 13:28:58 (4 months ago)
Author:
kasper
Message:

Fixed minor bug pertaining to primitive arrays not being recognized as Object instances.

Location:
AnalyzerBeans/trunk/core/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • AnalyzerBeans/trunk/core/src/main/java/org/eobjects/analyzer/util/ReflectionUtils.java

    r3053 r3069  
    7979                        thisClass = (Class<?>) thisType; 
    8080                        if (includeArray && thisClass.isArray() && !ofThatType.isArray()) { 
     81                                if (ofThatType == Object.class) { 
     82                                        return true; 
     83                                } 
     84                                 
    8185                                thisClass = thisClass.getComponentType(); 
    8286                        } 
    8387                } 
     88 
    8489                if (thisClass == ofThatType) { 
    8590                        return true; 
     
    479484                } 
    480485        } 
    481          
     486 
    482487        public static <A extends Annotation> A getAnnotation(Enum<?> enumConstant, Class<A> annotationClass) { 
    483488                try { 
     
    494499                } 
    495500        } 
    496          
     501 
    497502        public static boolean isAnnotationPresent(Enum<?> enumConstant, Class<? extends Annotation> annotationClass) { 
    498503                try { 
  • AnalyzerBeans/trunk/core/src/test/java/org/eobjects/analyzer/util/ReflectionUtilsTest.java

    r2341 r3069  
    131131        } 
    132132 
     133        public void testIsArrayAnObject() throws Exception { 
     134                assertTrue(ReflectionUtils.is(byte[].class, Object.class)); 
     135        } 
     136         
     137        public void testIsPrimitiveByteAnObject() throws Exception { 
     138                assertFalse(ReflectionUtils.is(byte.class, Object.class)); 
     139        } 
     140         
     141        public void testIsByteWrapperAnObject() throws Exception { 
     142                assertTrue(ReflectionUtils.is(Byte.class, Object.class)); 
     143        } 
     144 
    133145} 
Note: See TracChangeset for help on using the changeset viewer.