Kotlin-dsl-samples: Allow typed Project delegated properties

Created on 7 Dec 2017  路  3Comments  路  Source: gradle/kotlin-dsl-samples

currently I can do val someValue: String by extra and if I have a String named "someValue" my val is assigned extra["someValue"] with type String.
if I have val someValue: String by project it does not work, I get following error:

'getValue(Build_gradle, KProperty<*>)' function of property delegate is expected to return 'String', but returns 'Any?
breaking-change feature kotlin-dsl-api

Most helpful comment

@AlexCzar Do you know what is difference between by extra and by project actually?

Yes, I think I do.
In case you were really asking what those differences are and not if I'm aware of them:
If I'm not mistaken, by project is an analogue of project.findProperty(String) while by extra is an analogue of extra.properties.get(String)

All 3 comments

Closing as delivered in 4e8a53b

@AlexCzar Do you know what is difference between by extra and by project actually?

@AlexCzar Do you know what is difference between by extra and by project actually?

Yes, I think I do.
In case you were really asking what those differences are and not if I'm aware of them:
If I'm not mistaken, by project is an analogue of project.findProperty(String) while by extra is an analogue of extra.properties.get(String)

Was this page helpful?
0 / 5 - 0 ratings