Skip to content

Commit 86e8fc6

Browse files
committed
Merge pull request ocpsoft#230 from Tires/master
Extend ByteCodeFilter to Java 8 ocpsoft#229
2 parents 4dffdf3 + fd09691 commit 86e8fc6

2 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎annotations-impl/src/main/java/org/ocpsoft/rewrite/annotation/scan/ByteCodeFilter.java‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.io.InputStream;
2121
import java.lang.annotation.Annotation;
22-
import java.util.HashSet;
2322
import java.util.LinkedHashSet;
2423
import java.util.Set;
2524

@@ -66,6 +65,9 @@ public class ByteCodeFilter
6665
private final static int CONSTANT_Double = 6;
6766
private final static int CONSTANT_NameAndType = 12;
6867
private final static int CONSTANT_Utf8 = 1;
68+
private static final int CONSTANT_MethodHandle = 15;
69+
private static final int CONSTANT_MethodType = 16;
70+
private static final int CONSTANT_InvokeDynamic = 18;
6971

7072
/**
7173
* The strings to look for in the constants table
@@ -240,6 +242,40 @@ public boolean accept(InputStream classFileStream) throws IOException
240242
return true;
241243
}
242244
break;
245+
246+
case CONSTANT_MethodHandle:
247+
/*
248+
* CONSTANT_MethodHandle_info {
249+
* u1 tag;
250+
* u1 reference_kind;
251+
* u2 reference_index;
252+
* }
253+
*/
254+
in.readByte();
255+
in.readShort();
256+
break;
257+
258+
case CONSTANT_MethodType:
259+
/*
260+
* CONSTANT_MethodType_info {
261+
* u1 tag;
262+
* u2 descriptor_index;
263+
* }
264+
*/
265+
in.readShort();
266+
break;
267+
268+
case CONSTANT_InvokeDynamic:
269+
/*
270+
* CONSTANT_InvokeDynamic_info {
271+
* u1 tag;
272+
* u2 bootstrap_method_attr_index;
273+
* u2 name_and_type_index;
274+
* }
275+
*/
276+
in.readShort();
277+
in.readShort();
278+
break;
243279

244280
default:
245281
/*

‎annotations-impl/src/main/java/org/ocpsoft/rewrite/annotation/scan/WebClassesFinder.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ private void handleClassEntry(URL entryUrl, String entryName, ClassVisitor visit
174174
*/
175175
try
176176
{
177-
classFileStream = entryUrl.openStream();
177+
classFileStream = servletContext.getResourceAsStream(entryName);
178178
}
179-
catch (IOException e)
179+
catch (Exception e)
180180
{
181181
if (log.isDebugEnabled())
182182
{
183-
log.debug("Cound not obtain InputStream for class file: " + entryUrl.toString(), e);
183+
log.debug("Cound not obtain InputStream for class file: " + entryName, e);
184184
}
185185
}
186186

0 commit comments

Comments
 (0)