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

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/downloads/drops4/R-4.3-201306052000/details.html#JDTCORE

Cheers,
Thorsten

Hi Thorsten:

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

Cheers,
Dave