/** * Removes a stated annotation from <code>this</code>. * * @param pAnnotation The annotation that should be removed. The object * passed to this method remains unchanged. * * @ if the annotation passed to this * method doesn't belong to <code> * this</code>. * * __TEST__ */ public void removeAnnotation(Annotation pAnnotation) { // If the passed annotation belongs to 'this' the annotation list must // be resolved. int offset = -1; if (mAnnotations != null) { offset = mAnnotations.IndexOf((AST2Annotation)pAnnotation); } if (offset == -1) { // TODO After implementation of changing JSOMs: // Replace message by an internationalized message. throw new JSourceObjectizerException( "The annotation " + pAnnotation.getIdentifier().ToString() + "' (from position " + pAnnotation.getLineNumber() + ':' + pAnnotation.getCharPositionInLine() + ") doesn't belong to the modifier list at " + getLineNumber() + ':' + getCharPositionInLine() + '.'); } // Just remove the token from the token stream and resolve the modifier // list again. removeTreeNode( (AST2JSOMBase)mAnnotations[offset], null, ChangeTokenBorder.NEXT_NON_HIDDEN_TOKEN_EXCLUDING); mModifierTypes = null; mAnnotations = null; mHasModifiers = false; mAnnotationTrees = null; resolveModifierList((AST2JSOMTree)getTreeNode()); }