Avoid infinite cycle resolving generic type that refers itself
This commit improves type resolution for a unresolved generic type that uses itself in its upper bound declaration. Closes gh-16451pull/16472/head
parent
8a04e2cc86
commit
fbb5ffe0a4
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.configurationsample.generic;
|
||||
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
import org.springframework.boot.configurationsample.NestedConfigurationProperty;
|
||||
|
||||
/**
|
||||
* More advanced generic setup.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ConfigurationProperties("generic")
|
||||
public class ComplexGenericProperties {
|
||||
|
||||
@NestedConfigurationProperty
|
||||
private UpperBoundGenericPojo<Test> test = new UpperBoundGenericPojo<>();
|
||||
|
||||
public UpperBoundGenericPojo<Test> getTest() {
|
||||
return this.test;
|
||||
}
|
||||
|
||||
public enum Test {
|
||||
|
||||
ONE, TWO, THREE
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.configurationsample.generic;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A pojo with a complex generic signature.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class UpperBoundGenericPojo<T extends Enum<T>> {
|
||||
|
||||
private final Map<T, String> mappings = new HashMap<>();
|
||||
|
||||
public Map<T, String> getMappings() {
|
||||
return this.mappings;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue