// ///////////////////////////////////////////////////////////////////////////
// Checker Framework pluggable type-checking and Error Prone example
//

plugins {
  id 'java'
  id 'net.ltgt.errorprone' version '4.1.0'
  // Checker Framework pluggable type-checking
  id 'org.checkerframework' version '0.6.46'
}

apply plugin: 'org.checkerframework'

dependencies {
  // Must use at least version 2.4.0 of Error Prone.
  if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
    errorprone 'com.google.errorprone:error_prone_core:2.10.0'
  } else {
    errorprone 'com.google.errorprone:error_prone_core:2.12.0'
  }
}

repositories {
  mavenCentral()
}

checkerFramework {
  checkers = [
    'org.checkerframework.checker.nullness.NullnessChecker',
  ]
}

compileJava {
  // A checker will only run if Error Prone does not issue any warnings.  So
  // convert the expected error to a warning to test that both Error Prone
  // and the Nullness Checker run.
  options.errorprone.warn('CollectionIncompatibleType')
}
