[ 
https://issues.apache.org/jira/browse/DAFFODIL-1492?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16868972#comment-16868972
 ] 

Michael Beckerle commented on DAFFODIL-1492:
--------------------------------------------

To clarify. The task here is to hunt down all uses of the return keyword, and 
revise the code to use structured control (if-then-else) instead so the return 
keyword isn't needed.

(This is scala's return keyword, not to be confused with Java's return keyword 
which you have to use in java.)

> Remove return statements to avoid NonLocalReturnControl errors
> --------------------------------------------------------------
>
>                 Key: DAFFODIL-1492
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1492
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: Clean Ups
>            Reporter: Taylor Wise
>            Priority: Major
>              Labels: beginner
>
> This was a pain in the butt to figure out.  If you want to see what I'm 
> talking about with it not telling you where the error is, try running the 
> test specified in DFDL-929.  It won't give you a stack trace or exception.  
> You end up having to step through/into it to see where the exception is 
> happening and that it appears to be a ControlThrowable.  Unfortunately, 
> NonLocalReturnControl does not include a stack trace.  So there's no 
> specifics on what is directly causing it.
> I ended up having to use the following in the terminal to figure out what the 
> problem was:
> {code}SBT_OPTS="-Dscala.control.noTraceSuppression=false" sbt "debug:testOnly 
> edu.illinois.ncsa.daffodil.section12.aligned_data.TestAlignedDataDebug -- 
> --tests=test_alignmentTerminatorBitSkip"{code}
> You can force it to print out a stack trace to bypass the fact that the 
> NonLocalReturnControl suppresses it.
> The link I included in the objectives above tells you about the particular 
> issue and how we should really not use return.
> {quote}When a function value containing a return statement is evaluated 
> nonlocally, the computation is abandoned and the result is returned by 
> throwing a NonLocalReturnControl[A]. {quote}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to