This happens if I have an annotation such as `@Moc...
# kontributors
s
This happens if I have an annotation such as
@Mock
or
@Autowired
on a property, and then I call
addModifier
on that
KtProperty
k
You have the code, take a look yourself and maybe fix it.
s
... seriously?
I'm asking for help because I was redirected here from #reflect ... I have never touched kotlin source code, I'm asking if this is a bug.
k
this channel is for working with the kotlin source. what is your usecase?
s
there are reasons to use classes in the source without modifying the source..
i was requesting to know whether this was expected behaviour
k
that's hard to tell. A NPE is rarely intended. I would checkout the source and take a look. Otherwise file an issue on youtrack.
s
how can I get a KtFile?
k
you should be able to call
ktElement.containingKtFile
s
do I need some other library added to my project?
Copy code
buildscript {
    ext.kotlin_version = '1.1.50'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

group 'kt.addmodifier'
version '1.0-SNAPSHOT'

apply plugin: 'kotlin'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}