polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Type system in Java is bizarre... Help!
Date Wed, 26 Aug 2015 08:06:15 GMT
Gang and especially the Type System experts....

I am struggling to get the TypeLookup class converted to Stream API, and it
is because the Java type system (or at least the one built into IntelliJ)
to behave strangely.

For instance; I have the following method in ModuleInstance

public Stream<ModelModule<ObjectDescriptor>> visibleObjects(
Visibility visibility )

And trying to access it from TypeLookup

Stream<ModelModule<? extends ModelDescriptor>> moduleObjects =
moduleInstance.visibleObjects( module );

But that tells me that the moduleObjects are of the wrong type, and should
be Stream<ModelModule<ObjectDescriptor>>. I can also change the
visibleObjects() method to


public Stream<ModelModule<? extends Descriptor>> visibleObjects(
Visibility visibility )


without compile error in TypeLookup NOR in ModuleInstance. What magic
happens (or not) in this distinction.


Cheers
-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message