diff --git a/buildSrc/src/main/kotlin/de.siphalor.tweed5.base-module.gradle.kts b/buildSrc/src/main/kotlin/de.siphalor.tweed5.base-module.gradle.kts index d5028bf..58222a7 100644 --- a/buildSrc/src/main/kotlin/de.siphalor.tweed5.base-module.gradle.kts +++ b/buildSrc/src/main/kotlin/de.siphalor.tweed5.base-module.gradle.kts @@ -11,8 +11,8 @@ group = rootProject.group version = rootProject.version java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.main.get()) - targetCompatibility = JavaVersion.toVersion(libs.versions.java.main.get()) + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { @@ -54,8 +54,8 @@ dependencies { } tasks.compileTestJava { - sourceCompatibility = libs.versions.java.test.get() - targetCompatibility = libs.versions.java.test.get() + sourceCompatibility = JavaVersion.VERSION_21.toString() + targetCompatibility = JavaVersion.VERSION_21.toString() } tasks.test { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab223a2..512bd7a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,8 +3,6 @@ assertj = "3.26.3" asm = "9.7" autoservice = "1.1.1" acl = "1.3.5" -java-main = "8" -java-test = "21" jetbrains-annotations = "26.0.1" jspecify = "1.0.0" junit = "5.12.0" diff --git a/tweed5-annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/impl/RepeatableAnnotationContainerHelper.java b/tweed5-annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/impl/RepeatableAnnotationContainerHelper.java index 129b57b..23eab9b 100644 --- a/tweed5-annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/impl/RepeatableAnnotationContainerHelper.java +++ b/tweed5-annotation-inheritance/src/main/java/de/siphalor/tweed5/annotationinheritance/impl/RepeatableAnnotationContainerHelper.java @@ -89,7 +89,7 @@ public class RepeatableAnnotationContainerHelper { MethodHandle constructorHandle = MethodHandles.lookup().findConstructor( generatedClass, - MethodType.methodType(void.class, repeatableClass.arrayType()) + MethodType.methodType(void.class, arrayType(repeatableClass)) ); return (repeatedValues) -> { @@ -119,9 +119,9 @@ public class RepeatableAnnotationContainerHelper { "java/lang/Object", new String[]{containerClass.getName().replace('.', '/')} ); - Class repeatableArrayClass = repeatableClass.arrayType(); + Class repeatableArrayClass = arrayType(repeatableClass); - classWriter.visitField(Opcodes.ACC_PRIVATE, "values", repeatableArrayClass.descriptorString(), null, null); + classWriter.visitField(Opcodes.ACC_PRIVATE, "values", descriptor(repeatableArrayClass), null, null); appendConstructor(classWriter, repeatableArrayClass, generatedClassNameInternal); appendValueMethod(classWriter, repeatableArrayClass, generatedClassNameInternal); @@ -143,7 +143,7 @@ public class RepeatableAnnotationContainerHelper { MethodVisitor methodWriter = classWriter.visitMethod( Opcodes.ACC_PUBLIC, "", - "(" + repeatableArrayClass.descriptorString() + ")V", + "(" + descriptor(repeatableArrayClass) + ")V", null, null ); @@ -157,7 +157,7 @@ public class RepeatableAnnotationContainerHelper { Opcodes.PUTFIELD, generatedClassNameInternal, "values", - repeatableArrayClass.descriptorString() + descriptor(repeatableArrayClass) ); methodWriter.visitInsn(Opcodes.RETURN); methodWriter.visitMaxs(2, 2); @@ -172,7 +172,7 @@ public class RepeatableAnnotationContainerHelper { MethodVisitor methodWriter = classWriter.visitMethod( Opcodes.ACC_PUBLIC, "value", - "()" + repeatableArrayClass.descriptorString(), + "()" + descriptor(repeatableArrayClass), null, null ); @@ -182,7 +182,7 @@ public class RepeatableAnnotationContainerHelper { Opcodes.GETFIELD, generatedClassNameInternal, "values", - repeatableArrayClass.descriptorString() + descriptor(repeatableArrayClass) ); methodWriter.visitInsn(Opcodes.ARETURN); methodWriter.visitMaxs(1, 1); @@ -216,14 +216,14 @@ public class RepeatableAnnotationContainerHelper { Opcodes.GETFIELD, generatedClassNameInternal, "values", - repeatableArrayClass.descriptorString() + descriptor(repeatableArrayClass) ); methodWriter.visitVarInsn(Opcodes.ALOAD, 1); methodWriter.visitMethodInsn( Opcodes.INVOKEINTERFACE, containerAnnotationClassBinaryName, "value", - "()" + repeatableArrayClass.descriptorString(), + "()" + descriptor(repeatableArrayClass), true ); methodWriter.visitMethodInsn( @@ -263,7 +263,7 @@ public class RepeatableAnnotationContainerHelper { Opcodes.GETFIELD, generatedClassNameInternal, "values", - repeatableArrayClass.descriptorString() + descriptor(repeatableArrayClass) ); methodWriter.visitMethodInsn( Opcodes.INVOKESTATIC, @@ -302,7 +302,7 @@ public class RepeatableAnnotationContainerHelper { Opcodes.GETFIELD, generatedClassNameInternal, "values", - repeatableArrayClass.descriptorString() + descriptor(repeatableArrayClass) ); methodWriter.visitMethodInsn( Opcodes.INVOKESTATIC, @@ -384,4 +384,17 @@ public class RepeatableAnnotationContainerHelper { methodWriter.visitMaxs(1, 1); methodWriter.visitEnd(); } + + private static String descriptor(Class clazz) { + return Type.getType(clazz).getDescriptor(); + } + + private static Class arrayType(Class clazz) { + try { + //noinspection unchecked + return (Class) Class.forName("[L" + clazz.getName() + ";"); + } catch (ClassNotFoundException e) { + throw new IllegalStateException("Failed to get array class for " + clazz.getName(), e); + } + } } diff --git a/tweed5-core/src/main/java/de/siphalor/tweed5/core/api/sort/AcyclicGraphSorter.java b/tweed5-core/src/main/java/de/siphalor/tweed5/core/api/sort/AcyclicGraphSorter.java index 32b62b7..5fb760e 100644 --- a/tweed5-core/src/main/java/de/siphalor/tweed5/core/api/sort/AcyclicGraphSorter.java +++ b/tweed5-core/src/main/java/de/siphalor/tweed5/core/api/sort/AcyclicGraphSorter.java @@ -107,7 +107,9 @@ public class AcyclicGraphSorter { while (outgoingIter.hasNext()) { if (outgoingIter.next()) { if (stack.contains(outgoingIter.index())) { - throw new GraphCycleException(stack.reversed()); + Collection reversed = new ArrayList<>(stack.size()); + stack.descendingIterator().forEachRemaining(reversed::add); + throw new GraphCycleException(reversed); } stack.push(outgoingIter.index()); continue outer; @@ -229,7 +231,9 @@ public class AcyclicGraphSorter { int leftBitCount = bitCount; if (words == null) { for (int i = 0; i < wordCount; i++) { - sb.repeat("0", Math.min(WORD_SIZE, leftBitCount)); + for (int j = 0; j < Math.min(WORD_SIZE, leftBitCount); j++) { + sb.append("0"); + } sb.append(" "); leftBitCount -= WORD_SIZE; } diff --git a/tweed5-type-utils/src/main/java/de/siphalor/tweed5/typeutils/api/annotations/AnnotationRepeatType.java b/tweed5-type-utils/src/main/java/de/siphalor/tweed5/typeutils/api/annotations/AnnotationRepeatType.java index 969c2d8..81f3adb 100644 --- a/tweed5-type-utils/src/main/java/de/siphalor/tweed5/typeutils/api/annotations/AnnotationRepeatType.java +++ b/tweed5-type-utils/src/main/java/de/siphalor/tweed5/typeutils/api/annotations/AnnotationRepeatType.java @@ -90,7 +90,7 @@ public abstract class AnnotationRepeatType { valueHandle = MethodHandles.lookup().findVirtual( annotationClass(), "value", - MethodType.methodType(elementAnnotationClass.arrayType()) + MethodType.methodType(Class.forName("[L" + elementAnnotationClass.getName() + ";")) ); } catch (Exception e) { throw new IllegalStateException(