diff options
Diffstat (limited to 'src/main/javassist/CtBehavior.java')
-rw-r--r-- | src/main/javassist/CtBehavior.java | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index 75af53b8..1b9dbf0b 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -16,9 +16,27 @@ package javassist; -import javassist.bytecode.*; -import javassist.compiler.Javac; +import javassist.bytecode.AccessFlag; +import javassist.bytecode.AnnotationsAttribute; +import javassist.bytecode.AttributeInfo; +import javassist.bytecode.BadBytecode; +import javassist.bytecode.Bytecode; +import javassist.bytecode.CodeAttribute; +import javassist.bytecode.CodeIterator; +import javassist.bytecode.ConstPool; +import javassist.bytecode.Descriptor; +import javassist.bytecode.ExceptionsAttribute; +import javassist.bytecode.LineNumberAttribute; +import javassist.bytecode.LocalVariableAttribute; +import javassist.bytecode.LocalVariableTypeAttribute; +import javassist.bytecode.MethodInfo; +import javassist.bytecode.Opcode; +import javassist.bytecode.ParameterAnnotationsAttribute; +import javassist.bytecode.SignatureAttribute; +import javassist.bytecode.StackMap; +import javassist.bytecode.StackMapTable; import javassist.compiler.CompileError; +import javassist.compiler.Javac; import javassist.expr.ExprEditor; /** @@ -81,6 +99,7 @@ public abstract class CtBehavior extends CtMember { } } + @Override protected void extendToString(StringBuffer buffer) { buffer.append(' '); buffer.append(getName()); @@ -140,6 +159,7 @@ public abstract class CtBehavior extends CtMember { * <code>javassist.Modifier</code>. * @see Modifier */ + @Override public int getModifiers() { return AccessFlag.toModifier(methodInfo.getAccessFlags()); } @@ -153,6 +173,7 @@ public abstract class CtBehavior extends CtMember { * * @see Modifier */ + @Override public void setModifiers(int mod) { declaringClass.checkModify(); methodInfo.setAccessFlags(AccessFlag.of(mod)); @@ -166,6 +187,7 @@ public abstract class CtBehavior extends CtMember { * otherwise <code>false</code>. * @since 3.21 */ + @Override public boolean hasAnnotation(String typeName) { MethodInfo mi = getMethodInfo2(); AnnotationsAttribute ainfo = (AnnotationsAttribute) @@ -188,7 +210,8 @@ public abstract class CtBehavior extends CtMember { * @return the annotation if found, otherwise <code>null</code>. * @since 3.11 */ - public Object getAnnotation(Class clz) throws ClassNotFoundException { + @Override + public Object getAnnotation(Class<?> clz) throws ClassNotFoundException { MethodInfo mi = getMethodInfo2(); AnnotationsAttribute ainfo = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag); @@ -206,6 +229,7 @@ public abstract class CtBehavior extends CtMember { * @see #getAvailableAnnotations() * @since 3.1 */ + @Override public Object[] getAnnotations() throws ClassNotFoundException { return getAnnotations(false); } @@ -219,6 +243,7 @@ public abstract class CtBehavior extends CtMember { * @see #getAnnotations() * @since 3.3 */ + @Override public Object[] getAvailableAnnotations(){ try{ return getAnnotations(true); @@ -324,6 +349,7 @@ public abstract class CtBehavior extends CtMember { * @see javassist.bytecode.Descriptor * @see #getGenericSignature() */ + @Override public String getSignature() { return methodInfo.getDescriptor(); } @@ -335,6 +361,7 @@ public abstract class CtBehavior extends CtMember { * @see SignatureAttribute#toMethodSignature(String) * @since 3.17 */ + @Override public String getGenericSignature() { SignatureAttribute sa = (SignatureAttribute)methodInfo.getAttribute(SignatureAttribute.tag); @@ -351,6 +378,7 @@ public abstract class CtBehavior extends CtMember { * @see javassist.bytecode.SignatureAttribute.MethodSignature#encode() * @since 3.17 */ + @Override public void setGenericSignature(String sig) { declaringClass.checkModify(); methodInfo.addAttribute(new SignatureAttribute(methodInfo.getConstPool(), sig)); @@ -489,12 +517,13 @@ public abstract class CtBehavior extends CtMember { * * @param name attribute name */ - public byte[] getAttribute(String name) { + @Override + public byte[] getAttribute(String name) + { AttributeInfo ai = methodInfo.getAttribute(name); if (ai == null) return null; - else - return ai.get(); + return ai.get(); } /** @@ -507,7 +536,9 @@ public abstract class CtBehavior extends CtMember { * @param name attribute name * @param data attribute value */ - public void setAttribute(String name, byte[] data) { + @Override + public void setAttribute(String name, byte[] data) + { declaringClass.checkModify(); methodInfo.addAttribute(new AttributeInfo(methodInfo.getConstPool(), name, data)); @@ -530,7 +561,8 @@ public abstract class CtBehavior extends CtMember { * * @see javassist.runtime.Cflow */ - public void useCflow(String name) throws CannotCompileException { + public void useCflow(String name) throws CannotCompileException + { CtClass cc = declaringClass; cc.checkModify(); ClassPool pool = cc.getClassPool(); |