Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit a4cb844

Browse files
committed
Patch ASM to be able to process classes compiled by Java 9.
Change-Id: I7000344cc4d3ee6ab5a0c17ff8bdefbfa9440043
1 parent 75d4f54 commit a4cb844

File tree

36 files changed

+14787
-106
lines changed

36 files changed

+14787
-106
lines changed

bundles/jaxrs-ri/pom.xml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,6 @@
161161
<artifactId>hk2-locator</artifactId>
162162
<scope>provided</scope>
163163
</dependency>
164-
<dependency>
165-
<groupId>org.ow2.asm</groupId>
166-
<artifactId>asm-debug-all</artifactId>
167-
<optional>true</optional>
168-
</dependency>
169164
<dependency>
170165
<groupId>org.glassfish.jersey.bundles.repackaged</groupId>
171166
<artifactId>jersey-guava</artifactId>
@@ -283,10 +278,10 @@
283278
<Export-Package>
284279
javax.ws.rs.*;version=${jaxrs.api.impl.version},
285280
org.glassfish.jersey.*;version=${project.version},
286-
com.sun.research.ws.wadl.*;version=${project.version}
281+
com.sun.research.ws.wadl.*;version=${project.version},
282+
jersey.repackaged.org.objectweb.asm.*;version=${project.version}
287283
</Export-Package>
288284
<Import-Package><![CDATA[
289-
!org.objectweb.asm.*,
290285
javax.servlet.annotation.*;resolution:=optional;version="$<range;[==,+);${servlet3.version}>",
291286
javax.servlet.descriptor.*;resolution:=optional;version="$<range;[==,+);${servlet3.version}>",
292287
javax.servlet.*;version="[2.4,4.0)",
@@ -305,19 +300,6 @@
305300
<plugin>
306301
<groupId>org.apache.maven.plugins</groupId>
307302
<artifactId>maven-shade-plugin</artifactId>
308-
<configuration>
309-
<artifactSet>
310-
<includes>
311-
<include>org.ow2.asm:asm-debug-all:*</include>
312-
</includes>
313-
</artifactSet>
314-
<relocations>
315-
<relocation>
316-
<pattern>org.objectweb.asm</pattern>
317-
<shadedPattern>${jersey.repackaged.prefix}.org.objectweb.asm</shadedPattern>
318-
</relocation>
319-
</relocations>
320-
</configuration>
321303
</plugin>
322304
<!-- producing zipped archives -->
323305
<plugin>

core-server/pom.xml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
com.sun.research.ws.wadl.*;version=${project.version}
8989
</Export-Package>
9090
<Import-Package>
91-
!org.objectweb.asm.*,
9291
*
9392
</Import-Package>
9493
</instructions>
@@ -131,24 +130,6 @@
131130
<removeOldOutput>true</removeOldOutput>
132131
</configuration>
133132
</plugin>
134-
<plugin>
135-
<groupId>org.apache.maven.plugins</groupId>
136-
<artifactId>maven-shade-plugin</artifactId>
137-
<inherited>true</inherited>
138-
<configuration>
139-
<artifactSet>
140-
<includes>
141-
<include>org.ow2.asm:asm-debug-all:*</include>
142-
</includes>
143-
</artifactSet>
144-
<relocations>
145-
<relocation>
146-
<pattern>org.objectweb.asm</pattern>
147-
<shadedPattern>${jersey.repackaged.prefix}.org.objectweb.asm</shadedPattern>
148-
</relocation>
149-
</relocations>
150-
</configuration>
151-
</plugin>
152133
<plugin>
153134
<groupId>org.apache.maven.plugins</groupId>
154135
<artifactId>maven-surefire-plugin</artifactId>
@@ -206,11 +187,6 @@
206187
<groupId>org.glassfish.hk2</groupId>
207188
<artifactId>hk2-locator</artifactId>
208189
</dependency>
209-
<dependency>
210-
<groupId>org.ow2.asm</groupId>
211-
<artifactId>asm-debug-all</artifactId>
212-
<optional>true</optional>
213-
</dependency>
214190

215191
<dependency>
216192
<groupId>javax.validation</groupId>
@@ -292,13 +268,6 @@
292268
</plugin>
293269
</plugins>
294270
</build>
295-
<dependencies>
296-
<dependency>
297-
<groupId>org.ow2.asm</groupId>
298-
<artifactId>asm-debug-all</artifactId>
299-
<optional>false</optional>
300-
</dependency>
301-
</dependencies>
302271
</profile>
303272
</profiles>
304273

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/***
2+
* ASM: a very small and fast Java bytecode manipulation framework
3+
* Copyright (c) 2000-2011 INRIA, France Telecom
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions
8+
* are met:
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. Neither the name of the copyright holders nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28+
* THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
package jersey.repackaged.org.objectweb.asm;
31+
32+
/**
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+
*
37+
* @author Eric Bruneton
38+
* @author Eugene Kuleshov
39+
*/
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+
}
82+
83+
/**
84+
* Visits a primitive value of the annotation.
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).
97+
*/
98+
public void visit(String name, Object value) {
99+
if (av != null) {
100+
av.visit(name, value);
101+
}
102+
}
103+
104+
/**
105+
* Visits an enumeration value of the annotation.
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.
113+
*/
114+
public void visitEnum(String name, String desc, String value) {
115+
if (av != null) {
116+
av.visitEnum(name, desc, value);
117+
}
118+
}
119+
120+
/**
121+
* Visits a nested annotation value of the annotation.
122+
*
123+
* @param name
124+
* the value name.
125+
* @param desc
126+
* the class descriptor of the nested annotation class.
127+
* @return a visitor to visit the actual nested annotation value, or
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
131+
* visitor</i>.
132+
*/
133+
public AnnotationVisitor visitAnnotation(String name, String desc) {
134+
if (av != null) {
135+
return av.visitAnnotation(name, desc);
136+
}
137+
return null;
138+
}
139+
140+
/**
141+
* Visits an array value of the annotation. Note that arrays of primitive
142+
* types (such as byte, boolean, short, char, int, long, float or double)
143+
* can be passed as value to {@link #visit visit}. This is what
144+
* {@link ClassReader} does.
145+
*
146+
* @param name
147+
* the value name.
148+
* @return a visitor to visit the actual array value elements, or
149+
* <tt>null</tt> if this visitor is not interested in visiting these
150+
* values. The 'name' parameters passed to the methods of this
151+
* visitor are ignored. <i>All the array values must be visited
152+
* before calling other methods on this annotation visitor</i>.
153+
*/
154+
public AnnotationVisitor visitArray(String name) {
155+
if (av != null) {
156+
return av.visitArray(name);
157+
}
158+
return null;
159+
}
160+
161+
/**
162+
* Visits the end of the annotation.
163+
*/
164+
public void visitEnd() {
165+
if (av != null) {
166+
av.visitEnd();
167+
}
168+
}
169+
}

0 commit comments

Comments
 (0)