Can't make simple Streams over indirect projects work

Srikanth srikanth.adayapalam at oracle.com
Sun Aug 25 10:24:47 UTC 2019


Thanks for weighing on this Brian!

I have pushed a change set 
http://hg.openjdk.java.net/valhalla/valhalla/rev/e9393b1577db
on behalf of https://bugs.openjdk.java.net/browse/JDK-8230121 that 
addresses this problem.

Ben, I am able to compile the generic version of the Optional inline 
type and run the test case
that gave you grief earlier. Please check out valhalla repository lworld 
branch tip.

Note: As Brian Indicated the accepted syntax for the nullable projection 
type of parameterized types
is of the form GenericInlineType<TypeArgument>? as opposed to 
GenericInlineType?<TypeArgument>

(That said, Brian, internally I had to model that projection type as 
GenericInlineType?<TypeArgument>)

Ben, thanks for continued testing, I am away all week this week on a 
training program, but will try to address any new problems reported on a 
best case effort basis.

Thanks!
Srikanth


On 14/08/19 11:00 PM, Brian Goetz wrote:
> Ben;
>
> We appreciate your exploring these corners.  But, just by way of 
> setting expectations, there's nothing "simple" about this example; 
> you're hitting on all the areas that are at the periphery of the L2 
> goals.  So while we would of course like for these things to work, 
> we're not surprised there are pitfalls and interactions.  (I say this 
> because I want to avoid having the "simple" framing derail the 
> discussion.)
>
>> all my attempts to use it, eg. via code like this:
>>
>> List<Optional?<Integer>> opts = new ArrayList<>();
>
> The interaction of generic instantiation and the nullable projection 
> type are definitely in the corners right now.  This would be spelled 
> `Optional<Integer>?`, though; the `?` applies to the final (inline) 
> type, not to the base type.  (You would spell the raw type 
> `Optional?`.)  But, I suspect in the current prototype, that syntax 
> will not work either.
>
> But yes, it should be possible to project the type `Optional<Integer>` 
> to a nullable projection.
>
>




More information about the valhalla-dev mailing list