summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-07-18 15:33:14 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-07-18 15:33:14 +0000
commitf19b6003aee1f59e68fc685093721ca524f35e77 (patch)
tree49fec6447b88c9deb4902f11e1d8e200d38564a4 /src/main
parent722509666b5e7a9ceef5c3513fa3d70ed0a3ac74 (diff)
downloadjavassist-f19b6003aee1f59e68fc685093721ca524f35e77.tar.gz
javassist-f19b6003aee1f59e68fc685093721ca524f35e77.zip
reformatted.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@301 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main')
-rw-r--r--src/main/javassist/CtBehavior.java38
-rw-r--r--src/main/javassist/CtClass.java11
-rw-r--r--src/main/javassist/CtClassType.java49
-rw-r--r--src/main/javassist/CtField.java21
-rw-r--r--src/main/javassist/CtMember.java15
-rw-r--r--src/main/javassist/bytecode/annotation/AnnotationImpl.java6
6 files changed, 78 insertions, 62 deletions
diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java
index 54ecddd4..9be97eba 100644
--- a/src/main/javassist/CtBehavior.java
+++ b/src/main/javassist/CtBehavior.java
@@ -139,7 +139,7 @@ public abstract class CtBehavior extends CtMember {
* Returns the annotations associated with this method or constructor.
*
* @return an array of annotation-type objects.
- * @see CtMember#getAnnotations()
+ * @see #getAvailableAnnotations()
* @since 3.1
*/
public Object[] getAnnotations() throws ClassNotFoundException {
@@ -148,27 +148,32 @@ public abstract class CtBehavior extends CtMember {
/**
* Returns the annotations associated with this method or constructor.
- * If any annotations are not on the classpath, they are not returned
+ * If any annotations are not on the classpath, they are not included
+ * in the returned array.
*
* @return an array of annotation-type objects.
- * @see CtMember#getAnnotations()
+ * @see #getAnnotations()
* @since 3.3
*/
public Object[] getAvailableAnnotations(){
try{
return getAnnotations(true);
- }catch (ClassNotFoundException e){
+ }
+ catch (ClassNotFoundException e){
throw new RuntimeException("Unexpected exception", e);
}
}
- private Object[] getAnnotations(boolean ignoreNotFound) throws ClassNotFoundException {
+ private Object[] getAnnotations(boolean ignoreNotFound)
+ throws ClassNotFoundException
+ {
MethodInfo mi = getMethodInfo2();
AnnotationsAttribute ainfo = (AnnotationsAttribute)
mi.getAttribute(AnnotationsAttribute.invisibleTag);
AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
mi.getAttribute(AnnotationsAttribute.visibleTag);
- return CtClassType.toAnnotationType(ignoreNotFound, getDeclaringClass().getClassPool(),
+ return CtClassType.toAnnotationType(ignoreNotFound,
+ getDeclaringClass().getClassPool(),
ainfo, ainfo2);
}
@@ -179,7 +184,8 @@ public abstract class CtBehavior extends CtMember {
* equal to the number of the formal parameters. If each parameter has no
* annotation, the elements of the returned array are empty arrays.
*
- * @see CtMember#getAnnotations()
+ * @see #getAvailableParameterAnnotations()
+ * @see #getAnnotations()
* @since 3.1
*/
public Object[][] getParameterAnnotations() throws ClassNotFoundException {
@@ -188,33 +194,39 @@ public abstract class CtBehavior extends CtMember {
/**
* Returns the parameter annotations associated with this method or constructor.
- * If any annotations are not on the classpath, they are not returned
+ * If any annotations are not on the classpath, they are not included in the
+ * returned array.
*
* @return an array of annotation-type objects. The length of the returned array is
* equal to the number of the formal parameters. If each parameter has no
* annotation, the elements of the returned array are empty arrays.
*
- * @see CtMember#getAnnotations()
+ * @see #getParameterAnnotations()
+ * @see #getAvailableAnnotations()
* @since 3.3
*/
public Object[][] getAvailableParameterAnnotations(){
try {
return getParameterAnnotations(true);
- }catch(ClassNotFoundException e) {
+ }
+ catch(ClassNotFoundException e) {
throw new RuntimeException("Unexpected exception", e);
}
}
- Object[][] getParameterAnnotations(boolean ignoreNotFound) throws ClassNotFoundException {
+ Object[][] getParameterAnnotations(boolean ignoreNotFound)
+ throws ClassNotFoundException
+ {
MethodInfo mi = getMethodInfo2();
ParameterAnnotationsAttribute ainfo = (ParameterAnnotationsAttribute)
mi.getAttribute(ParameterAnnotationsAttribute.invisibleTag);
ParameterAnnotationsAttribute ainfo2 = (ParameterAnnotationsAttribute)
mi.getAttribute(ParameterAnnotationsAttribute.visibleTag);
- return CtClassType.toAnnotationType(ignoreNotFound, getDeclaringClass().getClassPool(),
+ return CtClassType.toAnnotationType(ignoreNotFound,
+ getDeclaringClass().getClassPool(),
ainfo, ainfo2, mi);
}
-
+
/**
* Obtains parameter types of this method/constructor.
*/
diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java
index a8261b37..3fb8860b 100644
--- a/src/main/javassist/CtClass.java
+++ b/src/main/javassist/CtClass.java
@@ -474,6 +474,7 @@ public abstract class CtClass {
* the <code>Author</code> object.
*
* @return an array of annotation-type objects.
+ * @see CtMember#getAnnotations()
* @since 3.1
*/
public Object[] getAnnotations() throws ClassNotFoundException {
@@ -482,13 +483,13 @@ public abstract class CtClass {
/**
* Returns the annotations associated with this class.
- * For example, if an annotation <code>@Author</code> is associated
- * with this class, the returned array contains an <code>Author</code>
- * object. The member values can be obtained by calling methods on
- * the <code>Author</code> object. If any annotations are not on the
- * classpath, they are not returned
+ * This method is equivalent to <code>getAnnotations()</code>
+ * except that, if any annotations are not on the classpath,
+ * they are not included in the returned array.
*
* @return an array of annotation-type objects.
+ * @see #getAnnotations()
+ * @see CtMember#getAvailableAnnotations()
* @since 3.3
*/
public Object[] getAvailableAnnotations(){
diff --git a/src/main/javassist/CtClassType.java b/src/main/javassist/CtClassType.java
index bc059026..ab0d07ed 100644
--- a/src/main/javassist/CtClassType.java
+++ b/src/main/javassist/CtClassType.java
@@ -417,27 +417,29 @@ class CtClassType extends CtClass {
}
public Object[] getAvailableAnnotations(){
- try
- {
+ try {
return getAnnotations(true);
}
- catch (ClassNotFoundException e)
- {
+ catch (ClassNotFoundException e) {
throw new RuntimeException("Unexpected exception ", e);
}
}
- private Object[] getAnnotations(boolean ignoreNotFound) throws ClassNotFoundException {
- ClassFile cf = getClassFile2();
- AnnotationsAttribute ainfo = (AnnotationsAttribute)
- cf.getAttribute(AnnotationsAttribute.invisibleTag);
- AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
- cf.getAttribute(AnnotationsAttribute.visibleTag);
- return toAnnotationType(ignoreNotFound, getClassPool(), ainfo, ainfo2);
+ private Object[] getAnnotations(boolean ignoreNotFound)
+ throws ClassNotFoundException
+ {
+ ClassFile cf = getClassFile2();
+ AnnotationsAttribute ainfo = (AnnotationsAttribute)
+ cf.getAttribute(AnnotationsAttribute.invisibleTag);
+ AnnotationsAttribute ainfo2 = (AnnotationsAttribute)
+ cf.getAttribute(AnnotationsAttribute.visibleTag);
+ return toAnnotationType(ignoreNotFound, getClassPool(), ainfo, ainfo2);
}
- static Object[] toAnnotationType(boolean ignoreNotFound, ClassPool cp, AnnotationsAttribute a1,
- AnnotationsAttribute a2) throws ClassNotFoundException {
+ static Object[] toAnnotationType(boolean ignoreNotFound, ClassPool cp,
+ AnnotationsAttribute a1, AnnotationsAttribute a2)
+ throws ClassNotFoundException
+ {
Annotation[] anno1, anno2;
int size1, size2;
@@ -474,23 +476,24 @@ class CtClassType extends CtClass {
for (int i = 0 ; i < size1 ; i++){
try{
annotations.add(toAnnoType(anno1[i], cp));
- }catch(ClassNotFoundException e){
}
+ catch(ClassNotFoundException e){}
}
- for (int j = 0; j < size2; j++)
- {
+ for (int j = 0; j < size2; j++) {
try{
annotations.add(toAnnoType(anno2[j], cp));
- }catch(ClassNotFoundException e){
}
+ catch(ClassNotFoundException e){}
}
-
+
return annotations.toArray();
}
}
- static Object[][] toAnnotationType(boolean ignoreNotFound, ClassPool cp, ParameterAnnotationsAttribute a1,
- ParameterAnnotationsAttribute a2, MethodInfo minfo)
+ static Object[][] toAnnotationType(boolean ignoreNotFound, ClassPool cp,
+ ParameterAnnotationsAttribute a1,
+ ParameterAnnotationsAttribute a2,
+ MethodInfo minfo)
throws ClassNotFoundException
{
int numParameters = 0;
@@ -537,16 +540,16 @@ class CtClassType extends CtClass {
for (int j = 0 ; j < size1 ; j++){
try{
annotations.add(toAnnoType(anno1[j], cp));
- }catch(ClassNotFoundException e){
}
+ catch(ClassNotFoundException e){}
}
for (int j = 0; j < size2; j++){
try{
annotations.add(toAnnoType(anno2[j], cp));
- }catch(ClassNotFoundException e){
}
+ catch(ClassNotFoundException e){}
}
-
+
result[i] = annotations.toArray();
}
}
diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java
index ea535290..30ea34e8 100644
--- a/src/main/javassist/CtField.java
+++ b/src/main/javassist/CtField.java
@@ -237,7 +237,7 @@ public class CtField extends CtMember {
* Returns the annotations associated with this field.
*
* @return an array of annotation-type objects.
- * @see CtMember#getAnnotations()
+ * @see #getAvailableAnnotations()
* @since 3.1
*/
public Object[] getAnnotations() throws ClassNotFoundException {
@@ -246,23 +246,22 @@ public class CtField extends CtMember {
/**
* Returns the annotations associated with this field.
- * If any annotations are not on the classpath, they are not returned
+ * If any annotations are not on the classpath, they are not included
+ * in the returned array.
*
* @return an array of annotation-type objects.
- * @see CtMember#getAnnotations()
+ * @see #getAnnotations()
* @since 3.3
*/
public Object[] getAvailableAnnotations(){
- try
- {
- return getAnnotations(true);
- }
- catch (ClassNotFoundException e)
- {
+ try {
+ return getAnnotations(true);
+ }
+ catch (ClassNotFoundException e) {
throw new RuntimeException("Unexpected exception", e);
- }
+ }
}
-
+
private Object[] getAnnotations(boolean ignoreNotFound) throws ClassNotFoundException {
FieldInfo fi = getFieldInfo2();
AnnotationsAttribute ainfo = (AnnotationsAttribute)
diff --git a/src/main/javassist/CtMember.java b/src/main/javassist/CtMember.java
index 341521b8..cb944e62 100644
--- a/src/main/javassist/CtMember.java
+++ b/src/main/javassist/CtMember.java
@@ -158,16 +158,17 @@ public abstract class CtMember {
/**
* Returns the annotations associated with this member.
- * For example, if an annotation <code>@Author</code> is associated
- * with this member, the returned array contains an <code>Author</code>
- * object. The member values can be obtained by calling methods on
- * the <code>Author</code> object.
- * If any annotations are not on the classpath, they are not returned
+ * This method is equivalent to <code>getAnnotations()</code>
+ * except that, if any annotations are not on the classpath,
+ * they are not included in the returned array.
*
* @return an array of annotation-type objects.
- * @see CtClass#getAnnotations()
+ * @see #getAnnotations()
+ * @see CtClass#getAvailableAnnotations()
+ * @since 3.3
*/
- public abstract Object[] getAvailableAnnotations() throws ClassNotFoundException;
+ public abstract Object[] getAvailableAnnotations()
+ throws ClassNotFoundException;
/**
diff --git a/src/main/javassist/bytecode/annotation/AnnotationImpl.java b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
index 9d8e49bc..005ab93e 100644
--- a/src/main/javassist/bytecode/annotation/AnnotationImpl.java
+++ b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
@@ -63,9 +63,9 @@ public class AnnotationImpl implements InvocationHandler {
/**
* Executes a method invocation on a proxy instance.
- * The implementations of <code>toString</code>, <code>equals</code>,
- * and <code>hashCode</code> are directly supplied by the
- * <code>AnnotationImpl</code>. The <code>annotationType</code> method
+ * The implementations of <code>toString()</code>, <code>equals()</code>,
+ * and <code>hashCode()</code> are directly supplied by the
+ * <code>AnnotationImpl</code>. The <code>annotationType()</code> method
* is also available on the proxy instance.
*/
public Object invoke(Object proxy, Method method, Object[] args)