groovy

Weird compiler error when using assert incorrectly

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.6.6, 1.7-rc-1
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

I used assert the wrong way round like:

assert "error message should have contained template name" : "Template not found for name [bad] .+" ==~ e.message

And got a horrible error:

java.lang.VerifyError: (class: ConsoleScript1, method: run signature: ()Ljava/lang/Object;) Expecting to find object/array on stack

Activity

Hide
blackdrag blackdrag added a comment -

the expression to test the assert and the message are in the wrong order, that is causing the problem. I made a change to ensure that even if the massage is in fact a boolean expression we still get an assertion message and no bytecode problem

Show
blackdrag blackdrag added a comment - the expression to test the assert and the message are in the wrong order, that is causing the problem. I made a change to ensure that even if the massage is in fact a boolean expression we still get an assertion message and no bytecode problem

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: