Community
Participate
Working Groups
M2 As we use the AST infrastructure more and more we come to its limitations. Lot of code that was previously done using IJavaElements is moved to use the AST due to 100% precisness. That means more and more utility functions change to ues ITypeBindings as input and output. A problematic limitation is that I can't create a ITypeBinding on demand. I have methods that return ITypeBinding as result and currently can not do that as there type is not in the AST: e.g. ITypeBinding[] getAssignableTypes(ITypeBinding binding) what's possible: binding == ArrayList: result is List, Collection... what's not: binding == ArrayList[]: result would be List[], Collection[]... So to solve this I have either have to switch to String[] or IType[] as result and loose all the precisness. All transformations from IJavaElement to ASTNodes have to be minimized as they are expensive and introduce errors (e.g. because there are no local types in the JavaModel) Other problem: No way to get the subtypes: Of course I don't expect to get the subtypes directly from the type binding, but I would pass in a progress monitor for the creation.
The reason these functionalities aren't available is that they have a huge memory footprint. In order to compute more bindings lazily, we have to retain all our bindings cache in memory, in case you decide to bind one more type... Similarily, computing a subtype hierarchy is always doable using the model APIs. Nothing is free on this side.
It doesn't has to be cheap. I'd be ok it bindings cache has to be rebuild. That's still better than having nothing. Using the model API is, if you are already in IBinding world, loss of precission. No local, no anonymous types. Tricky code to get a IType from a ITypeBinding and back.
> It doesn't have to be cheap. Until later on you log a defect about the fact that during profile, 80% time is spent in this area <g>
Not for 3.0
Could this PR please be reconsidered for 3.1? IMO, it would be sufficient if clients could just 'compose' existing bindings to form new ones, e.g.: Integer --> Integer[] List --> List<?> List, Number --> List<Number> List, Number --> List<? extends Number> List, Number --> List<? super Number>
Philippe, can we do something here ?
Considering for 3.2
Considering for 3.3.
This request is now part of bug 150657. *** This bug has been marked as a duplicate of bug 150657 ***