@@ -576,29 +576,22 @@ public boolean supports(Class<?> clazz) {
576
576
}
577
577
578
578
@ Override
579
- @ SuppressWarnings ("deprecation" )
580
579
public boolean supports (Type genericType ) {
581
580
if (genericType instanceof ParameterizedType ) {
582
581
ParameterizedType parameterizedType = (ParameterizedType ) genericType ;
583
582
if (JAXBElement .class == parameterizedType .getRawType () &&
584
583
parameterizedType .getActualTypeArguments ().length == 1 ) {
585
- boolean isJdk6 = (org .springframework .core .JdkVersion .getMajorJavaVersion () <= org .springframework .core .JdkVersion .JAVA_16 );
586
- boolean isJdk7 = (org .springframework .core .JdkVersion .getMajorJavaVersion () >= org .springframework .core .JdkVersion .JAVA_17 );
587
584
Type typeArgument = parameterizedType .getActualTypeArguments ()[0 ];
588
585
if (typeArgument instanceof Class ) {
589
586
Class <?> classArgument = (Class <?>) typeArgument ;
590
- if (isJdk7 && classArgument .isArray ()) {
591
- return (classArgument .getComponentType () == Byte .TYPE );
592
- }
593
- else {
594
- return (isPrimitiveWrapper (classArgument ) || isStandardClass (classArgument ) ||
595
- supportsInternal (classArgument , false ));
596
- }
587
+ return (((classArgument .isArray () && Byte .TYPE == classArgument .getComponentType ())) ||
588
+ isPrimitiveWrapper (classArgument ) || isStandardClass (classArgument ) ||
589
+ supportsInternal (classArgument , false ));
597
590
}
598
- else if (isJdk6 && typeArgument instanceof GenericArrayType ) {
599
- // see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5041784
591
+ else if (typeArgument instanceof GenericArrayType ) {
592
+ // Only on JDK 6 - see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5041784
600
593
GenericArrayType arrayType = (GenericArrayType ) typeArgument ;
601
- return (arrayType . getGenericComponentType () == Byte . TYPE );
594
+ return (Byte . TYPE == arrayType . getGenericComponentType () );
602
595
}
603
596
}
604
597
}
@@ -634,21 +627,21 @@ else if (!ObjectUtils.isEmpty(this.classesToBeBound)) {
634
627
* Compare section 8.5.1 of the JAXB2 spec.
635
628
*/
636
629
private boolean isPrimitiveWrapper (Class <?> clazz ) {
637
- return Boolean .class == clazz ||
630
+ return ( Boolean .class == clazz ||
638
631
Byte .class == clazz ||
639
632
Short .class == clazz ||
640
633
Integer .class == clazz ||
641
634
Long .class == clazz ||
642
635
Float .class == clazz ||
643
- Double .class == clazz ;
636
+ Double .class == clazz ) ;
644
637
}
645
638
646
639
/**
647
640
* Checks whether the given type is a standard class.
648
641
* Compare section 8.5.2 of the JAXB2 spec.
649
642
*/
650
643
private boolean isStandardClass (Class <?> clazz ) {
651
- return String .class == clazz ||
644
+ return ( String .class == clazz ||
652
645
BigInteger .class .isAssignableFrom (clazz ) ||
653
646
BigDecimal .class .isAssignableFrom (clazz ) ||
654
647
Calendar .class .isAssignableFrom (clazz ) ||
@@ -661,10 +654,11 @@ private boolean isStandardClass(Class<?> clazz) {
661
654
DataHandler .class == clazz ||
662
655
// Source and subclasses should be supported according to the JAXB2 spec, but aren't in the RI
663
656
// Source.class.isAssignableFrom(clazz) ||
664
- UUID .class == clazz ;
657
+ UUID .class == clazz ) ;
665
658
666
659
}
667
660
661
+
668
662
// Marshalling
669
663
670
664
@ Override
0 commit comments