groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Seibert (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GROOVY-8953) Imported enum causes compilation bug preventing tests from compiling
Date Tue, 29 Jan 2019 12:54:00 GMT

    [ https://issues.apache.org/jira/browse/GROOVY-8953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16754977#comment-16754977
] 

Christoph Seibert commented on GROOVY-8953:
-------------------------------------------

[~paulk]: I believe I encountered the same issue and was able to reproduce it. The issue appears
to be triggered when there's an annotation on the constructor parameter of an enum. If you
remove the {{@Deprecated}} annotation from the example enum (see below), it's fine. It does
not depend on this specific annotation; I originally stumbled upon it because of a {{javax.annotations.Nonnull}}
annotation.

 Steps to reproduce:
 * Unpack the attached {{groovy-8593.zip}}
 * Compile AnEnum.java with {{javac}} 1.8 (on my environment, the output of {{javac -version}}
is {{javac 1.8.0_202-ea}})
 * Try to compile {{groovy-8953.groovy}} with {{groovyc}} 2.4.16 ({{groovyc -version}}: {{Groovy
compiler version 2.4.16}})

Expected result:
 * Compilation finishes without error (it does with {{groovyc}} 2.4.15)

Actual result:
{code}
>>> a serious error occurred: BUG! exception in phase 'semantic analysis' in source
unit 'groovy-8953.groovy' Constructor parameter annotations length [1] does not match the
parameter length: private AnEnum(java.lang.String,int,java.lang.String)

>>> stacktrace:

BUG! exception in phase 'semantic analysis' in source unit 'groovy-8953.groovy' Constructor
parameter annotations length [1] does not match the parameter length: private AnEnum(java.lang.String,int,java.lang.String)

at org.codehaus.groovy.vmplugin.v5.Java5.getConstructorParameterAnnotations(Java5.java:438)

at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:386)

at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)

at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1009)

at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1004)

at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:998)

at org.codehaus.groovy.control.ResolveVisitor.transformPropertyExpression(ResolveVisitor.java:916)

at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:760)

at org.codehaus.groovy.ast.expr.Expression.transformExpressions(Expression.java:51)

at org.codehaus.groovy.ast.expr.ArgumentListExpression.transformExpression(ArgumentListExpression.java:69)

at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:775)

at org.codehaus.groovy.control.ResolveVisitor.transformMethodCallExpression(ResolveVisitor.java:1145)

at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:766)

at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:144)

at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)

at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)

at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)

at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1402)

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.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:55)

at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:239)

at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)

at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1081)

at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)

at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1345)

at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:214)

at org.codehaus.groovy.control.CompilationUnit$12.call(CompilationUnit.java:684)

at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:966)

at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:626)

at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:575)

at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)

at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:71)

at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:227)

at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:160)

at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:190)

at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:174)

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:116)

at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138)
{code}

> Imported enum causes compilation bug preventing tests from compiling
> --------------------------------------------------------------------
>
>                 Key: GROOVY-8953
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8953
>             Project: Groovy
>          Issue Type: Bug
>         Environment: JDK 8
> groovy-all:2.4.+
>            Reporter: Rhys Cox
>            Priority: Minor
>         Attachments: groovy-8953.zip
>
>
> In early December our spock tests were compiling fine, but at the start of this year
they're all breaking with the following error:
> Error:Groovyc: While compiling tests of REDACTED: BUG! exception in phase 'semantic analysis'
in source unit 'REDACTEDSpec.groovy' Constructor parameter annotations length [5] does not
match the parameter length: private REDACTEDENUMCLASS(java.lang.String,int,int,java.lang.String,ANOTHERREDACTEDENUMCLASS,java.lang.String,java.util.regex.Pattern)
>     at org.codehaus.groovy.vmplugin.v5.Java5.getConstructorParameterAnnotations(Java5.java:438)
>     at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:386)
>     at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
>     at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:877)
>     at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:892)
>     at org.codehaus.groovy.ast.ClassNode.hasPossibleStaticMethod(ClassNode.java:1313)
>     at org.codehaus.groovy.control.StaticImportVisitor.findStaticMethod(StaticImportVisitor.java:597)
>     at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessorByFullName(StaticImportVisitor.java:565)
>     at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessor(StaticImportVisitor.java:532)
>     at org.codehaus.groovy.control.StaticImportVisitor.findStaticFieldOrPropAccessorImportFromModule(StaticImportVisitor.java:440)
>     at org.codehaus.groovy.control.StaticImportVisitor.transformVariableExpression(StaticImportVisitor.java:198)
>     at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:99)
>     at org.codehaus.groovy.ast.expr.Expression.transformExpressions(Expression.java:51)
>     at org.codehaus.groovy.ast.expr.ArgumentListExpression.transformExpression(ArgumentListExpression.java:69)
>     at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:117)
>     at org.codehaus.groovy.ast.expr.ConstructorCallExpression.transformExpression(ConstructorCallExpression.java:50)
>     at org.codehaus.groovy.control.StaticImportVisitor.transformConstructorCallExpression(StaticImportVisitor.java:339)
>     at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:114)
>     at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitField(ClassCodeExpressionTransformer.java:70)
>     at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1073)
>     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
>     at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:78)
>     at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:692)
>     at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
>     at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
>     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
>     at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
>     at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:118)
>     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.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:91)
>     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.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:160)
>     at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:89)
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>     at java.lang.Thread.run(Thread.java:748)
> The thing it's complaining about appears to be when using one of our enums in a spock
test.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message