Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kotlin: suppress warning for function starting with uppercase letter

The Kotlin guide on coding conventions says factory functions may start with an uppercase letter,

Exception: factory functions used to create instances of classes can have the same name as the class being created:
    abstract class Foo { ... }

    class FooImpl : Foo { ... }

    fun Foo(): Foo { return FooImpl(...) }

The code inspector in android studio did not get the memo, however; it complains about the upcase letter. I realize I can go into settings and modify the rule, but (1) I don't want to make that global change, and (2) I don't want other people using my code to get the warning. I just wish to suppress the warning coming from this one line with a @Suppress directive (or some other way).

And I can't seem to find a list of all @Suppress directives -- where is it?

And where do I file a bug report for this?

like image 576
Nicholas Wagner Avatar asked Jul 17 '18 13:07

Nicholas Wagner


1 Answers

To suppress any warning in Kotlin, press Alt-Enter, then the right arrow key and select the suppress action from the context menu, as shown on the attached screenshot.

Suppress quickfix

The issue for this problem has already been filed.

like image 89
yole Avatar answered Oct 05 '22 03:10

yole