Why does the error method return an error?

Raven

I want to validate input corresponding to the following grammar snippet:

Declaration:
    name = ID "=" brCon=BracketContent
;

    BracketContent:
        decCon=DecContent (comp+=COMPARATOR content+=DecContent)*
    ;

        DecContent:
            (neg=("!"|"not"))? singleContent=VarContent (op+=OPERATOR nextCon+=VarContent)*
        ;

My validation looks like that:

  @Check
  def checkNoCycleInHierarchy(Declaration dec) {
    if(dec.decCon.singleContent.reference == null) {
        return
    }

    var names = newArrayList

    var con = dec.decCon.singleContent

    while(con.reference != null) {
        con = getThatReference(con).singleContent

        if(names.contains(getParentName(con))) {
            val errorMsg = "Cycle in hierarchy!"
            error(errorMsg, 
                SQFPackage.eINSTANCE.bracketContent_DecCon,
                CYCLE_IN_HIERARCHY)

            return
        }

        names.add(getParentName(con))
    }
  }

But when I test this validation with a testCaseit returns me an error message:

Expected ERROR 'raven.sqf.CycleInHierarchy' on Declaration at [-1:-1] but got
ERROR (org.eclipse.emf.ecore.impl.EClassImpl@5a7fe64f (name: Declaration) (instanceClassName: null) (abstract: false, interface: false).0) 'Error executing EValidator', offset null, length null
ERROR (org.eclipse.emf.ecore.impl.EClassImpl@5a7fe64f (name: Declaration) (instanceClassName: null) (abstract: false, interface: false).0) 'Error executing EValidator', offset null, length null

I just can't figure out what's wrong with it so I hope that someone of you might have an idea.

Greetings Krzmbrzl

Raven

It turned out it was an internal error...I'm still not exactly sure what went wrong but I have rewritten my validation method and now it works as expected.
Now the method looks like this:

enter code here@Check
  def checkNoCycleInHierarchy(Declaration dec) {
    if(dec.varContent.reference == null) {
        //proceed only if there is a reference
        return
    }

    var content = dec.varContent

    var names = newArrayList

    while(content.reference != null && !names.contains(getParentName(content))) {
        names.add(getParentName(content))
        content = content.reference.varContent

        if(names.contains(getParentName(content))) {
            val errorMsg = "Cycle in hierarchy!"
            error(errorMsg,
                SQFPackage.eINSTANCE.declaration_BrCon,
                CYCLE_IN_HIERARCHY)

                return
        }
    }
  }

I have the suspicion that there was a problem with the usage of my "getThatReference" in this case.

Greeting Krzmbrzl

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Why does an async method not return the awaitable immediately?

분류에서Dev

Why does this for loop run into an ArrayIndexOtOfBounds error? (Java)

분류에서Dev

Why does this provide me with a stack overflow error?

분류에서Dev

Why doesn't my Deferred run the error method?

분류에서Dev

Why doesn't my Deferred run the error method?

분류에서Dev

Why does ternary operator fail with a type mismatch error?

분류에서Dev

Why does tilde V output ~V [LogLevel ERROR]?

분류에서Dev

Why does this compound command {...} not exit on error, when used with ||?

분류에서Dev

PayPal: error - return to merchant

분류에서Dev

return Json syntax error

분류에서Dev

Syntax error on return

분류에서Dev

Parse iOS: PFUser saveInBackgroundWithBlock does not return error when the save does not succeed

분류에서Dev

Why does apache block viewvc (error 403) with error "client denied by server configuration"?

분류에서Dev

Fixing a method and parameter error

분류에서Dev

Error:The method is not aplicable for the arguments

분류에서Dev

Error in imageloader in getView method

분류에서Dev

Method with if statement with syntax error

분류에서Dev

Why is a divide by error coming?

분류에서Dev

Why is this not returning an @@ERROR?

분류에서Dev

php return json with angularjs error

분류에서Dev

"Missing return statement" error in Java

분류에서Dev

Bus Error on void function return

분류에서Dev

Jinja Error Return About For Loop

분류에서Dev

getNextSibling() method does not return any results

분류에서Dev

I am trying to perform the Euler method in python but I am getting a 'type error', why?

분류에서Dev

Why PHP doesn't show Strict Standards error when overriding method with different signature?

분류에서Dev

Java / Android unexplained compile error : is not abstract and does not override abstract method onTabReselected (Tab, FragmentTransaction) in TabListener

분류에서Dev

Api Post error:The requested resource does not support http method 'GET'.88

분류에서Dev

No Method Error // Helper // Rails 3

Related 관련 기사

  1. 1

    Why does an async method not return the awaitable immediately?

  2. 2

    Why does this for loop run into an ArrayIndexOtOfBounds error? (Java)

  3. 3

    Why does this provide me with a stack overflow error?

  4. 4

    Why doesn't my Deferred run the error method?

  5. 5

    Why doesn't my Deferred run the error method?

  6. 6

    Why does ternary operator fail with a type mismatch error?

  7. 7

    Why does tilde V output ~V [LogLevel ERROR]?

  8. 8

    Why does this compound command {...} not exit on error, when used with ||?

  9. 9

    PayPal: error - return to merchant

  10. 10

    return Json syntax error

  11. 11

    Syntax error on return

  12. 12

    Parse iOS: PFUser saveInBackgroundWithBlock does not return error when the save does not succeed

  13. 13

    Why does apache block viewvc (error 403) with error "client denied by server configuration"?

  14. 14

    Fixing a method and parameter error

  15. 15

    Error:The method is not aplicable for the arguments

  16. 16

    Error in imageloader in getView method

  17. 17

    Method with if statement with syntax error

  18. 18

    Why is a divide by error coming?

  19. 19

    Why is this not returning an @@ERROR?

  20. 20

    php return json with angularjs error

  21. 21

    "Missing return statement" error in Java

  22. 22

    Bus Error on void function return

  23. 23

    Jinja Error Return About For Loop

  24. 24

    getNextSibling() method does not return any results

  25. 25

    I am trying to perform the Euler method in python but I am getting a 'type error', why?

  26. 26

    Why PHP doesn't show Strict Standards error when overriding method with different signature?

  27. 27

    Java / Android unexplained compile error : is not abstract and does not override abstract method onTabReselected (Tab, FragmentTransaction) in TabListener

  28. 28

    Api Post error:The requested resource does not support http method 'GET'.88

  29. 29

    No Method Error // Helper // Rails 3

뜨겁다태그

보관