diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-11-12 13:30:33 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2005-11-12 13:30:33 +0000 |
commit | 7ea6c585a1171bbae39575e2babb4525da3c162f (patch) | |
tree | 3031977ceec9d0c4b37b4239fcd6c54d6c6cadfa | |
parent | 724b9b93c33f7f9c0fb6628261f43fe960014c17 (diff) | |
download | javassist-7ea6c585a1171bbae39575e2babb4525da3c162f.tar.gz javassist-7ea6c585a1171bbae39575e2babb4525da3c162f.zip |
updated javadoc comments.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@222 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r-- | src/main/javassist/bytecode/AnnotationsAttribute.java | 4 | ||||
-rw-r--r-- | src/main/javassist/bytecode/ClassFile.java | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/main/javassist/bytecode/AnnotationsAttribute.java b/src/main/javassist/bytecode/AnnotationsAttribute.java index d3cb9494..9092a0f9 100644 --- a/src/main/javassist/bytecode/AnnotationsAttribute.java +++ b/src/main/javassist/bytecode/AnnotationsAttribute.java @@ -90,8 +90,12 @@ import javassist.bytecode.annotation.*; * a.addMemberValue("name", new StringMemberValue("Chiba", cp)); * attr.setAnnotation(a); * cf.addAttribute(attr); + * cf.setVersionToJava5(); * </pre></ul> * + * <p>The last statement is necessary if the class file was produced by + * Javassist or JDK 1.4. Otherwise, it is not necessary. + * * @see AnnotationDefaultAttribute * @see javassist.bytecode.annotation.Annotation */ diff --git a/src/main/javassist/bytecode/ClassFile.java b/src/main/javassist/bytecode/ClassFile.java index bab40b70..8f2fc66b 100644 --- a/src/main/javassist/bytecode/ClassFile.java +++ b/src/main/javassist/bytecode/ClassFile.java @@ -675,7 +675,7 @@ public final class ClassFile { } /** - * Set the Major version. + * Set the major version. * * @param major * the major version @@ -685,7 +685,7 @@ public final class ClassFile { } /** - * Get the Minor version. + * Get the minor version. * * @return the minor version */ @@ -694,7 +694,7 @@ public final class ClassFile { } /** - * Set the Minor version. + * Set the minor version. * * @param minor * the minor version @@ -702,4 +702,16 @@ public final class ClassFile { public void setMinorVersion(int minor) { this.minor = minor; } + + /** + * Sets the major and minor version to Java 5. + * + * If the major version is older than 49, Java 5 + * extensions such as annotations are ignored + * by the JVM. + */ + public void setVersionToJava5() { + this.major = 49; + this.minor = 0; + } } |