I have the IType object of a class. I want to know if the class is an abstract class or not. Is there any method available in the IType or ICompilationUnit to determine the same (other than reflection).
IType type = ...;
boolean isAbstract = Flags.isAbstract(type.getFlags());
You could get the IType's fully qualified name (maybe using IType.getTypeQualifiedName()), then use Class.forName() on that name to get the Class object, then use the Modifier.isAbstract() as others have recommended.
Java's Class object is part of the reflection suite, so this way still kinda uses reflection...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With