svn commit: r1858483 - /ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1858483 - /ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java

mthl
Author: mthl
Date: Wed May  1 12:55:51 2019
New Revision: 1858483

URL: http://svn.apache.org/viewvc?rev=1858483&view=rev
Log:
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.

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java?rev=1858483&r1=1858482&r2=1858483&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/collections/MapContextTest.java Wed May  1 12:55:51 2019
@@ -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",