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

Tool treats streams from non-internal APIs as new streams #142

Open
khatchad opened this issue Dec 27, 2017 · 1 comment
Open

Tool treats streams from non-internal APIs as new streams #142

khatchad opened this issue Dec 27, 2017 · 1 comment

Comments

@khatchad
Copy link
Member

Related to #103.

Consider this test case:

class A {
	Stream<Object> m() {
		Stream<Object> stream = new HashSet<>().parallelStream();
		return stream;
	}

	void n() {
		Stream<Object> s = m();
		s.count();
	}
}
-- Error Log from JUnit --
Class: edu.cuny.hunter.streamrefactoring.ui.tests.ConvertStreamToParallelRefactoringTest
Method: testNonInternalAPI
Actual: null
Expected: null
Stack Trace:
java.lang.NullPointerException
	at edu.cuny.hunter.streamrefactoring.core.analysis.Stream.inferInitialOrdering(Stream.java:580)
	at edu.cuny.hunter.streamrefactoring.core.analysis.Stream.<init>(Stream.java:194)
	at edu.cuny.hunter.streamrefactoring.core.analysis.StreamAnalysisVisitor.visit(StreamAnalysisVisitor.java:51)
	at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:231)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2844)
	at org.eclipse.jdt.core.dom.VariableDeclarationFragment.accept0(VariableDeclarationFragment.java:263)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2867)
	at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:267)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2867)
	at org.eclipse.jdt.core.dom.Block.accept0(Block.java:137)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2844)
	at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:635)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2867)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:470)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2867)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:257)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2796)
	at edu.cuny.hunter.streamrefactoring.ui.tests.ConvertStreamToParallelRefactoringTest.helper(ConvertStreamToParallelRefactoringTest.java:258)
	at edu.cuny.hunter.streamrefactoring.ui.tests.ConvertStreamToParallelRefactoringTest.testNonInternalAPI(ConvertStreamToParallelRefactoringTest.java:431)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at junit.framework.TestCase.runTest(TestCase.java:176)
	at junit.framework.TestCase.runBare(TestCase.java:141)
	at junit.framework.TestResult$1.protect(TestResult.java:122)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.framework.TestResult.run(TestResult.java:125)
	at junit.framework.TestCase.run(TestCase.java:129)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:23)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
	at junit.framework.TestResult.runProtected(TestResult.java:142)
	at junit.extensions.TestSetup.run(TestSetup.java:27)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:121)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:181)
	at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:43)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4497)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4110)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:52)
	at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:43)
	at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:46)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
@khatchad
Copy link
Member Author

I don't think that this is happening anymore. @saledouble could you verify?

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

1 participant