directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <>
Subject [Studio] Build problem with List cast
Date Sun, 18 Nov 2007 20:48:57 GMT
Hi Dev,

in Studio we have the following line of code:

configuration.setSupportedMechanisms( new ArrayList<String>( ( List<?
extends String> ) Arrays.asList(
supportedMechanismsTableViewer.getCheckedElements() ) ) );

The method configuration.setSupportedMechanisms expects an List<String>
parameter. The "supportedMechanismsTableViewer.getCheckedElements()"
returns an Object[].

Inside of eclipse this line is just marked with a warning: "Type safety:
Unchecked cast from List<Object> to List<? extends String>"

But when building from command line using ant I get the following error:

inconvertible types
    [javac] found   : java.util.List<java.lang.Object>
    [javac] required: java.util.List<? extends java.lang.String>
    [javac]             .asList(
supportedMechanismsTableViewer.getCheckedElements() ) ) );

The odd thing is if I just touch the java file (adding a space
somewhere) the compilation works!

Any idea what may be the problem here?

Here is the class:


View raw message