Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Kepler Service Release 2 and Java 8 support(Java 8 support (specifically List.stream))
Kepler Service Release 2 and Java 8 support [message #1403923] Mon, 28 July 2014 15:25 Go to next message
Duncan Lyall is currently offline Duncan LyallFriend
Messages: 2
Registered: July 2014
Junior Member
Ubuntu Linux 12.04
jdk1.8.0_11
Kepler Service Release 2
followed instructions at
http://www.eclipse.org/downloads/java8/
and installed
Java 8 support for Eclipse Kepler SR2
jdk1.8.0_11 shown and selected in Installed JREs
Compiler compliance level set to 1.8
everything else I can find that has anything to do
with the Java version is also set to 1.8

I have the following code

Integer foo[] = {1, 3, 2, 9, 6, 0, 8, 7, 7, 8, 5, 11, 87, 23, 6};
java.util.List<Integer> il = java.util.Arrays.asList(foo);
java.util.stream.Stream<Integer> s = il.stream();

Eclipse recognizes java.util.Stream as existing
but gives the following error

"the method stream is undefined for the type List<Integer>"

interface List implements interface Collection which provides the method stream() according the API docs.

Is this a bug or am I doing something stupid, it's my first real look at streams so please excuse any stupidity on my part.

thanks
Re: Kepler Service Release 2 and Java 8 support [message #1403928 is a reply to message #1403923] Mon, 28 July 2014 15:30 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3518
Registered: July 2009
Senior Member

Does the project itself reference that JDK on its Java Build Path?

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Kepler Service Release 2 and Java 8 support [message #1403947 is a reply to message #1403928] Mon, 28 July 2014 16:50 Go to previous messageGo to next message
Duncan Lyall is currently offline Duncan LyallFriend
Messages: 2
Registered: July 2014
Junior Member
If I click project -> properties the Java Build Path dialog appears
if I look at the 'Libraries' tab I have

JRE System Library [JavaSE-1.7]
JRE System Library [jdk 1.8.0_11]

If I then look at the 'Order and Export' tab

I have
my project source
JRE System Library [JavaSE-1.7]
JRE System Library [jdk 1.8.0_11]

JRE System Library [jdk 1.8.0_11] is selected

so, I thought I'd move up JRE System Library [jdk 1.8.0_11]

now I have

my project source
JRE System Library [jdk 1.8.0_11]
JRE System Library [JavaSE-1.7]

and ... it compiles
I was wondering why in this case should Eclipse recognize the library class
java.util.stream.Stream but not the stream() method on the List

Thanks for the heads up anyway, it compiles now


Re: Kepler Service Release 2 and Java 8 support [message #1403955 is a reply to message #1403947] Mon, 28 July 2014 17:25 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3518
Registered: July 2009
Senior Member

You should only have one "JRE System Library" entry. It is what dictates which JRE's class library your project compiles against. If that method was new to 1.8, then it would not have been found within the class definition in the 1.7 JRE.

Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Mon, 28 July 2014 17:26]

Report message to a moderator

Previous Topic:Having issue removing code preview bar (or called something else) from PyDev editor in eclipse.
Next Topic:issues connecting eclipse birt report to sqlserver
Goto Forum:
  


Current Time: Wed Oct 23 15:55:38 GMT 2019

Powered by FUDForum. Page generated in 0.02724 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top