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:44:44 UTC
[groovy] branch master updated: GROOVY-9185: groovyc doesn't keep
RetentionPolicy in generated bytecode (test)
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 2117edc GROOVY-9185: groovyc doesn't keep RetentionPolicy in generated bytecode (test)
2117edc is described below
commit 2117edc833f87bf2818dd1780810f428344fb4c9
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Feb 17 23:44:31 2020 +1000
GROOVY-9185: groovyc doesn't keep RetentionPolicy in generated bytecode (test)
---
src/test/gls/annotations/AnnotationTest.groovy | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/test/gls/annotations/AnnotationTest.groovy b/src/test/gls/annotations/AnnotationTest.groovy
index bd58bb0..43d26f0 100644
--- a/src/test/gls/annotations/AnnotationTest.groovy
+++ b/src/test/gls/annotations/AnnotationTest.groovy
@@ -882,6 +882,22 @@ final class AnnotationTest extends CompilableTestSupport {
'''
}
+ void testAnnotationRetentionMirrorsJava() {
+ assertScript '''
+ for (retention in ['', '@Retention(SOURCE)', '@Retention(CLASS)', '@Retention(RUNTIME)']) {
+ def src = """
+ import java.lang.annotation.Retention;
+ import static java.lang.annotation.RetentionPolicy.*;
+ $retention
+ @interface MyAnnotation {}
+ """
+ def mag = new GroovyClassLoader().parseClass src
+ def maj = new org.apache.groovy.util.JavaShell().compile 'MyAnnotation', src
+ assert mag.annotations == maj.annotations
+ }
+ '''
+ }
+
void testAnnotationWithRepeatableSupportedPrecompiledJava() {
assertScript '''
import java.lang.annotation.*