Skip to content
This repository was archived by the owner on Jan 27, 2021. It is now read-only.

Commit 62dace1

Browse files
committed
Merge pull request #13 from cowwoc/JERSEY-2429
JERSEY-2429: JDK 8 support
2 parents d2c5671 + 58ada30 commit 62dace1

23 files changed

Lines changed: 6764 additions & 3865 deletions

jersey-server/src/main/java/com/sun/jersey/spi/scanning/AnnotationScannerListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public void onProcess(String name, InputStream in) throws IOException {
140140

141141
//
142142

143-
private final class AnnotatedClassVisitor implements ClassVisitor {
143+
private final class AnnotatedClassVisitor extends ClassVisitor {
144144

145145
/**
146146
* The name of the visited class.
@@ -155,6 +155,10 @@ private final class AnnotatedClassVisitor implements ClassVisitor {
155155
*/
156156
private boolean isAnnotated;
157157

158+
private AnnotatedClassVisitor() {
159+
super(Opcodes.ASM5);
160+
}
161+
158162
public void visit(int version, int access, String name,
159163
String signature, String superName, String[] interfaces) {
160164
className = name;
Lines changed: 106 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***
22
* ASM: a very small and fast Java bytecode manipulation framework
3-
* Copyright (c) 2000-2007 INRIA, France Telecom
3+
* Copyright (c) 2000-2011 INRIA, France Telecom
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without
@@ -30,68 +30,140 @@
3030
package jersey.repackaged.org.objectweb.asm;
3131

3232
/**
33-
* A visitor to visit a Java annotation. The methods of this interface must be
34-
* called in the following order: (<tt>visit<tt> | <tt>visitEnum<tt> |
35-
* <tt>visitAnnotation<tt> | <tt>visitArray<tt>)* <tt>visitEnd<tt>.
36-
*
33+
* A visitor to visit a Java annotation. The methods of this class must be
34+
* called in the following order: ( <tt>visit</tt> | <tt>visitEnum</tt> |
35+
* <tt>visitAnnotation</tt> | <tt>visitArray</tt> )* <tt>visitEnd</tt>.
36+
*
3737
* @author Eric Bruneton
3838
* @author Eugene Kuleshov
3939
*/
40-
public interface AnnotationVisitor {
40+
public abstract class AnnotationVisitor {
41+
42+
/**
43+
* The ASM API version implemented by this visitor. The value of this field
44+
* must be one of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
45+
*/
46+
protected final int api;
47+
48+
/**
49+
* The annotation visitor to which this visitor must delegate method calls.
50+
* May be null.
51+
*/
52+
protected AnnotationVisitor av;
53+
54+
/**
55+
* Constructs a new {@link AnnotationVisitor}.
56+
*
57+
* @param api
58+
* the ASM API version implemented by this visitor. Must be one
59+
* of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
60+
*/
61+
public AnnotationVisitor(final int api) {
62+
this(api, null);
63+
}
64+
65+
/**
66+
* Constructs a new {@link AnnotationVisitor}.
67+
*
68+
* @param api
69+
* the ASM API version implemented by this visitor. Must be one
70+
* of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
71+
* @param av
72+
* the annotation visitor to which this visitor must delegate
73+
* method calls. May be null.
74+
*/
75+
public AnnotationVisitor(final int api, final AnnotationVisitor av) {
76+
if (api != Opcodes.ASM4 && api != Opcodes.ASM5) {
77+
throw new IllegalArgumentException();
78+
}
79+
this.api = api;
80+
this.av = av;
81+
}
4182

4283
/**
4384
* Visits a primitive value of the annotation.
44-
*
45-
* @param name the value name.
46-
* @param value the actual value, whose type must be {@link Byte},
47-
* {@link Boolean}, {@link Character}, {@link Short},
48-
* {@link Integer}, {@link Long}, {@link Float}, {@link Double},
49-
* {@link String} or {@link Type}. This value can also be an array
50-
* of byte, boolean, short, char, int, long, float or double values
51-
* (this is equivalent to using {@link #visitArray visitArray} and
52-
* visiting each array element in turn, but is more convenient).
85+
*
86+
* @param name
87+
* the value name.
88+
* @param value
89+
* the actual value, whose type must be {@link Byte},
90+
* {@link Boolean}, {@link Character}, {@link Short},
91+
* {@link Integer} , {@link Long}, {@link Float}, {@link Double},
92+
* {@link String} or {@link Type} or OBJECT or ARRAY sort. This
93+
* value can also be an array of byte, boolean, short, char, int,
94+
* long, float or double values (this is equivalent to using
95+
* {@link #visitArray visitArray} and visiting each array element
96+
* in turn, but is more convenient).
5397
*/
54-
void visit(String name, Object value);
98+
public void visit(String name, Object value) {
99+
if (av != null) {
100+
av.visit(name, value);
101+
}
102+
}
55103

56104
/**
57105
* Visits an enumeration value of the annotation.
58-
*
59-
* @param name the value name.
60-
* @param desc the class descriptor of the enumeration class.
61-
* @param value the actual enumeration value.
106+
*
107+
* @param name
108+
* the value name.
109+
* @param desc
110+
* the class descriptor of the enumeration class.
111+
* @param value
112+
* the actual enumeration value.
62113
*/
63-
void visitEnum(String name, String desc, String value);
114+
public void visitEnum(String name, String desc, String value) {
115+
if (av != null) {
116+
av.visitEnum(name, desc, value);
117+
}
118+
}
64119

65120
/**
66121
* Visits a nested annotation value of the annotation.
67-
*
68-
* @param name the value name.
69-
* @param desc the class descriptor of the nested annotation class.
122+
*
123+
* @param name
124+
* the value name.
125+
* @param desc
126+
* the class descriptor of the nested annotation class.
70127
* @return a visitor to visit the actual nested annotation value, or
71-
* <tt>null</tt> if this visitor is not interested in visiting
72-
* this nested annotation. <i>The nested annotation value must be
73-
* fully visited before calling other methods on this annotation
128+
* <tt>null</tt> if this visitor is not interested in visiting this
129+
* nested annotation. <i>The nested annotation value must be fully
130+
* visited before calling other methods on this annotation
74131
* visitor</i>.
75132
*/
76-
AnnotationVisitor visitAnnotation(String name, String desc);
133+
public AnnotationVisitor visitAnnotation(String name, String desc) {
134+
if (av != null) {
135+
return av.visitAnnotation(name, desc);
136+
}
137+
return null;
138+
}
77139

78140
/**
79141
* Visits an array value of the annotation. Note that arrays of primitive
80142
* types (such as byte, boolean, short, char, int, long, float or double)
81143
* can be passed as value to {@link #visit visit}. This is what
82144
* {@link ClassReader} does.
83-
*
84-
* @param name the value name.
145+
*
146+
* @param name
147+
* the value name.
85148
* @return a visitor to visit the actual array value elements, or
86-
* <tt>null</tt> if this visitor is not interested in visiting
87-
* these values. The 'name' parameters passed to the methods of this
149+
* <tt>null</tt> if this visitor is not interested in visiting these
150+
* values. The 'name' parameters passed to the methods of this
88151
* visitor are ignored. <i>All the array values must be visited
89152
* before calling other methods on this annotation visitor</i>.
90153
*/
91-
AnnotationVisitor visitArray(String name);
154+
public AnnotationVisitor visitArray(String name) {
155+
if (av != null) {
156+
return av.visitArray(name);
157+
}
158+
return null;
159+
}
92160

93161
/**
94162
* Visits the end of the annotation.
95163
*/
96-
void visitEnd();
164+
public void visitEnd() {
165+
if (av != null) {
166+
av.visitEnd();
167+
}
168+
}
97169
}

0 commit comments

Comments
 (0)