public List < CommentInfo > integrate ( List < CommentInfo > comments , JCCompilationUnit unit ) { List < CommentInfo > out = new ArrayList < CommentInfo > ( ) ; CommentInfo lastExcisedComment = null ; JCTree lastNode = null ; for ( CommentInfo cmt : comments ) { if ( ! cmt . isJavadoc ( ) ) { out . add ( cmt ) ; continue ; } JCTree node = findJavadocableNodeOnOrAfter ( unit , cmt . endPos ) ; if ( node == null ) { out . add ( cmt ) ; continue ; } if ( node == lastNode ) { out . add ( lastExcisedComment ) ; } if ( ! attach ( unit , node , cmt ) ) { out . add ( cmt ) ; } else { lastNode = node ; lastExcisedComment = cmt ; } } return out ; }
Returns the same comment list as when this integrator was created minus all doc comments that have been successfully integrated into the compilation unit .