How do I use reflection to call a generic method?

You need to use reflection to get the method to start with, then “construct” it by supplying type arguments with MakeGenericMethod: MethodInfo method = typeof(Sample).GetMethod(nameof(Sample.GenericMethod)); MethodInfo generic = method.MakeGenericMethod(myType); generic.Invoke(this, null); For a static method, pass null as the first argument to Invoke. That’s nothing to do with generic methods – it’s just normal reflection. … Read more

Only one annotation is showing

The class indeed has only one annotation. The other two belong to the class methods. To get to them you’d do something like: Method getValue = Tree.class.getMethod(“getValue”); //get the method getValue.getAnnotations(); //get annotations, only ElementField in this case The same for every other method.