Skip to content

Commit eb4fef7

Browse files
committed
Update to Kores 4.0.4: Not Found - Serialization support
1 parent 34f09a2 commit eb4fef7

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ buildscript {
1212
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
1313
classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:$license_version"
1414
classpath "com.github.jengelman.gradle.plugins:shadow:$shadow_version"
15+
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
1516
}
1617

1718
}
1819

1920
group 'com.github.jonathanxd'
20-
version '4.0.1.bytecode.1'
21+
version '4.0.4.bytecode.1'
2122

2223
apply from: project(":Kores").file("gradle/common.gradle")
2324

@@ -27,7 +28,7 @@ dependencies {
2728
// with runtime dependency pointing to Kores published version
2829
//compile project(":Kores")
2930
compileOnly project(":Kores")
30-
runtime "com.github.JonathanxD.Kores:Kores:4.0.1.base"
31+
runtime "com.github.JonathanxD.Kores:Kores:4.0.4.base"
3132
compile 'com.github.JonathanxD:BytecodeDisassembler:2.1.1'
3233
compile "org.ow2.asm:asm:6.0"
3334
compile "org.ow2.asm:asm-analysis:6.0"

src/main/kotlin/com/github/jonathanxd/kores/bytecode/processor/processors/SwitchProcessor.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@ object SwitchProcessor : Processor<SwitchStatement> {
213213
caseList
214214
.filterNot(Case::isDefault)
215215
.map { it.value.safeForComparison as Literals.IntLiteral }
216-
.map { it.name.toLong() }
217-
.min() ?: 0L
216+
.map { it.int.toLong() }
217+
.minOrNull() ?: 0L
218218

219219

220220
private fun getMax(caseList: List<Case>): Long =
221221
caseList
222222
.filterNot(Case::isDefault)
223223
.map { it.value.safeForComparison as Literals.IntLiteral }
224-
.map { it.name.toLong() }
225-
.max() ?: 0L
224+
.map { it.int.toLong() }
225+
.maxOrNull() ?: 0L
226226

227227
private fun getCasesToFill(caseList: List<Case>): Long {
228228
val min = this.getMin(caseList)

src/main/kotlin/com/github/jonathanxd/kores/bytecode/processor/processors/VariableOperateProcessor.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import com.github.jonathanxd.kores.bytecode.common.MethodVisitorHelper
3636
import com.github.jonathanxd.kores.literal.Literal
3737
import com.github.jonathanxd.kores.operator.Operators
3838
import com.github.jonathanxd.kores.type.`is`
39+
import com.github.jonathanxd.kores.type.javaSpecName
3940
import org.objectweb.asm.Label
4041

4142
object VariableOperateProcessor {

src/main/kotlin/com/github/jonathanxd/kores/bytecode/util/LiteralUtil.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import com.github.jonathanxd.kores.common.Stack
3232
import com.github.jonathanxd.kores.literal.Literal
3333
import com.github.jonathanxd.kores.literal.Literals
3434
import com.github.jonathanxd.kores.type.KoresType
35+
import com.github.jonathanxd.kores.type.`is`
3536
import com.github.jonathanxd.kores.util.typeDesc
3637
import org.objectweb.asm.MethodVisitor
3738
import org.objectweb.asm.Opcodes
@@ -40,7 +41,7 @@ import org.objectweb.asm.Type
4041
object LiteralUtil {
4142

4243
fun visitLiteral(num: Literal, mv: MethodVisitor) {
43-
val name = num.name
44+
val value = num.value
4445

4546
if (num == Stack)
4647
return
@@ -59,31 +60,31 @@ object LiteralUtil {
5960

6061
} else if (num.type.`is`(Types.STRING)) {
6162

62-
mv.visitLdcInsn(name.substring(1, name.length - 1))
63+
mv.visitLdcInsn((value as String).substring(1, value.length - 1))
6364

6465
} else if (num.type.`is`(Types.INT) && num !is Literals.ByteLiteral) {
6566

66-
InsnUtil.visitInt(Integer.parseInt(name), mv)
67+
InsnUtil.visitInt(value as Int, mv)
6768

6869
} else if (num.type.`is`(Types.LONG)) {
6970

70-
InsnUtil.visitLong(java.lang.Long.parseLong(name), mv)
71+
InsnUtil.visitLong(value as Long, mv)
7172

7273
} else if (num.type.`is`(Types.DOUBLE)) {
7374

74-
InsnUtil.visitDouble(java.lang.Double.parseDouble(name), mv)
75+
InsnUtil.visitDouble(value as Double, mv)
7576

7677
} else if (num is Literals.ByteLiteral) {
7778

78-
mv.visitIntInsn(Opcodes.BIPUSH, java.lang.Byte.parseByte(name).toInt())
79+
mv.visitIntInsn(Opcodes.BIPUSH, (value as Byte).toInt())
7980

8081
} else if (num.type.`is`(Types.CHAR)) {
8182

82-
mv.visitIntInsn(Opcodes.BIPUSH, name[0].toInt())
83+
mv.visitIntInsn(Opcodes.BIPUSH, (value as Char).code)
8384

8485
} else if (num.type.`is`(Types.FLOAT)) {
8586

86-
InsnUtil.visitFloat(java.lang.Float.parseFloat(name), mv)
87+
InsnUtil.visitFloat(value as Float, mv)
8788

8889
} else if (num.type.`is`(Types.KORES_TYPE)) {
8990

0 commit comments

Comments
 (0)