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:
Alexander Udalov
2016-10-14 14:29:05 +03:00
parent 17e54b6d2d
commit 0e9f29fdba
9 changed files with 22 additions and 22 deletions
@@ -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)
@@ -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))
}