[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-apt-dev] About TypeDeclaration.getActualTypeArguments()

Hello buddies,

   I met some problem with TypeDeclaration.getActualTypeArguments(), I don't know if my understand
is correct that this invocation should return the concrete types substituting the formal type
parameters as possible.
   The last straw was that I called Types.isAssignable(TypeMirror, TypeMirror) with a type
parameter from the generic type of a field declaration, and ended up with a

   After some dig, I found the implementation here:

    public Collection<TypeMirror> getActualTypeArguments()
        final ITypeBinding type = getTypeBinding();
        final ITypeBinding[] typeArgs = type.getTypeArguments();
        if( typeArgs == null || typeArgs.length == 0 )
    		return Collections.emptyList();

        final Collection<TypeMirror> result = new ArrayList<TypeMirror>(typeArgs.length);
        for( ITypeBinding arg : typeArgs ){
            final TypeMirror mirror = Factory.createTypeMirror(arg, _env);
            if(arg == null)

        return result;

   Is this CORRECT? If it is, please any buddy tell me how to test that whether the type parameter
of a field declaration is sub class of a specific one? Say, when processing annotations, how can I
see whether a field is of type Set<? extends Collection>, but not a Set<String> ? In this case a
field of type Set<List> should return true while type Set<String> should return false.

   Thanks in advance to any hint!

Compl Yue Still

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around