[
https://issues.apache.org/jira/browse/GROOVY-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-4941:
--------------------------------
Language: groovy
> Static methods cannot be called during AST transformation via
> AstBuilder.buildFromSpec()
> ----------------------------------------------------------------------------------------
>
> Key: GROOVY-4941
> URL: https://issues.apache.org/jira/browse/GROOVY-4941
> Project: Groovy
> Issue Type: Bug
> Components: ast builder
> Environment: Groovy Version: 1.8.0/1.9-beta-1
> Reporter: Masato Nagai
> Priority: Major
> Attachments: Test.zip, patch
>
>
> Static methods cannot be called during AST transformation via
> AstBuilder.buildFromSpec() because
> AstSpecificationCompiler.staticMethodCall() doesn't take a ClassNode object
> and if I try to call it with a Class object, I get "ClassNode#getTypeClass is
> called before the type class is set" error. I have no idea why the method
> takes a Class object instead.
> I attached a program to reproduce the error. Please unzip the Test.zip and
> run Main.groovy then you'll get the following error:
> ----
> Caught: BUG! exception in phase 'canonicalization' in source unit
> 'src\Main.groovy' ClassNode#getTypeClass for Clazz is called before the type
> class is set
> BUG! exception in phase 'canonicalization' in source unit 'src\Main.groovy'
> ClassNode#getTypeClass for Clazz is called before the type class is set
> at
> AnASTTransformation$_visit_closure1_closure2_closure3_closure4.doCall(AnASTTransformation.groovy:39)
> at
> AnASTTransformation$_visit_closure1_closure2_closure3_closure4.doCall(AnASTTransformation.groovy)
> at
> AnASTTransformation$_visit_closure1_closure2_closure3.doCall(AnASTTransformation.groovy:38)
> at
> AnASTTransformation$_visit_closure1_closure2_closure3.doCall(AnASTTransformation.groovy)
> at
> AnASTTransformation$_visit_closure1_closure2.doCall(AnASTTransformation.groovy:35)
> at
> AnASTTransformation$_visit_closure1_closure2.doCall(AnASTTransformation.groovy)
> at
> AnASTTransformation$_visit_closure1.doCall(AnASTTransformation.groovy:34)
> at
> AnASTTransformation$_visit_closure1.doCall(AnASTTransformation.groovy)
> at AnASTTransformation.visit(AnASTTransformation.groovy:33)
> ----
> I also attached a patch for the trunk to add a version that takes a ClassNode
> object.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)