/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*/
/*
* @test
* @bug 4891872
* @summary Some tests for the generic core reflection api.
* @author Gilad Bracha
* @compile TestC1.java
*/
abstract class C1<T> {
public T ft;
public C1(T t) {}
public abstract T mt(T t);
}
public class TestC1 {
static {
}
testMethods();
testFields();
}
static void testSuperclass() {
assert
"The generic superclass of C1 should be Object";
}
static void testSuperInterfaces() {
assert
"C1 should have no generic superinterfaces";
}
static void testTypeParameters() {
assert
"C1 should have one type parameter";
assert
"T should have one bound";
assert
"The default bound of a type variable should be Object";
}
assert
"C1.mc1t has three parameters";
assert
p1_mc1t instanceof TypeVariable :
"Generic type of the 1st parameter of mc1t(T) is a type variable";
assert
assert
"T should have one bound (mc1t)";
assert
"The bound of T should be Object (mc1t)";
assert
p2_mc1t instanceof ParameterizedType :
"The type of parameter 2 of mc1t is a parameterized type";
assert
"Type of parameter 2 of mc1t is instantiation of C1";
assert
"Type of parameter 2 of mc1t is has null owner";
assert
"The type of parameter 2 of mc1t has one type argument";
assert
ta instanceof TypeVariable :
"The actual type arg of C1<T> is a type variable (mc1t)";
assert
assert
"mc1t: The type argument of C1<T> should have one bound";
assert
"mc1t: The bound of the type arg of C1<T> should be Object";
assert
"Type of parameter 3 of mc1t is C1";
assert
"C1.mc1 has zero parameters";
assert
"C1.mt has one parameter";
assert
p_mt instanceof TypeVariable :
"The generic type of the parameter of mt(T) is a type variable";
assert
assert
"T should have one bound";
assert
"The bound of T should be Object";
assert
"Method C1.mc1t should have no generic exception types";
assert
"Method C1.mc1 should have no generic exception types";
assert
"Method C1.mt should have no generic exception types";
assert
"Method C1.mc1t should have no type parameters";
assert
"Method C1.mc1 should have no type parameters";
assert
"Method C1.mt should have no type parameters";
}
assert
gt_ft instanceof TypeVariable :
"The generic type of C1.ft is a type variable";
assert
assert
"The type of ft should have one bound";
assert
"The bound of the type of ft should be Object";
assert
gt_fc1t instanceof ParameterizedType :
"The generic type of C1.fc1t is a parameterized type";
assert
"Type of C1.fc1t is instantiation of C1";
assert
"Type of C1.fc1t is has null owner";
assert
"The type of fc1t has one type argument";
assert
ta instanceof TypeVariable :
"The actual type arg of C1<T> is a type variable";
assert
assert
"The type argument of C1<T> should have one bound";
assert
"The bound of the type arg of C1<T> should be Object";
assert
" Type of C1.fc1 should be C1";
}
assert
"Constructor C1(T) should have one generic parameter type";
assert
pt instanceof TypeVariable :
"The generic type of the parameter of C1(T) is a type variable";
assert
assert
"T should have one bound";
assert
"The bound of T should be Object";
assert
"Constructor C1(T) should have no generic exception types";
assert
"Constructor C1(T) should have no type parameters";
}
}