File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed
spring-beans/src/test/java/org/springframework/beans Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -1577,6 +1577,24 @@ public void testPropertyTypeMismatch() {
1577
1577
assertEquals (8 , bwi .getPropertyValue ("object" ));
1578
1578
}
1579
1579
1580
+ @ Test
1581
+ public void testGenericArraySetter () {
1582
+ SkipReaderStub foo = new SkipReaderStub ();
1583
+ BeanWrapperImpl bwi = new BeanWrapperImpl (foo );
1584
+ List <String > values = new LinkedList <String >();
1585
+ values .add ("1" );
1586
+ values .add ("2" );
1587
+ values .add ("3" );
1588
+ values .add ("4" );
1589
+ bwi .setPropertyValue ("items" , values );
1590
+ Object [] result = foo .items ;
1591
+ assertEquals (4 , result .length );
1592
+ assertEquals ("1" , result [0 ]);
1593
+ assertEquals ("2" , result [1 ]);
1594
+ assertEquals ("3" , result [2 ]);
1595
+ assertEquals ("4" , result [3 ]);
1596
+ }
1597
+
1580
1598
1581
1599
static class Spr10115Bean {
1582
1600
@@ -1991,4 +2009,21 @@ public Integer getObject() {
1991
2009
}
1992
2010
}
1993
2011
2012
+
2013
+ public static class SkipReaderStub <T > {
2014
+
2015
+ public T [] items ;
2016
+
2017
+ public SkipReaderStub () {
2018
+ }
2019
+
2020
+ public SkipReaderStub (T ... items ) {
2021
+ this .items = items ;
2022
+ }
2023
+
2024
+ public void setItems (T ... items ) {
2025
+ this .items = items ;
2026
+ }
2027
+ }
2028
+
1994
2029
}
You can’t perform that action at this time.
0 commit comments