Am 19.08.2016 um 19:28 schrieb John Hewson:
On 19 Aug 2016, at 04:28, Simon Steiner <[email protected]> wrote:

Hi,



Cosarray has:

    public List<?> toList()



does that mean I need to explicitly cast to list<cosbase>, how come it
doesn't return List<COSBase>?
I think this my have been an oversight when PDFBox was originally ported to 
make use of Java 5 generics. Seems like something we could change.

This doesn't work for methods like this one:

    public List<COSName> getFilters()
    {
        List<COSName> retval = null;
        COSBase filters = stream.getFilters();
        if (filters instanceof COSName)
        {
            COSName name = (COSName) filters;
retval = new COSArrayList<COSName>(name, name, stream, COSName.FILTER);
        }
        else if (filters instanceof COSArray)
        {
retval = ((COSArray) filters).toList(); // incompatible types: java.util.List<org.apache.pdfbox.cos.COSBase> cannot be converted to java.util.List<org.apache.pdfbox.cos.COSName>
        }
        return retval;
    }

I also tried using

List<? extends COSBase> toList()

but this doesn't work either.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to