groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul King (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GROOVY-8669) Groovy class does not compile if the ValueType of an annotation is not on the classpath
Date Thu, 16 Aug 2018 06:32:00 GMT

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

Paul King updated GROOVY-8669:
------------------------------
    Description: 
If a groovy class (Test.groovy) references a class (AnnotatedClass) which has an annotation
(Annotation) with a value class (ValueClass), which is not on the classpath an NoClassDefFoundError
is thrown.

This does happen during Compilation. This did not happen in Groovy 2.4.15.
The stacktrace is:
{noformat}
Caused by: java.lang.NoClassDefFoundError: annos.ValueClass
    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:48)
    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:81)
    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:72)
    at org.codehaus.groovy.ast.decompiled.Annotations.annotationValueToExpression(Annotations.java:58)
    at org.codehaus.groovy.ast.decompiled.Annotations.createAnnotationNode(Annotations.java:51)
   ...
{noformat}

I think the class org.codehaus.groovy.ast.decompiled.Annotations should also ignore annotation
nodes, if the values type is not resolvable. Like it is done if the annotation type itself
is not resolvable, see line 43-46.

I have attached a simple sample to reproduce the issue.
 1. Compile it with gradle build
 2. Open the jar file annos/build/libs/annos.jar
 3. Delete the classfile annos/ValueClass.class
 4. Compile it with gradle :client:build
 Now the exception is thrown.

 

 

 

  was:
If a groovy class (Test.groovy) references a class (AnnotatedClass) which has an annotation
(Annotation) with a value class (ValueClass), which is not on the classpath an NoClassDefFoundError
is thrown.

{{This does happen during Compilation. This did not happen in Groovy 2.4.15.}}
 {{The stacktrace is:}}
 {{Caused by: java.lang.NoClassDefFoundError: annos.ValueClass}}
 {{    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:48)}}
 {{    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:81)}}
 {{    at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:72)}}
 {{    at org.codehaus.groovy.ast.decompiled.Annotations.annotationValueToExpression(Annotations.java:58)}}
 {{    at org.codehaus.groovy.ast.decompiled.Annotations.createAnnotationNode(Annotations.java:51)}}
 \{{    at }}

I think the class org.codehaus.groovy.ast.decompiled.Annotations should also ignore annotation
nodes, if the values type is not resolvable. Like it is done if the annotation type itself
is not resolvable, see line 43-46.

I have attached a simple sample to reproduce the issue.
 1. Compile it with gradle build
 2. Open the jar file annos/build/libs/annos.jar
 3. Delete the classfile annos/ValueClass.class
 4. Compile it with gradle :client:build
 Now the exception is thrown.

 

 

 


> Groovy class does not compile if the ValueType of an annotation is not on the classpath
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8669
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8669
>             Project: Groovy
>          Issue Type: Bug
>          Components: class generator
>    Affects Versions: 2.5.0
>            Reporter: Andreas Turban
>            Priority: Major
>              Labels: annotations, compile-error
>         Attachments: AnnoTest.zip
>
>
> If a groovy class (Test.groovy) references a class (AnnotatedClass) which has an annotation
(Annotation) with a value class (ValueClass), which is not on the classpath an NoClassDefFoundError
is thrown.
> This does happen during Compilation. This did not happen in Groovy 2.4.15.
> The stacktrace is:
> {noformat}
> Caused by: java.lang.NoClassDefFoundError: annos.ValueClass
>     at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:48)
>     at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:81)
>     at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:72)
>     at org.codehaus.groovy.ast.decompiled.Annotations.annotationValueToExpression(Annotations.java:58)
>     at org.codehaus.groovy.ast.decompiled.Annotations.createAnnotationNode(Annotations.java:51)
>    ...
> {noformat}
> I think the class org.codehaus.groovy.ast.decompiled.Annotations should also ignore annotation
nodes, if the values type is not resolvable. Like it is done if the annotation type itself
is not resolvable, see line 43-46.
> I have attached a simple sample to reproduce the issue.
>  1. Compile it with gradle build
>  2. Open the jar file annos/build/libs/annos.jar
>  3. Delete the classfile annos/ValueClass.class
>  4. Compile it with gradle :client:build
>  Now the exception is thrown.
>  
>  
>  



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

Mime
View raw message