i read at http://groovy.codehaus.org/Differences+from+Java "this" in a
static context refer to the class.
So if I do :
class Dev
{
public static void main(String[] args)
{
println this
}
}
... this print "class pack.Dev". I Understand. I suppose "this" is an
object of class Class here.
But if I write "println this.getClass()" -> syntax error ?
this.name -> syntax error ?
this.hashCode() -> syntax error ?
So what is this ?
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
I use groovy 1.6.4 with JVM 1.6.0_14 and Netbeans 6.7.1
So it's a groovy 1.6.4 bug ?
I'm going to download the 1.6.6...
Thanks.
I fixed several bugs in that area a while back, not sure if I did for
1.6.6 as well
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
During Netbeans code parsing there this an error
java.lang.NullPointerException
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:264)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:165)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitTupleExpression(PathFinderVisitor.java:358)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:274)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitArgumentlistExpression(PathFinderVisitor.java:542)
at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:73)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitMethodCallExpression(PathFinderVisitor.java:285)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:63)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:63)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:159)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitExpressionStatement(PathFinderVisitor.java:205)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitBlockStatement(PathFinderVisitor.java:170)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:73)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:80)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitConstructorOrMethod(PathFinderVisitor.java:145)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:88)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitMethod(PathFinderVisitor.java:571)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:907)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:48)
at org.netbeans.modules.groovy.editor.api.PathFinderVisitor.visitClass(PathFinderVisitor.java:556)
at org.netbeans.modules.groovy.editor.api.AstPath.find(AstPath.java:182)
at org.netbeans.modules.groovy.editor.api.AstPath.findPathTo(AstPath.java:139)
at org.netbeans.modules.groovy.editor.api.AstPath.<init>(AstPath.java:91)
at org.netbeans.modules.groovy.editor.api.parser.GroovyOccurrencesFinder.run(GroovyOccurrencesFinder.java:142)
at org.netbeans.modules.groovy.editor.api.parser.GroovyOccurrencesFinder.run(GroovyOccurrencesFinder.java:72)
at org.netbeans.modules.csl.editor.semantic.MarkOccurrencesHighlighter.processImpl(MarkOccurrencesHighlighter.java:170)
at org.netbeans.modules.csl.editor.semantic.MarkOccurrencesHighlighter.run(MarkOccurrencesHighlighter.java:122)
at org.netbeans.modules.csl.editor.semantic.MarkOccurrencesHighlighter.run(MarkOccurrencesHighlighter.java:81)
at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:668)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[catch] at java.lang.Thread.run(Thread.java:619)
I suppose it's on :
public static void main(String[] args)
{
println this.getClass() // here.
}
Same with .hashCode(), .equals(), .name, .getName()...
2009/12/1 Jochen Theodorou <blac...@gmx.org>:
netbeans is messing around with the compiler, as it shows up in the
trace at positions were only the groovy internals are t be expected. SO
you need to try it outside of the IDE, since it is possible the netbeans
guys missed a possible NPE here