Search in sources :

Example 1 with ClassVal

use of org.checkerframework.common.reflection.qual.ClassVal in project checker-framework by typetools.

the class MethodValInferenceTest method testGetMethodParamLen.

public void testGetMethodParamLen(Class<?> @ArrayLen(2) [] classArray2, Class<?>[] classArrayUnknown) throws Exception {
    @StringVal("someMethod") String str = "someMethod";
    @ClassVal("java.lang.Object") Class<?> c = Object.class;
    @MethodVal(className = "java.lang.Object", methodName = "getA", params = 0) Method m1 = c.getMethod("getA", new Class[] {});
    @MethodVal(className = "java.lang.Object", methodName = "getA", params = 0) Method m2 = c.getMethod("getA", (Class[]) null);
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 1) Method m3 = c.getMethod("someMethod", new Class[] { Integer.class });
    @MethodVal(className = "java.lang.Object", methodName = "equals", params = 1) Method m4 = c.getMethod("equals", Object.class);
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 1) Method m5 = c.getMethod(str, int.class);
    @MethodVal(className = "java.lang.Object", methodName = "getB", params = 0) Method m6 = c.getMethod("getB", new Class[0]);
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 1) Method m7 = c.getMethod(str, new Class[] { int.class });
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 2) Method m8 = c.getMethod(str, new Class[] { Integer.class, Integer.class });
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 2) Method m10 = c.getMethod(str, int.class, int.class);
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = 2) Method m11 = c.getMethod(str, classArray2);
    @MethodVal(className = "java.lang.Object", methodName = "someMethod", params = -1) Method m12 = c.getMethod(str, classArrayUnknown);
}
Also used : MethodVal(org.checkerframework.common.reflection.qual.MethodVal) ClassVal(org.checkerframework.common.reflection.qual.ClassVal) StringVal(org.checkerframework.common.value.qual.StringVal) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 ClassVal (org.checkerframework.common.reflection.qual.ClassVal)1 MethodVal (org.checkerframework.common.reflection.qual.MethodVal)1 StringVal (org.checkerframework.common.value.qual.StringVal)1