Upgraded to ASM 4.2

This commit is contained in:
Juergen Hoeller 2013-10-25 13:29:20 +02:00
parent b8809daf5f
commit 833d76ba5e
3 changed files with 34 additions and 12 deletions

View File

@ -204,11 +204,14 @@ public class ByteVector {
* automatically enlarged if necessary.
*
* @param s
* a String.
* a String whose UTF8 encoded length must be less than 65536.
* @return this byte vector.
*/
public ByteVector putUTF8(final String s) {
int charLength = s.length();
if (charLength > 65535) {
throw new IllegalArgumentException();
}
int len = length;
if (len + 2 + charLength > data.length) {
enlarge(2 + charLength);
@ -238,6 +241,9 @@ public class ByteVector {
byteLength += 2;
}
}
if (byteLength > 65535) {
throw new IllegalArgumentException();
}
data[length] = (byte) (byteLength >>> 8);
data[length + 1] = (byte) byteLength;
if (length + 2 + byteLength > data.length) {

View File

@ -477,12 +477,12 @@ public class ClassWriter extends ClassVisitor {
* <tt>true</tt> if the maximum stack size and number of local variables
* must be automatically computed.
*/
private final boolean computeMaxs;
private boolean computeMaxs;
/**
* <tt>true</tt> if the stack map frames must be recomputed from scratch.
*/
private final boolean computeFrames;
private boolean computeFrames;
/**
* <tt>true</tt> if the stack map tables of this class are invalid. The
@ -908,9 +908,22 @@ public class ClassWriter extends ClassVisitor {
attrs.put(this, null, 0, -1, -1, out);
}
if (invalidFrames) {
ClassWriter cw = new ClassWriter(COMPUTE_FRAMES);
new ClassReader(out.data).accept(cw, ClassReader.SKIP_FRAMES);
return cw.toByteArray();
anns = null;
ianns = null;
attrs = null;
innerClassesCount = 0;
innerClasses = null;
bootstrapMethodsCount = 0;
bootstrapMethods = null;
firstField = null;
lastField = null;
firstMethod = null;
lastMethod = null;
computeMaxs = false;
computeFrames = true;
invalidFrames = false;
new ClassReader(out.data).accept(this, ClassReader.SKIP_FRAMES);
return toByteArray();
}
return out.data;
}

View File

@ -49,7 +49,8 @@ public final class Handle {
final int tag;
/**
* The internal name of the field or method designed by this handle.
* The internal name of the class that owns the field or method designated
* by this handle.
*/
final String owner;
@ -76,8 +77,8 @@ public final class Handle {
* {@link Opcodes#H_NEWINVOKESPECIAL} or
* {@link Opcodes#H_INVOKEINTERFACE}.
* @param owner
* the internal name of the field or method designed by this
* handle.
* the internal name of the class that owns the field or method
* designated by this handle.
* @param name
* the name of the field or method designated by this handle.
* @param desc
@ -106,9 +107,11 @@ public final class Handle {
}
/**
* Returns the internal name of the field or method designed by this handle.
* Returns the internal name of the class that owns the field or method
* designated by this handle.
*
* @return the internal name of the field or method designed by this handle.
* @return the internal name of the class that owns the field or method
* designated by this handle.
*/
public String getOwner() {
return owner;
@ -154,7 +157,7 @@ public final class Handle {
* Returns the textual representation of this handle. The textual
* representation is:
*
* <pre class="code">
* <pre>
* owner '.' name desc ' ' '(' tag ')'
* </pre>
*