private String [ ] getSourceLines ( Method obj ) { if ( srcInited ) { return sourceLines ; } try { srcLineAnnotation = SourceLineAnnotation . forEntireMethod ( getClassContext ( ) . getJavaClass ( ) , obj ) ; if ( srcLineAnnotation != null ) { SourceFinder sourceFinder = AnalysisContext . currentAnalysisContext ( ) . getSourceFinder ( ) ; SourceFile sourceFile = sourceFinder . findSourceFile ( srcLineAnnotation . getPackageName ( ) , srcLineAnnotation . getSourceFile ( ) ) ; try ( BufferedReader sourceReader = new BufferedReader ( new InputStreamReader ( sourceFile . getInputStream ( ) , StandardCharsets . UTF_8 ) ) ) { List < String > lines = new ArrayList <> ( 100 ) ; String line ; while ( ( line = sourceReader . readLine ( ) ) != null ) { lines . add ( line ) ; } sourceLines = lines . toArray ( new String [ 0 ] ) ; } } } catch ( IOException ioe ) { // noop } srcInited = true ; return sourceLines ; }
reads the sourcefile based on the source line annotation for the method