You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/19 21:02:44 UTC

[jira] [Updated] (GROOVY-8089) Compiler bug regarding first class functions and static fields

     [ https://issues.apache.org/jira/browse/GROOVY-8089?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King updated GROOVY-8089:
------------------------------
    Description: 
This bug is quite easy to reproduce by using a few lines of code.
The source below should print "TEST" twice, but in the second attempt an MissingMethodException is thrown.
{code}
class Test {	
	static def staticDo;	
	static main(args) {
		def normalDo = { print("normal:\t") ; it() };
		staticDo     = { print("static:\t") ; it() };
	
		def test = { println("TEST") };
			
		def clo = { normalDo( test ) };
		clo();		
		clo     = { staticDo( test ) };		
		clo();
	}	
}
{code}


  was:
This bug is quite easy to reproduce by using a few lines of code.
The source below should print "TEST" twice, but in the second attempt an MissingMethodException is thrown.

class Test {	
	static def staticDo;	
	static main(args) {
		def normalDo = { print("normal:\t") ; it() };
		staticDo     = { print("static:\t") ; it() };
	
		def test = { println("TEST") };
			
		def clo = { normalDo( test ) };
		clo();		
		clo     = { staticDo( test ) };		
		clo();
	}	
}



> Compiler bug regarding first class functions and static fields
> --------------------------------------------------------------
>
>                 Key: GROOVY-8089
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8089
>             Project: Groovy
>          Issue Type: Bug
>          Components: bytecode
>    Affects Versions: 2.4.8
>         Environment: Windows 10 java 7
>            Reporter: Hood Wilson Gusso Silva
>              Labels: easytest
>
> This bug is quite easy to reproduce by using a few lines of code.
> The source below should print "TEST" twice, but in the second attempt an MissingMethodException is thrown.
> {code}
> class Test {	
> 	static def staticDo;	
> 	static main(args) {
> 		def normalDo = { print("normal:\t") ; it() };
> 		staticDo     = { print("static:\t") ; it() };
> 	
> 		def test = { println("TEST") };
> 			
> 		def clo = { normalDo( test ) };
> 		clo();		
> 		clo     = { staticDo( test ) };		
> 		clo();
> 	}	
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)