-
1. Re: rel 3.1 - Problem with CtBehavior#getParameterAnnotation
adrian.brock May 16, 2006 11:22 AM (in response to yanic)No, that is not intentional,
"
Method::getParameterAnnotations
public Annotation[][] getParameterAnnotations()
Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of the method represented by this Method object. (Returns an array of length zero if the underlying method is parameterless. If the method has one or more parameters, a nested array of length zero is returned for each parameter with no annotations.) The annotation objects contained in the returned arrays are serializable. The caller of this method is free to modify the returned arrays; it will have no effect on the arrays returned to other callers.
"
The cause is in AttributeInfo where if there are no
parameter annotations at all for the behaviour, it doesn't set up
any array of annotations (the ParameterAnnotationsAttribute is null).
Later CtClassType interprets this as an empty array of annotations.static Object[][] toAnnotationType(ClassPool cp, ParameterAnnotationsAttribute a1, ParameterAnnotationsAttribute a2) throws ClassNotFoundException { int numParameters = 0; if (a1 != null) numParameters = a1.numParameters(); else if (a2 != null) numParameters = a2.numParameters(); else return new Object[0][]; // HERE
Bug report: http://jira.jboss.com/jira/browse/JASSIST-19 -
2. Re: rel 3.1 - Problem with CtBehavior#getParameterAnnotation
chiba May 29, 2006 6:35 AM (in response to yanic)I have fixed this problem.