groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniil Ovchinnikov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-7929) @SelfType compilation fail
Date Mon, 05 Sep 2016 12:50:21 GMT

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

Daniil Ovchinnikov updated GROOVY-7929:
---------------------------------------
    Description: 
{code}
class C1 {
    def c1() {}
}

@groovy.transform.CompileStatic
@groovy.transform.SelfType(C1)
trait TT {
    def foo() {
        c2()
    }
}
{code}

Fails with:
{noformat}
java.lang.UnsupportedOperationException
       	at org.codehaus.groovy.transform.stc.UnionTypeClassNode.getInnerClasses(UnionTypeClassNode.java:269)
       	at org.codehaus.groovy.transform.trait.Traits.findHelpers(Traits.java:114)
       	at org.codehaus.groovy.transform.trait.Traits.findHelper(Traits.java:104)
       	at org.codehaus.groovy.transform.stc.TraitTypeCheckingExtension.handleMissingMethod(TraitTypeCheckingExtension.java:82)
       	at org.codehaus.groovy.transform.stc.DefaultTypeCheckingExtension.handleMissingMethod(DefaultTypeCheckingExtension.java:110)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2925)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:317)
       	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
       	at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
       	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
       	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
       	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:164)
       	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:123)
       	at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63)
       	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
       	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
       	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
       	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
       	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
       	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
       	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
       	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
       	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
       	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
       	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
       	at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
       	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       	at java.lang.reflect.Method.invoke(Method.java:498)
       	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
       	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131){noformat}

  was:
{code}
class C1 {
    def c1() {}
}

class C2 {
    def c2() {}
}

@groovy.transform.CompileStatic
@groovy.transform.SelfType([C1, C2])
trait TT {
    def foo() {
        c1()
        c2()
        c3()
    }
}
{code}

Fails with:
{noformat}
java.lang.UnsupportedOperationException
       	at org.codehaus.groovy.transform.stc.UnionTypeClassNode.getInnerClasses(UnionTypeClassNode.java:269)
       	at org.codehaus.groovy.transform.trait.Traits.findHelpers(Traits.java:114)
       	at org.codehaus.groovy.transform.trait.Traits.findHelper(Traits.java:104)
       	at org.codehaus.groovy.transform.stc.TraitTypeCheckingExtension.handleMissingMethod(TraitTypeCheckingExtension.java:82)
       	at org.codehaus.groovy.transform.stc.DefaultTypeCheckingExtension.handleMissingMethod(DefaultTypeCheckingExtension.java:110)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2925)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:317)
       	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
       	at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
       	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
       	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
       	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:164)
       	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
       	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
       	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
       	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:123)
       	at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63)
       	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
       	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
       	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
       	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
       	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
       	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
       	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
       	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
       	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
       	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
       	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
       	at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
       	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       	at java.lang.reflect.Method.invoke(Method.java:498)
       	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
       	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
{noformat}

        Summary: @SelfType compilation fail  (was: @SelfType with multiple classes compilation
fail)

> @SelfType compilation fail
> --------------------------
>
>                 Key: GROOVY-7929
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7929
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static Type Checker
>    Affects Versions: 2.4.6, 2.4.7
>            Reporter: Daniil Ovchinnikov
>
> {code}
> class C1 {
>     def c1() {}
> }
> @groovy.transform.CompileStatic
> @groovy.transform.SelfType(C1)
> trait TT {
>     def foo() {
>         c2()
>     }
> }
> {code}
> Fails with:
> {noformat}
> java.lang.UnsupportedOperationException
>        	at org.codehaus.groovy.transform.stc.UnionTypeClassNode.getInnerClasses(UnionTypeClassNode.java:269)
>        	at org.codehaus.groovy.transform.trait.Traits.findHelpers(Traits.java:114)
>        	at org.codehaus.groovy.transform.trait.Traits.findHelper(Traits.java:104)
>        	at org.codehaus.groovy.transform.stc.TraitTypeCheckingExtension.handleMissingMethod(TraitTypeCheckingExtension.java:82)
>        	at org.codehaus.groovy.transform.stc.DefaultTypeCheckingExtension.handleMissingMethod(DefaultTypeCheckingExtension.java:110)
>        	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2925)
>        	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethodCallExpression(StaticCompilationVisitor.java:317)
>        	at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
>        	at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
>        	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
>        	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>        	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
>        	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
>        	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
>        	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
>        	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitMethod(StaticCompilationVisitor.java:164)
>        	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
>        	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
>        	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
>        	at org.codehaus.groovy.transform.sc.StaticCompilationVisitor.visitClass(StaticCompilationVisitor.java:123)
>        	at org.codehaus.groovy.transform.sc.StaticCompileTransformation.visit(StaticCompileTransformation.java:63)
>        	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
>        	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
>        	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
>        	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
>        	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
>        	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
>        	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
>        	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
>        	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
>        	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
>        	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
>        	at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
>        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>        	at java.lang.reflect.Method.invoke(Method.java:498)
>        	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
>        	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131){noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message