It would be nice if we have suitable convenience method in javax.lang.model to provide this functionality.
Comments
The only (or last) user of the JavaDoc `WorkArounds.searchClass(TypeElement,String)` method was `ThrowsTaglet`, but this use war removed with JDK-8295277. There is thus no more need to implement this method in any official API.
02-11-2023
This should (probably) not be on javax.lang.model.
It should (probably) be on the Tree API, because it is searching imports, which are not available/meaningful in the context of the Language Model API.
13-08-2016
Method signature: public TypeElement searchClass(TypeElement klass, String className);
see the implementation in WorkArounds.java