Community
Participate
Working Groups
When deleting a MemberValuePair ASTNode, which has a NormalAnnotation as its value Expression, part of the annotation gets left behind in the source. When stepping through this in the debugger, it looks like the MemberValuePair's getLength() method is not returning the correct length; it is ignoring anything after and including the first open paren of the NormalAnnotation. I am removing the MemberValuePair by navigating to it through the AST, and then calling the delete() method. For example I created the following code (through AST calls): @Jpf.Action( validatableProperties={@Jpf.ValidatableProperty(propertyName="fooField", localeRules={@Jpf.ValidationLocaleRules( validateMinLength=@Jpf.ValidateMinLength(chars="12") )} )} ) public Forward actionForValidationRuleTest() { return null; } The problem occurs when trying to delete the MemberValuePair: validateMinLength=@Jpf.ValidateMinLength(chars="12") it leaves behind the "(chars="12")", so the resulting code is: @Jpf.Action( validatableProperties={@Jpf.ValidatableProperty(propertyName="fooField", localeRules={@Jpf.ValidationLocaleRules( (chars="12") )} )} ) public Forward actionForValidationRuleTest() { return null; } Tracing through in th debugger, it looks like the MemberValuePair is returning an incorrect length when the value is a NormalAnnotation. Even though it's toString value is: validateMinLength=@Jpf.ValidateMinLength(chars="12") which is 52 chars long, it is returning 40 chars as its length, which corresponds to the part that actually got removed: validateMinLength=@Jpf.ValidateMinLength I also tried this with a NormalAnnotation with no children, and the same thing happened, it left behind an empty "()". I can try to put together a simple set of sample code to reproduce this if it will help; I don't currently have a small isolated repro case that I can upload. (these annotations are defined in the apache beehive project's pageflow annotations, but the definitions aren't necessary to repro this)
The bug seems to be in the ASTConverter. I am investigating.
I fixed the positions bug. Fixed and released in HEAD. Regression test added in ASTConverter15Test.test0149
Verified in 20050330-0500