aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/CtClass.java2
-rw-r--r--src/main/javassist/bytecode/AnnotationsAttribute.java12
-rw-r--r--src/main/javassist/bytecode/LocalVariableAttribute.java23
3 files changed, 26 insertions, 11 deletions
diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java
index 16fab666..2acd5776 100644
--- a/src/main/javassist/CtClass.java
+++ b/src/main/javassist/CtClass.java
@@ -44,7 +44,7 @@ public abstract class CtClass {
/**
* The version number of this release.
*/
- public static final String version = "3.0";
+ public static final String version = "3.1";
/**
* Prints the version number and the copyright notice.
diff --git a/src/main/javassist/bytecode/AnnotationsAttribute.java b/src/main/javassist/bytecode/AnnotationsAttribute.java
index 42ac8a59..34c82c4c 100644
--- a/src/main/javassist/bytecode/AnnotationsAttribute.java
+++ b/src/main/javassist/bytecode/AnnotationsAttribute.java
@@ -27,13 +27,13 @@ import javassist.bytecode.annotation.*;
* <code>RuntimeInvisibleAnnotations_attribute</code>.
*
* <p>To obtain an AnnotationAttribute object, invoke
- * <code>getAttribute(AnnotationsAttribute.invisibleTag)</code>
+ * <code>getAttribute(AnnotationsAttribute.visibleTag)</code>
* in <code>ClassFile</code>, <code>MethodInfo</code>,
* or <code>FieldInfo</code>. The obtained attribute is a
- * runtime invisible annotations attribute.
+ * runtime visible annotations attribute.
* If the parameter is
- * <code>AnnotationAttribute.visibleTag</code>, then the obtained
- * attribute is a runtime visible one.
+ * <code>AnnotationAttribute.invisibleTag</code>, then the obtained
+ * attribute is a runtime invisible one.
*
* <p>For example,
*
@@ -41,7 +41,7 @@ import javassist.bytecode.annotation.*;
* CtMethod m = ... ;
* MethodInfo minfo = m.getMethodInfo();
* AnnotationsAttribute attr = (AnnotationsAttribute)
- * minfo.getAttribute(AnnotationsAttribute.invisibleTag);
+ * minfo.getAttribute(AnnotationsAttribute.visibleTag);
* Annotation an = attr.getAnnotation("Author");
* String s = ((StringMemberValue)a.getMemberValue("name")).getValue();
* System.out.println("@Author(name=" + s + ")");
@@ -58,7 +58,7 @@ import javassist.bytecode.annotation.*;
* ClassFile cf = ... ;
* ConstPool cp = cf.getConstPool();
* AnnotationsAttribute attr
- * = new AnnotationsAttribute(cp, AnnotationsAttribute.invisibleTag);
+ * = new AnnotationsAttribute(cp, AnnotationsAttribute.visibleTag);
* Annotation a = new Annotation("Author", cp);
* a.addMemberValue("name", new StringMemberValue("Chiba", cp));
* attr.setAnnotation(a);
diff --git a/src/main/javassist/bytecode/LocalVariableAttribute.java b/src/main/javassist/bytecode/LocalVariableAttribute.java
index 6ccdd321..686fd8d1 100644
--- a/src/main/javassist/bytecode/LocalVariableAttribute.java
+++ b/src/main/javassist/bytecode/LocalVariableAttribute.java
@@ -38,7 +38,21 @@ public class LocalVariableAttribute extends AttributeInfo {
* Constructs an empty LocalVariableTable.
*/
public LocalVariableAttribute(ConstPool cp) {
- super(cp, tag, new byte[2]);
+ this(cp, tag);
+ }
+
+ /**
+ * Constructs an empty LocalVariableTable.
+ *
+ * @param name the attribute name.
+ * <code>LocalVariableAttribute.tag</code> or
+ * <code>LocalVariableAttribute.typeTag</code>.
+ * @see #tag
+ * @see #typeTag
+ * @since 3.1
+ */
+ public LocalVariableAttribute(ConstPool cp, String name) {
+ super(cp, name, new byte[2]);
ByteArray.write16bit(0, info, 0);
}
@@ -48,8 +62,8 @@ public class LocalVariableAttribute extends AttributeInfo {
super(cp, n, in);
}
- private LocalVariableAttribute(ConstPool cp, byte[] i) {
- super(cp, tag, i);
+ private LocalVariableAttribute(ConstPool cp, String name, byte[] i) {
+ super(cp, name, i);
}
/**
@@ -222,7 +236,8 @@ public class LocalVariableAttribute extends AttributeInfo {
byte[] src = get();
byte[] dest = new byte[src.length];
ConstPool cp = getConstPool();
- LocalVariableAttribute attr = new LocalVariableAttribute(newCp, dest);
+ LocalVariableAttribute attr
+ = new LocalVariableAttribute(newCp, getName(), dest);
int n = ByteArray.readU16bit(src, 0);
ByteArray.write16bit(n, dest, 0);
int j = 2;