[GRADLE-2115] Up-To-Date check ignores @Input-annotated boolean properties Created: 22/Feb/12 Updated: 14/Sep/16 Resolved: 12/Jul/16 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 3.0-rc-1 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Lóránt Pintér |
Resolution: | Fixed | Votes: | 0 |
Description |
Hi, I have a task (written in Java, wrapped in a Plugin) that has a couple of boolean configuration flags that affect the files that are being generated by that task. I have annotated the boolean configuration properties in the task class like so: @Input Configuring the task in build.gradle: generateSomeSource { The problem is that gradle considers my task up-to-date and doesn't run it, even if I change the configuration flag in build.gradle. I have generated public accessor methods in the task class, I tried to annotate the getter instead of the field and I tried primitive "boolean" and Object "Boolean". Nothing seems to work. If I use a java.lang.String instead of the booleans, gradle behaves as expected. Is that a bug? Should I file a jira ticket? Or am I missing something? Thanks in advance, |
Comments |
Comment by Gradle Forums [ 22/Feb/12 ] |
Hi Mike, regards, |
Comment by Gradle Forums [ 22/Feb/12 ] |
Hi Rene, thanks for the quick reply. I'm using quite a few other annotations, here's an outline of the task: public class MyGeneratorTask extends SourceTask { @OutputDirectory @OutputDirectory @OutputFile @InputFiles @Input @Input @Input @TaskAction I'm afraid this won't be very helpful for you. But the fact that it works as expected for you hints at an error on my side. I'll have to hunt down the issue tomorrow, starting with an empty task. Regards, |
Comment by Gradle Forums [ 22/Feb/12 ] |
Which Gradle version? |
Comment by Gradle Forums [ 22/Feb/12 ] |
milestone-7 as well as milestone-8a |
Comment by Gradle Forums [ 22/Feb/12 ] |
I finally found the issue! I started off the task class with primitive boolean fields and generated the accessors for that field. The generated methods were: @Input public boolean isFeature1Enabled() { public void setFeature1Enabled(boolean boolean1Enabled) { Apparently, gradle ignores the @Input annotation if it doesn't find a method starting with "get" (note the getter method name "isFeature1Enabled" vs. "getFeature1Enabled"). Since the JavaBean Spec ( [1]http://download.oracle.com/otn-pub/jc... ) explicitely allows the "is" notation (in section 8.3.2) and IDEs like Eclipse generate boolean getters with "is...", I think this should be considered a gradle bug. Best regards, |
Comment by Lóránt Pintér [ 12/Jul/16 ] |
This has been resolved in 3.0. |