Add inspection and quick-fix to remove empty parentheses in annotation entries
This commit is contained in:
committed by
Mikhail Glukhikh
parent
e903b2f92a
commit
793cac02e8
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.RemoveEmptyParenthesesFromAnnotationEntryInspection
|
||||
idea/testData/inspectionsLocal/removeEmptyParenthesesFromAnnotationEntry/allParameterHaveDefaults.kt
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
annotation class MyAnnotation(val x: Int = 10)
|
||||
|
||||
@MyAnnotation(<caret>)
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
annotation class MyAnnotation(val x: Int = 10)
|
||||
|
||||
@MyAnnotation
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class MyAnnotation
|
||||
|
||||
fun test() {
|
||||
val x = @MyAnnotation(<caret>) 5
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class MyAnnotation
|
||||
|
||||
fun test() {
|
||||
val x = @MyAnnotation 5
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
annotation class MyAnnotation
|
||||
|
||||
@MyAnnotation(
|
||||
<caret>
|
||||
)
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
annotation class MyAnnotation
|
||||
|
||||
@MyAnnotation
|
||||
fun test() {
|
||||
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// PROBLEM: none
|
||||
// ERROR: No value passed for parameter 'x'
|
||||
annotation class MyAnnotation(val x: Int)
|
||||
|
||||
// there is an error but the inspection is not triggered because parentheses are needed in the end
|
||||
@MyAnnotation(<caret>)
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
annotation class MyAnnotation
|
||||
|
||||
@MyAnnotation(<caret>)
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
annotation class MyAnnotation
|
||||
|
||||
@MyAnnotation
|
||||
fun test() {
|
||||
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
public @interface MyJavaAnnotation {}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
@MyJavaAnnotation(<caret>)
|
||||
fun test() {
|
||||
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
@MyJavaAnnotation
|
||||
fun test() {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user