private static Object invokeAnnotation(Class<?> clazz, Object[] trees) throws InstantiationException, IllegalAccessException, InvocationTargetException {
        Constructor<?> ctor = clazz.getDeclaredConstructors()[0];
        ctor.setAccessible(true);
        Object instance = ctor.newInstance();
        Method method = null;
        Method[] declaredMethods = clazz.getDeclaredMethods();
        for (Method m : declaredMethods) {
            if (m.getName().equals("apply")) method = m;
        }
        assert method != null: "Method 'apply' not found in annotation class";
        method.setAccessible(true);
        Object result;
        try {
            result = method.invoke(instance, trees);
        }   catch (InvocationTargetException e) {
            // we can't even pass exceptions without re-wraping them since classes on the invoking side are incompatible
            // also flatten to avoid getting nested ITEs
            RuntimeException exception = new RuntimeException(e.getTargetException().toString());
            exception.setStackTrace(e.getStackTrace());
            throw exception;
        }
        return result;
    }
private static Object invokeAnnotation(Class<?> clazz, Object[] trees) throws InstantiationException, IllegalAccessException, InvocationTargetException {
        Constructor<?> ctor = clazz.getDeclaredConstructors()[0];
        ctor.setAccessible(true);
        Object instance = ctor.newInstance();
        Method method = null;
        Method[] declaredMethods = clazz.getDeclaredMethods();
        for (Method m : declaredMethods) {
            if (m.getName().equals("apply")) method = m;
        }
        assert method != null: "Method 'apply' not found in annotation class";
        method.setAccessible(true);
        Object result;
        try {
            result = method.invoke(instance, trees);
        }   catch (InvocationTargetException e) {
           
           
            RuntimeException exception = new RuntimeException(e.getTargetException().toString());
            exception.setStackTrace(e.getStackTrace());
            throw exception;
        }
        return result;
    }
private static object invokeannotation(class<?> clazz, object[] trees) throws instantiationexception, illegalaccessexception, invocationtargetexception { constructor<?> ctor = clazz.getdeclaredconstructors()[0]; ctor.setaccessible(true); object instance = ctor.newinstance(); method method = null; method[] declaredmethods = clazz.getdeclaredmethods(); for (method m : declaredmethods) { if (m.getname().equals("apply")) method = m; } assert method != null: "method 'apply' not found in annotation class"; method.setaccessible(true); object result; try { result = method.invoke(instance, trees); } catch (invocationtargetexception e) { runtimeexception exception = new runtimeexception(e.gettargetexception().tostring()); exception.setstacktrace(e.getstacktrace()); throw exception; } return result; }