/*
* Copyright (c) 2010, 2011, 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.
*/
import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.code.Types;
import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.comp.Check;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
import com.sun.tools.javac.file.JavacFileManager;
/**
* Test harness whose goal is to simplify the task of writing type-system
* regression test. It provides functionalities to build custom types as well
* as to access the underlying javac's symbol table in order to retrieve
* predefined types. Among the features supported by the harness are: type
* substitution, type containment, subtyping, cast-conversion, assigment
* conversion.
*
* This class is meant to be a common super class for all concrete type test
* classes. A subclass can access the type-factory and the test methods so as
* to write compact tests. An example is reported below:
*
*
* Type X = fac.TypeVariable();
* Type Y = fac.TypeVariable();
* Type A_X_Y = fac.Class(0, X, Y);
* Type A_Obj_Obj = fac.Class(0,
* predef.objectType,
* predef.objectType);
* checkSameType(A_Obj_Obj, subst(A_X_Y,
* Mapping(X, predef.objectType),
* Mapping(Y, predef.objectType)));
*
*
* The above code is used to create two class types, namely {@code A} and
* {@code A