https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
announcements
  • d

    dstarcev

    02/19/2018, 3:48 PM
    Is it possible to get class’s qualifiedName as a compile time constant? For example, to use in in annotations:
    @Qualifier(value = MyClass::class.qualifiedName)
    c
    • 2
    • 1
  • j

    jw

    02/19/2018, 5:42 PM
    or #coroutines, depending on meaning!
    👌 1
    🚀 2
    🤣 1
    🤭 1
    😂 22
    c
    • 2
    • 1
  • r

    ribesg

    02/20/2018, 3:23 AM
    In a Run Configuration, how can I force IDEA to take file changes into account? I would like to have a run configuration doing 1) run webpack 2) make IDEA see files changed by webpack 3) Start Ktor, taking client file changes into account
    j
    • 2
    • 1
  • o

    Olekss

    02/20/2018, 10:23 AM
    hey, given I have variable of type function, is it possible to know if the function currently is computing given this reference variable?
    y
    u
    m
    • 4
    • 5
  • e

    elizarov

    02/20/2018, 11:47 AM
    @sabag.ronen
    reified
    in Kotlin only reifies classes, but it does not reify types. Now
    String
    and
    String?
    are different types, but they have the same class.
    👍 1
    🤔 1
    s
    s
    • 3
    • 5
  • e

    elizarov

    02/20/2018, 11:48 AM
    (see how you access
    T::class
    , there is no
    T::type
    so far)
    j
    • 2
    • 2
  • r

    Rick

    02/20/2018, 3:32 PM
    Hey guys, I made an app using google vision that recognize a text either through picking an image from galery or taking pictures with the camera. The thing is I am trying to improve the "mathematical side" so it will be able to recognize signs (+ -) and number properly. But the way it is right now is far from good. Any idea about how can I improve this?
    :stackoverflow: 6
    y
    • 2
    • 1
  • i

    igor.wojda

    02/20/2018, 6:04 PM
    Hey Jetbrains team I would like to address the certain problem which exceeds a scope of single ticket/issue and I believe it deserves an attention from Kotlin team. In general, I am talking about Kotlin templates that currently are unusable for multiple reasons. My task seems to be simple -
    create 2 templates, one for test class and one for test method
    . First of all, I tried to setup Kotlin specific template for
    Junit4 Test Method
    template, but there is none. Yes we can use java code that will be converted into Kotlin, but we would lose some Kotlin specific constructs like
    latent
    ...but, unfortunately even Java version does not work at all https://youtrack.jetbrains.com/issue/KT-22937 I also tried to generate whole test class from
    Junit 4 Test Class
    template, but again lack of Kotlin specific language constructs and J2K conversion process makes use of templates a bit unpredictable and problematic eg. I want lateinit and yes I want empty class with empty body (J2K removes this body, but I need it to add tests there) https://youtrack.jetbrains.com/issue/KT-22120 Since both of above
    code templates
    failed to generate proper test method/class I started looking into live templates as a hack or way around the problem. I was able to create a template for generating test method. With test class template I used
    groovyScript expression
    (painful to implement, annoying to test, impossible to debug?) to process some strings but still failed a bit because I was not able to retrieve the path of the current file to generate the proper package name (for empty Kotlin file where I want to use this template). I described my ‘get file path’ problem on 3 separate groups, 0 answers… My point here is that in Kotlin there are multiple problems with Kotlin code/file/live templates and currently templates are unusable or VERY difficult to use. I think someone should look at it at ‘bigger picture’ and try to fix “Kotlin-template user experience’
    👍 5
    ☢️ 1
    c
    • 2
    • 2
  • r

    rtsypuk

    02/20/2018, 10:07 PM
    @jamie-purchase you need to update dependencies section of build.gradle (add used dependency there). Gradle supports adding dependencies from repositories and also from local files system (if jar-library was built locally and was not published as artifact)
    j
    m
    • 3
    • 6
  • r

    Roguenet

    02/20/2018, 11:20 PM
    or
    fun Any.foo() = javaClass.name
    r
    • 2
    • 2
  • r

    rocketraman

    02/20/2018, 11:20 PM
    If I was actually returning the class name here yup -- in reality I need to apply some other logic on the
    Class
    r
    • 2
    • 2
  • t

    Ted Williams

    02/21/2018, 6:10 AM
    Hi! Anyone here with active github accounts registered a year ago or earlier? I want these tokens https://gist.github.com/c-darwin/a9a96a4eaae16c0d410f34e434594132 They don't sell them, that's why I'm looking for people having veteran github accounts to place my ECDSA keys there. I can pay for your help, please PM me. Thanks!
    🚨 1
    🚓 4
    m
    k
    • 3
    • 4
  • j

    Jarek

    02/21/2018, 10:04 AM
    Hi! I want to write extension for firefox with kotlinjs and java. I try to open file and rename file name using java.io.File.Is it possible?
    d
    a
    g
    • 4
    • 5
  • l

    louiscad

    02/21/2018, 10:55 AM
    I read in a few places that Kotlin will bring inline classes in the future (i.e. zero overhead API wrapper on a single type, primitive or not). Just wanted to tell that I know it'd be super useful to write great DSLs on top of legacy designed APIs (e.g. Android)
    💯 1
    ➕ 1
    g
    • 2
    • 1
  • f

    fabricio

    02/21/2018, 2:05 PM
    How do I use
    @ClassRule
    i n kotlin?
    @ClassRule
        public static Neo4jRule neo4j = new Neo4jRule();
    I tried
    @ClassRule
        var neo4j = Neo4jRule()
    but it says
    The @ClassRule 'neo4j' must be public
    a
    • 2
    • 3
  • f

    fabricio

    02/21/2018, 2:15 PM
    I did this
    companion object {
            @ClassRule
            @JvmField
            val neo4j = Neo4jRule()
        }
    now I get this error:
    org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@6778aea6' was successfully initialized, but failed to start. Please see the attached cause exception "io.netty.handler.ssl.SslContext.newServerContextInternal(Lio/netty/handler/ssl/SslProvider;Ljava/security/Provider;[Ljava/security/cert/X509Certificate;Ljavax/net/ssl/TrustManagerFactory;[Ljava/security/cert/X509Certificate;Ljava/security/PrivateKey;Ljava/lang/String;Ljavax/net/ssl/KeyManagerFactory;Ljava/lang/Iterable;Lio/netty/handler/ssl/CipherSuiteFilter;Lio/netty/handler/ssl/ApplicationProtocolConfig;JJLio/netty/handler/ssl/ClientAuth;[Ljava/lang/String;ZZ)Lio/netty/handler/ssl/SslContext;".
    d
    • 2
    • 1
  • s

    sujin

    02/21/2018, 2:16 PM
    is creating a
    companion object
    and
    object
    similar in some sense?
    d
    • 2
    • 2
  • s

    sujin

    02/21/2018, 2:18 PM
    Guys which one is better for creating a singleton class in kotlin? Just like in plain old java using
    abstract
    class or
    object
    ?
    d
    u
    • 3
    • 5
  • d

    David R.

    02/21/2018, 3:15 PM
    So I've run into an issue that works in Java, but I can't figure out how to make it work in Kotlin. Specifically, I'm trying to create an empty instance of an enum set given a type reference. Context for this is a custom deserializer to map null to empty set. Here's the code that works in java (type is a CollectionType)
    Class<Enum> enumType = type.getContentType().getRawClass() as Class<Enum>
    EnumSet.noneOf(enumType)
    However, the kotlin version does not like the types if implemented as followed
    val enumType = type.contentType.rawClass as Class<Enum<*>>
    EnumSet.noneOf(enumType)
    The error kotlin displays on the noneOf call is about Enum<*> not being a subtype of Enum<Enum<*>>. Is there any way to make this work? Thanks!
    d
    j
    • 3
    • 4
  • m

    Michael Jagielo

    02/21/2018, 4:15 PM
    I'm looking for help migrating ButterKnife with KotterKnife
    z
    • 2
    • 1
  • j

    jw

    02/21/2018, 4:30 PM
    swap
    map
    and
    observeOn
    order
    😮 1
  • d

    dead.fish

    02/21/2018, 6:53 PM
    (I don't want to use a sealed class for just this emptiness case)
    r
    • 2
    • 8
  • e

    evkaky

    02/21/2018, 7:39 PM
    ok, I got it. But why such design decision in kotlin? I mean, most of developers (i think so) are comfortable with exclusive reanges by default
    c
    • 2
    • 1
  • j

    jtonic

    02/21/2018, 8:11 PM
    Hi, Do you know if there is an idea channel for intellij idea plugin development? Thank you in advance.
    j
    • 2
    • 1
  • j

    jtonic

    02/22/2018, 5:10 AM
    Hi, Is there a good reason for Idea 2018.1 eap considering 1.2.30-eap-60-IJ2018.1-1 as a stable version in configure kotlin plugin updates dialog? In fact I noticed that Idea considered this installed plugin as the latest regarding the selected channel. I would like to use the stable version of the kotlin plugin in EAP versions of Idea 2018. Do I have to go on the path of reinstalling the plugin? Thank you
    g
    • 2
    • 5
  • o

    Olekss

    02/22/2018, 12:27 PM
    what it takes to bundle kotlin compiler as part of my program, in case if I want to be able to compile user provided "configs" written in my kotlin DSL?
    w
    c
    • 3
    • 5
  • r

    Ruckus

    02/22/2018, 2:44 PM
    It doesn't matter how you instantiate it, that function says N is a
    BaseNavigator
    . Unless
    BaseNavigator
    is a subclass of
    NavigationController
    (it's not, you have it the other way around), that won't compile.
    y
    • 2
    • 4
  • p

    poohbar

    02/22/2018, 6:26 PM
    Blame the company with the dumbest pricing scheme in history - Slack.
    c
    f
    +2
    • 5
    • 11
  • e

    ech0s7r

    02/22/2018, 11:22 PM
    It is possible to create an object by lazy delegation passing a parameter to the object in a static context?
    o
    d
    • 3
    • 5
  • k

    karelpeeters

    02/23/2018, 10:29 AM
    I'd have called it
    map
    .
    i
    • 2
    • 2
Powered by Linen
Title
k

karelpeeters

02/23/2018, 10:29 AM
I'd have called it
map
.
i

ilya.gorbunov

02/23/2018, 12:07 PM
And what if the receiver is a collection?
k

karelpeeters

02/23/2018, 12:14 PM
Ah damm, right. Maybe
singleMap
, but that's stretching it.
run
doesn't really capture what it does though...
View count: 3