#1 2013-07-22 14:54:20

quasimotoca
Member
Registered: 2013-05-30

Development question

Hi Guys:

The following class (BirtReportDatasourceProviderHooker.java):

public class BirtReportDatasourceProviderHooker implements
        DatasourceProviderHook {

    @Override
    public Collection<? extends Class<? extends DatasourceDefinition>> getDatasources() {
        return (Collection<? extends Class<? extends DatasourceDefinition>>) Arrays.asList(new Class[]{BirtReportDatasourceDefinition.class});
    }

}

In eclipse I get a type safety warning - no issue. When I use javac to compile the class javac throws an "incompatible types" error.  I'm using Oracle JavaSE 1.7.0_17. I've Googled some issues about the Java compiler not understanding bounds while trying to compile generics. Is there a slightly different way we could write the class to make javac happy?

Cheers,
Dave

Offline

#2 2013-07-22 15:20:25

Thorsten J. Krause
Guest

Re: Development question

Hi Dave,

you could try to change this not to use Arrays.asList, but to explicitly instantiate a Collection:

Collection<Class<? extends DatasourceDefinition>> datasources = new ArrayList<Class<? extends DatasourceDefinition>>();
datasources.add(BirtReportDatasourceDefinition.class);
return datasources;

But it is very likely that you will find many and more ocurrances of similar code, that you would have to change.

If you are not set on using oracles javac: We compile ReportServer using the eclipse java compiler

http://download.eclipse.org/eclipse/dow … ml#JDTCORE


Cheers,
Thorsten

#3 2013-07-22 16:54:14

quasimotoca
Member
Registered: 2013-05-30

Re: Development question

Hi Thorsten:

Worked perfect. Luckily it was only in a ciouple other spots.  Thanks for the help...

Cheers,
Dave

Offline

Board footer

Powered by FluxBB