Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DFDL-1492

Remove return statements to avoid NonLocalReturnControl errors

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: deferred
    • Component/s: clean ups
    • Labels:
      None

      Description

      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:

      SBT_OPTS="-Dscala.control.noTraceSuppression=false" sbt "debug:testOnly edu.illinois.ncsa.daffodil.section12.aligned_data.TestAlignedDataDebug -- --tests=test_alignmentTerminatorBitSkip"

      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.

      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].

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              twise Taylor Wise
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Tasks