Community
Participate
Working Groups
3.3 I would also like to pass in an IType (from a source file) to JavaCore.getGeneratedResources(IRegion, boolean) and get the corresponding class file. At the moment the region is limited to ICompilationUnit and parent elements. Mapping an IType to a class file is not trivial when anonymous classes or local types are involved.
Actually i think it's not only non-trivial, but not possible at all. We don't have a method getBinaryName on IType so it's not clear which resource from JavaCore.getGeneratedResources maps to which IType.
No need for an API. You can use an AST with binding resolved + an AST visitor and it works. -1 for a new API
Can you elaborate, maybe a code snipped? I don't have an AST, just an IType... I believe this is a common use case (see the discussions in bug 6584). If it's more than 5-10 lines of code I would say it makes sense if JavaCore.getGeneratedResources can support this. Also it's expensive to build an AST, and JavaCore.getGeneratedResources maybe has more efficient ways to do the mapping.