/**
* Check that an assignment to an incorrect class type will not work (otherwise,
* the rest of the tests will pass trivially)
*/
static error {
Class<String> c = Integer.class;
}
/** Check that String.class has the proper type */
test {
Class<String> c = String.class;
}
/** Check that Class.class has the proper type */
test {
Class<Class> c = Class.class;
}
/** Check that a parameterized type's class literal has the proper type */
test {
Class<Class<String>> c = Class<String>.class;
}
/** Check that a wildcarded parameterized type's class literal has the proper type */
test {
Class<Class<? extends String>> c = Class<? extends String>.class;
}
/** Check that boolean.class has the proper type */
test {
Class<Boolean> c = boolean.class;
}
/** Check that char.class has the proper type */
test {
Class<Character> c = char.class;
}
/** Check that byte.class has the proper type */
test {
Class<Byte> c = byte.class;
}
/** Check that short.class has the proper type */
test {
Class<Short> c = short.class;
}
/** Check that int.class has the proper type */
test {
Class<Integer> c = int.class;
}
/** Check that long.class has the proper type */
test {
Class<Long> c = long.class;
}
/** Check that float.class has the proper type */
test {
Class<Float> c = Float.class;
}
/** Check that double.class has the proper type */
test {
Class<Double> c = double.class;
}
/** Check that void.class has the proper type */
test {
Class<Void> c = void.class;
}
/** Check that int[].class has the proper type */
test {
Class<int[]> c = int[].class;
}
/** Check that String[][].class has the proper type */
test {
Class<String[][]> c = String[][].class;
}