Minor: make variables initialized in defineClass lateinit instead of nullable.
This commit is contained in:
+3
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,7 +42,7 @@ abstract class ClassNameCollectionClassBuilderFactory(
|
||||
|
||||
override fun getDelegate() = _delegate
|
||||
|
||||
private var classInternalName: String? = null
|
||||
private lateinit var classInternalName: String
|
||||
|
||||
override fun defineClass(origin: PsiElement?, version: Int, access: Int, name: String, signature: String?, superName: String, interfaces: Array<out String>) {
|
||||
classInternalName = name
|
||||
@@ -50,9 +50,7 @@ abstract class ClassNameCollectionClassBuilderFactory(
|
||||
}
|
||||
|
||||
override fun done() {
|
||||
if (classInternalName != null) {
|
||||
handleClashingNames(classInternalName!!, classCreatedFor)
|
||||
}
|
||||
handleClashingNames(classInternalName, classCreatedFor)
|
||||
super.done()
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ abstract class SignatureCollectingClassBuilderFactory(
|
||||
|
||||
protected abstract fun handleClashingSignatures(data: ConflictingJvmDeclarationsData)
|
||||
protected abstract fun onClassDone(classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String?,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>)
|
||||
|
||||
override fun newClassBuilder(origin: JvmDeclarationOrigin): DelegatingClassBuilder {
|
||||
@@ -46,7 +46,7 @@ abstract class SignatureCollectingClassBuilderFactory(
|
||||
|
||||
override fun getDelegate() = _delegate
|
||||
|
||||
private var classInternalName: String? = null
|
||||
private lateinit var classInternalName: String
|
||||
|
||||
private val signatures = LinkedMultiMap<RawSignature, JvmDeclarationOrigin>()
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -91,7 +91,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
|
||||
override fun onClassDone(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String?,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
reportDiagnosticsTasks.add { reportClashingSignaturesInHierarchy(classOrigin, classInternalName, signatures) }
|
||||
@@ -99,7 +99,7 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
|
||||
private fun reportClashingSignaturesInHierarchy(
|
||||
classOrigin: JvmDeclarationOrigin,
|
||||
classInternalName: String?,
|
||||
classInternalName: String,
|
||||
signatures: MultiMap<RawSignature, JvmDeclarationOrigin>
|
||||
) {
|
||||
val descriptor = classOrigin.descriptor
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.resolve.jvm.diagnostics
|
||||
|
||||
class ConflictingJvmDeclarationsData(
|
||||
val classInternalName: String?,
|
||||
val classInternalName: String,
|
||||
val classOrigin: JvmDeclarationOrigin,
|
||||
val signature: RawSignature,
|
||||
val signatureOrigins: Collection<JvmDeclarationOrigin>
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -101,9 +101,9 @@ abstract class AnnotationCollectorExtensionBase(val supportInheritedAnnotations:
|
||||
}
|
||||
}
|
||||
|
||||
private var currentClassSimpleName: String? = null
|
||||
private lateinit var currentClassSimpleName: String
|
||||
|
||||
private var currentPackageName: String? = null
|
||||
private lateinit var currentPackageName: String
|
||||
|
||||
override fun getVisitor() = classVisitor
|
||||
|
||||
@@ -184,13 +184,13 @@ abstract class AnnotationCollectorExtensionBase(val supportInheritedAnnotations:
|
||||
|
||||
try {
|
||||
val annotationId = shortenedAnnotationCache.save(annotationFqName, writer)
|
||||
val packageName = this.currentPackageName!!
|
||||
val packageName = this.currentPackageName
|
||||
|
||||
val packageNameId = if (!packageName.isEmpty())
|
||||
shortenedPackageNameCache.save(packageName, writer)
|
||||
else null
|
||||
|
||||
val className = this.currentClassSimpleName!!
|
||||
val className = this.currentClassSimpleName
|
||||
val outputClassName = getOutputClassName(packageNameId, className)
|
||||
val elementName = if (name != null) " $name" else ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user