aboutsummaryrefslogtreecommitdiff
path: root/compiler-plugin/testData/api/annotationValue_kt.kt
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-plugin/testData/api/annotationValue_kt.kt')
-rw-r--r--compiler-plugin/testData/api/annotationValue_kt.kt73
1 files changed, 73 insertions, 0 deletions
diff --git a/compiler-plugin/testData/api/annotationValue_kt.kt b/compiler-plugin/testData/api/annotationValue_kt.kt
new file mode 100644
index 00000000..28c28772
--- /dev/null
+++ b/compiler-plugin/testData/api/annotationValue_kt.kt
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2020 Google LLC
+ * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// WITH_RUNTIME
+// TEST PROCESSOR: AnnotationArgumentProcessor
+// EXPECTED:
+// defaultInNested
+// Str
+// 42
+// Foo
+// File
+// Local
+// Array
+// @Foo
+// @Suppress
+// G
+// ONE
+// 31
+// Throws
+// END
+// FILE: a.kt
+
+enum class RGB {
+ R, G, B
+}
+
+class ThrowsClass {
+ @Throws(Exception::class)
+ protected open fun throwsException() {
+ }
+}
+
+annotation class Foo(val s: Int) {
+ annotation class Nested(val nestedDefault:String = "defaultInNested")
+}
+
+annotation class Bar(
+ val argStr: String,
+ val argInt: Int,
+ val argClsUser: kotlin.reflect.KClass<*>,
+ val argClsLib: kotlin.reflect.KClass<*>,
+ val argClsLocal: kotlin.reflect.KClass<*>,
+ val argClsArray: kotlin.reflect.KClass<*>,
+ val argAnnoUser: Foo,
+ val argAnnoLib: Suppress,
+ val argEnum: RGB,
+ val argJavaNum: JavaEnum,
+ val argDef: Int = 31
+)
+
+fun Fun() {
+ @Foo.Nested
+ @Bar("Str", 40 + 2, Foo::class, java.io.File::class, Local::class, Array<String>::class, Foo(17), Suppress("name1", "name2"), RGB.G, JavaEnum.ONE)
+ class Local
+}
+
+// FILE: JavaEnum.java
+
+enum JavaEnum { ONE, TWO, THREE }