All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.tambapps.marcel.compiler.CompilerConfiguration.kt Maven / Gradle / Ivy
package com.tambapps.marcel.compiler
import com.tambapps.marcel.semantic.SemanticPurpose
import marcel.lang.Script
data class CompilerConfiguration(
val classVersion: Int = computeClassVersion(),
val dumbbellEnabled: Boolean = false,
val scriptClass: Class<*> = Script::class.java,
val purpose: SemanticPurpose = SemanticPurpose.COMPILATION
) {
constructor(classVersion: Int, dumbbellEnabled: Boolean): this(classVersion, dumbbellEnabled, Script::class.java)
companion object {
@JvmStatic
val DEFAULT_VERSION = 52 // 52 is for Java 8
// https://stackoverflow.com/questions/9170832/list-of-java-class-file-format-major-version-numbers
@JvmStatic
val VERSION_MAP = mutableMapOf(
Pair("1.8", 52),
Pair("8", 52),
Pair("9", 53),
Pair("10", 54),
Pair("11", 55),
Pair("12", 56),
Pair("13", 57),
Pair("14", 58),
Pair("15", 59),
Pair("16", 60),
Pair("17", 61),
Pair("18", 62),
Pair("19", 63),
Pair("20", 64),
Pair("21", 65),
Pair("22", 66),
)
@JvmStatic
fun getClassVersion(version: String?) = version?.let { VERSION_MAP[it] } ?: DEFAULT_VERSION
@JvmStatic
fun computeClassVersion(): Int {
val version: String? = System.getProperty("java.specification.version")
return getClassVersion(version)
}
}
}