enhanced type-inference

Joe Bowbeer joe.bowbeer at gmail.com
Wed Jan 30 15:23:40 PST 2013


Thanks!

I picked up these changes when I installed binary snapshot b75.

I updated my samples(*) accordingly and now the following static imports
are working without addition type annotation:

  Collectors.toList
  ConcurrentCollectors.groupBy
  Character.compare

Nits:

1. orElse(null) is still a nuisance.  Will this be resolved?

2. ConcurrentCollectors.groupBy vs. Collectors.groupingBy (should be
groupBy?)

http://download.java.net/lambda/b75/docs/api/java/util/stream/ConcurrentCollectors.html#groupBy(java.util.function.Function)
http://download.java.net/lambda/b75/docs/api/java/util/stream/Collectors.html#groupingBy(java.util.function.Function)

3. NetBeans jdk8lambda build #1612 is not as smart as the new compiler and
flags the graph-inference lines as errors.

http://bertram2.netbeans.org:8080/job/jdk8lambda/


(*) Sample projects:

bitbucket.org/joebowbeer/anagrams
bitbucket.org/joebowbeer/stringcompare
bitbucket.org/joebowbeer/wordchainkata


--Joe



On Fri, Jan 25, 2013 at 10:11 AM, Brian Goetz <brian.goetz at oracle.com>wrote:

> More info on new type inference.
>
>
> -------- Original Message --------
> Subject: enhanced type-inference
> Date: Fri, 25 Jan 2013 17:49:07 +0000
> From: Maurizio Cimadamore <maurizio.cimadamore at oracle.**com<maurizio.cimadamore at oracle.com>
> >
> Organization: Oracle
> To: lambda-dev <lambda-dev at openjdk.java.net>
>
> Dear lambdackers,
> I've just pushed a patch that enables a more general inference support
> for nested generic method calls/stuck expressions. This scheme has been
> available for a while in lambda-repo (when using the hidden flag
> -XDuseGraphInference), but we have now decided it's time to flip the
> switch and make it the default when using JDK 8. In the past few weeks
> I've been hunting down as many bugs in the new inference scheme as
> possible, in order to provide a smooth transition from the old world to
> the new one. I hope the transition is indeed smooth - but, given the
> nature of the change, I also expect bugs to pop up here and there, so
> please, keep throwing the kitchen sink at javac and report your
> experience back to us; without your valuable feedback and dedication we
> would never have gotten thus far.
>
> Example of things that now work:
>
>      Stream<Integer> si = ...
>      List<Integer> l1 = si.into(new ArrayList<>()); //not really - too
> late for that ;-)
>      List<Integer> l2 = si.collect(toList());
>      List<Integer> l3 = si.collect(toCollection(**ArrayList::new));
>
> Thanks
> Maurizio
>
>
>
>
>


More information about the lambda-libs-spec-observers mailing list