Skip to content

Commit

Permalink
build: update kotlinc to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Jun 4, 2024
1 parent dc02c4f commit a3e72ce
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 27 deletions.
5 changes: 4 additions & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions .idea/libraries/KotlinRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@
<echo message="Compiling Kotlin generator..." level="info" taskname="Generator" unless:set="generator-uptodate"/>
<mkdir dir="${bin.generator}"/>
<kotlinc moduleName="generator" output="${bin.generator}" printVersion="true" unless:set="generator-uptodate">
<compilerarg line="-language-version 2.0"/>
<compilerarg line="-api-version 2.0"/>
<compilerarg value="-progressive"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
Expand Down Expand Up @@ -214,6 +216,8 @@
<pathelement location="${bin.generator}"/>
</classpath>

<compilerarg line="-language-version 2.0"/>
<compilerarg line="-api-version 2.0"/>
<compilerarg value="-progressive"/>
<compilerarg value="-Xno-call-assertions"/>
<compilerarg value="-Xno-param-assertions"/>
Expand Down Expand Up @@ -591,7 +595,6 @@
<pathelement path="${bin.lwjgl}/core/META-INF/versions/16" if:set="core.java16"/>
<pathelement path="${module.classpath}"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib.jar"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib-jdk7.jar"/>
</classpath>

<compilerarg line="-jvm-target 1.8"/>
Expand Down Expand Up @@ -621,7 +624,6 @@
<pathelement path="${bin.extract}"/>
<pathelement path="${test.resources}"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib.jar"/>
<pathelement path="${kotlinc}/lib/kotlin-stdlib-jdk7.jar"/>
<pathelement path="${lib}/native"/>
</classpath>

Expand Down
18 changes: 8 additions & 10 deletions modules/generator/src/main/kotlin/org/lwjgl/generator/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ class ConstantBlock<T : Any>(
try {
value = Integer.parseInt(ev.expression) + 1 // decimal
formatType = 1 // next values will be decimal
} catch(e: NumberFormatException) {
} catch(_: NumberFormatException) {
try {
value = Integer.parseInt(ev.expression, 16) + 1 // hex
} catch(e: Exception) {
// ignore
} catch(_: Exception) {
}
formatType = 0 // next values will be hex
}
Expand Down Expand Up @@ -165,11 +164,10 @@ class ConstantBlock<T : Any>(
try {
value = java.lang.Byte.parseByte(ev.expression) + 1L // decimal
formatType = 1 // next values will be decimal
} catch(e: NumberFormatException) {
} catch(_: NumberFormatException) {
try {
value = java.lang.Byte.parseByte(ev.expression, 16) + 1L // hex
} catch(e: Exception) {
// ignore
} catch(_: Exception) {
}
formatType = 0 // next values will be hex
}
Expand Down Expand Up @@ -207,11 +205,10 @@ class ConstantBlock<T : Any>(
try {
value = java.lang.Long.parseLong(ev.expression) + 1L // decimal
formatType = 1 // next values will be decimal
} catch(e: NumberFormatException) {
} catch(_: NumberFormatException) {
try {
value = java.lang.Long.parseLong(ev.expression, 16) + 1L // hex
} catch(e: Exception) {
// ignore
} catch(_: Exception) {
}
formatType = 0 // next values will be hex
}
Expand Down Expand Up @@ -325,8 +322,9 @@ class ConstantBlock<T : Any>(

private fun PrintWriter.printConstant(constant: Constant<T>, indent: String, alignment: Int) {
print("$indent${getConstantName(constant.name)}")
for (i in 0 until alignment - constant.name.length)
(0 until alignment - constant.name.length).forEach {
print(' ')
}

print(" = ")
if (constant is ConstantExpression) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private class AutoSizeBytesTransform(
else
"$expression >> $s"
}
} catch(e: NumberFormatException) {
} catch(_: NumberFormatException) {
// non-numeric expressions
expression = if (type.mapping.let { it === PrimitiveMapping.POINTER || it === PrimitiveMapping.LONG })
"($expression << $byteShift) ${factor.operator} ${if (factor.expression.contains(' ')) "(${factor.expression})" else factor.expression}"
Expand Down
4 changes: 2 additions & 2 deletions modules/generator/src/main/kotlin/org/lwjgl/generator/JNI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ object JNI : GeneratorTargetNative(Module.CORE, "JNI") {
print("return ")
val resultType = it.returnType.jniFunctionType
if (it.returnType.abiType != resultType)
print("($resultType)");
print("($resultType)")
}
print("((${it.returnType.abiType} (${if (it.callingConvention === CallingConvention.STDCALL) "APIENTRY " else ""}*) ")
print(if (it.arguments.isEmpty())
Expand Down Expand Up @@ -174,7 +174,7 @@ object JNI : GeneratorTargetNative(Module.CORE, "JNI") {
val resultType = it.returnType.jniFunctionType
print("$resultType $RESULT = ")
if (it.returnType.abiType != resultType)
print("($resultType)");
print("($resultType)")
}
print("((${it.returnType.abiType} (${if (it.callingConvention === CallingConvention.STDCALL) "APIENTRY " else ""}*) ")
print(it.arguments.asSequence()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ private fun paramMultilineAligment(alignment: Int): String {
val whitespace = " @param ".length + alignment + 1
return StringBuilder("$t *".length + whitespace).apply {
append("$t *")
for (i in 0 until whitespace)
(0 until whitespace).forEach {
append(' ')
}
}.toString()
}

Expand All @@ -238,8 +239,9 @@ private fun StringBuilder.printParam(name: String, documentation: String, indent
append("@param $name")

// Align
for (i in 0..(alignment - name.length))
(0..(alignment - name.length)).forEach {
append(' ')
}

append(documentation.cleanup(multilineAligment))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ abstract class ModifierTarget<T : TemplateModifier> {
inline infix fun <reified M : T> has(modifier: M) = modifiers[M::class] === modifier

inline fun <reified M : T> has() = modifiers.containsKey(M::class)
inline fun <reified M : T> has(predicate: M.() -> Boolean) = (modifiers[M::class] as M?)?.predicate() ?: false
inline fun <reified M : T> has(predicate: M.() -> Boolean) = (modifiers[M::class] as M?)?.predicate() == true
inline fun <reified M : T> get() = modifiers[M::class] as M

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class FunctionType internal constructor(
}

// typedefs
fun typedef(@Suppress("UNUSED_PARAMETER") typedef: OpaqueType, name: String) = OpaqueType(name)
fun typedef(@Suppress("unused") typedef: OpaqueType, name: String) = OpaqueType(name)
fun typedef(typedef: PrimitiveType, name: String) = PrimitiveType(name, typedef.mapping)
fun typedef(typedef: CharType, name: String) = CharType(name, typedef.mapping)
fun typedef(typedef: IntegerType, name: String) = IntegerType(name, typedef.mapping, typedef.unsigned)
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>org.lwjgl</groupId>
<artifactId>lwjgl</artifactId>
<version>3.2.3</version>
<version>3.3.3</version>

<name>LWJGL</name>
<description>The LWJGL core library.</description>
Expand Down
4 changes: 2 additions & 2 deletions update-dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<property name="jquery" value="3.5.1"/>
<property name="slf4j" value="1.7.36"/>
<property name="joml" value="1.10.5"/>
<property name="kotlinc-version" value="2.0.0-RC2"/>
<property name="kotlinc-build" value="2.0.0-RC2-release-272"/>
<property name="kotlinc-version" value="2.0.0"/>
<property name="kotlinc-build" value="2.0.0-release-341"/>
<property name="jmh-core" value="1.37"/>
<property name="jmh-generator-annprocess" value="1.37"/>
<property name="jopt-simple" value="5.0.4"/>
Expand Down

0 comments on commit a3e72ce

Please sign in to comment.