Should we be reporting FindBugs issues?

Some of the bytecode that Kotlin generates gets flagged by FindBugs with the reasonable defaults in place. Should we bother reporting this to JetBrains?

For example:

arguments = Files.newBufferedReader(filename).use { parse(it) }

generates unhappy bytecode; FindBugs says

Self assignment of it in new <snip>

Bug type SA_LOCAL_SELF_ASSIGNMENT (click for details)
In class <snip>
In method new <snip>
Local variable named it
At <snip>.kt:[line 72]

The details mention this:

SA_LOCAL_SELF_ASSIGNMENT: Self assignment of local variable

This method contains a self assignment of a local variable; e.g.

  public void foo() {
    int x = 3;
    x = x;
  }

Such assignments are useless, and may indicate a logic error or typo.

Not my project, but there’s a bunch of others like that listed in this findbugs-exclude.xml.

1 Like

We’re aware of inefficiencies in the Kotlin-generated bytecode, and we plan to address them when switching to a new implementation of the JVM backend in Kotlin 1.2. At this time, I don’t think it’s worth filing issues for problem that FindBugs detects, because we won’t address them anyway, and it’s likely that they will go away after the rewrite.

1 Like

Update, since this was mentioned here:

Dmitry Jemerov says:
June 29, 2017 at 5:43 pm
At this time we don’t plan to release the new JVM backend in the 1.2 timeframe. We do invest effort into local improvements of the generated bytecode with our current backend implementation, so it would help if you could file issues regarding your FindBugs problems – we’ll look into them.

2 Likes

The year is 2022 and Kotlin 1.6 has been released.
Problem still here :thinking:

1 Like