You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/02/17 13:34:57 UTC

[groovy] branch master updated: GROOVY-9185: groovyc doesn't keep RetentionPolicy in generated bytecode

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f0f13b  GROOVY-9185: groovyc doesn't keep RetentionPolicy in generated bytecode
0f0f13b is described below

commit 0f0f13b4dcb505f93b44a5409ccf455bb2b52481
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Feb 17 23:34:41 2020 +1000

    GROOVY-9185: groovyc doesn't keep RetentionPolicy in generated bytecode
---
 src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
index 06e8aa6..efd8e39 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Java8.java
@@ -340,7 +340,9 @@ public class Java8 implements VMPlugin {
         for (AnnotationNode an : annotations) {
             plugin.configureAnnotationNodeFromDefinition(an, node);
         }
-        plugin.configureAnnotationNodeFromDefinition(node, node);
+        if (!node.getClassNode().getName().equals("java.lang.annotation.Retention")) {
+            plugin.configureAnnotationNodeFromDefinition(node, node);
+        }
     }
 
     private void configureAnnotation(AnnotationNode node, Annotation annotation) {
@@ -440,11 +442,11 @@ public class Java8 implements VMPlugin {
             Class<?> sc = clazz.getSuperclass();
             if (sc != null) classNode.setUnresolvedSuperClass(makeClassNode(compileUnit, clazz.getGenericSuperclass(), sc));
             makeInterfaceTypes(compileUnit, classNode, clazz);
-            setAnnotationMetaData(classNode.getTypeClass().getAnnotations(), classNode);
+            setAnnotationMetaData(clazz.getAnnotations(), classNode);
 
             PackageNode packageNode = classNode.getPackage();
             if (packageNode != null) {
-                setAnnotationMetaData(classNode.getTypeClass().getPackage().getAnnotations(), packageNode);
+                setAnnotationMetaData(clazz.getPackage().getAnnotations(), packageNode);
             }
         } catch (NoClassDefFoundError e) {
             throw new NoClassDefFoundError("Unable to load class "+classNode.toString(false)+" due to missing dependency "+e.getMessage());