Fix annotations on Java elements in reflection

#KT-10840 Fixed
This commit is contained in:
Alexander Udalov
2016-01-28 16:38:51 +03:00
parent b946d725d7
commit 2a5b4d2c83
6 changed files with 45 additions and 5 deletions
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.load.java.structure.JavaElement
import org.jetbrains.kotlin.load.java.structure.reflect.ReflectJavaElement
object RuntimeSourceElementFactory : JavaSourceElementFactory {
private class RuntimeSourceElement(override val javaElement: ReflectJavaElement) : JavaSourceElement {
class RuntimeSourceElement(override val javaElement: ReflectJavaElement) : JavaSourceElement {
override fun toString() = javaClass.name + ": " + javaElement.toString()
override fun getContainingFile(): SourceFile = SourceFile.NO_SOURCE_FILE
}
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.load.java.structure.JavaAnnotationArgument
import org.jetbrains.kotlin.name.Name
import java.lang.reflect.Method
class ReflectJavaAnnotation(private val annotation: Annotation) : ReflectJavaElement(), JavaAnnotation {
class ReflectJavaAnnotation(val annotation: Annotation) : ReflectJavaElement(), JavaAnnotation {
override fun findArgument(name: Name): JavaAnnotationArgument? {
return getArgumentValue(annotation.annotationClass.java.getDeclaredMethod(name.asString()))
}