Martin
07/17/2025, 12:03 PMMapProperty questions:
⢠Is it possible to have null as a value?
⢠Having MapProperty<String, Any?> displays an error in my IDE but compiles fine. Where is the disconnect? How come the KIJP knows that the bound is non nullable?Vampire
07/17/2025, 12:12 PMorg.gradle.api.provider package is annotated with @NullMarked which means that anything that is not annotated as nullable is non-null and so the V is a non-nullable type.Vampire
07/17/2025, 12:15 PMput already shows an error in IDE already if you give null with 8.14.3 as there the old nullable annotations already work too.Vampire
07/17/2025, 12:16 PMprovider { null } would anyway not work, as that is an absent provider, so even if you could have null as value, then only as direct value not as provider.Martin
07/17/2025, 12:21 PMIn 8.14.3 the IDE does not show an error.This is what gets me confused, I compile against
8.0 so where does the IDE gets that information from?Martin
07/17/2025, 12:25 PMTheTIL about package level annotations til Turns out all of `org.gradle` is now annotated as `NullMarked` ?package is annotated withorg.gradle.api.provider@NullMarked
Martin
07/17/2025, 12:25 PMMartin
07/17/2025, 12:26 PMgradle-api in my compile classpath š¤Vampire
07/17/2025, 12:28 PMMartin
07/17/2025, 12:28 PMVampire
07/17/2025, 12:28 PMVampire
07/17/2025, 12:29 PMVampire
07/17/2025, 12:29 PMnull would be a valid valueMartin
07/17/2025, 12:30 PMMartin
07/17/2025, 12:30 PMMartin
07/17/2025, 12:30 PMVampire
07/17/2025, 12:30 PMnull before anywayVampire
07/17/2025, 12:31 PMput and it also does not compile with 8.14.3Martin
07/17/2025, 12:31 PMVampire
07/17/2025, 12:31 PMVampire
07/17/2025, 12:31 PM> Configure project :
w: file:///D:/Sourcecode/other/showcase/build.gradle.kts:55:16: Type mismatch: inferred type is Any? but Any was expected
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Sourcecode\other\showcase\build.gradle.kts' line: 55
* What went wrong:
Cannot add an entry with a null value to a property of type Map.Vampire
07/17/2025, 12:32 PMMartin
07/17/2025, 12:37 PMdev.gradleplugins:gradle-api:8.0 in the compile classpath, the IDE error actually depends on the Gradle wrapper version š¤·Martin
07/17/2025, 12:38 PMVampire
07/17/2025, 12:41 PMMartin
07/17/2025, 12:56 PM