Issue Details (XML | Word | Printable)

Key: GROOVY-1265
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jochen Theodorou
Reporter: Dierk Koenig
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

using 'this' in field assignments

Created: 08/Mar/06 06:44 AM   Updated: 28/Mar/06 02:16 PM   Resolved: 28/Mar/06 02:16 PM
Component/s: command line processing
Affects Version/s: 1.0-JSR-5
Fix Version/s: 1.0-JSR-6

Time Tracking:
Not Specified


 Description  « Hide

> ----
> class Bla { > @Property Bla self = this > }
> println new Bla()
> ----
> throws NPE.

It's probably helpful to say that it causes an NPE in the compiler:

Caught: java.lang.NullPointerException
java.lang.NullPointerException
at org.codehaus.groovy.ast.ClassNode.equals(ClassNode.java:540)
at org.codehaus.groovy.ast.ClassNode.equals(ClassNode.java:538)
at org.codehaus.groovy.classgen.AsmClassGenerator.doConvertAndCast
(AsmClassGenerator.java:993)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitCastExpression
(AsmClassGenerator.java:1429)
at org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual
(AsmClassGenerator.java:2812)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression
(AsmClassGenerator.java:1055)
at org.codehaus.groovy.ast.expr.BinaryExpression.visit
(BinaryExpression.java:79)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean
(AsmClassGenerator.java:2876)
at
org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(
AsmClassGenerator.java:1021)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit
(ExpressionStatement.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement
(CodeVisitorSupport.java:165)
at
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement
(ClassCodeVisitorSupport.java:93)
at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement
(AsmClassGenerator.java:465)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit
(BlockStatement.java:82)



Jochen Theodorou added a comment - 28/Mar/06 02:16 PM

seems to be fixed