fixing compilation errors - STEMLab/geotools GitHub Wiki

The transition to Java 5 allows us to add generic types in GeoTools code base. This addition is usually transparent. However there is a few cases where it may cause compilation failures. This page list the errors and how to fix them.

Compilation errors related to generic types

cannot find symbol symbol : constructor FactoryCreator(List<Class>)

In codes like below:

FactoryRegistry registry = new FactoryCreator(Arrays.asList(new Class[] {
    MyFactorySpi.class
}));

The new Class[] statement needs to be replaced by new Class<?>[].

reference to Hints is ambiguous, both method Hints(Map) and Hints(RenderingHints) match

Replace the call to new Hints(null) by new Hints().

Other compilation errors

cannot find symbol symbol : class FactoryConfigurationError

This exception was deprecated in GeoTools 2.4 and replaced by FactoryRegistryException.

cannot find symbol symbol : method getServiceProviders(Class)

This method was deprecated in GeoTools 2.4 and replaced by getServiceProviders(Class, Filter, Hints). Just adding two null arguments will be enough. We made those arguments mandatory (even if null) in order to remind developpers to always pass user's Hints if they known them.

⚠️ **GitHub.com Fallback** ⚠️