# Specify platform types

**URL:** <https://discuss.kotlinlang.org/t/specify-platform-types/16453>\
**Category:** Support\
**Created:** [February 23, 2020, 5:28am UTC](https://discuss.kotlinlang.org/t/specify-platform-types/16453 "2020-02-23T05:28:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kotlinIsland](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kotlinIsland](https://discuss.kotlinlang.org/u/kotlinIsland)\
**Post date:** [February 23, 2020, 5:28am UTC](https://discuss.kotlinlang.org/t/specify-platform-types/16453/1 "2020-02-23T05:28:07Z")

</div>

For some un-annotated java class:

```nohighlight
class Foo {
    String foo() { /* ... */ }
}

```

Is there any way to specify the platform type for nullability/mutability? like a [python stub file](https://mypy.readthedocs.io/en/stable/stubs.html).

Maybe introduce a soft keyword `stub class`:

```kotlin
stub class Foo {
    fun foo(): String?
}

stub class javax.servlet {
    /* ... */
}

```

---

<div class="post-metadata">

**Author:** ![fatjoe79](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fatjoe79/32/4221_2.png) [@fatjoe79](https://discuss.kotlinlang.org/u/fatjoe79)\
**Post date:** [February 23, 2020, 9:59am UTC](https://discuss.kotlinlang.org/t/specify-platform-types/16453/2 "2020-02-23T09:59:31Z")

</div>

If you are using IntelliJ, you can define external annotations for java classes that you cannot modify.

---

<div class="post-metadata">

**Author:** ![kotlinIsland](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kotlinIsland](https://discuss.kotlinlang.org/u/kotlinIsland)\
**Post date:** [February 23, 2020, 11:15am UTC](https://discuss.kotlinlang.org/t/specify-platform-types/16453/3 "2020-02-23T11:15:56Z")

</div>

how?

---

<div class="post-metadata">

**Author:** ![SackCastellon](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sackcastellon/32/4553_2.png) [@SackCastellon](https://discuss.kotlinlang.org/u/SackCastellon)\
**Post date:** [February 23, 2020, 11:25am UTC](https://discuss.kotlinlang.org/t/specify-platform-types/16453/4 "2020-02-23T11:25:12Z")

</div>

> **[External annotations | IntelliJ IDEA](https://www.jetbrains.com/help/idea/external-annotations.html)**
