diff --git a/spring-core/src/main/java/org/springframework/asm/Item.java b/spring-core/src/main/java/org/springframework/asm/Item.java
index 6ee6faff8f..91dc701d09 100644
--- a/spring-core/src/main/java/org/springframework/asm/Item.java
+++ b/spring-core/src/main/java/org/springframework/asm/Item.java
@@ -208,9 +208,12 @@ final class Item {
this.strVal2 = strVal2;
this.strVal3 = strVal3;
switch (type) {
+ case ClassWriter.CLASS:
+ this.intVal = 0; // intVal of a class must be zero, see visitInnerClass
+ hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
+ return;
case ClassWriter.UTF8:
case ClassWriter.STR:
- case ClassWriter.CLASS:
case ClassWriter.MTYPE:
case ClassWriter.TYPE_NORMAL:
hashCode = 0x7FFFFFFF & (type + strVal1.hashCode());
diff --git a/spring-core/src/main/java/org/springframework/asm/Label.java b/spring-core/src/main/java/org/springframework/asm/Label.java
index b0e97cb34f..ec69979b83 100644
--- a/spring-core/src/main/java/org/springframework/asm/Label.java
+++ b/spring-core/src/main/java/org/springframework/asm/Label.java
@@ -473,7 +473,7 @@ public class Label {
void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
status |= VISITED;
- srcAndRefPositions = new int[(nbSubroutines - 1) / 32 + 1];
+ srcAndRefPositions = new int[nbSubroutines / 32 + 1];
}
srcAndRefPositions[(int) (id >>> 32)] |= (int) id;
}
diff --git a/spring-core/src/main/java/org/springframework/asm/MethodWriter.java b/spring-core/src/main/java/org/springframework/asm/MethodWriter.java
index 3a08227a18..0ba89282e2 100644
--- a/spring-core/src/main/java/org/springframework/asm/MethodWriter.java
+++ b/spring-core/src/main/java/org/springframework/asm/MethodWriter.java
@@ -1966,43 +1966,43 @@ class MethodWriter extends MethodVisitor {
stackMap.putByte(v);
}
} else {
- StringBuffer buf = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
d >>= 28;
while (d-- > 0) {
- buf.append('[');
+ sb.append('[');
}
if ((t & Frame.BASE_KIND) == Frame.OBJECT) {
- buf.append('L');
- buf.append(cw.typeTable[t & Frame.BASE_VALUE].strVal1);
- buf.append(';');
+ sb.append('L');
+ sb.append(cw.typeTable[t & Frame.BASE_VALUE].strVal1);
+ sb.append(';');
} else {
switch (t & 0xF) {
case 1:
- buf.append('I');
+ sb.append('I');
break;
case 2:
- buf.append('F');
+ sb.append('F');
break;
case 3:
- buf.append('D');
+ sb.append('D');
break;
case 9:
- buf.append('Z');
+ sb.append('Z');
break;
case 10:
- buf.append('B');
+ sb.append('B');
break;
case 11:
- buf.append('C');
+ sb.append('C');
break;
case 12:
- buf.append('S');
+ sb.append('S');
break;
default:
- buf.append('J');
+ sb.append('J');
}
}
- stackMap.putByte(7).putShort(cw.newClass(buf.toString()));
+ stackMap.putByte(7).putShort(cw.newClass(sb.toString()));
}
}
}
diff --git a/spring-core/src/main/java/org/springframework/asm/Type.java b/spring-core/src/main/java/org/springframework/asm/Type.java
index 1814655a62..40025be218 100644
--- a/spring-core/src/main/java/org/springframework/asm/Type.java
+++ b/spring-core/src/main/java/org/springframework/asm/Type.java
@@ -401,8 +401,8 @@ public class Type {
* @return the size of the arguments of the method (plus one for the
* implicit this argument), argSize, and the size of its return
* value, retSize, packed into a single int i =
- * (argSize << 2) | retSize (argSize is therefore equal to
- * i >> 2, and retSize to i & 0x03).
+ * (argSize << 2) | retSize (argSize is therefore equal to
+ * i >> 2, and retSize to i & 0x03).
*/
public static int getArgumentsAndReturnSizes(final String desc) {
int n = 1;
@@ -556,11 +556,11 @@ public class Type {
case DOUBLE:
return "double";
case ARRAY:
- StringBuffer b = new StringBuffer(getElementType().getClassName());
+ StringBuilder sb = new StringBuilder(getElementType().getClassName());
for (int i = getDimensions(); i > 0; --i) {
- b.append("[]");
+ sb.append("[]");
}
- return b.toString();
+ return sb.toString();
case OBJECT:
return new String(buf, off, len).replace('/', '.');
default:
@@ -606,9 +606,10 @@ public class Type {
*
* @return the size of the arguments (plus one for the implicit this
* argument), argSize, and the size of the return value, retSize,
- * packed into a single int i = (argSize << 2) | retSize
- * (argSize is therefore equal to i >> 2, and retSize to
- * i & 0x03).
+ * packed into a single
+ * int i = (argSize << 2) | retSize
+ * (argSize is therefore equal to i >> 2,
+ * and retSize to i & 0x03).
*/
public int getArgumentsAndReturnSizes() {
return getArgumentsAndReturnSizes(getDescriptor());
@@ -624,9 +625,9 @@ public class Type {
* @return the descriptor corresponding to this Java type.
*/
public String getDescriptor() {
- StringBuffer buf = new StringBuffer();
- getDescriptor(buf);
- return buf.toString();
+ StringBuilder sb = new StringBuilder();
+ getDescriptor(sb);
+ return sb.toString();
}
/**
@@ -642,24 +643,24 @@ public class Type {
*/
public static String getMethodDescriptor(final Type returnType,
final Type... argumentTypes) {
- StringBuffer buf = new StringBuffer();
- buf.append('(');
+ StringBuilder sb = new StringBuilder();
+ sb.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
- argumentTypes[i].getDescriptor(buf);
+ argumentTypes[i].getDescriptor(sb);
}
- buf.append(')');
- returnType.getDescriptor(buf);
- return buf.toString();
+ sb.append(')');
+ returnType.getDescriptor(sb);
+ return sb.toString();
}
/**
* Appends the descriptor corresponding to this Java type to the given
- * string buffer.
+ * string builder.
*
* @param buf
- * the string buffer to which the descriptor must be appended.
+ * the string builder to which the descriptor must be appended.
*/
- private void getDescriptor(final StringBuffer buf) {
+ private void getDescriptor(final StringBuilder buf) {
if (this.buf == null) {
// descriptor is in byte 3 of 'off' for primitive types (buf ==
// null)
@@ -699,9 +700,9 @@ public class Type {
* @return the descriptor corresponding to the given class.
*/
public static String getDescriptor(final Class> c) {
- StringBuffer buf = new StringBuffer();
- getDescriptor(buf, c);
- return buf.toString();
+ StringBuilder sb = new StringBuilder();
+ getDescriptor(sb, c);
+ return sb.toString();
}
/**
@@ -713,12 +714,12 @@ public class Type {
*/
public static String getConstructorDescriptor(final Constructor> c) {
Class>[] parameters = c.getParameterTypes();
- StringBuffer buf = new StringBuffer();
- buf.append('(');
+ StringBuilder sb = new StringBuilder();
+ sb.append('(');
for (int i = 0; i < parameters.length; ++i) {
- getDescriptor(buf, parameters[i]);
+ getDescriptor(sb, parameters[i]);
}
- return buf.append(")V").toString();
+ return sb.append(")V").toString();
}
/**
@@ -730,25 +731,25 @@ public class Type {
*/
public static String getMethodDescriptor(final Method m) {
Class>[] parameters = m.getParameterTypes();
- StringBuffer buf = new StringBuffer();
- buf.append('(');
+ StringBuilder sb = new StringBuilder();
+ sb.append('(');
for (int i = 0; i < parameters.length; ++i) {
- getDescriptor(buf, parameters[i]);
+ getDescriptor(sb, parameters[i]);
}
- buf.append(')');
- getDescriptor(buf, m.getReturnType());
- return buf.toString();
+ sb.append(')');
+ getDescriptor(sb, m.getReturnType());
+ return sb.toString();
}
/**
- * Appends the descriptor of the given class to the given string buffer.
+ * Appends the descriptor of the given class to the given string builder.
*
- * @param buf
+ * @param sb
* the string buffer to which the descriptor must be appended.
* @param c
* the class whose descriptor must be computed.
*/
- private static void getDescriptor(final StringBuffer buf, final Class> c) {
+ private static void getDescriptor(final StringBuilder sb, final Class> c) {
Class> d = c;
while (true) {
if (d.isPrimitive()) {
@@ -772,20 +773,20 @@ public class Type {
} else /* if (d == Long.TYPE) */{
car = 'J';
}
- buf.append(car);
+ sb.append(car);
return;
} else if (d.isArray()) {
- buf.append('[');
+ sb.append('[');
d = d.getComponentType();
} else {
- buf.append('L');
+ sb.append('L');
String name = d.getName();
int len = name.length();
for (int i = 0; i < len; ++i) {
char car = name.charAt(i);
- buf.append(car == '.' ? '/' : car);
+ sb.append(car == '.' ? '/' : car);
}
- buf.append(';');
+ sb.append(';');
return;
}
}