Sealed Interfaces and Sealed Classes Improvements

Поделиться
HTML-код
  • Опубликовано: 18 сен 2024
  • Join us for the Kotlin 1.5 Online Event! 👉 kotl.in/youtub...
    The event will feature a live Q&A session with the Kotlin team.
    🗓 May 25, 2021 16:00 - 17:30 CEST
    This video introduces the new sealed interfaces functionality in #Kotlin #1.5.0 and other improvements for sealed classes. It also touches on the topic of sealed classes support in the latest JVM versions, and how Kotlin will make use of it.
    Find all the news for this release in this blog post kotl.in/1.5.0
    Subscribe to our Twitter - / kotlin

Комментарии • 13

  • @DanCojocaru2000
    @DanCojocaru2000 3 года назад +2

    This video is very nice and informative, and the speaker explains the information very well!

  • @piyushmor1241
    @piyushmor1241 3 года назад +1

    Can you please have different videos explaining , what is actually present in 1.5.0 and what will be done later?

    • @Kotlin
      @Kotlin  3 года назад +1

      Check out the 1.5.0 playlist on our channel.

  • @raphaeltarita5187
    @raphaeltarita5187 3 года назад

    What is the reason behind "permittedSubclasses" being available at runtime? Why does the JVM have to perform runtime checks to ensure that sealed classes / interfaces are not extended beyond their permissions? From my understanding, all of this could be checked at compile-time

    • @joakker8820
      @joakker8820 3 года назад

      I imagine it's to be able to make exhaustive 'is' checks by comparing the class to each element in the array. Mainly for objects created dynamically at runtime that the compiler wouldn't have access to

    • @petrushoc
      @petrushoc 3 года назад +3

      I think it used in Reflection 😺

    • @dominicfischer2891
      @dominicfischer2891 3 года назад +1

      There's probably a forwards compatibility story here too. Adding a new subclass to sealed class is a breaking change.

    • @o_danc
      @o_danc 3 года назад +1

      Also there can be 3rd party subclasses loaded by service loaders dynamically

    • @SriHarshaChilakapati
      @SriHarshaChilakapati 3 года назад

      In case of sealed interfaces, JVM has to protect implementing another such interfaces using Proxies. So runtime checks are necessary.

  • @FessNiklas1987
    @FessNiklas1987 2 года назад +1

    Как же ей трудно изъясняться на английском)

  • @TimSchraepen
    @TimSchraepen 3 года назад +2

    At least 2 people that dislike strong typing watched this video

  • @zhimbura
    @zhimbura 3 года назад +1

    Ага мы обновились и пришлось откатиться из-за kotkin-datetime :(

  • @sfilkin
    @sfilkin 3 года назад

    She musses terms up. There is no notion of library in Java nor Kotlin; compilation unit is just a .java file. This makes unclear what sealed interface declaration restrictions are.