Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin 'rem' as replacement for 'mod' not available?

For count % 2 I get the warning

Warning:(137, 17) Kotlin: 'mod(Int): Int' is deprecated. Use rem(other) instead

and the Intellij IDE provides for an automated correction to count.rem(2) which I then get flagged as an error due to an unresolved reference to rem.

What am I doing wrong?

like image 551
Tina Hildebrandt Avatar asked Mar 10 '17 11:03

Tina Hildebrandt


1 Answers

This is a known bug in the Kotlin IDE plugin.

It arises from the deprecation of the mod function in Kotlin 1.1, which should be replaced by rem (see Other changes in this blog post). But the IDE plugin incorrectly reports and suggest the quick fix even for earlier Kotlin versions which didn't have rem.

Unitl it is fixed, you can either update your project to Kotlin 1.1 or suppress the warnings, or just ignore them.

like image 188
hotkey Avatar answered Oct 19 '22 01:10

hotkey