private DeclaredType getDeclaredType0(Type outer,
                                              ClassSymbol sym,
                                              TypeMirror... typeArgs) {
            if (typeArgs.length != sym.type.getTypeArguments().length())
                throw new IllegalArgumentException(
                "Incorrect number of type arguments");

            ListBuffer<Type> targs = new ListBuffer<>();
            for (TypeMirror t : typeArgs) {
                if (!(t instanceof ReferenceType || t instanceof WildcardType))
                    throw new IllegalArgumentException(t.toString());
                targs.append((Type) t);
            }
            // TODO: Would like a way to check that type args match formals.

            return (DeclaredType) new Type.ClassType(outer, targs.toList(), sym);
        }
private DeclaredType getDeclaredType0 ( Type outer , ClassSymbol sym , TypeMirror ... typeArgs ) { if ( typeArgs . length != sym . type . getTypeArguments ( ) . length ( ) ) throw new IllegalArgumentException ( "Incorrect number of type arguments" ) ; ListBuffer < Type > targs = new ListBuffer < > ( ) ; for ( TypeMirror t : typeArgs ) { if ( ! ( t instanceof ReferenceType || t instanceof WildcardType ) ) throw new IllegalArgumentException ( t . toString ( ) ) ; targs . append ( ( Type ) t ) ; } return ( DeclaredType ) new Type . ClassType ( outer , targs . toList ( ) , sym ) ; }
where