Minor: extract constant
This commit is contained in:
+3
@@ -12,6 +12,9 @@ sealed class AnnotatedElementDescriptor(val classFqName: String) {
|
||||
}
|
||||
|
||||
class Constructor(classFqName: String) : AnnotatedElementDescriptor(classFqName) {
|
||||
companion object {
|
||||
const val METHOD_NAME = "<init>"
|
||||
}
|
||||
// use referential equality
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ class KotlinAnnotationProvider(annotationsReader: Reader) {
|
||||
ANNOTATED_METHOD -> {
|
||||
val name = elementName ?: throw AssertionError("Name for method must be provided")
|
||||
|
||||
if ("<init>" == name)
|
||||
if (AnnotatedElementDescriptor.Constructor.METHOD_NAME == name)
|
||||
AnnotatedElementDescriptor.Constructor(classFqName)
|
||||
else
|
||||
AnnotatedElementDescriptor.Method(classFqName, name)
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class AnnotationListParseTest {
|
||||
when (element) {
|
||||
is AnnotatedElementDescriptor.Method -> actualAnnotations.append(' ').append(element.methodName)
|
||||
is AnnotatedElementDescriptor.Field -> actualAnnotations.append(' ').append(element.fieldName)
|
||||
is AnnotatedElementDescriptor.Constructor -> actualAnnotations.append(" <init>")
|
||||
is AnnotatedElementDescriptor.Constructor -> actualAnnotations.append(" ${AnnotatedElementDescriptor.Constructor.METHOD_NAME}")
|
||||
is AnnotatedElementDescriptor.Class -> {}
|
||||
}
|
||||
actualAnnotations.append('\n')
|
||||
|
||||
Reference in New Issue
Block a user