"Applied fix from trunk for revision: 1858483"

------------------------------------------------------------------------
r1858483 | mthl | 2019-05-01 14:55:51 +0200 (mer. 01 mai 2019) | 7 lignes

Improved: Remove unneeded generics in ‘MapContextTest’
(OFBIZ-10933)

This is done to remove a warning in OpenJDK 8 which doesn't seem to
handle ‘@safevarargs’ annotation properly when using generics.  This
warning was not present with OpenJDK 11.

------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858979 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2019-05-09 09:01:19 +00:00
parent f6206c1774
commit bdfc43319f
@@ -41,11 +41,11 @@ public class MapContextTest {
*
* @see ControllerConfig
*/
static class PNode<K, V> {
static class PNode {
/** The properties of the node. */
public Map<K, V> props;
public Map<String, String> props;
/** The included identifier of nodes. */
private List<PNode<K, V>> includes;
private List<PNode> includes;
/**
* Constructs a node without properties.
@@ -53,7 +53,7 @@ public class MapContextTest {
* @param includes the included nodes
*/
@SafeVarargs
public PNode(PNode<K, V>... includes) {
public PNode(PNode... includes) {
this(Collections.emptyMap(), includes);
}
@@ -64,7 +64,7 @@ public class MapContextTest {
* @param includes the included nodes
*/
@SafeVarargs
public PNode(Map<K, V> props, PNode<K, V>... includes) {
public PNode(Map<String, String> props, PNode... includes) {
this.props = props;
this.includes = Arrays.asList(includes);
}
@@ -74,8 +74,8 @@ public class MapContextTest {
*
* @return a map context containing the properties of the tree.
*/
public MapContext<K, V> allProps() {
MapContext<K, V> res = new MapContext<>();
public MapContext<String, String> allProps() {
MapContext<String, String> res = new MapContext<>();
includes.forEach(inc -> res.push(inc.allProps()));
res.push(props);
return res;
@@ -90,10 +90,10 @@ public class MapContextTest {
UtilMisc.toMap(LinkedHashMap::new, "aa", "1", "ab", "1");
Map<String, String> propsB =
UtilMisc.toMap(LinkedHashMap::new, "ba", "3", "bb", "8", "bc", "1", "bd", "14");
PNode<String, String> pn = new PNode<>(propsA,
new PNode<>(propsB, new PNode<>(), new PNode<>()),
new PNode<>(new PNode<>()),
new PNode<>());
PNode pn = new PNode(propsA,
new PNode(propsB, new PNode(), new PNode()),
new PNode(new PNode()),
new PNode());
MapContext<String, String> mc = pn.allProps();
assertThat("insertion order of LinkedHashMap is preserved by the 'values' method",