Merge
authorppunegov
Thu, 14 Apr 2016 18:15:41 +0200
changeset 38041 eae42e8b1a4b
parent 38037 31c22b526d30 (current diff)
parent 38040 4dc4b97c2bf1 (diff)
child 38042 95b4f1f6cb72
Merge
hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TypeUtil.java
--- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java	Thu Apr 14 18:15:41 2016 +0200
@@ -26,7 +26,6 @@
  * @bug 8137167
  * @summary Tests CompileCommand=print
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
- * @ignore 8140354
  * @build compiler.compilercontrol.commandfile.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java	Thu Apr 14 18:15:41 2016 +0200
@@ -26,7 +26,6 @@
  * @bug 8137167
  * @summary Tests CompileCommand=print
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
- * @ignore 8140354
  * @build compiler.compilercontrol.commands.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java	Thu Apr 14 18:15:41 2016 +0200
@@ -26,7 +26,6 @@
  * @bug 8137167
  * @summary Tests directives to be able to turn on print_assembly
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
- * @ignore 8140354
  * @build compiler.compilercontrol.directives.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Thu Apr 14 18:15:41 2016 +0200
@@ -26,7 +26,6 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
- * @ignore 8140354
  * @build compiler.compilercontrol.jcmd.PrintDirectivesTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Thu Apr 14 18:15:41 2016 +0200
@@ -26,7 +26,6 @@
  * @bug 8137167
  * @summary Randomly generates valid commands with random types
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
- * @ignore 8140354
  * @build compiler.compilercontrol.mixed.RandomValidCommandsTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TypeUtil.java	Tue Apr 12 11:53:44 2016 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.test.lib.jittester;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-
-public class TypeUtil {
-
-    public static Collection<Type> getImplicitlyCastable(Collection<Type> types, Type type) {
-        ArrayList<Type> result = new ArrayList<>(types);
-        Iterator<Type> iterator = result.iterator();
-        while (iterator.hasNext()) {
-            if (!iterator.next().canImplicitlyCastTo(type)) {
-                iterator.remove();
-            }
-        }
-        return result;
-    }
-
-    public static Collection<Type> getExplicitlyCastable(Collection<Type> types, Type type) {
-        ArrayList<Type> result = new ArrayList<>(types);
-        Iterator<Type> iterator = result.iterator();
-        while (iterator.hasNext()) {
-            if (!iterator.next().canExplicitlyCastTo(type)) {
-                iterator.remove();
-            }
-        }
-        return result;
-    }
-
-    public static List<Type> getMoreCapatiousThan(Collection<Type> types, BuiltInType type) {
-        ArrayList<Type> result = new ArrayList<>();
-        Iterator<Type> iterator = types.iterator();
-        while (iterator.hasNext()) {
-            try {
-                BuiltInType builtInType = (BuiltInType) iterator.next();
-                if (builtInType.isMoreCapaciousThan(type)) {
-                    result.add(builtInType);
-                }
-            } catch (Exception e) {
-            }
-        }
-        return result;
-    }
-
-    public static List<Type> getLessCapatiousOrEqualThan(Collection<Type> types, BuiltInType type) {
-        ArrayList<Type> result = new ArrayList<>();
-        Iterator<Type> iterator = types.iterator();
-        while (iterator.hasNext()) {
-            try {
-                BuiltInType builtInType = (BuiltInType) iterator.next();
-                if (!builtInType.isMoreCapaciousThan(type) || builtInType.equals(type)) {
-                    result.add(builtInType);
-                }
-            } catch (Exception e) {
-            }
-        }
-        return result;
-    }
-}
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -31,7 +31,7 @@
 import jdk.test.lib.jittester.Rule;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.VariableBase;
 import jdk.test.lib.jittester.VariableInfo;
 import jdk.test.lib.jittester.types.TypeKlass;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -29,7 +29,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeInt;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.utils.PseudoRandom;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -28,7 +28,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeBoolean;
 import jdk.test.lib.jittester.types.TypeInt;
 import jdk.test.lib.jittester.types.TypeKlass;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -28,11 +28,11 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
 import jdk.test.lib.jittester.types.TypeInt;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.types.TypeLong;
 import jdk.test.lib.jittester.utils.PseudoRandom;
+import jdk.test.lib.jittester.utils.TypeUtil;
 
 class BinaryShiftOperatorFactory extends BinaryOperatorFactory {
     BinaryShiftOperatorFactory(OperatorKind opKind, long complexityLimit, int operatorLimit,
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -28,7 +28,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.UnaryOperator;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.types.TypeInt;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -33,7 +33,7 @@
 import jdk.test.lib.jittester.SymbolTable;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.loops.DoWhile;
 import jdk.test.lib.jittester.loops.For;
 import jdk.test.lib.jittester.loops.While;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -30,7 +30,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeBoolean;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.utils.PseudoRandom;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -30,7 +30,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.utils.PseudoRandom;
 
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -30,7 +30,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.types.TypeBoolean;
 import jdk.test.lib.jittester.utils.PseudoRandom;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -30,7 +30,7 @@
 import jdk.test.lib.jittester.SymbolTable;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.VariableInfo;
 import jdk.test.lib.jittester.loops.CounterInitializer;
 import jdk.test.lib.jittester.types.TypeKlass;
@@ -48,7 +48,7 @@
 
     @Override
     protected IRNode sproduce() throws ProductionFailedException {
-        List<Type> types = TypeUtil.getMoreCapatiousThan(TypeList.getBuiltIn(), new TypeInt());
+        List<Type> types = TypeUtil.getMoreCapaciousThan(TypeList.getBuiltIn(), new TypeInt());
         types.add(new TypeInt());
         final Type selectedType = PseudoRandom.randomElement(types);
         IRNode init = new LiteralInitializer(counterValue, selectedType);
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -34,7 +34,7 @@
 import jdk.test.lib.jittester.Rule;
 import jdk.test.lib.jittester.Switch;
 import jdk.test.lib.jittester.Type;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.types.TypeByte;
 import jdk.test.lib.jittester.types.TypeChar;
@@ -63,7 +63,7 @@
     @Override
     protected IRNode sproduce() throws ProductionFailedException {
         if (statementLimit > 0 && complexityLimit > 0) {
-            ArrayList<Type> switchTypes = new ArrayList<>();
+            List<Type> switchTypes = new ArrayList<>();
             switchTypes.add(new TypeChar());
             switchTypes.add(new TypeByte());
             switchTypes.add(new TypeShort());
@@ -78,8 +78,8 @@
                     .setCanHaveReturn(canHaveReturn);
             MAIN_LOOP:
             for (Type type : switchTypes) {
-                ArrayList<IRNode> caseConsts = new ArrayList<>();
-                ArrayList<IRNode> caseBlocks = new ArrayList<>();
+                List<IRNode> caseConsts = new ArrayList<>();
+                List<IRNode> caseBlocks = new ArrayList<>();
                 try {
                     int accumulatedStatements = 0;
                     int currentStatementsLimit = 0;
@@ -94,10 +94,10 @@
                             .getLimitedExpressionFactory()
                             .produce();
                     accumulatedComplexity += currentComplexityLimit;
-                    ArrayList<Type> caseTypes = new ArrayList<>();
+                    List<Type> caseTypes = new ArrayList<>();
                     caseTypes.add(new TypeByte());
                     caseTypes.add(new TypeChar());
-                    caseTypes = new ArrayList<>(TypeUtil.getLessCapatiousOrEqualThan(caseTypes,
+                    caseTypes = new ArrayList<>(TypeUtil.getLessCapaciousOrEqualThan(caseTypes,
                             (BuiltInType) type));
                     if (PseudoRandom.randomBoolean()) { // "default"
                         currentStatementsLimit = (int) (PseudoRandom.random()
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -30,7 +30,7 @@
 import jdk.test.lib.jittester.TernaryOperator;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.types.TypeBoolean;
 import jdk.test.lib.jittester.utils.PseudoRandom;
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -31,7 +31,7 @@
 import jdk.test.lib.jittester.TryCatchBlock;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.utils.PseudoRandom;
 
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java	Tue Apr 12 11:53:44 2016 +0800
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java	Thu Apr 14 18:15:41 2016 +0200
@@ -29,7 +29,7 @@
 import jdk.test.lib.jittester.ProductionFailedException;
 import jdk.test.lib.jittester.Type;
 import jdk.test.lib.jittester.TypeList;
-import jdk.test.lib.jittester.TypeUtil;
+import jdk.test.lib.jittester.utils.TypeUtil;
 import jdk.test.lib.jittester.UnaryOperator;
 import jdk.test.lib.jittester.types.TypeBoolean;
 import jdk.test.lib.jittester.types.TypeInt;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/TypeUtil.java	Thu Apr 14 18:15:41 2016 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.jittester.utils;
+
+import jdk.test.lib.jittester.BuiltInType;
+import jdk.test.lib.jittester.Type;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Utility functions for type system
+ */
+public class TypeUtil {
+    /**
+     * Gets a list of implicitly castable types to a given one from the collection of types
+     *
+     * @param types a collection to get types from
+     * @param type  a target type which result type could be implicitly cast to
+     * @return      a result collection of types that match given conditions
+     */
+    public static Collection<Type> getImplicitlyCastable(Collection<Type> types, Type type) {
+        return types.stream()
+                .filter(t -> t.canImplicitlyCastTo(type))
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * Gets a list of explicitly castable types to a given one from the collection of types
+     *
+     * @param types a collection to get types from
+     * @param type  a target type which result type could be explicitly cast to
+     * @return      a result collection of types that match given conditions
+     */
+    public static Collection<Type> getExplicitlyCastable(Collection<Type> types, Type type) {
+        return types.stream()
+                .filter(t -> t.canExplicitlyCastTo(type))
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * Gets a list of more capacious types than a given one from the collection of types
+     *
+     * @param types a collection to get types from
+     * @param type  a type to filter given types by capacity
+     * @return      a result collection of types that match given conditions
+     */
+    public static List<Type> getMoreCapaciousThan(Collection<Type> types, BuiltInType type) {
+        return types.stream()
+                .filter(t -> ((BuiltInType) t).isMoreCapaciousThan(type))
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * Gets a list of less or equal capacious types than a given one from the collection of types
+     *
+     * @param types a collection to get types from
+     * @param type  a type to filter given types by capacity
+     * @return      a result collection of types that match given conditions
+     */
+    public static List<Type> getLessCapaciousOrEqualThan(Collection<Type> types, BuiltInType type) {
+        return types.stream()
+                .filter(t -> !((BuiltInType) t).isMoreCapaciousThan(type) || t.equals(type))
+                .collect(Collectors.toList());
+    }
+}