import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
import java.lang.reflect.WildcardType;
import java.net.URISyntaxException;
import java.net.URL;
assertTrue(new File(parent, "Nodes.java").exists());
assertTrue(new File(parent, "NodesBuilder.java").exists());
assertTrue(new File(parent, "Alg.java").exists());
- assertTrue(new File(parent, "NodesIdUnionBuilder.java").exists());
- CompilationTestUtils.assertFilesCount(parent, 6);
+ CompilationTestUtils.assertFilesCount(parent, 5);
// Test if sources are compilable
CompilationTestUtils.testCompilation(sourcesOutputDir, compiledOutputDir);
private static void testReturnTypeIdentityref(final Class<?> clazz, final String methodName,
final String returnTypeStr) throws NoSuchMethodException {
- Method method = clazz.getMethod(methodName);
- assertEquals(java.lang.Class.class, method.getReturnType());
- java.lang.reflect.Type returnType = method.getGenericReturnType();
- assertTrue(returnType instanceof ParameterizedType);
- final ParameterizedType pt = (ParameterizedType) returnType;
- final java.lang.reflect.Type[] parameters = pt.getActualTypeArguments();
- assertEquals(1, parameters.length);
- final java.lang.reflect.Type parameter = parameters[0];
- assertTrue(parameter instanceof WildcardType);
- final WildcardType wildcardType = (WildcardType) parameter;
- assertEquals("? extends " + returnTypeStr, wildcardType.toString());
+ Class<?> returnType = clazz.getMethod(methodName).getReturnType();
+ assertTrue(returnType.isInterface());
+ assertEquals(returnTypeStr, returnType.getName());
}
private static void testReturnTypeInstanceIdentitifer(final ClassLoader loader, final Class<?> clazz,
final Class<?> rawReturnType = Class.forName("org.opendaylight.yangtools.yang.binding.InstanceIdentifier", true,
loader);
assertEquals(rawReturnType, method.getReturnType());
- final java.lang.reflect.Type returnType = method.getGenericReturnType();
+ final Type returnType = method.getGenericReturnType();
assertTrue(returnType instanceof ParameterizedType);
final ParameterizedType pt = (ParameterizedType) returnType;
- final java.lang.reflect.Type[] parameters = pt.getActualTypeArguments();
+ final Type[] parameters = pt.getActualTypeArguments();
assertEquals(1, parameters.length);
- final java.lang.reflect.Type parameter = parameters[0];
+ final Type parameter = parameters[0];
assertTrue(parameter instanceof WildcardType);
final WildcardType wildcardType = (WildcardType) parameter;
assertEquals("?", wildcardType.toString());