@@ -130,7 +130,7 @@ public <T> T get(Enum<?> key, Class<T> expectedType) {
130
130
@ SuppressWarnings ("unchecked" )
131
131
public final <T > Collection <T > getCollection (String key , Class <T > type ) {
132
132
final Object value = get (key );
133
- if (type .isInstance (value )) {
133
+ if (type .isInstance (value ) && ( value != null && ! Collection . class . isAssignableFrom ( value . getClass ())) ) {
134
134
return Collections .singleton (type .cast (value ));
135
135
} else {
136
136
final Collection <Object > collection = get (key , Collection .class );
@@ -154,7 +154,7 @@ public <T> Collection<T> getCollection(Enum<?> key, Class<T> type) {
154
154
@ SuppressWarnings ("unchecked" )
155
155
public final <T > Set <T > getSet (String key , Class <T > type ) {
156
156
final Object value = get (key );
157
- if (type .isInstance (value )) {
157
+ if (type .isInstance (value ) && ( value != null && ! Set . class . isAssignableFrom ( value . getClass ())) ) {
158
158
return Collections .singleton (type .cast (value ));
159
159
} else {
160
160
final Set <Object > set = get (key , Set .class );
@@ -178,7 +178,7 @@ public <T> Set<T> getSet(Enum<?> key, Class<T> type) {
178
178
@ SuppressWarnings ("unchecked" )
179
179
public final <T > List <T > getList (String key , Class <T > type ) {
180
180
final Object value = get (key );
181
- if (type .isInstance (value )) {
181
+ if (type .isInstance (value ) && ( value != null && ! List . class . isAssignableFrom ( value . getClass ())) ) {
182
182
return Collections .singletonList (type .cast (value ));
183
183
} else {
184
184
final List <Object > list = get (key , List .class );
0 commit comments