Skip to content

Fix for #103 #124

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

Merged
merged 9 commits into from
Dec 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package p;

import java.util.HashSet;
import java.util.stream.*;

import edu.cuny.hunter.streamrefactoring.annotations.*;

class A {

Stream<Object> m() {
Stream<Object> stream = new HashSet<>().parallelStream().sorted();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to see how this is varying the execution order. Particularly, I should see a call to either parallel() or sequential() rather than something like sorted().

Copy link
Contributor Author

@yiming-tang-cs yiming-tang-cs Dec 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add one more test case similar to testNonInternalAPI4() but varying execution modes.

Is .parallelStream() not enough?
sorted() influences ordering and .parallelStream() influences execution mode. You want to see different execution mode or ordering?

return stream;
}

@EntryPoint
void n() {
Stream<Object> s = m();
s.distinct().count();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,14 @@ public void testNonInternalAPI4() throws Exception {
false, null, null, null, RefactoringStatus.ERROR,
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
}


public void testNonInternalAPI5() throws Exception {
helper(new StreamAnalysisExpectedResult("new HashSet<>().parallelStream()",
Collections.singleton(ExecutionMode.PARALLEL), Collections.singleton(Ordering.UNORDERED), false,
false, false, null, null, null, RefactoringStatus.ERROR,
EnumSet.of(PreconditionFailure.NO_TERMINAL_OPERATIONS)));
}

public void testCollectionFromParameter() throws Exception {
helper(new StreamAnalysisExpectedResult("h.parallelStream()", Collections.singleton(ExecutionMode.PARALLEL),
Collections.singleton(Ordering.UNORDERED), false, true, false, null, null, null,
Expand Down