[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jdt-core-dev] code assist labels and captured types
|
Implementation of captured types and capture signatures has some
influence on code assist display labels: Try code assist in this snippet
(from bug 89562) in N20050519 and see how the proposals get quite
complicated due to "capture-of" expressions:
import java.util.*;
public class StarGeneric {
void foo(List<?> star) {
star.|
}
}
In the above example, it does not make sense to offer the
add(capture-of ? o)
proposal to the user if all he can pass as an argument is 'null'. I
would prefer to show a simpler proposal similar to what we did for m6:
add(Null o)
or similar.
We used to apply some heuristics to filter the type signatures in
proposals to create the user displayable strings, which does not work
any longer with captures. No blame, the behavior was not specified...
but I think that the proper way to do this would not be UI relying on
heuristics, but that Jdt-core should offer a way to tranform a signature
to a nice display string. See also bug 85293 (which is not accurate any
longer, but the same problem exists now with captured types).
Is there any chance that jdt-core could offer such a functionality? I
would imagine something along these lines:
o.e.jdt.core.Signature {
// returns the method signature (lower bound of parameters, upper
bound of return type)
char[] unboundedMethodSignature(char[] methodSignature);
// or
char[] upperBound(char[] typeSignature);
char[] lowerBound(char[] typeSignature);
}
-tom