path
stringlengths
4
280
owner
stringlengths
2
39
repo_id
int64
21.1k
756M
is_fork
bool
2 classes
languages_distribution
stringlengths
12
2.44k
content
stringlengths
6
6.29M
issues
float64
0
10k
main_language
stringclasses
128 values
forks
int64
0
54.2k
stars
int64
0
157k
commit_sha
stringlengths
40
40
size
int64
6
6.29M
name
stringlengths
1
100
license
stringclasses
104 values
compiler/testData/codegen/box/casts/castToDefinitelyNotNullType.kt
JetBrains
3,432,266
false
{"Kotlin": 74444760, "Java": 6669398, "Swift": 4261253, "C": 2620837, "C++": 1953730, "Objective-C": 640870, "Objective-C++": 170766, "JavaScript": 135724, "Python": 48402, "Shell": 30960, "TypeScript": 22754, "Lex": 18369, "Groovy": 17273, "Batchfile": 11693, "CSS": 11368, "Ruby": 10470, "EJS": 5241, "Dockerfile": 5136, "HTML": 5073, "CMake": 4448, "Pascal": 1698, "FreeMarker": 1393, "Roff": 725, "LLVM": 395, "Scala": 80}
// !LANGUAGE: +DefinitelyNonNullableTypes // IGNORE_BACKEND: JS // IGNORE_BACKEND: JS_IR, JS_IR_ES6 // IGNORE_BACKEND: WASM fun <T> test(t: T) = t as (T & Any) fun box(): String = try { test<Any?>(null) "FAIL: expected NPE" } catch (ex: NullPointerException) { test("OK") }
166
Kotlin
5,771
46,772
bef0946ab7e5acd5b24b971eca532c43c8eba750
311
kotlin
Apache License 2.0
app/src/main/java/com/mateuszkoslacz/movipershowcase/viper/login/LoginContract.kt
mkoslacz
88,354,834
false
null
package com.mateuszkoslacz.movipershowcase.viper.login import android.app.Activity import com.hannesdorfmann.mosby.mvp.MvpView import com.mateuszkoslacz.moviper.iface.interactor.ViperRxInteractor import com.mateuszkoslacz.moviper.iface.routing.ViperRxRouting import com.mateuszkoslacz.movipershowcase.data.LoginBundle import com.mateuszkoslacz.movipershowcase.data.UserModel import io.reactivex.Observable import io.reactivex.Single interface LoginContract { interface View : MvpView { val loginClicks: Observable<LoginBundle> val helpClicks: Observable<Any> fun showLoading() fun showError(error: Throwable) } interface Interactor : ViperRxInteractor { fun performLogin(loginBundle: LoginBundle): Single<UserModel> } interface Routing : ViperRxRouting<Activity> { fun goToHelpScreen() fun goToProfileScreen(user: UserModel) fun finish() } }
0
Kotlin
0
9
b9aa20e0cdfc318070f25321edda49f9fd4c0115
936
MoviperShowcase
Apache License 2.0
nj2k/src/org/jetbrains/kotlin/nj2k/conversions/NonCodeElementsConversion.kt
android
263,405,600
true
null
/* * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.nj2k.conversions import org.jetbrains.kotlin.nj2k.NewJ2kConverterContext import org.jetbrains.kotlin.nj2k.tree.JKClass import org.jetbrains.kotlin.nj2k.tree.JKTreeElement class NonCodeElementsConversion(context: NewJ2kConverterContext) : RecursiveApplicableConversionBase(context) { override fun applyToElement(element: JKTreeElement): JKTreeElement { when (element) { is JKClass -> { element.name.leadingComments += element.inheritance.trailingComments element.inheritance.trailingComments.clear() } } return recurse(element) } }
15
Kotlin
37
316
74126637a097f5e6b099a7b7a4263468ecfda144
860
kotlin
Apache License 2.0
src/main/kotlin/edu/stanford/cfuller/imageanalysistools/filter/MaskFilter.kt
cjfuller
4,823,440
false
null
package edu.stanford.cfuller.imageanalysistools.filter import edu.stanford.cfuller.imageanalysistools.image.WritableImage import edu.stanford.cfuller.imageanalysistools.image.ImageCoordinate /** * A Filter that applies a mask to an Image. A mask is any Image that has nonzero pixel values in regions and zero pixel * values elsewhere. * * * The reference Image should be set to the mask that will be applied. This will not be modified. * * * The argument to the apply method should be the Image that will be masked by the reference Image. The masking operation will leave * the Image unchanged except for setting to zero any pixel that has a zero value in the mask. * @author <NAME> */ class MaskFilter : Filter() { /** * Applies the MaskFilter to a given Image. * @param im The Image that will be masked by the reference Image. */ override fun apply(im: WritableImage) { val referenceImage = this.referenceImage ?: throw ReferenceImageRequiredException("MaskFilter requires a reference image.") im.asSequence() .filter { referenceImage.getValue(it) == 0f } .forEach { im.setValue(it, 0f) } } }
14
Kotlin
0
3
f05bcc696d2be038fa2af8cf886160b75e147112
1,199
imageanalysistools
Apache License 2.0
app/src/main/java/com/nlx/ggstreams/chat/adapter/MessageViewHolder.kt
slx-apps
121,867,069
false
null
package com.nlx.ggstreams.chat.adapter import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import android.view.View import com.nlx.ggstreams.R import com.nlx.ggstreams.models.GGMessage import kotlinx.android.synthetic.main.row_chat_message.view.* class MessageViewHolder(itemView: View) : androidx.recyclerview.widget.RecyclerView.ViewHolder(itemView) { private lateinit var message: GGMessage fun bind(message: GGMessage) { this.message = message setMessage(message.text) setFrom(message.userName, message.color) } fun setMessage(message: CharSequence?) { if (message == null) return itemView.tvText.text = message } private fun setFrom(user: String, color: String) { when (color) { "simple" -> itemView.tvFrom.setTextColor( ContextCompat.getColor(itemView.context, R.color.silver)) "silver" -> itemView.tvFrom.setTextColor( ContextCompat.getColor(itemView.context, R.color.silver)) "gold" -> itemView.tvFrom.setTextColor( ContextCompat.getColor(itemView.context, R.color.gold)) "premium-personal" -> itemView.tvFrom.setTextColor( ContextCompat.getColor(itemView.context, R.color.premium)) } if (user.isEmpty()) { itemView.tvFrom.text = "" } else { itemView.tvFrom.text = user } } }
0
Kotlin
0
0
db528be8c7701c621f3dcea3c492807a0f174fb7
1,492
ggstreams
MIT License
src/test/kotlin/com/terraformation/backend/seedbank/db/accessionStore/AccessionStoreBagTest.kt
terraware
323,722,525
false
{"Kotlin": 3707833, "HTML": 88820, "Python": 46278, "FreeMarker": 16407, "PLpgSQL": 3305, "Makefile": 746, "Dockerfile": 674}
package com.terraformation.backend.seedbank.db.accessionStore import com.terraformation.backend.db.seedbank.AccessionId import com.terraformation.backend.db.seedbank.BagId import com.terraformation.backend.db.seedbank.tables.pojos.BagsRow import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test internal class AccessionStoreBagTest : AccessionStoreTest() { @Test fun `bag numbers are not shared between accessions`() { val payload = accessionModel(bagNumbers = setOf("bag 1", "bag 2")) store.create(payload) store.create(payload) val initialBags = bagsDao.fetchByAccessionId(AccessionId(1)).toSet() val secondBags = bagsDao.fetchByAccessionId(AccessionId(2)).toSet() assertNotEquals(initialBags, secondBags) } @Test fun `bags are inserted and deleted as needed`() { val initial = store.create(accessionModel(bagNumbers = setOf("bag 1", "bag 2"))) val initialBags = bagsDao.fetchByAccessionId(AccessionId(1)) // Insertion order is not defined by the API, so don't assume bag ID 1 is "bag 1". assertEquals(setOf(BagId(1), BagId(2)), initialBags.map { it.id }.toSet(), "Initial bag IDs") assertEquals( setOf("bag 1", "bag 2"), initialBags.map { it.bagNumber }.toSet(), "Initial bag numbers") val desired = initial.copy(bagNumbers = setOf("bag 2", "bag 3")) store.update(desired) val updatedBags = bagsDao.fetchByAccessionId(AccessionId(1)) assertTrue(BagsRow(BagId(3), AccessionId(1), "bag 3") in updatedBags, "New bag inserted") assertTrue(updatedBags.none { it.bagNumber == "bag 1" }, "Missing bag deleted") assertEquals( initialBags.filter { it.bagNumber == "bag 2" }, updatedBags.filter { it.bagNumber == "bag 2" }, "Existing bag is not replaced") } }
9
Kotlin
1
9
ab6fbb71381d0eda0684e9d06aa68004d9718b05
1,914
terraware-server
Apache License 2.0
app/src/main/java/com/sunnyweather/sunnyweatherv1/ui/weather/WeatherActivity.kt
imheardev
436,436,514
false
{"Kotlin": 26050}
package com.sunnyweather.sunnyweatherv1.ui.weather import android.content.Context import android.graphics.Color import android.os.Build import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.inputmethod.InputMethodManager import android.widget.ImageView import android.widget.TextView import androidx.core.view.GravityCompat import androidx.drawerlayout.widget.DrawerLayout import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import com.sunnyweather.sunnyweatherv1.R import com.sunnyweather.sunnyweatherv1.databinding.ActivityWeatherBinding import com.sunnyweather.sunnyweatherv1.logic.model.Weather import com.sunnyweather.sunnyweatherv1.logic.model.getSky import com.sunnyweather.sunnyweatherv1.logic.showToast import java.text.SimpleDateFormat import java.util.* class WeatherActivity : AppCompatActivity() { private lateinit var binding:ActivityWeatherBinding val viewModel by lazy { ViewModelProvider(this).get(WeatherViewModel::class.java) } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding = ActivityWeatherBinding.inflate(layoutInflater) if(Build.VERSION.SDK_INT > Build.VERSION_CODES.Q){ window.setDecorFitsSystemWindows(false) }else{ window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN window.statusBarColor = Color.TRANSPARENT } setContentView(binding.root) binding.now.navBtn.setOnClickListener { binding.drawerLayout.openDrawer(GravityCompat.START) } binding.drawerLayout.addDrawerListener(object :DrawerLayout.DrawerListener{ override fun onDrawerStateChanged(newState: Int) {} override fun onDrawerSlide(drawerView: View, slideOffset: Float) {} override fun onDrawerOpened(drawerView: View) {} override fun onDrawerClosed(drawerView: View) { val manager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager manager.hideSoftInputFromWindow(drawerView.windowToken, InputMethodManager.HIDE_NOT_ALWAYS) } }) if(viewModel.locationLng.isEmpty()){ // TODO no magical word,参数名应定义在model中,取参用语法:${model.常量名},避免输入错误参数名问题 viewModel.locationLng = intent.getStringExtra("location_lng")?:"" } if(viewModel.locationLat.isEmpty()){ viewModel.locationLat = intent.getStringExtra("location_lat")?:"" } if(viewModel.placeName.isEmpty()){ viewModel.placeName = intent.getStringExtra("place_name")?:"" } viewModel.weatherLiveData.observe(this, Observer { result -> val weather = result.getOrNull() if(weather != null){ showWeatherInfo(weather) }else{ "无法成功获取天气信息".showToast() result.exceptionOrNull()?.printStackTrace() } binding.swipeRefresh.isRefreshing = false }) binding.swipeRefresh.setColorSchemeResources(R.color.colorPrimary) refreshWeather() binding.swipeRefresh.setOnRefreshListener { refreshWeather() } } fun refreshWeather(){ viewModel.refreshWeather(viewModel.locationLng,viewModel.locationLat) binding.swipeRefresh.isRefreshing = true } private fun showWeatherInfo(weather: Weather){ binding.now.placeName.text = viewModel.placeName val realtime = weather.realtime val daily = weather.daily // 填充now.xml布局中的数据 val currentTempText = "${realtime.temperature.toInt()} ℃" binding.now.currentTemp.text = currentTempText binding.now.currentSky.text = getSky(realtime.skycon).info // TODO 这里应使用消息模板,no magical word val currentPM25Text = "空气指数 ${realtime.airQuality.aqi.chn.toInt()}" binding.now.currentAQI.text = currentPM25Text binding.now.nowLayout.setBackgroundResource(getSky(realtime.skycon).bg) // 填充forecat.xml布局中的数据 binding.forecast.forecastLayout.removeAllViews() val days = daily.skycon.size for (i in 0 until days){ val skycon = daily.skycon[i] val temperature = daily.temperature[i] val view = LayoutInflater.from(this).inflate(R.layout.forecast_item, binding.forecast.forecastLayout,false) // TODO 这里如何使用视图绑定写法替换,难点:在activity中取得其他activity的绑定视图 val dateInfo = view.findViewById(R.id.dateInfo) as TextView val skyIcon = view.findViewById(R.id.skyIcon) as ImageView val skyInfo = view.findViewById(R.id.skyInfo) as TextView val temperatureInfo = view.findViewById(R.id.temperatureInfo) as TextView val simpleDateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) dateInfo.text = simpleDateFormat.format(skycon.date) val sky = getSky(skycon.value) skyIcon.setImageResource(sky.icon) skyInfo.text = sky.info val tempText = "${temperature.min.toInt()} ~ ${temperature.max.toInt()} ℃" temperatureInfo.text = tempText binding.forecast.forecastLayout.addView(view) } // 填充life_index.xml布局中的数据 val lifeIndex = daily.lifeIndex binding.lifeIndex.coldRiskText.text = lifeIndex.coldRisk[0].desc binding.lifeIndex.dressingText.text = lifeIndex.dressing[0].desc binding.lifeIndex.ultravioletText.text = lifeIndex.ultraviolet[0].desc binding.lifeIndex.carWashingText.text = lifeIndex.carWashing[0].desc binding.weatherLayout.visibility = View.VISIBLE } fun closeDrawers() { binding.drawerLayout.closeDrawers() } }
0
Kotlin
0
0
b786f48b471b5ca131a87d7fe36f2d00fd854480
6,180
SunnyWeatherV1
Apache License 2.0
app/src/main/java/com/kshitijpatil/tazabazar/ui/common/LoadImageDelegate.kt
Kshitij09
395,308,440
false
null
package com.kshitijpatil.tazabazar.ui.common import android.widget.ImageView import coil.load import coil.request.CachePolicy import com.kshitijpatil.tazabazar.R interface LoadImageDelegate { fun load(imageView: ImageView, imageUri: String) } class CoilProductLoadImageDelegate : LoadImageDelegate { override fun load(imageView: ImageView, imageUri: String) { imageView.load(imageUri) { placeholder(R.drawable.product_preview_placeholder) error(R.drawable.product_preview_placeholder) memoryCachePolicy(CachePolicy.ENABLED) memoryCacheKey(imageUri) } } }
8
Kotlin
2
1
d709b26d69cf46c3d6123a217190f098b79a6562
634
TazaBazar
Apache License 2.0
android/app/src/main/kotlin/com/example/FlutterWeather/MainActivity.kt
Mwita04
410,277,754
true
{"Dart": 45629, "Swift": 404, "Kotlin": 131, "Objective-C": 38}
package com.example.FlutterWeather import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { }
0
Dart
0
0
6d5d12d12fe89c0c67ed6bf17abd0089e05b5bba
131
FlutterWeather
MIT License
core/designsystem/src/commonMain/kotlin/io/spherelabs/designsystem/passwordcard/LKPasswordCardDefaults.kt
getspherelabs
687,455,894
false
{"Kotlin": 917584, "Ruby": 6814, "Swift": 1128, "Shell": 1048}
package io.spherelabs.designsystem.passwordcard import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.TextUnit object LKPasswordCardDefaults { @Composable fun passwordCardColor( backgroundColor: Color = LKPasswordCardTokens.backgroundColor, copyBackgroundColor: Color = LKPasswordCardTokens.copyBackgroundColor, copyColor: Color = LKPasswordCardTokens.copyColor, emailColor: Color = LKPasswordCardTokens.emailColor, passwordColor: Color = LKPasswordCardTokens.passwordColor, titleColor: Color = LKPasswordCardTokens.titleColor ): LKPasswordCardColor { return LKPasswordCardColor( backgroundColor = backgroundColor, copyBackgroundColor = copyBackgroundColor, copyColor = copyColor, emailColor = emailColor, passwordColor = passwordColor, titleColor = titleColor) } @Composable fun passwordCardStyle( titleFontFamily: FontFamily = LKPasswordCardTokens.titleFontFamily, emailFontFamily: FontFamily = LKPasswordCardTokens.emailFontFamily, passwordFontFamily: FontFamily = LKPasswordCardTokens.passwordFontFamily, copyFontFamily: FontFamily = LKPasswordCardTokens.copyFontFamily, emailFontSize: TextUnit = LKPasswordCardTokens.emailFontSize, passwordFontSize: TextUnit = LKPasswordCardTokens.passwordFontSize, copyFontSize: TextUnit = LKPasswordCardTokens.copyFontSize, titleFontSize: TextUnit = LKPasswordCardTokens.titleFontSize, cardCornerShape: Dp = LKPasswordCardTokens.cardCornerShape, ): LKPasswordCardStyle { return LKPasswordCardStyle( titleFontFamily = titleFontFamily, emailFontFamily = emailFontFamily, passwordFontFamily = passwordFontFamily, copyFontFamily = copyFontFamily, emailFontSize = emailFontSize, passwordFontSize = passwordFontSize, copyFontSize = copyFontSize, titleFontSize = titleFontSize, cardCornerShape = cardCornerShape) } }
18
Kotlin
24
188
902a0505c5eaf0f3848a5e06afaec98c1ed35584
2,135
anypass-kmp
Apache License 2.0
app/src/main/java/com/ifanr/tangzhi/ext/Single.kt
cyrushine
224,551,311
false
{"Kotlin": 673925, "Java": 59856, "Python": 795}
package com.ifanr.tangzhi.ext import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.MutableLiveData import com.ifanr.tangzhi.ui.base.BaseViewModel import com.ifanr.tangzhi.ui.base.autoDispose import com.ifanr.tangzhi.ui.widgets.dismissLoading import com.ifanr.tangzhi.ui.widgets.showLoading import com.ifanr.tangzhi.util.LoadingState import com.uber.autodispose.android.lifecycle.autoDispose import io.reactivex.Completable import io.reactivex.Single import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers fun <T> Single<T>.ioTask( vm: BaseViewModel, loadingState: MutableLiveData<LoadingState>? = null, loadingDelay: Boolean = true ) = subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnSubscribe { if (loadingState != null) loadingState.value = if (loadingDelay) LoadingState.SHOW_DELAY else LoadingState.SHOW } .doAfterTerminate { if (loadingState != null) loadingState.value = LoadingState.DISMISS } .autoDispose(vm) fun <T> Single<T>.ioTask(activity: AppCompatActivity) = subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnSubscribe { activity.showLoading() } .doAfterTerminate { activity.dismissLoading() } .autoDispose(activity)
0
Kotlin
0
0
ab9a7a2eba7f53eca918e084da9d9907f7997cee
1,366
tangzhi_android
Apache License 2.0
src/main/java/com/andres_k/lib/library/utils/config/PdfContext.kt
Draym
319,586,872
false
{"Kotlin": 221870}
package com.andres_k.lib.library.utils.config import com.andres_k.lib.library.core.property.Box2d import org.apache.pdfbox.pdmodel.PDPageContentStream /** * Created on 2020/07/20. * * @author <NAME> */ data class PdfContext( val properties: PdfProperties, private val stream: PDPageContentStream?, val page: PdfPageProperties, val viewBody: Box2d, val debug: PdfDebugContext ) { fun stream(): PDPageContentStream { if (stream == null) { throw IllegalArgumentException("[PdfContext] Stream is only available within the draw process") } return stream } }
0
Kotlin
0
1
5084ca91cf25328afa3238abc19d1f0e3c095fe1
629
PDF-Flex
MIT License
src/main/kotlin/platform/mixin/handlers/MixinAnnotationHandler.kt
minecraft-dev
42,327,118
false
null
/* * Minecraft Dev for IntelliJ * * https://minecraftdev.org * * Copyright (c) 2023 minecraft-dev * * MIT License */ package com.demonwav.mcdev.platform.mixin.handlers import com.demonwav.mcdev.platform.mixin.handlers.injectionPoint.InsnResolutionInfo import com.demonwav.mcdev.platform.mixin.util.MixinConstants import com.demonwav.mcdev.platform.mixin.util.MixinTargetMember import com.demonwav.mcdev.platform.mixin.util.mixinTargets import com.demonwav.mcdev.util.findAnnotation import com.demonwav.mcdev.util.findContainingClass import com.demonwav.mcdev.util.resolveClass import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.extensions.RequiredElement import com.intellij.openapi.project.Project import com.intellij.openapi.util.KeyedExtensionCollector import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiElement import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.searches.AnnotatedElementsSearch import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager import com.intellij.psi.util.PsiModificationTracker import com.intellij.serviceContainer.BaseKeyedLazyInstance import com.intellij.util.KeyedLazyInstance import com.intellij.util.xmlb.annotations.Attribute import org.objectweb.asm.tree.ClassNode interface MixinAnnotationHandler { fun resolveTarget(annotation: PsiAnnotation): List<MixinTargetMember> { val containingClass = annotation.findContainingClass() ?: return emptyList() return containingClass.mixinTargets.flatMap { resolveTarget(annotation, it) } } fun resolveTarget(annotation: PsiAnnotation, targetClass: ClassNode): List<MixinTargetMember> fun isUnresolved(annotation: PsiAnnotation): InsnResolutionInfo.Failure? { val containingClass = annotation.findContainingClass() ?: return InsnResolutionInfo.Failure() return containingClass.mixinTargets .mapNotNull { isUnresolved(annotation, it) } .reduceOrNull(InsnResolutionInfo.Failure::combine) } fun isUnresolved(annotation: PsiAnnotation, targetClass: ClassNode): InsnResolutionInfo.Failure? fun resolveForNavigation(annotation: PsiAnnotation): List<PsiElement> { val containingClass = annotation.findContainingClass() ?: return emptyList() return containingClass.mixinTargets.flatMap { resolveForNavigation(annotation, it) } } fun resolveForNavigation(annotation: PsiAnnotation, targetClass: ClassNode): List<PsiElement> fun createUnresolvedMessage(annotation: PsiAnnotation): String? /** * Returns true if we don't actually know the implementation of the annotation, and we're just making * a guess. Prevents unresolved errors but still attempts navigation */ val isSoft: Boolean get() = false /** * Returns whether elements annotated with this annotation should be considered "entry points", * i.e. not reported as unused */ val isEntryPoint: Boolean companion object { private val EP_NAME = ExtensionPointName<KeyedLazyInstance<MixinAnnotationHandler>>( "com.demonwav.minecraft-dev.mixinAnnotationHandler", ) private val COLLECTOR = KeyedExtensionCollector<MixinAnnotationHandler, String>(EP_NAME) fun getBuiltinHandlers(): Sequence<Pair<String, MixinAnnotationHandler>> = EP_NAME.extensions.asSequence().map { it.key to it.instance } fun forMixinAnnotation(qualifiedName: String, project: Project? = null): MixinAnnotationHandler? { val extension = COLLECTOR.findSingle(qualifiedName) if (extension != null) { return extension } if (project != null) { val extraMixinAnnotations = CachedValuesManager.getManager(project).getCachedValue(project) { val result = JavaPsiFacade.getInstance(project) .findClass(MixinConstants.Annotations.ANNOTATION_TYPE, GlobalSearchScope.allScope(project)) ?.let { annotationType -> AnnotatedElementsSearch.searchPsiClasses( annotationType, GlobalSearchScope.allScope(project), ).mapNotNull { injectionInfoClass -> injectionInfoClass.findAnnotation(MixinConstants.Annotations.ANNOTATION_TYPE) ?.findAttributeValue("value") ?.resolveClass() ?.qualifiedName }.toSet() } ?: emptySet() CachedValueProvider.Result(result, PsiModificationTracker.MODIFICATION_COUNT) } if (extraMixinAnnotations != null && qualifiedName in extraMixinAnnotations) { return DefaultInjectorAnnotationHandler } } return null } } } class MixinAnnotationHandlerInfo : BaseKeyedLazyInstance<MixinAnnotationHandler>(), KeyedLazyInstance<MixinAnnotationHandler> { @Attribute("annotation") @RequiredElement lateinit var annotation: String @Attribute("implementation") @RequiredElement lateinit var implementation: String override fun getKey(): String { return annotation } override fun getImplementationClassName(): String { return implementation } }
204
Kotlin
152
1,154
36cc3d47f7f39c847c0ebdcbf84980bc7262dab7
5,575
MinecraftDev
MIT License
compiler/testData/codegen/box/controlStructures/doWhile.kt
JetBrains
3,432,266
false
{"Kotlin": 74444760, "Java": 6669398, "Swift": 4261253, "C": 2620837, "C++": 1953730, "Objective-C": 640870, "Objective-C++": 170766, "JavaScript": 135724, "Python": 48402, "Shell": 30960, "TypeScript": 22754, "Lex": 18369, "Groovy": 17273, "Batchfile": 11693, "CSS": 11368, "Ruby": 10470, "EJS": 5241, "Dockerfile": 5136, "HTML": 5073, "CMake": 4448, "Pascal": 1698, "FreeMarker": 1393, "Roff": 725, "LLVM": 395, "Scala": 80}
fun box(): String { var x = 0 do x++ while (x < 5) if (x != 5) return "Fail 1 $x" var y = 0 do { y++ } while (y < 5) if (y != 5) return "Fail 2 $y" var z = "" do { z += z.length } while (z.length < 5) if (z != "01234") return "Fail 3 $z" return "OK" }
166
Kotlin
5,771
46,772
bef0946ab7e5acd5b24b971eca532c43c8eba750
307
kotlin
Apache License 2.0