AllOpen with Kotlin 1.1.2 and Weld/CDI


#1

I have been using the allopen Plugin in a JEE Environment especially for the use with CDI (Injection and Interceptors).
It was working just fine until I updated to Kotlin 1.1.2 (Problem persists in 1.1.3).

It seems that the behavior of the plugin changed in a way which causes private methods of a class to remain final.
This makes the class not proxy-able for weld and causes deployments to fail. I did not change any configuration other than the kotlin version.

Is this a bug or intended behavior? How can I get CDI-Interceptors to work again?

EDIT: Provided an example.

The following kotlin class (Injectable is the annotation activating the allOpen-Plugin):

@Injectable
class TestBean {
    fun publicFunction() {
    }

    private fun privateFunction() {
    }
}

Compiled with Kotlin 1.1.1

@Metadata(<Removed for shortness>)
@Injectable
public class TestBean {
   public void publicFunction() {
   }

   private void privateFunction() {
   }
}

Compiled with Kotlin >=1.1.2

@Metadata(<Removed for shortness>)
@Injectable
public class TestBean {
   public void publicFunction() {
   }

   private final void privateFunction() {
   }
}

Changing private functions to final is a breaking change.


#2

Yes, it was an intended change in 1.1.2 (see https://youtrack.jetbrains.com/issue/KT-16627 and https://youtrack.jetbrains.com/issue/KT-16619).

We didn’t know if it breaks any existing use-cases, but this looks like a major regression. Can you please file the new issue for this (http://kotl.in/issue)?


#3

Thank you for your Feedback. I will file an issue tomorrow and link the ticket here.

EDIT:
Filed a bug: https://youtrack.jetbrains.com/issue/KT-19047