ponder-lab / Optimize-Java-8-Streams-Refactoring

Refactorings for optimizing Java 8 stream client code for greater parallelism and efficiency.
http://cuny.is/streams
Eclipse Public License 1.0
8 stars 7 forks source link

NoEnclosingMethodNodeFoundException should not be caught in the code of low level #189

Closed yiming-tang-cs closed 6 years ago

yiming-tang-cs commented 6 years ago

In my code, NoEnclosingMethodNodeFoundException is caught in the method reportDeadEntryPoints(), but it should be caught in the code of high level.

I've tried to throw it in the high level code, but why https://github.com/ponder-lab/Java-8-Stream-Refactoring/blob/bb7adad2d8b88972c7cc8025c61e65db46da11a1/edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/refactorings/ConvertToParallelStreamRefactoringProcessor.java#L279 is the highest place where I can throw the exception.

khatchad commented 6 years ago

I'm not sure I understand the question, but, currently, this exception is caught here: https://github.com/ponder-lab/Java-8-Stream-Refactoring/blob/bb7adad2d8b88972c7cc8025c61e65db46da11a1/edu.cuny.hunter.streamrefactoring.core/src/edu/cuny/hunter/streamrefactoring/core/analysis/Stream.java#L629-L634

khatchad commented 6 years ago

Are you saying it should not be caught here?

yiming-tang-cs commented 6 years ago

Are you saying it should not be caught here?

Yes. I found in some code snippets, the exceptions are caught immediately following the throwing. However, in some code snippets, the exceptions are caught in the other methods instead of the method where the exceptions are thrown. How can I decide the location to catch the exceptions?

khatchad commented 6 years ago

Why do you feel that it should not be caught here?