Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Нужно поднять jvm target для Kotlin с 1.6 до 1.8 #109

Open
Karloid opened this issue Jan 4, 2019 · 4 comments
Open

Нужно поднять jvm target для Kotlin с 1.6 до 1.8 #109

Karloid opened this issue Jan 4, 2019 · 4 comments

Comments

@Karloid
Copy link

Karloid commented Jan 4, 2019

Сейчас не компилируется код из-за использований возможностей 8 джавы (2014год)

Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'

падает на коде:

game.robots.maxWith(Comparator.comparingDouble {
                    it.z
                })

полный лог

stdout:
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------< com.codegame.codeball2018.devkit:kotlin-cgdk >------------
[INFO] Building kotlin-cgdk 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ kotlin-cgdk ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /project/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ kotlin-cgdk ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /project/target/classes
[INFO] 
[INFO] --- kotlin-maven-plugin:1.3.11:compile (compile) @ kotlin-cgdk ---
[ERROR] /project/src/main/kotlin/MyStrategy.kt: (52, 63) Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.665 s
[INFO] Finished at: 2019-01-04T12:16:10Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.11:compile (compile) on project kotlin-cgdk: Compilation failure
[ERROR] /project/src/main/kotlin/MyStrategy.kt:[52,63] Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

stderr:
+ '[' compile '!=' base ']'
+ rm src/main/kotlin/MyStrategy.kt
+ cp -rn ###
+ mvn package --batch-mode
@udalov
Copy link
Contributor

udalov commented Jan 4, 2019

Если что, можно покороче и без восьмой джавы:

game.robots.maxBy { it.z }

@Karloid
Copy link
Author

Karloid commented Jan 4, 2019

@udalov да это понятно, но тем не менее актуальная задача, мб на 8 джаве еще буст производительности будет

@udalov
Copy link
Contributor

udalov commented Jan 4, 2019

Не будет. :) Но в целом да, почему бы и нет

@Karloid
Copy link
Author

Karloid commented Jan 4, 2019

@udalov я конечно не замерял. Но теоритически в джава 8 есть новые инструкции байт-кода используя которые котлтнаэ компилятор накомпилирует более оптимальные байт-код.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants