groovy
  1. groovy
  2. GROOVY-4741

VerifyError: Expecting to find integer on stack

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8-rc-3
    • Fix Version/s: 1.8-rc-4
    • Component/s: Compiler
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Hi, I have the same issue as in GROOVY-4587.

      For the inputs

      [0.0], [], [], [543]
      

      the function-code below does throw an Exception which can be fixed by changing

      if (ReWK < 0) {
      

      to

      if (((int)ReWK) < 0) {
      

      Seems like a bug to me or am I doing it wrong? Various other inputs run fine.

      Gesamtbetrag,Direktabzug,Prozent,Einzelbetrag->                                                               
      
      def int ReWK = 0
      def arrAbzWK = []; 
      
      Gesamtbetrag.eachWithIndex {
                                                                  
      	it, index ->                                                                                                          
         
      	if(Gesamtbetrag[index] > 0){ 
      
      		                                               
              	if(Prozent[index] != 0 && Prozent[index] != null) {  
      			ReWK = Math.ceil( Gesamtbetrag[index] * (100 - Prozent[index]) / 100 ) 
      
      		} else if (Direktabzug[index] > 0 ) {           
               
      			ReWK = Math.ceil( Gesamtbetrag[index] - Direktabzug[index] )    
               
      			if (ReWK < 0) { 
      				ReWK = 0
      			}                                     
      
               	} 
                      else if (Einzelbetrag[index] > 0) { 
      			ReWK = Math.ceil( Einzelbetrag[index] )                                                                           		
      		} else {			
      			ReWK = 0	
      		}                                                                                     
         	}                                                                                  
                                                                                                                 
         	arrAbzWK.add(ReWK)    
                                                                                     
      }
      
      return arrAbzWK 
      
      1. gmaven-1.3.tgz
        2.43 MB
        David Hansmann
      2. test.groovy
        0.9 kB
        David Hansmann

        Activity

        Hide
        David Hansmann added a comment -

        Seems to be easily reproducible, I attached the example and wish you good luck hunting the bug down.

        As for the gmaven stuff: I attached my full .tgz, can you assign it to somebody who can check the stuff in? I am not familiar how the process here works and don't want to create an issue in the GMaven-Jira if it's abandoned.

        Show
        David Hansmann added a comment - Seems to be easily reproducible, I attached the example and wish you good luck hunting the bug down. As for the gmaven stuff: I attached my full .tgz, can you assign it to somebody who can check the stuff in? I am not familiar how the process here works and don't want to create an issue in the GMaven-Jira if it's abandoned.
        Hide
        Guillaume Laforge added a comment -

        Thanks for the code sample!
        I've managed to reduce the failing example to this snippet:

        int a = 0
        [].each { 
            if (a < 0) {}
        }
        

        For the GMaven stuff, could you please open an issue in the GMaven JIRA?
        http://jira.codehaus.org/browse/GMAVEN
        Thanks in advance for that.

        Show
        Guillaume Laforge added a comment - Thanks for the code sample! I've managed to reduce the failing example to this snippet: int a = 0 [].each { if (a < 0) {} } For the GMaven stuff, could you please open an issue in the GMaven JIRA? http://jira.codehaus.org/browse/GMAVEN Thanks in advance for that.
        Hide
        Guillaume Laforge added a comment -

        David, as a workaround for now, till we fix the issue, you can use an Integer instead of an int, for the ReWK variable. So you can say Integer ReWK = 0, or simply def ReWK = 0

        Show
        Guillaume Laforge added a comment - David, as a workaround for now, till we fix the issue, you can use an Integer instead of an int, for the ReWK variable. So you can say Integer ReWK = 0, or simply def ReWK = 0
        Hide
        David Hansmann added a comment -

        Wow, that's a lot shorter than mine. I'll rather not touch my ((int)ReWK) workaround for now as I have to run a full build and tests then, but nice to know!

        I'll open another bug for the GMaven stuff.

        Show
        David Hansmann added a comment - Wow, that's a lot shorter than mine. I'll rather not touch my ((int)ReWK) workaround for now as I have to run a full build and tests then, but nice to know! I'll open another bug for the GMaven stuff.
        Hide
        blackdrag blackdrag added a comment -

        works now

        Show
        blackdrag blackdrag added a comment - works now

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            David Hansmann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: