Make ClassDescriptor#classId nullable
Local classes or anonymous objects do not have a class id. Use "!!" almost everywhere to make assertion explicit
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ class MissingDependencyClassChecker : CallChecker {
|
||||
|
||||
fun consider(classDescriptor: ClassDescriptor) {
|
||||
if (classDescriptor is NotFoundClasses.MockClassDescriptor) {
|
||||
result.add(classDescriptor.classId)
|
||||
result.add(classDescriptor.classId!!)
|
||||
return
|
||||
}
|
||||
(classDescriptor.containingDeclaration as? ClassDescriptor)?.let(::consider)
|
||||
|
||||
+3
-3
@@ -73,11 +73,11 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker {
|
||||
fileAnnotationsToCheck.add(Pair(entry, classDescriptor))
|
||||
}
|
||||
|
||||
if (!fileAnnotationsToCheck.any { it.second.classId.asSingleFqName() == JvmFileClassUtil.JVM_MULTIFILE_CLASS }) return
|
||||
if (!fileAnnotationsToCheck.any { it.second.classId?.asSingleFqName() == JvmFileClassUtil.JVM_MULTIFILE_CLASS }) return
|
||||
|
||||
for ((entry, classDescriptor) in fileAnnotationsToCheck) {
|
||||
val classFqName = classDescriptor.classId.asSingleFqName()
|
||||
if (ALWAYS_APPLICABLE.contains(classFqName)) continue
|
||||
val classFqName = classDescriptor.classId!!.asSingleFqName()
|
||||
if (classFqName in ALWAYS_APPLICABLE) continue
|
||||
if (classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) {
|
||||
trace.report(ErrorsJvm.ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES.on(entry, classFqName))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user