Skip to content

Commit 67ce02a

Browse files
committed
Update README.md to reflect what plugin this is
1 parent 63d09a2 commit 67ce02a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
# kotlin-hides-members
1+
# kotlin-null-defaults
22

33

4-
A Kotlin compiler plugin that allows `@HidesMembers` to work for more declarations than just `forEach` and `addSuppressed`.
4+
A Kotlin compiler plugin that allows Java callers to pass in `null` for default parameters by automatically checking for nulls and substituting the default values .
55

6-
In short, this plugin allows using `@HidesMembers` so that you can declare an extension function that takes over a member function in overload resolution.
6+
In short, this plugin, through annotating any relevant declarations with @NullDefaults, allows you to treat your default parameters as if they were nullable. The annotation can be applied to a whole class (for constructors), a specific function/constructor, or even individual parameters.
77

8-
The main use-case being redefining functions using multiple receivers.
8+
The main use-case being supporting legacy Java code that expects being able to pass in null for certain parameters and having that being handled on its own. Note that this plugin specifically doesn't allow Kotlin callers to do the same thing due to the ease of use and idiomacy of default parameters in Kotlin and the fact that such a feature would go against most established conventions. However, in the future the plugin could support this limited use-case behind a flag.
99

1010
Use with care!
1111

1212
Note: This plugin was created
1313
using [Brian Norman's Kotlin IR Plugin Template](https://github.com/bnorm/kotlin-ir-plugin-template) and from guidance
1414
from his wonderful article
1515
series [Writing Your Second Kotlin Compiler Plugin](https://blog.bnorm.dev/writing-your-second-compiler-plugin-part-1) (seriously like the articles were immensely helpful when I just knew absolutely nothing about IR)
16+
and it was created originally as part of the discussion on [Kotlin Discussions: Feature Request: Constructor parameter default value when receiving null input](https://discuss.kotlinlang.org/t/feature-request-constructor-parameter-default-value-when-receiving-null-input/22704) to support the OP's use-case.

0 commit comments

Comments
 (0)