title: Kotlin 1.1.1 vs 1.2.30 & AspectJ
body: <p>I am trying to use Kotlin 1.2.30 with AspectJ (using the following AspectJ gradle plugin: <a href="https://github.com/sedovalx/gradle-aspectj-binary" rel="nofollow noreferrer">github repo</a>, no affiliation with the author). My build gradle seems to work with older versions of kotlin (e.g. 1.1.1), but not with 1.2 versions.</p>
  <p>I am trying to add aspects to the following <em>Main.kt</em> file:</p>
  <pre><code>package test
  
  fun main (args: Array&lt;String&gt;) {
      object  {
          fun foo () { print(&quot;foo&quot;)}
      }.foo()
  }
  </code></pre>
  <p>My aspect file, <em>AspectTest.kt</em> is as follows:</p>
  <pre><code>package test
  
  import org.aspectj.lang.ProceedingJoinPoint
  import org.aspectj.lang.annotation.Around
  import org.aspectj.lang.annotation.Aspect
  
  @Aspect
  class AspectTest {
  
      @Around(&quot;execution (* *())&quot;)
      fun around(joinPoint: ProceedingJoinPoint) : Any? {
              println(&quot;joinpoint&quot;)
              return joinPoint.proceed();
      }
  }
  </code></pre>
  <p>My <em>build.gradle</em> is:</p>
  <pre><code>buildscript {
      ext.kotlin_version = '1.2.30'
      repositories {
          mavenCentral()
          jcenter()
      }
      dependencies {
          classpath &quot;org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version&quot;
          classpath &quot;com.github.sedovalx.gradle:gradle-aspectj-binary:1.0.25&quot;
      }
  }
  
  
  group 'test'
  version '1.0-SNAPSHOT'
  
  apply plugin: 'kotlin'
  apply plugin: 'application'
  apply plugin: 'com.github.sedovalx.gradle-aspectj-binary'
  
  sourceCompatibility = 1.8
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile &quot;org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version&quot;
      testCompile group: 'junit', name: 'junit', version: '4.12'
  
      compile (&quot;org.aspectj:aspectjrt:1.9.1&quot;)
      compile 'org.aspectj:aspectjweaver:1.9.1'
      compile 'org.slf4j:slf4j-simple:1.7.21'
  }
  
  compileKotlin {
      kotlinOptions.jvmTarget = &quot;1.8&quot;
  }
  compileTestKotlin {
      kotlinOptions.jvmTarget = &quot;1.8&quot;
  }
  
  mainClassName ='test.MainKt'
  
  weaveClasses.dependsOn compileJava
  classes.dependsOn weaveClasses
  </code></pre>
  <p>When I run the code using <code>kotlin_version = 1.1.1</code> it works and prints:</p>
  <blockquote>
  <p>joinpoint</p>
  <p>foo</p>
  </blockquote>
  <p>In case of Kotlin 1.2.30 (or any other in 1.2 branch I tried) &quot;foo&quot; is printed, as if the aspect did not work.</p>
  <p>How can I remedy the problem in case of newer kotlin versions?</p>