< prev index next >
test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TypeList.java
Print this page
rev 53171 : 8158646: [jittester] generated tests may not compile by javac
Reviewed-by: duke
@@ -21,15 +21,10 @@
* questions.
*/
package jdk.test.lib.jittester;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.function.Predicate;
-
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.types.TypeByte;
import jdk.test.lib.jittester.types.TypeChar;
import jdk.test.lib.jittester.types.TypeDouble;
import jdk.test.lib.jittester.types.TypeFloat;
@@ -37,10 +32,15 @@
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeLong;
import jdk.test.lib.jittester.types.TypeShort;
import jdk.test.lib.jittester.types.TypeVoid;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.function.Predicate;
+
public class TypeList {
public static final TypeVoid VOID = new TypeVoid();
public static final TypeBoolean BOOLEAN = new TypeBoolean();
public static final TypeByte BYTE = new TypeByte();
public static final TypeChar CHAR = new TypeChar();
@@ -54,11 +54,11 @@
private static final List<Type> TYPES = new ArrayList<>();
private static final List<Type> BUILTIN_TYPES = new ArrayList<>();
private static final List<Type> BUILTIN_INT_TYPES = new ArrayList<>();
private static final List<Type> BUILTIN_FP_TYPES = new ArrayList<>();
- private static final List<Type> REFERENCE_TYPES = new ArrayList<>();
+ private static final List<TypeKlass> REFERENCE_TYPES = new ArrayList<>();
static {
BUILTIN_INT_TYPES.add(BOOLEAN);
BUILTIN_INT_TYPES.add(BYTE);
BUILTIN_INT_TYPES.add(CHAR);
@@ -97,11 +97,11 @@
protected static Collection<Type> getBuiltInFP() {
return BUILTIN_FP_TYPES;
}
- protected static Collection<Type> getReferenceTypes() {
+ protected static Collection<TypeKlass> getReferenceTypes() {
return REFERENCE_TYPES;
}
protected static boolean isBuiltInFP(Type t) {
return BUILTIN_FP_TYPES.contains(t);
@@ -146,21 +146,25 @@
}
}
return null;
}
- public static void add(Type t) {
+ public static void add(TypeKlass t) {
REFERENCE_TYPES.add(t);
TYPES.add(t);
}
protected static void remove(Type t) {
REFERENCE_TYPES.remove(t);
TYPES.remove(t);
}
public static void removeAll() {
- Predicate<? super Type> isNotBasic = t -> t.getName().startsWith("Test_");
- TYPES.removeIf(isNotBasic);
- REFERENCE_TYPES.removeIf(isNotBasic);
+ Predicate<? super String> isNotBasic = s -> s.startsWith("Test_");
+ Predicate<? super Type> isNotBasicType = t -> isNotBasic.test(t.getName());
+ REFERENCE_TYPES.stream()
+ .map(TypeKlass::getChildrenNames)
+ .forEach(l -> l.removeIf(isNotBasic));
+ TYPES.removeIf(isNotBasicType);
+ REFERENCE_TYPES.removeIf(isNotBasicType);
}
}
< prev index next >