Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support incremental annotation processing. #1230

Conversation

stephanenicolas
Copy link
Contributor

Addresses issue: #1225

With #1045, the support for incremental annotation processing is complete.
It would be really nice to see 9.0.0 released with this soon ;)
(let me know if I can help)

@@ -209,6 +213,10 @@
return false;
}

public HashMap<String, List<Element>> getMapGeneratedFileToOriginatingElements() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**package-private*/ @VisibleForTesting would make more sense.

@Alexander--
Copy link

@stephanenicolas Are you sure, that ButterKnife can be considered "isolating"? It appears to analyze the autogenerated R classes under some circumstances (such as when used in library project), so at very least it should be "aggregating".

To make matters worse, it is currently using javac-internal APIs (JCTree) to locate R classes in packages, which makes it's compatibility with incremental processing somewhat questionable.

@stephanenicolas
Copy link
Contributor Author

@Alexander-- I think it doesn't impact, but I am not sure. From what I see, R2 is not generated by the AP but by the butterknife plugin. And the plugin will generate R2 before compilation (the task is registered as a java generating taks).

As soon as R changes, R2 is generated again and when processing a class using R2 values, they are inlined by the compiler, so I don't think it makes sense to say that a generated class depends on R2. I don't think we would add any valuable information to gradle.

IF R doesn't chagne we are using the old values of R2.
IF R is changed, R2 changes and will be recompiled. And the new R2 values will be used. As the values are inlined in the annotations values, it will trigger the recompilation of all files using BK annotations. That's just normal wiring inside gradle.

So, yeah, I am pretty confident that BK AP is isolating.

@Alexander--
Copy link

@stephanenicolas I was worried if Gradle's IncrementalProcessingEnvironment can be used to successfully retrieve the instance of com.sun.source.util.Trees, but if it worked fine in your tests, then I guess, everything should be ok.

@oehme
Copy link

oehme commented Mar 27, 2018

If it only looks at the R class because its constants are referenced by the annotated files, then that's fine, because as soon as R changes, the annotated class will be recompiled.

If a processor looked up R "out of the blue", with no connection to an annotated element (e.g. to decide whether to generated some class at all), then that would be a different story.

That being said, I haven't read the code deeply, I'm just using my user-facing understanding of BK.

@hungvietnguyen
Copy link

The first commit looks good to me. I tested it locally and it seems to work well. Hopefully this will be the first incremental AP!

@tprochazka
Copy link

@stephanenicolas And did you test the speed improvements when butter knife supports incremental compile. My build currently takes several minutes, so I'm looking for this like salvation.

@oehme
Copy link

oehme commented Apr 3, 2018

As Alexander pointed out, using com.sun.source.util.Trees or any other compiler-specific APIs may not work with incremental annotation processing. You may want to add some end-to-end tests that actually do some incremental builds using Gradle. You can use TestKit to invoke Gradle from your tests.

@stephanenicolas
Copy link
Contributor Author

@tprochazka yes it really works well and incremental compilation just works. Of course it's faster. But if you wait for salvation, I would recommend modularizing your code. Yes, it's long, difficult and painful but it gives great results.

@kageiit
Copy link
Contributor

kageiit commented Apr 10, 2018

I made a few improvements to the processor in #1244 . They should help on top of the incremental ap logic. It may make the incremental logic even better as butterknife no longer looks at all fields in R2 classes

@tprochazka
Copy link

I see that in the ButterKnife repository is quite a lot of open pull requests.
Some of them more than year old.
I worry a little bit.

@tprochazka
Copy link

@stephanenicolas What is the status of this pull request?

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Apr 18, 2018 via email

@JakeWharton
Copy link
Owner

JakeWharton commented Apr 18, 2018 via email

@tprochazka
Copy link

But there is merge conflict, which can fix only the author of the pull request.

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Apr 19, 2018 via email

@tprochazka
Copy link

Gradle 4.7 is already out. I think that now this is the most important thing for every library using annotation processing. Recompilation whole project on every small change takes 35s for me and I think that I'm not working on the biggest project.

@tprochazka
Copy link

tprochazka commented May 29, 2018

Android-State is now first Android lib with incremental compilation support!
I tested it together with version of butterknife from @stephanenicolas and it looks that it works.
But I tested it just on the small project. I need to test it on something bigger now.
On bigger problem is that Data Binding prevents to use incremental compile :-(

@tprochazka
Copy link

So it looks that Google team added support for incremental compilation to annotation processors included in build plugin itself. https://androidstudio.googleblog.com/2018/09/android-studio-33-canary-11-available.html Any chance that this pull request will be merged and at least snapshot build will be available?

@autonomousapps
Copy link

Hey guys, what's the state of this? Would love to see butterknife opt into incremental compilation sooner than later :)

@JakeWharton
Copy link
Owner

JakeWharton commented Oct 18, 2018 via email

@autonomousapps
Copy link

That's fine by me. I'm just advocating on behalf of all the people still using Butterknife AP.

If using butterknife-reflect is the preferred solution, maybe it's worth updating the readme to suggest that? There's nothing in the top-level readme to encourage users to switch to that instead.

@zobo
Copy link

zobo commented Nov 5, 2018

Here's a reason why NOT to use butterknife-reflect: #1391
Test what you fly...

@JakeWharton
Copy link
Owner

JakeWharton commented Nov 5, 2018 via email

@tprochazka
Copy link

PRs for missing functionality are welcome.

This is PR with missing functionality :-(

@JakeWharton
Copy link
Owner

JakeWharton commented Nov 16, 2018 via email

@tprochazka
Copy link

Maybe would be great to reconsider finish this pull request, when reflect runtime is almost impossible to use because of #1364

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Dec 22, 2018 via email

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Jan 5, 2019

@JakeWharton and/or other contributors. Can we have a transparent, open and in-depth discussion on this PR ?

It looks like there are some reasons on the maintainers side not to merge it and this PR has received some support from the community. Can we talk about it, and maybe figure out an even better solution ?

@autonomousapps
Copy link

If there is concern about the safety of this, butterknife could always follow dagger's lead and make it an opt-in feature.

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Jan 6, 2019 via email

@autonomousapps
Copy link

@stephanenicolas
Copy link
Contributor Author

Thx @autonomousapps

@stephanenicolas
Copy link
Contributor Author

If you are interested, I got a fork of butterknife with incremental annotation processing available (+inheritance across modules which is a related issue).
The fork is here: https://github.com/stephanenicolas/butterknife/tree/sni/version-10-incap
(branch version-10-incap)

The artifacts are on maven central: com.github.stephanenicolas:butterknife*: https://search.maven.org/search?q=a:butterknife

In the fork, all class names and packages have been preserved, using the fork is as simple as changing the artifacts names.

@tprochazka
Copy link

tprochazka commented Jan 26, 2019

I just tried to use

implementation 'com.github.stephanenicolas:butterknife:10.0.0-INCAP'
annotationProcessor 'com.github.stephanenicolas:butterknife-compiler:10.0.0-INCAP'

and for some unknown reason it always fail on all @BindView annotation with error

ExoVideoPlayerActivity.java:77: error: Unable to parse @BindView binding.
	@BindView(videoView) PlayerView vSimpleExoPlayerView;

Tried it anybody else already?

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Jan 26, 2019

@tprochazka can you give more of the stacktrace please. I don't see this issue at all. Ideally something that explains what is the issue. You can use ./gradlew <assemble> -d and/or -s to get more info.

We don't experience this issue at all.

Also make sure you change all butterknife libs, not only the 2 above. I mean annotations too, etc.. if needed. Then do a clean build, and then you should get it working.

@tprochazka
Copy link

All other libs are referenced by main one. I tried check it by dependencies task and there is no com.jakewharton dependency at all. So I'm not sure what you mean.

I'm using android build plugin 3.3.0 and Gradle 4.10.2 currently on this project.

annotation processor classpath looks like this

+--- com.github.stephanenicolas:butterknife-compiler:10.0.0-INCAP
|    +--- com.squareup:javapoet:1.10.0 -> 1.11.1
|    +--- com.github.stephanenicolas:butterknife-annotations:10.0.0-INCAP
|    |    \--- androidx.annotation:annotation:1.0.0
|    +--- com.google.auto:auto-common:0.10
|    |    \--- com.google.guava:guava:23.5-jre -> 24.0-jre
|    |         +--- com.google.code.findbugs:jsr305:1.3.9
|    |         +--- org.checkerframework:checker-compat-qual:2.0.0
|    |         +--- com.google.errorprone:error_prone_annotations:2.1.3
|    |         +--- com.google.j2objc:j2objc-annotations:1.1
|    |         \--- org.codehaus.mojo:animal-sniffer-annotations:1.14
|    \--- com.google.guava:guava:24.0-jre (*)
\--- com.evernote:android-state-processor:1.4.1
     \--- com.squareup:javapoet:1.11.1

And here is whole stacktrace:

01:53:50.745 [ERROR] [system.err] ...HintView.java:143: error: Unable to generate view binder for @OnClick.
01:53:50.745 [ERROR] [system.err]       void onGotItButtonClicked() {
01:53:50.745 [ERROR] [system.err]            ^
01:53:50.745 [ERROR] [system.err]
01:53:50.745 [ERROR] [system.err]   java.lang.NullPointerException
01:53:50.745 [ERROR] [system.err]       at butterknife.compiler.ButterKnifeProcessor.elementToIds(ButterKnifeProcessor.java:1364)
01:53:50.746 [ERROR] [system.err]       at butterknife.compiler.ButterKnifeProcessor.parseListenerAnnotation(ButterKnifeProcessor.java:1240)
01:53:50.746 [ERROR] [system.err]       at butterknife.compiler.ButterKnifeProcessor.findAndParseListener(ButterKnifeProcessor.java:1051)
01:53:50.746 [ERROR] [system.err]       at butterknife.compiler.ButterKnifeProcessor.findAndParseTargets(ButterKnifeProcessor.java:355)
01:53:50.746 [ERROR] [system.err]       at butterknife.compiler.ButterKnifeProcessor.process(ButterKnifeProcessor.java:194)
01:53:50.746 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.processing.DelegatingProcessor.process(DelegatingProcessor.java:62)
01:53:50.746 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.processing.IsolatingProcessor.process(IsolatingProcessor.java:50)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.main.Main.compile(Main.java:523)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
01:53:50.746 [ERROR] [system.err]       at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
01:53:50.746 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:89)
01:53:50.746 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
01:53:50.746 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:50)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:36)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:100)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:49)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.AnnotationProcessorDiscoveringCompiler.execute(AnnotationProcessorDiscoveringCompiler.java:35)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:39)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:27)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:153)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:138)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:110)
01:53:50.747 [ERROR] [system.err]       at com.android.build.gradle.tasks.ProcessAnnotationsTask.compile(ProcessAnnotationsTask.kt:90)
01:53:50.747 [ERROR] [system.err]       at sun.reflect.GeneratedMethodAccessor916.invoke(Unknown Source)
01:53:50.747 [ERROR] [system.err]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
01:53:50.747 [ERROR] [system.err]       at java.lang.reflect.Method.invoke(Method.java:498)
01:53:50.747 [ERROR] [system.err]       at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
01:53:50.747 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
01:53:50.748 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
01:53:50.748 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
01:53:50.749 [ERROR] [system.err]       at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
01:53:50.749 [ERROR] [system.err]       at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
01:53:50.749 [ERROR] [system.err]       at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
01:53:50.749 [ERROR] [system.err]       at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
01:53:50.749 [ERROR] [system.err]       at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
01:53:50.749 [ERROR] [system.err]       at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
01:53:50.749 [ERROR] [system.err]       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
01:53:50.749 [ERROR] [system.err]       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
01:53:50.749 [ERROR] [system.err]       at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
01:53:50.749 [ERROR] [system.err]       at java.lang.Thread.run(Thread.java:748)

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Jan 27, 2019 via email

@stephanenicolas
Copy link
Contributor Author

@tprochazka I can't repro the issue and this part of BK is not supposed to have changed in my fork.
Can you set up a small example on GH to reproduce the issue please? Also, it may sound like a stupid question but does everything work without the fork, using the original BK ?

@stephanenicolas
Copy link
Contributor Author

@tprochazka do you still have this issue ?

@tprochazka
Copy link

Sorry for the delay. And yes, with
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
everything works correctly. I will test in on different project or create empty project.

@tprochazka
Copy link

I tested it on a different project with the same result, then I created a sample project just by AS wizard and just replace findViewById() with your forked ButterKnife and it has the same issue.
Here is source code https://www.dropbox.com/s/5neciycvsuubs7s/butterknife-incap-test.zip?dl=1

@JakeWharton
Copy link
Owner

JakeWharton commented Jan 31, 2019 via email

@stephanenicolas
Copy link
Contributor Author

stephanenicolas commented Feb 1, 2019

I just enabled the issues on https://github.com/stephanenicolas/butterknife. Also, I was able to repro in the sample of TP 2 (which is also becoming incremental..). Feel free to create the issue in the fork's repo.

The bug has been fixed and the fork of butterknife (now named butterfork :)) is working just fine with incremental annotation processing.

@@ -22,6 +22,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete line

import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete line

import org.junit.Test;

import java.util.List;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete empty lines

import javax.tools.JavaFileObject;
import javax.tools.StandardLocation;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete empty lines

@@ -3,14 +3,21 @@
import butterknife.compiler.ButterKnifeProcessor;
import com.google.common.collect.ImmutableList;
import com.google.testing.compile.JavaFileObjects;

import javax.lang.model.element.Element;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: delete empty lines

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.7-20180323002511+0000-bin.zip
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants