private int instrumentNotNull(File dir,final InstrumentationClassFinder finder){
  int instrumented=0;
  final File[] files=dir.listFiles();
  for (int i=0; i < files.length; i++) {
    File file=files[i];
    final String name=file.getName();
    if (name.endsWith(".class")) {
      final String path=file.getPath();
      log("Adding @NotNull assertions to " + path,Project.MSG_VERBOSE);
      try {
        final FileInputStream inputStream=new FileInputStream(file);
        try {
          ClassReader reader=new FailSafeClassReader(inputStream);
          int version=getClassFileVersion(reader);
          if (version >= Opcodes.V1_5 && !shouldBeSkippedByAnnotationPattern(reader)) {
            ClassWriter writer=new InstrumenterClassWriter(getAsmClassWriterFlags(version),finder);
            if (NotNullVerifyingInstrumenter.processClassFile(reader,writer)) {
              final FileOutputStream fileOutputStream=new FileOutputStream(path);
              try {
                fileOutputStream.write(writer.toByteArray());
                instrumented++;
              }
  finally {
                fileOutputStream.close();
              }
            }
          }
        }
  finally {
          inputStream.close();
        }
      }
 catch (      IOException e) {
        log("Failed to instrument @NotNull assertion for " + path + ": "+ e.getMessage(),Project.MSG_WARN);
      }
catch (      Exception e) {
        fireError("@NotNull instrumentation failed for " + path + ": "+ e.toString());
      }
    }
 else     if (file.isDirectory()) {
      instrumented+=instrumentNotNull(file,finder);
    }
  }
  return instrumented;
}

private int instrumentNotNull ( File dir , final InstrumentationClassFinder finder ) { int instrumented = 0 ; final File [ ] files = dir . listFiles ( ) ; for ( int i = 0 ; i < files . length ; i ++ ) { File file = files [ i ] ; final String name = file . getName ( ) ; if ( name . endsWith ( ".class" ) ) { final String path = file . getPath ( ) ; log ( "Adding @NotNull assertions to " + path , Project . MSG_VERBOSE ) ; try { final FileInputStream inputStream = new FileInputStream ( file ) ; try { ClassReader reader = new FailSafeClassReader ( inputStream ) ; int version = getClassFileVersion ( reader ) ; if ( version >= Opcodes . V1_5 && ! shouldBeSkippedByAnnotationPattern ( reader ) ) { ClassWriter writer = new InstrumenterClassWriter ( getAsmClassWriterFlags ( version ) , finder ) ; if ( NotNullVerifyingInstrumenter . processClassFile ( reader , writer ) ) { final FileOutputStream fileOutputStream = new FileOutputStream ( path ) ; try { fileOutputStream . write ( writer . toByteArray ( ) ) ; instrumented ++ ; } finally { fileOutputStream . close ( ) ; } } } } finally { inputStream . close ( ) ; } } catch ( IOException e ) { log ( "Failed to instrument @NotNull assertion for " + path + ": " + e . getMessage ( ) , Project . MSG_WARN ) ; } catch ( Exception e ) { fireError ( "@NotNull instrumentation failed for " + path + ": " + e . toString ( ) ) ; } } else if ( file . isDirectory ( ) ) { instrumented += instrumentNotNull ( file , finder ) ; } } return instrumented ; }
instrument classes with notnull annotations
