https://kotlinlang.org logo
Docs
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
getting-started
  • k

    Klitos Kyriacou

    09/09/2022, 8:09 AM
    When returning a new instance of an anonymous class, in Java it's obvious that it's a new instance:
    return new InterfaceXXX() {
        @Override public void foo() {}
        @Override public void bar() {}
    }
    But Kotlin uses the
    object
    keyword:
    return object : InterfaceXXX {
        override fun foo() {}
        override fun bar() {}
    }
    And because it uses the
    object
    keyword, it looks as if you are returning the same singleton instance every time. I have to do a double-take to notice it's not actually a singleton. Does this confuse others too?
    j
    s
    e
    • 4
    • 4
  • f

    frogger

    09/09/2022, 8:58 AM
    any elegant way to get
    z = null
    here instead of an exception? (try)
    fun main() {
        val (x, y, z) = "A/B".split("/")
    }
    e
    k
    • 3
    • 4
  • b

    Ben Edwards

    09/09/2022, 12:12 PM
    Hi, trying to work out some generic code to add listeners to all buttons using view Bindings 'pattern'. I will put full class below but the bit that does not work is
    for (i in binding) {
        if (i is Button) i.btnPlayVideo.setOnClickListener(this)
    }
    I get why as you cant do a for iteration on bindings but what would be alternative code for this?
    package com.funkytwig.youtubeplayer
    
    import android.os.Bundle
    import android.os.PersistableBundle
    import android.util.Log
    import android.view.View
    import android.widget.Button
    import androidx.appcompat.app.AppCompatActivity
    import com.funkytwig.youtubeplayer.databinding.ActivityStandaloneBinding
    import com.google.android.youtube.player.YouTubeStandalonePlayer
    
    class StandaloneActivity : AppCompatActivity(), View.OnClickListener { // android.view.View
        private val TAG = "StandaloneActivity"
        private lateinit var binding: ActivityStandaloneBinding
    
        override fun onCreate(savedInstanceState: Bundle?) {
            Log.d(TAG, "onCreate")
            super.onCreate(savedInstanceState)
            binding = ActivityStandaloneBinding.inflate(layoutInflater)
            setContentView(binding.root)
    
            for (i in binding) {
                if (i is Button) i.btnPlayVideo.setOnClickListener(this)
            }
    
            // Long form version of code
            // binding.btnPlayVideo.setOnClickListener(this)
            // binding.btnPlayPlaylist.setOnClickListener(this)
        }
    
        override fun onClick(view: View) { // Ctrl+I to implement interface
            TODO("Needs implementing")    
        }
    }
    Ben
    m
    • 2
    • 2
  • g

    Gasan

    09/09/2022, 3:28 PM
    Hello here, I was reading about the mixed kotlin/java support and was wondering. In the docs it advises to run Kotlin compiler first (i use maven) and later java compiler. I tried to create a kotlin class that depends on java class and it worked. My question is why? Java compilation happens after. If it would be the other way around (java class depending on kotlin class and running java compiler without compiling kotlin first) it wouldnt work. So why does it work when you compile kotlin classes that depend on java classes that are not compiled (yet)? I also tried running the kotlin compilation alone and in target folder I saw only compiled kotlin class but not the java class it depends upon. A quick look over compiler documentation didnt provide me with an answer. So maybe someone here knows or could point me in the right direction. Thanks in advance.
    m
    e
    • 3
    • 16
  • g

    Gavin Ray

    09/10/2022, 3:46 PM
    I'm writing a database in Kotlin, and don't have a solid understanding of concurrency fundamentals Traditionally, you'd use Read-Write Locks for I/O operations like reading/writing to disk If I'm using Kotlin Coroutines, what's the best practice for ensuring that multiple concurrent reads can happen but only a single write?
    class DiskManagerImpl(file: File) : DiskManager {
        private val channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ, StandardOpenOption.WRITE)
    
        override suspend fun readPage(pageId: PageId, buffer: MemorySegment) {
            val offset = pageId * PAGE_SIZE
            val read = channel.readAsync(buffer.asByteBuffer(), offset.toLong())
            require(read == PAGE_SIZE) { "Failed to read page $pageId" }
        }
    
        override suspend fun writePage(pageId: PageId, buffer: MemorySegment) {
            val offset = pageId * PAGE_SIZE
            val written = channel.writeAsync(buffer.asByteBuffer(), offset.toLong())
            require(written == PAGE_SIZE) { "Failed to write page $pageId" }
        }
    }
    g
    • 2
    • 4
  • e

    ephemient

    09/11/2022, 5:47 AM
    https://pl.kotl.in/urxAUO4rz :this-is-fine:
    val a: Double = Double.NaN
    println(a == a) // false
    val b: Number = a
    println(a == b) // true
    val c: Double = 0.0
    println(c == -c) // true
    val d: Number = c
    println(d == -c) // false
    (yes, I know why this has to happen for IEEE 754 and boxed equals() reasons, it's a fun puzzler to figure out if you don't know why though)
    a
    i
    • 3
    • 2
  • b

    Ben Edwards

    09/11/2022, 2:26 PM
    Ime having as problem with AsyncTask (I know it is depreciated, but I am doing an exercise). Basically, doInBackground is running fine but onPostExecute never runs.
    @file:Suppress("DEPRECATION")
    
    package com.funkytwig.flickerbrowser
    
    import android.os.AsyncTask
    import android.util.Log
    import java.io.IOException
    import java.net.MalformedURLException
    import java.net.URL
    
    enum class DowsloadStatus {
        OK, IDLE, NOT_INSTALLED, FAILED_OR_EMPTY, PERMISSIONS_ERROR, ERROR
    }
    private const val TAG = "GetRawData"
    
    @Suppress("DEPRECATION")
    class GetRawData : AsyncTask<String, Void, String>() { // class
        private var downloadStatus = DowsloadStatus.IDLE
    
        @Deprecated("Deprecated in Java")
        override fun doInBackground(vararg params: String?): String {
            // params[0] = JSON URL
            val funct = "doInBackground"
            Log.d(TAG, funct)
            Log.d(TAG, "$funct ${params[0]}")
            if (params[0] == null) {
                Log.d(TAG, "$funct No URL")
                downloadStatus = DowsloadStatus.NOT_INSTALLED
                return "No URL Specified"
            }
    
            try {
                downloadStatus = DowsloadStatus.OK
                Log.d(TAG, "$funct: DowsloadStatus.OK")
                return URL(params[0]).readText()
            } catch (e: Exception) {
                val errorMessage = when (e) {
                    is MalformedURLException -> {
                        downloadStatus = DowsloadStatus.NOT_INSTALLED
                        "Invalid URL ${e.message}"
                    }
                    is IOException -> {
                        downloadStatus = DowsloadStatus.FAILED_OR_EMPTY
                        "IO Exception ${e.message}"
                    }
                    is SecurityException -> {
                        downloadStatus = DowsloadStatus.PERMISSIONS_ERROR
                        "Needs Permission ${e.message}"
                    }
                    else -> {
                        downloadStatus = DowsloadStatus.ERROR
                        "Unknown Error ${e.message}"
                    }
    
                }
                Log.d(TAG, "$funct dome errorMessage")
    
                return errorMessage
            } // try/catch
        } // doInBackground
    
        @Deprecated("Deprecated in Java")
        override fun onPostExecute(result: String?) {
            val funct = "onPostExecute"
            Log.d(TAG, funct)
            super.onPostExecute(result)
        }
    
        @Deprecated("Deprecated in Java")
        override fun onCancelled() {
            val funct = "onCancelled"
            Log.d(TAG, funct)
            super.onCancelled()
        }
    
        @Deprecated("Deprecated in Java")
        override fun onPreExecute() {
            val funct = "onPreExecute"
            Log.d(TAG, funct)
            super.onPreExecute()
        }
    
        @Deprecated("Deprecated in Java")
        override fun onProgressUpdate(vararg values: Void?) {
            val funct = "onProgressUpdate"
            Log.d(TAG, funct)
            super.onProgressUpdate(*values)
        }
    }
    Any ideas?
    m
    • 2
    • 3
  • p

    Philip Graf

    09/12/2022, 9:18 AM
    Hi all, is there a way to write a data class that compiles to the same as the following Java class?
    public class Pet {
    
        private List<String> names;
    
        public @NonNull List<@NonNull String> getNames() {
            return names;
        }
    
        // constructor, setter, etc. omitted
    }
    I tried to write the following data class:
    data class Pet(val names: @get:NonNull List<@get:NonNull String>)
    For each of the annotations I get two compile errors: - This annotation is not applicable to target 'undefined target' and use site target '@get' - This annotation is not applicable to target 'type usage' and use site target '@get' The NonNull annotation is from the Java library microprofile-graphql-api
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
    @Documented
    public @interface NonNull {
    }
    I run into the same problem when I try to set the annotations on the field:
    data class Pet(val names: @field:NonNull List<@field:NonNull String>)
    Is there a way to get annotations on the type and generic type of a getter method or field?
    s
    e
    • 3
    • 6
  • j

    Joan Killeen

    09/12/2022, 9:26 AM
    I am using kotlin in Intellij with a maven build. I have JUnit 5 Version 1.7.10 and the bundled Kotlin compiler. My simple Kotlin code is working fine but I cannot get the JUnit Tests to work in the Test runner. In the Maven build the tests work (goal install). When starting test in the runner I get this error message: Sep 12, 2022 11:20:58 AM org.junit.platform.launcher.core.DefaultLauncher handleThrowable WARNING: TestEngine with ID 'junit-jupiter' failed to discover tests java.lang.NoClassDefFoundError: org/junit/jupiter/api/ClassOrderer at org.junit.jupiter.engine.config.DefaultJupiterConfiguration.<clinit>(DefaultJupiterConfiguration.java:50) at org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:66) at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168) at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155) at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:120) at org.apache.maven.surefire.junitplatform.TestPlanScannerFilter.accept(TestPlanScannerFilter.java:56) has anyone seen this problem before??
  • j

    jeggy

    09/12/2022, 3:05 PM
    interface Criteria<T: Criteria<T>> { fun test(): T }
    
    open class Filter1(val data: String = ""): Criteria<Filter1> {
        override fun test() = Filter1("Basic")
    }
    
    object Standard: Filter1() {}
    
    // How can I provide some correct type here?
    fun whatever(): Criteria<*> {
        // Some custom code...
        return Standard
    }
    
    fun main() {
        println(whatever().data) 
    }
    Could someone help me with my
    whatever
    function here, so it returns the correct type? (playground: https://pl.kotl.in/z4lPq_kWE)
    a
    y
    • 3
    • 9
  • a

    Alina Grebenkina

    09/12/2022, 3:10 PM
    Each month sees new server side developers beginning their journeys with Kotlin. Some just want to give the language a try, while others have specific goals in mind. 🧑‍💻 Let us know how your Kotlin journey began so we can make it easier. 👉 👉 👉 https://surveys.jetbrains.com/s3/kotlin-usage-survey
    j
    • 2
    • 2
  • j

    Jan

    09/12/2022, 6:23 PM
    Is it possible to use builder inference with variables? (See thread)
    g
    • 2
    • 2
  • g

    Gasan

    09/13/2022, 9:19 AM
    Hi here, how do I reference a constant declared above a kotlin class from the java code?
    k
    e
    • 3
    • 3
  • k

    Kenneth

    09/13/2022, 1:04 PM
    Is there an easy way to make chunked split on spaces and not just size?
    j
    s
    • 3
    • 2
  • k

    Kristian Nedrevold

    09/13/2022, 8:20 PM
    When using the use function on autoClosable classes that implement close(). Is there a way I can get the suppressed exceptions to log them?
    m
    • 2
    • 6
  • o

    oday

    09/14/2022, 10:48 AM
    I would like to express this
    enum class TextRowState {
        Enabled,
        Disabled,
        ActiveAlpha{
            fun get(){
                if (Enabled){
                    0.5f
                }else{
                    1f
                }
            }
        }
    }
    s
    • 2
    • 3
  • l

    Laurent Laborde

    09/14/2022, 5:08 PM
    What would you suggest for massively parallel programming in Kotlin ? (library, framework) single computer (no need for MPI & co) purely asynchronous (no need to synchronize a known state at any moment) context : a bunch of asynchronous “artificial creature” living in a “shared world”. There will be race condition and its an integral part of the simulation. (whatever happens in case of race condition, happens). a thread pool would be good as i want to create 1 thread per creature.
    c
    o
    m
    • 4
    • 15
  • z

    zt

    09/14/2022, 9:56 PM
    Is there any library for image/gif manipulation? such as resizing, blurring, color filters, etc
    j
    • 2
    • 1
  • z

    zt

    09/15/2022, 12:29 AM
    How do I convert a float to a Duration? there's extension values for other number types but not one for floats
    e
    • 2
    • 1
  • b

    Bernhard

    09/15/2022, 10:05 AM
    I'm getting
    Type argument is not within its bounds: should be subtype of 'PostgreSQLContainer<PostgreSQLContainer<*>!>!'
    when instantiating it via
    PostgreSQLContainer<PostgreSQLContainer<*>>
    this used to work in Kotlin 1.6. Java signature is
    PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends JdbcDatabaseContainer<SELF>
  • b

    Bernhard

    09/15/2022, 10:15 AM
    removed the type parameters and it works; still probably something wrong with type checking here
  • y

    y

    09/15/2022, 10:49 AM
    hey, coming from other languages, I’m struggling to see use cases for
    return@
    . why is it needed? does it allow you to do something you previously couldn’t, or is it just syntax sugar?
    j
    e
    k
    • 4
    • 5
  • l

    Laurent Laborde

    09/15/2022, 4:52 PM
    what would be the equivalent of lua for a kotlin/jvm application please ? (to provide modding/extensibility)
    c
    • 2
    • 2
  • m

    Midoriya

    09/16/2022, 3:11 AM
    How can i print word like this -> Hello World in terminal? using kotlin
    j
    k
    • 3
    • 4
  • b

    Ben Edwards

    09/16/2022, 8:53 AM
    Trying to get my head around what internal means. Been doing a bit of reading (https://kotlinlang.org/docs/visibility-modifiers.html, https://kotlinlang.org/spec/packages-and-imports.html#modules, https://www.digitalocean.com/community/tutorials/kotlin-visibility-modifiers-public-protected-internal-private). The digitalocean.com seems to sum it all up and is consistent with the kotlinlang.org docs. Come with me down the rabbit hole :). I understand everything here apart from internal and exactly what a module is. It says "Setting a declaration as internal means that it’ll be available in the same module only. By module in Kotlin, we mean a group of files that are compiled together.". I think the sticking point for me is "Compiled together". What exactly does that mean? Is this something to do with packages? Or is it simply referring to the current .kt file? The other thing that got me wondering is the use of
    private const val TAG = "BaseActivity"
    Which can put just after the imports. Its not defined within a class which seems inconsistent with private being '`private` means that the member is visible inside this class only (including all its members).'. Does it effectively become private to all classes in the file? To go further down the rabbit hole what does 'including all its members' mean? I guess it means function/methods but if so why not just say this?
    y
    j
    • 3
    • 12
  • l

    LastExceed

    09/16/2022, 9:34 AM
    listOf(1,2,3).sumOf { it.toDouble() } //works fine
    listOf(1,2,3).sumOf { it.toFloat() } //error: no applicable overload
    can someone explain why?
    s
    i
    e
    • 4
    • 6
  • j

    jeggy

    09/16/2022, 12:41 PM
    fun <T> List<Int>.transform(
        block: (Int) -> T = { it }
    ): List<T> {
        return map { block(it) }
    }
    
    fun main() {
        val items = listOf(1, 2, 3)
        
        println(items.transform { "$it, " })
        println(items.transform())
    }
    Does anyone know if there is a issue on youtrack somewhere discussing making something like this possible?
    a
    s
    e
    • 4
    • 7
  • m

    martmists

    09/16/2022, 1:02 PM
    Is it possible to use JvmMultifileClass to separate api (as class/interface) and implementation (class/interface/extensionfuncs/packagefuncs)?
    e
    • 2
    • 2
  • l

    Laurent Laborde

    09/16/2022, 8:22 PM
    is it OK to have a constructor throw an exception or is it bad practice ?
    j
    a
    +2
    • 5
    • 10
  • l

    Laurent Laborde

    09/16/2022, 9:30 PM
    err, i just realized, if my kotlin code isn’t meant to be called from java, i don’t need to use the @throws annotation in my class declaration, right ?
    c
    m
    j
    • 4
    • 5
Powered by Linen
Title
l

Laurent Laborde

09/16/2022, 9:30 PM
err, i just realized, if my kotlin code isn’t meant to be called from java, i don’t need to use the @throws annotation in my class declaration, right ?
c

Chris Lee

09/16/2022, 9:31 PM
correct
l

Laurent Laborde

09/16/2022, 9:31 PM
pfew, it will be so much more readable ! thx !
m

mkrussel

09/16/2022, 9:33 PM
I think having it can still be useful documentation. If you expected it to be handled then document it. If it cannot be handled then don’t (whether you are using it from Java or not).
l

Laurent Laborde

09/16/2022, 9:38 PM
well this one cannot be handled but i’ll keep it in mind. thank you.
j

Johann Pardanaud

09/17/2022, 10:09 AM
The
@throws
annotation is really meant to tell the JVM which checked exceptions the method can throw, and might not be available when compiling to other platforms. If you want to document what your method can throw, use the `@throws class, @exception class` documentation tags, they are platform-agnostic.
View count: 3