Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anything returning a Stream breaks REPL #63

Open
NeQuissimus opened this issue Jul 24, 2014 · 3 comments
Open

Anything returning a Stream breaks REPL #63

NeQuissimus opened this issue Jul 24, 2014 · 3 comments

Comments

@NeQuissimus
Copy link
Contributor

It seems that returning a stream into one of the resX variables breaks the REPL.

The following breaks JavaREPL reliably:

Object[] o1 = new Object[1];
o1[0] = "hello"
o1
Object[] o2 = new Object[2];
o2[0] = "world";
o2[1] = "foo"
List<Object[]> l = new ArrayList<>()
l.add(o1)
l.add(o2)
l.stream()

From this point forward, every single command will output the following:

ERROR: package java.util.stream.ReferencePipeline does not exist
  public java.util.stream.ReferencePipeline.Head res14 = valueOf("res14");

However, streams themselves seem to be okay. The following works flawlessly:

Object[] o1 = new Object[1];
o1[0] = "hello"
o1
Object[] o2 = new Object[2];
o2[0] = "world";
o2[1] = "foo"
List<Object[]> l = new ArrayList<>()
l.add(o1)
l.add(o2)
l.stream().map(java.util.Arrays::toString).collect(Collectors.toList())

I am using Java 1.8.0_11

@mishadoff
Copy link

Observed the same behaviour

java> 1
java.lang.Integer res2 = 1
java> Arrays.asList(1,2,3).stream().parallel();
java.util.stream.ReferencePipeline.Head res3 = java.util.stream.ReferencePipeline$Head@6b0839b6
java> 1
ERROR: not a statement
    1;
    ^

ERROR: package java.util.stream.ReferencePipeline does not exist
  public java.util.stream.ReferencePipeline.Head res3 = valueOf("res3");

@shufengh
Copy link

On my machine, the stream is returned when invoked at the first time and fails afterwards

java> list = new ArrayList<Integer>()
java.util.ArrayList list = []
java> list.stream()
java.util.stream.ReferencePipeline.Head res1 = java.util.stream.ReferencePipeline$Head@5e76dc2c
java> list.stream()
ERROR: package java.util.stream.ReferencePipeline does not exist
  public java.util.stream.ReferencePipeline.Head res1 = valueOf("res1");
                                           ^

@NeQuissimus
Copy link
Contributor Author

@Shufeng01 After calling stream() for the first time, execute any other command and it should display the same error even though it has nothing to do with the stream. Check what @mishadoff does by just entering "1".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants