961N/A * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 791N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 791N/A * This code is free software; you can redistribute it and/or modify it 791N/A * under the terms of the GNU General Public License version 2 only, as 791N/A * published by the Free Software Foundation. 791N/A * This code is distributed in the hope that it will be useful, but WITHOUT 791N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 791N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 791N/A * version 2 for more details (a copy is included in the LICENSE file that 791N/A * accompanied this code). 791N/A * You should have received a copy of the GNU General Public License version 791N/A * 2 along with this work; if not, write to the Free Software Foundation, 791N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 791N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 791N/A * or visit www.oracle.com if you need additional information or have any 791N/A * Test harness whose goal is to simplify the task of writing type-system 791N/A * regression test. It provides functionalities to build custom types as well 791N/A * as to access the underlying javac's symbol table in order to retrieve 791N/A * predefined types. Among the features supported by the harness are: type 791N/A * substitution, type containment, subtyping, cast-conversion, assigment 791N/A * This class is meant to be a common super class for all concrete type test 791N/A * classes. A subclass can access the type-factory and the test methods so as 791N/A * to write compact tests. An example is reported below: 791N/A * Type X = fac.TypeVariable(); 791N/A * Type Y = fac.TypeVariable(); 791N/A * Type A_X_Y = fac.Class(0, X, Y); 791N/A * Type A_Obj_Obj = fac.Class(0, 791N/A * checkSameType(A_Obj_Obj, subst(A_X_Y, 791N/A * Mapping(X, predef.objectType), 791N/A * Mapping(Y, predef.objectType))); 791N/A * The above code is used to create two class types, namely {@code A<X,Y>} and 791N/A * {@code A<Object,Object>} where both {@code X} and {@code Y} are type-variables. 791N/A * The code then verifies that {@code [X:=Object,Y:=Object]A<X,Y> == A<Object,Object>}. 791N/A // <editor-fold defaultstate="collapsed" desc="type assertions"> 791N/A /** assert that 's' is a subtype of 't' */ 791N/A /** assert that 's' is/is not a subtype of 't' */ 791N/A " is not a subtype of " :
791N/A /** assert that 's' is the same type as 't' */ 791N/A /** assert that 's' is/is not the same type as 't' */ 791N/A " is not the same type as " :
791N/A " is the same type as ";
791N/A /** assert that 's' is castable to 't' */ 791N/A /** assert that 's' is/is not castable to 't' */ 791N/A " is not castable to " :
791N/A /** assert that 's' is convertible (method invocation conversion) to 't' */ 791N/A /** assert that 's' is/is not convertible (method invocation conversion) to 't' */ 791N/A " is not convertible to " :
791N/A /** assert that 's' is assignable to 't' */ 791N/A /** assert that 's' is/is not assignable to 't' */ 791N/A " is not assignable to " :
820N/A /** assert that generic type 't' is well-formed */ 820N/A /** assert that 's' is/is not assignable to 't' */ 820N/A " is not a valid generic type" :
820N/A " is a valid generic type";
791N/A // <editor-fold defaultstate="collapsed" desc="type functions"> 791N/A /** compute the erasure of a type 't' */ 791N/A /** compute the capture of a type 't' */ 791N/A /** compute the boxed type associated with 't' */ 791N/A /** compute the unboxed type associated with 't' */ 791N/A /** compute a type substitution on 't' given a list of type mappings */ 791N/A /** create a fresh type mapping from a type to another */ 791N/A // <editor-fold defaultstate="collapsed" desc="type factory"> 791N/A * This class is used to create Java types in a simple way. All main 791N/A * kinds of type are supported: primitive, reference, non-denotable. The 791N/A * factory also supports creation of constant types (used by the compiler 791N/A * to represent the type of a literal).