Hi, I am trying to build GeoTools and I get two errors in gt-metadata module.I 
use Eclipse - Mars.1 Release (4.5.1) - in Windows.

...\modules\library\metadata\src\main\java\org\geotools\factory\CategoryRegistry.java

1)   public CategoryRegistry(final FactoryRegistry factoryRegistry,            
final Iterable<Class<?>> categories) {        ...        // use an unmodifiable 
map to guarantee immutability        this.categories = stream(categories)       
         .collect(                        collectingAndThen(                    
            toMap(category -> category,                                      
category -> new InstanceRegistry<>(factoryRegistry,category), <-- ERROR         
                             (firstRegistry, secondRegistry) -> 
secondRegistry),                                      
Collections::unmodifiableMap));    }
ERROR --> Type mismatch: cannot convert from Object to 
Map<Class<?>,CategoryRegistry.InstanceRegistry<?>>

2)     public <S> Optional<S> getInstanceOfType(Class<S> type) {        ...     
   return streamCategories().filter(category -> 
category.isAssignableFrom(type))                .map(this::instanceRegistry)    
                                                                          <-- 
ERROR                .flatMap(registry -> 
stream(registry.getInstanceOfType(type))).findFirst();    }
ERROR -> Type mismatch: cannot convert from Stream<Object> to <unknown>



I can fix these errors with a pair of minor changes:
1)    public CategoryRegistry(final FactoryRegistry factoryRegistry,            
final Iterable<Class<?>> categories) {        ...        // use an unmodifiable 
map to guarantee immutability
        this.categories = stream(categories)                .collect(           
             collectingAndThen(                                toMap(category 
-> category,                                      category -> new 
InstanceRegistry<Class<?>>(factoryRegistry,category),                           
           (firstRegistry, secondRegistry) -> secondRegistry),                  
                    Collections::unmodifiableMap));    }
2)     public <S> Optional<S> getInstanceOfType(Class<S> type) {        ...     
   return streamCategories().filter(category -> 
category.isAssignableFrom(type))                .map(category -> 
(InstanceRegistry<?>) instanceRegistry(category))                
.flatMap(registry -> stream(registry.getInstanceOfType(type))).findFirst();    }

But I do not know if they are right. Could you help me? Am I missing anything?
Thanks in advanceAlvaro
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to