Replace assert with lazy assert, times with repeat.
This commit is contained in:
@@ -93,7 +93,7 @@ public object JarUserDataManager {
|
||||
private fun storeUserData(counter: JarBooleanPropertyCounter, localJarFile: VirtualFile,
|
||||
hasFileWithProperty: Boolean?, timestamp: Long? = null) {
|
||||
assert(localJarFile.isInLocalFileSystem)
|
||||
assert((timestamp == null) == (hasFileWithProperty == null), "Using empty timestamp is only allowed for storing not counted value")
|
||||
assert((timestamp == null) == (hasFileWithProperty == null)) { "Using empty timestamp is only allowed for storing not counted value" }
|
||||
|
||||
localJarFile.putUserData(counter.key,
|
||||
PropertyData(hasFileWithProperty, timestamp ?: localJarFile.timeStamp))
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
private val psiManager: PsiManager = PsiManager.getInstance(project)
|
||||
|
||||
override fun getContextForPackage(files: Collection<JetFile>): LightClassConstructionContext {
|
||||
assert(!files.isEmpty(), "No files in package")
|
||||
assert(!files.isEmpty()) { "No files in package" }
|
||||
|
||||
return getContextForFiles(files)
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class IDELightClassGenerationSupport(private val project: Project) : Ligh
|
||||
}
|
||||
|
||||
override fun getContextForFacade(files: Collection<JetFile>): LightClassConstructionContext {
|
||||
assert(!files.isEmpty(), "No files in facade")
|
||||
assert(!files.isEmpty()) { "No files in facade" }
|
||||
|
||||
return getContextForFiles(files)
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ internal class ProjectResolutionFacade(
|
||||
}, false)
|
||||
|
||||
fun getAnalysisResultsForElements(elements: Collection<JetElement>): AnalysisResult {
|
||||
assert(elements.isNotEmpty(), "elements collection should not be empty")
|
||||
assert(elements.isNotEmpty()) { "elements collection should not be empty" }
|
||||
val slruCache = synchronized(analysisResults) {
|
||||
analysisResults.getValue()!!
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ private fun Project.getOrCreateElementsToShorten(): MutableSet<ShorteningRequest
|
||||
}
|
||||
|
||||
public fun JetElement.addToShorteningWaitSet(options: Options = Options.DEFAULT) {
|
||||
assert (ApplicationManager.getApplication()!!.isWriteAccessAllowed(), "Write access needed")
|
||||
assert(ApplicationManager.getApplication()!!.isWriteAccessAllowed()) { "Write access needed" }
|
||||
val project = getProject()
|
||||
val elementPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(this)
|
||||
project.getOrCreateElementsToShorten().add(ShorteningRequest(elementPointer, options))
|
||||
|
||||
+1
-2
@@ -132,8 +132,7 @@ private class ClassClsStubBuilder(
|
||||
if (!isClass() || !classProto.hasPrimaryConstructor()) return
|
||||
val primaryConstructorProto = classProto.getPrimaryConstructor()
|
||||
|
||||
assert(classProto.getPrimaryConstructor().hasData(),
|
||||
"Primary constructor in class is always non-default, so data should not be empty")
|
||||
assert(classProto.getPrimaryConstructor().hasData()) { "Primary constructor in class is always non-default, so data should not be empty" }
|
||||
|
||||
createCallableStub(classOrObjectStub, primaryConstructorProto.getData(), c, ProtoContainer(classProto, null, c.nameResolver))
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class KotlinSuppressIntentionAction(
|
||||
|
||||
private fun suppressAtExpression(caretBox: CaretBox<JetExpression>, id: String) {
|
||||
val suppressAt = caretBox.expression
|
||||
assert(suppressAt !is JetDeclaration, "Declarations should have been checked for above")
|
||||
assert(suppressAt !is JetDeclaration) { "Declarations should have been checked for above" }
|
||||
|
||||
val parentheses = JetPsiPrecedences.getPrecedence(suppressAt) > JetPsiPrecedences.PRECEDENCE_OF_PREFIX_EXPRESSION
|
||||
val placeholderText = "PLACEHOLDER_ID"
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class BuiltInsReferenceResolver(val project: Project, val startupManager:
|
||||
}
|
||||
|
||||
private fun initialize() {
|
||||
assert(moduleDescriptor == null, "Attempt to initialize twice")
|
||||
assert(moduleDescriptor == null) { "Attempt to initialize twice" }
|
||||
|
||||
val jetBuiltInsFiles = getJetBuiltInsFiles()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user