Can I parse generic method with javaparser ?? If its possible so how? For example this is my method:
public static < E > void printArray( E[] inputArray )
{
// Display array elements
for ( E element : inputArray ){
System.out.printf( "%s ", element );
}
System.out.println();
}
When I parse with MethodVisitor and use MethodVisitor.getParameters().getType I get E[] but I need to get that it is Object. It is posible?
The only way is create own parser. JavaParser return BeginLine methods and the only way is parse this line.
When we remove all modificators (public and static) and next value not equal to return type(void), we get and we know E is Object.