# Platform independent code and import java.\*

**URL:** <https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007>\
**Category:** Uncategorized\
**Created:** [November 20, 2012, 6:46pm UTC](https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007 "2012-11-20T18:46:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flow](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@Flow](https://discuss.kotlinlang.org/u/Flow)\
**Post date:** [November 20, 2012, 6:46pm UTC](https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007/1 "2012-11-20T18:46:01Z")

</div>

Hi!

I wonder what the policy is for importing classes from java.\* et al in projects intended not only for the JVM?

Take a look at this commit, which I believe is not correct: [https://github.com/JetBrains/kotlin/commit/be7989af36197879774e55335216ca0fa4b6df5d](https://github.com/JetBrains/kotlin/commit/be7989af36197879774e55335216ca0fa4b6df5d)

As you can see in the comment section below the commits, despite there being an import java.util.StringBuilder the resulting Javscript code  
works just fine since there is an implementation of StringBuilder in the js-stdlib.

Regards, Tommy

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [November 22, 2012, 5:39pm UTC](https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007/2 "2012-11-22T17:39:04Z")

</div>

Hi,

Yes, there is a naming problem there, and we should have a “kotlin” string builder available in the appropriate package, but this is not done yet

---

<div class="post-metadata">

**Author:** ![Flow](https://avatars.discourse-cdn.com/v4/letter/f/8edcca/32.png) [@Flow](https://discuss.kotlinlang.org/u/Flow)\
**Post date:** [November 22, 2012, 6:58pm UTC](https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007/3 "2012-11-22T18:58:16Z")

</div>

So it would be ok to start suggesting a std lib for kotlin and perhaps implement those classes in pure Kotlin?

This makes me glad, I was starting to feel that Kotlin had been tainted by JVM-ness.

For me, Kotlin feels like something like a cross of C# and Ruby, and the std lib should reflect that and not blindly copy atrocious API’s like Java’s StringBuilder class.

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [November 23, 2012, 7:19am UTC](https://discuss.kotlinlang.org/t/platform-independent-code-and-import-java/1007/4 "2012-11-23T07:19:56Z")

</div>

While suggesting additions to std lib, keep in mind that interoperabilty with Java is still very important.
