public void initProcessAnnotations ( Iterable < ? extends Processor > processors , Collection < ? extends JavaFileObject > initialFiles , Collection < String > initialClassNames ) { // Process annotations if processing is not disabled and there // is at least one Processor available. if ( options . isSet ( PROC , "none" ) ) { processAnnotations = false ; } else if ( procEnvImpl == null ) { procEnvImpl = JavacProcessingEnvironment . instance ( context ) ; procEnvImpl . setProcessors ( processors ) ; processAnnotations = procEnvImpl . atLeastOneProcessor ( ) ; if ( processAnnotations ) { options . put ( "parameters" , "parameters" ) ; reader . saveParameterNames = true ; keepComments = true ; genEndPos = true ; if ( ! taskListener . isEmpty ( ) ) taskListener . started ( new TaskEvent ( TaskEvent . Kind . ANNOTATION_PROCESSING ) ) ; deferredDiagnosticHandler = new Log . DeferredDiagnosticHandler ( log ) ; procEnvImpl . getFiler ( ) . setInitialState ( initialFiles , initialClassNames ) ; } else { // free resources procEnvImpl . close ( ) ; } } }
Check if we should process annotations . If so and if no scanner is yet registered then set up the DocCommentScanner to catch doc comments and set keepComments so the parser records them in the compilation unit .