[Jython-checkins] jython: Accept annotations in org.python.compiler.ClassFile#addField
darjus.loktevic
jython-checkins at python.org
Fri Nov 13 23:33:43 EST 2015
https://hg.python.org/jython/rev/81adb2def410
changeset: 7807:81adb2def410
user: cpburnz <cpburnz at gmail.com>
date: Sat Nov 14 15:30:55 2015 +1100
summary:
Accept annotations in org.python.compiler.ClassFile#addField
files:
src/org/python/compiler/ClassFile.java | 17 ++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/org/python/compiler/ClassFile.java b/src/org/python/compiler/ClassFile.java
--- a/src/org/python/compiler/ClassFile.java
+++ b/src/org/python/compiler/ClassFile.java
@@ -162,7 +162,24 @@
public void addField(String name, String type, int access)
throws IOException
{
+ addField(name, type, access, null);
+ }
+
+ public void addField(String name, String type, int access, AnnotationDescr[] annotationDescrs)
+ throws IOException
+ {
FieldVisitor fv = cw.visitField(access, name, type, null, null);
+
+ if (annotationDescrs != null) {
+ for (AnnotationDescr ad: annotationDescrs) {
+ AnnotationVisitor av = fv.visitAnnotation(ad.getName(), true);
+ if (ad.hasFields()) {
+ visitAnnotations(av, ad.getFields());
+ }
+ av.visitEnd();
+ }
+ }
+
fieldVisitors.add(fv);
}
--
Repository URL: https://hg.python.org/jython
More information about the Jython-checkins
mailing list