Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.3
-
Fix Version/s: 1.6.4, 1.7-beta-1
-
Component/s: Compiler
-
Labels:None
-
Environment:eclipse 3.5M7 + mac os x jdk 1.6 + groovy eclipse 1.6.3.20090514
-
Testcase included:yes
-
Number of attachments :
Description
The following sample does not work :
@Category(Tet)
class TestCategory {
//String getName() {return "hello"}
String getSuperName() {
String myname = "" // CENTRAL POINT
return myname + " yeah"
}
}
interface Tet {
String getName()
}
class MyTest implements Tet {
String getName() {return "hi"}
}
def onetest = new MyTest()
println onetest.getName()
use(TestCategory) {
println onetest.getSuperName()
}
The stack trace of the error compiling this code with groovy 1.6.3 is :
BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@14956342[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]] at org.codehaus.groovy.ast.expr.DeclarationExpression.check(DeclarationExpression.java:48) at org.codehaus.groovy.ast.expr.DeclarationExpression.<init>(DeclarationExpression.java:37) at org.codehaus.groovy.ast.expr.DeclarationExpression.transformExpression(DeclarationExpression.java:72) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.transform(ClassCodeExpressionTransformer.java:90) at org.codehaus.groovy.transform.CategoryASTTransformation$1.transform(CategoryASTTransformation.java:115)
When using 'name' for assignment at the CENTRAL POINT of the code the error is the same.
When using 'this.name' for assignment at the CENTRAL POINT of the code the error is (a bit more explicit) :
BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@292bf0be[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]]
Activity
Roshan Dawrani
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Assignee | Roshan Dawrani [ roshandawrani ] |
Roshan Dawrani
made changes -
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] | |
| Fix Version/s | 1.7-beta-1 [ 14014 ] | |
| Fix Version/s | 1.6.4 [ 15291 ] |
Louis Foucart
made changes -
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
| Resolution | Fixed [ 1 ] |
Roshan Dawrani
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
Paul King
made changes -
| Description |
The following sample does not work : //////////////////////////////////////////////////////////////////////////////////// @Category(Tet) class TestCategory { //String getName() {return "hello"} String getSuperName() { String myname = "" // CENTRAL POINT return myname + " yeah" } } interface Tet { String getName() } class MyTest implements Tet { String getName() {return "hi"} } def onetest = new MyTest() println onetest.getName() use(TestCategory) { println onetest.getSuperName() } /////////////////////////////////////////////////////////////////////////////////// The stack trace of the error compiling this code with groovy 1.6.3 is : BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@14956342[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]] at org.codehaus.groovy.ast.expr.DeclarationExpression.check(DeclarationExpression.java:48) at org.codehaus.groovy.ast.expr.DeclarationExpression.<init>(DeclarationExpression.java:37) at org.codehaus.groovy.ast.expr.DeclarationExpression.transformExpression(DeclarationExpression.java:72) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.transform(ClassCodeExpressionTransformer.java:90) at org.codehaus.groovy.transform.CategoryASTTransformation$1.transform(CategoryASTTransformation.java:115) When using 'name' for assignement at the CENTRAL POINT of the code the error is the same. When using 'this.name' for assignement at the CENTRAL POINT of the code the error is (a bit more explicit) : BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@292bf0be[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]] |
The following sample does not work : {code} @Category(Tet) class TestCategory { //String getName() {return "hello"} String getSuperName() { String myname = "" // CENTRAL POINT return myname + " yeah" } } interface Tet { String getName() } class MyTest implements Tet { String getName() {return "hi"} } def onetest = new MyTest() println onetest.getName() use(TestCategory) { println onetest.getSuperName() } {code} The stack trace of the error compiling this code with groovy 1.6.3 is : {noformat} BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@14956342[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]] at org.codehaus.groovy.ast.expr.DeclarationExpression.check(DeclarationExpression.java:48) at org.codehaus.groovy.ast.expr.DeclarationExpression.<init>(DeclarationExpression.java:37) at org.codehaus.groovy.ast.expr.DeclarationExpression.transformExpression(DeclarationExpression.java:72) at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.transform(ClassCodeExpressionTransformer.java:90) at org.codehaus.groovy.transform.CategoryASTTransformation$1.transform(CategoryASTTransformation.java:115) {noformat} When using 'name' for assignment at the CENTRAL POINT of the code the error is the same. When using 'this.name' for assignment at the CENTRAL POINT of the code the error is (a bit more explicit) : {noformat} BUG! exception in phase 'canonicalization' in source unit '/eclipses/workspaces/geny-runtime/groovy.generator.uml2/src/test.groovy' illegal left expression for declaration: org.codehaus.groovy.ast.expr.PropertyExpression@292bf0be[object: org.codehaus.groovy.ast.expr.VariableExpression@4a1bf766[variable: $this] property: ConstantExpression[myname]] {noformat} |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |
ok my mistake about the errors, they are the same !
I put only the stack trace till the CategoryASTTransformation because i think the problem comes from here.