Skip to content

DATACMNS-899 - Fix recursion in ParameterizedTypeInformation.getMapValueType #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>1.13.0.BUILD-SNAPSHOT</version>
<version>1.13.0.DATACMNS-899-SNAPSHOT</version>

<name>Spring Data Core</name>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2014 the original author or authors.
* Copyright 2011-2016 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.
Expand Down Expand Up @@ -32,6 +32,7 @@
* class we will have to resolve generic parameters against.
*
* @author Oliver Gierke
* @author Mark Paluch
*/
class ParameterizedTypeInformation<T> extends ParentTypeAwareTypeInformation<T> {

Expand Down Expand Up @@ -85,7 +86,7 @@ protected TypeInformation<?> doGetMapValueType() {
}
}

return super.getMapValueType();
return super.doGetMapValueType();
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2016 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.
Expand Down Expand Up @@ -39,6 +39,7 @@
* Unit tests for {@link ParameterizedTypeInformation}.
*
* @author Oliver Gierke
* @author Mark Paluch
*/
@RunWith(MockitoJUnitRunner.class)
public class ParameterizedTypeUnitTests {
Expand Down Expand Up @@ -137,6 +138,19 @@ public void usesLocalGenericInformationOfFields() {
assertThat(valueType.getProperty("value").getType(), is(typeCompatibleWith(Education.class)));
}

/**
* @see DATACMNS-899
*/
@Test
public void returnsNullMapValueTypeForNonMapProperties(){

TypeInformation<?> valueType = ClassTypeInformation.from(Bar.class).getProperty("param");
TypeInformation<?> mapValueType = valueType.getMapValueType();

assertThat(valueType, instanceOf(ParameterizedTypeInformation.class));
assertThat(mapValueType, is(nullValue()));
}

@SuppressWarnings("serial")
class Localized<S> extends HashMap<Locale, S> {
S value;
Expand All @@ -152,6 +166,10 @@ class Foo {
Localized2<String> param2;
}

class Bar {
List<String> param;
}

class Parameterized<T> {
T property;
}
Expand Down