MailRuChamps / raic-2018

Russian AI Cup — artificial intelligence programming contest. Official website: http://russianaicup.ru
43 stars 32 forks source link

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

Open Karloid opened 5 years ago

Karloid commented 5 years ago

Сейчас не компилируется код из-за использований возможностей 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 commented 5 years ago

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

game.robots.maxBy { it.z }
Karloid commented 5 years ago

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

udalov commented 5 years ago

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

Karloid commented 5 years ago

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