JakeWharton / JakeWharton/nopen

nopen not respecting disableWarningInGeneratedCode errorprone setting

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
317
Forks
9
PR merge metrics
No merged PRs in 30d

Description

I am attempting to use nopen with an Android Project, but cannot seem to disable the errors in generated code. nopen is currently flagging the ButterKnife generated view bindings. My app module build.gradle is as follows:

```
apply plugin: 'com.android.application'
apply plugin: "net.ltgt.errorprone"

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

defaultConfig {
applicationId "com.nickwelna.issuemanagerforgithub"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "CLIENT_SECRET", keystoreProperties["CLIENT_SECRET"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

}

dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta05'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation "androidx.navigation:navigation-fragment:2.2.0-beta01"
implementation "androidx.navigation:navigation-ui:2.2.0-beta01"
implementation 'com.google.android.material:material:1.1.0-beta01'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation 'com.squareup.retrofit2:converter-moshi:2.6.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.3'
debugImplementation 'com.squareup.leakcanary:leakcanary-support-fragment:1.6.3'
implementation 'com.google.flogger:flogger:0.4'
implementation 'com.google.flogger:flogger-system-backend:0.4'
implementation 'com.squareup.moshi:moshi:1.8.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'

compileOnly 'com.jakewharton.nopen:nopen-annotations:1.0.1'
errorprone "com.google.errorprone:error_prone_core:2.3.3"
errorprone 'com.jakewharton.nopen:nopen-checker:1.0.1'
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
}

android.applicationVariants.all { variant ->
variant.javaCompileProvider.configure {
options.errorprone.disableWarningsInGeneratedCode = true
}
}

apply plugin: 'com.google.gms.google-services'
```
And my project build.gradle:
```
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()
gradlePluginPortal()
}
dependencies {
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:1.1.0'
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
```
Am I missing something?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the app module build.gradle and project build.gradle, then reproduce the Android build using nopen, Error Prone, and the generated ButterKnife bindings. Trace how options.errorprone.disableWarningsInGeneratedCode is applied to the Java compile task; done means generated-code diagnostics are suppressed without disabling the checker for handwritten code.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.