[GRADLE-3414] Confusing task input validation error messages when property name exercise JavaBean spec corner cases Created: 15/Mar/16  Updated: 01/Apr/16  Resolved: 16/Mar/16

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.13-rc-1

Type: Bug
Reporter: Paul Merlin Assignee: Paul Merlin
Resolution: Fixed Votes: 0


 Description   

Given the following build script:

class MyTask extends DefaultTask {
    private String flags

    @Input
    public String getCFlags() {
        flags
    }

    public void setCFlags(String flags) {
        this.flags = flags
    }
}

task('something', type: MyTask) {}

A simple task with an @Input property declared using a getter and a corresponding setter.

Running gradle something rightly shows an error message about the missing non-optional input:

> No value has been specified for property 'cFlags'.

So, let's do what Gradle says:

task('something', type: MyTask) {
	cFlags = "anything"
}

But then gradle something shows the following error:

> No such property: cFlags for class: MyTask_Decorated
  Possible solutions: CFlags, class

According to the JavaBean spec, the property name should be CFlags, not cFlags.
Groovy respect the spec and we have a mismatch.

The issue is the same with a bunch of the JavaBeans spec corner cases like e.g. getURL() or getcCompiler().


Generated at Wed Jun 30 12:48:11 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.