From 8c99e84509d20bd8f6387c974c6137e38a07301c Mon Sep 17 00:00:00 2001 From: Alex Vanyo Date: Sat, 21 Aug 2021 15:29:52 -0500 Subject: [PATCH] Initial multiplatform exploration --- .github/workflows/ci.yml | 5 +- Dangerfile | 2 +- build.gradle.kts | 127 +++++++--------- config/detekt/detekt.yml | 1 + ksp/build.gradle.kts | 66 ++++++++- .../internal/ksp/GenSealedEnumHolder.kt | 0 .../ksp/InvalidSubclassVisibilityException.kt | 0 .../sealedenum/internal/ksp/KotlinPoetKsp.kt | 0 .../sealedenum/internal/ksp/KspUtils.kt | 0 .../ksp/NonObjectSealedSubclassException.kt | 0 .../internal/ksp/SealedEnumProcessor.kt | 0 .../internal/ksp/SuperInterfaces.kt | 0 processing-common/build.gradle.kts | 62 ++++++++ .../internal/common/SealedClassNode.kt | 0 .../sealedenum/internal/common/TreeUtils.kt | 0 .../sealedenum/internal/common/Unique.kt | 0 .../sealedenum/internal/common/Visibility.kt | 0 .../internal/common/spec/CamelCase.kt | 0 .../common/spec/EnumForSealedEnumTypeSpec.kt | 0 .../spec/EnumSealedObjectPropertySpec.kt | 0 .../common/spec/MaybeAddOriginatingElement.kt | 0 .../common/spec/SealedClassExtensions.kt | 0 .../common/spec/SealedEnumEnumPropertySpec.kt | 0 .../common/spec/SealedEnumFileSpec.kt | 0 .../common/spec/SealedEnumNamePropertySpec.kt | 0 .../spec/SealedEnumOrdinalPropertySpec.kt | 0 .../spec/SealedEnumSealedEnumPropertySpec.kt | 0 .../common/spec/SealedEnumTypeSpec.kt | 5 +- .../common/spec/SealedEnumValueOfFunSpec.kt | 0 .../spec/SealedEnumValuesPropertySpec.kt | 0 .../internal/common/TreeUtilsTests.kt | 0 .../JavaPrivateInterfaceOuterClass.java | 0 .../JavaPrivateInterfaceSubclass.java | 0 .../JavaProtectedInterfaceBaseClass.java | 0 .../JavaProtectedInterfaceSubclass.java | 0 .../JavaProtectedInterfaceBaseClass.java | 0 .../JavaProtectedInterfaceSubclass.java | 0 .../compilation/basic/EmptySealedClass.kt | 6 +- .../basic/EmptySealedClassTests.kt | 2 +- .../compilation/basic/EmptySealedInterface.kt | 6 +- .../basic/EmptySealedInterfaceTests.kt | 2 +- .../compilation/basic/OneObjectSealedClass.kt | 6 +- .../basic/OneObjectSealedClassTests.kt | 2 +- .../basic/OneObjectSealedInterface.kt | 6 +- .../basic/OneObjectSealedInterfaceTests.kt | 2 +- .../compilation/basic/TwoObjectSealedClass.kt | 6 +- .../basic/TwoObjectSealedClassTests.kt | 2 +- .../basic/TwoObjectSealedInterface.kt | 6 +- .../basic/TwoObjectSealedInterfaceTests.kt | 2 +- .../generics/GenericSealedClass.kt | 24 +-- .../generics/GenericSealedClassTests.kt | 0 .../SealedEnumWithAbstractBaseClasses.kt | 12 +- .../SealedEnumWithAbstractBaseClassesTests.kt | 0 .../generics/SealedEnumWithInterfaces.kt | 24 +-- .../generics/SealedEnumWithInterfacesTests.kt | 0 .../hierarchy/SealedClassHierarchy.kt | 12 +- .../hierarchy/SealedClassHierarchyTests.kt | 0 .../hierarchy/SealedInterfaceHierarchy.kt | 12 +- .../SealedInterfaceHierarchyTests.kt | 0 .../compilation/location/NestedClass.kt | 0 .../compilation/location/NestedClassTests.kt | 0 .../location/OutsideSealedClass.kt | 24 +-- .../location/OutsideSealedClassTests.kt | 0 .../location/SplitAcrossFilesSealedClass.kt | 6 +- .../SplitAcrossFilesSealedClassTests.kt | 0 .../location/SplitAcrossFilesSubclassA.kt | 0 .../location/SplitAcrossFilesSubclassB.kt | 0 .../location/SplitAcrossFilesSubclassC.kt | 0 .../compilation/traversal/TraversalOrder.kt | 18 +-- .../traversal/TraversalOrderTests.kt | 0 .../usecases/EnvironmentsSealedEnum.kt | 6 +- .../usecases/EnvironmentsSealedEnumTests.kt | 2 +- .../visibility/PrivateInterfaceSealedClass.kt | 6 +- .../PrivateInterfaceSealedClassTests.kt | 2 +- .../ProtectedInterfaceSealedClass.kt | 6 +- .../ProtectedInterfaceSealedClassTests.kt | 2 +- ...ealedClassWithDifferentPackageBaseClass.kt | 6 +- ...ClassWithDifferentPackageBaseClassTests.kt | 2 +- .../visibility/VisibilitySealedClass.kt | 24 +-- .../visibility/VisibilitySealedClassTests.kt | 8 +- .../sealedenum/errors/AnnotationErrors.kt | 0 .../sealedenum/errors/NonObjectErrors.kt | 0 .../testing/CompilationAssertions.kt | 0 .../sealedenum/testing/PathsUtils.kt | 5 +- .../sealedenum/testing/ProcessingType.kt | 0 processing-tests/ksp-tests/build.gradle.kts | 90 +++++++++--- .../sealedenum/testing/Compilation.kt | 0 .../testing/CurrentProcessingType.kt | 0 .../processor-tests/build.gradle.kts | 84 +++++++++-- .../kitchensink/JavaFirstBaseClass.java | 0 .../kitchensink/JavaInterface1.java | 0 .../kitchensink/JavaInterface2.java | 0 .../kitchensink/JavaInterface3.java | 0 .../kitchensink/JavaInterface4.java | 0 .../kitchensink/JavaInterface5.java | 0 .../kitchensink/JavaSecondBaseClass.java | 0 .../kitchensink/JavaBaseClasses.kt | 6 +- .../kitchensink/JavaBaseClassesTests.kt | 0 .../sealedenum/testing/Compilation.kt | 0 .../testing/CurrentProcessingType.kt | 0 processor/build.gradle.kts | 73 ++++++++-- .../InvalidSubclassVisibilityException.kt | 0 .../NonObjectSealedSubclassException.kt | 0 .../internal/processor/SealedEnumProcessor.kt | 0 .../internal/processor/SuperInterfaces.kt | 0 .../processor/WildcardedTypeParameters.kt | 0 runtime/api/runtime.api | 4 +- runtime/build.gradle.kts | 66 ++++++++- .../sealedenum/EnumForSealedEnumProvider.kt | 4 +- .../com/livefront/sealedenum/GenSealedEnum.kt | 3 +- .../sealedenum/RepeatableContainer.kt | 10 ++ .../com/livefront/sealedenum/SealedEnum.kt | 10 +- .../sealedenum/SealedEnumWithEnumProvider.kt | 0 .../sealedenum/TreeTraversalOrder.kt | 0 .../CreateSealedEnumFromEnumTests.kt | 130 +++++++++++++++++ .../sealedenum/RepeatableContainer.jvm.kt | 8 + .../CreateSealedEnumFromEnumTests.kt | 137 ------------------ 117 files changed, 738 insertions(+), 404 deletions(-) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/GenSealedEnumHolder.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/InvalidSubclassVisibilityException.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/KotlinPoetKsp.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/KspUtils.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/NonObjectSealedSubclassException.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/SealedEnumProcessor.kt (100%) rename ksp/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/ksp/SuperInterfaces.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/SealedClassNode.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/TreeUtils.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/Unique.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/Visibility.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/CamelCase.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/EnumForSealedEnumTypeSpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/EnumSealedObjectPropertySpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/MaybeAddOriginatingElement.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedClassExtensions.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumEnumPropertySpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumFileSpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumNamePropertySpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumOrdinalPropertySpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumSealedEnumPropertySpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt (97%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValueOfFunSpec.kt (100%) rename processing-common/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValuesPropertySpec.kt (100%) rename processing-common/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/internal/common/TreeUtilsTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceOuterClass.java (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceSubclass.java (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceBaseClass.java (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceSubclass.java (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceBaseClass.java (100%) rename processing-tests/common/{test => src/jvmTest}/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceSubclass.java (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt (92%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt (91%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt (93%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt (93%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt (93%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt (93%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClassTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClassesTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfacesTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchyTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchyTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/NestedClassTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClassTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClassTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassA.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassB.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassC.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrderTests.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt (99%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt (98%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt (97%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt (96%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/errors/AnnotationErrors.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/errors/NonObjectErrors.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/testing/CompilationAssertions.kt (100%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt (94%) rename processing-tests/common/{test => src/jvmTest}/kotlin/com/livefront/sealedenum/testing/ProcessingType.kt (100%) rename processing-tests/ksp-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/testing/Compilation.kt (100%) rename processing-tests/ksp-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaFirstBaseClass.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface1.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface2.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface3.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface4.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface5.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/java/com/livefront/sealedenum/compilation/kitchensink/JavaSecondBaseClass.java (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt (97%) rename processing-tests/processor-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClassesTests.kt (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/testing/Compilation.kt (100%) rename processing-tests/processor-tests/src/{test => jvmTest}/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt (100%) rename processor/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/processor/InvalidSubclassVisibilityException.kt (100%) rename processor/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/processor/NonObjectSealedSubclassException.kt (100%) rename processor/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/processor/SealedEnumProcessor.kt (100%) rename processor/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/processor/SuperInterfaces.kt (100%) rename processor/src/{main => jvmMain}/kotlin/com/livefront/sealedenum/internal/processor/WildcardedTypeParameters.kt (100%) rename runtime/src/{main => commonMain}/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt (91%) rename runtime/src/{main => commonMain}/kotlin/com/livefront/sealedenum/GenSealedEnum.kt (98%) create mode 100644 runtime/src/commonMain/kotlin/com/livefront/sealedenum/RepeatableContainer.kt rename runtime/src/{main => commonMain}/kotlin/com/livefront/sealedenum/SealedEnum.kt (89%) rename runtime/src/{main => commonMain}/kotlin/com/livefront/sealedenum/SealedEnumWithEnumProvider.kt (100%) rename runtime/src/{main => commonMain}/kotlin/com/livefront/sealedenum/TreeTraversalOrder.kt (100%) create mode 100644 runtime/src/commonTest/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt create mode 100644 runtime/src/jvmMain/kotlin/com/livefront/sealedenum/RepeatableContainer.jvm.kt delete mode 100644 runtime/src/test/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b39324f4..ad073775 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,10 @@ jobs: java-version: ${{ matrix.java-version }} - name: Test - run: ./gradlew check jacocoTestReport + run: ./gradlew check jacocoTestReport --no-parallel + + - name: cat + run: cat build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml - name: Danger # Run Danger for PRs originating from within the repo (for fork PRs the token won't give permission to comment) diff --git a/Dangerfile b/Dangerfile index ad11a33d..1ffafb74 100644 --- a/Dangerfile +++ b/Dangerfile @@ -1 +1 @@ -shroud.report 'build/reports/jacoco/test/jacocoTestReport.xml', 80, 80, false +shroud.report 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml', 80, 80, false diff --git a/build.gradle.kts b/build.gradle.kts index 5c27da6d..535cfd01 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - kotlin("jvm") version Versions.kotlin + kotlin("multiplatform") version Versions.kotlin apply false jacoco id("io.gitlab.arturbosch.detekt") version Versions.detekt id("org.jetbrains.dokka") version Versions.dokka @@ -16,88 +16,23 @@ allprojects { } subprojects { - apply { - plugin() - plugin() - plugin() - plugin() - } - - dependencies { - detektPlugins(Dependencies.detektFormatting) - } - - java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlin { - explicitApi() - } - tasks { - compileKotlin { + withType().configureEach { kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() - allWarningsAsErrors = true } } - - compileTestKotlin { + withType().configureEach { kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8.toString() + freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" allWarningsAsErrors = true } } - test { - useJUnitPlatform() - } - - jacoco { - toolVersion = Versions.jacoco - } - - jacocoTestReport { - dependsOn(test) - - reports { - html.isEnabled = true - xml.isEnabled = true - } - } - - withType { - jvmTarget = JavaVersion.VERSION_1_8.toString() - } - - check { - dependsOn("detektMain") - } - - dokkaHtml { - outputDirectory.set(javadoc.get().destinationDir) - } - plugins.withType(MavenPublishPlugin::class) { - val sourcesJar by creating(Jar::class) { - archiveClassifier.set("sources") - from(sourceSets.main.get().allSource) - } - - val javadocJar by creating(Jar::class) { - archiveClassifier.set("javadoc") - from(dokkaHtml) - } - publishing { publications { create("default") { - from(this@subprojects.components["java"]) - artifact(sourcesJar) - artifact(javadocJar) - pom { name.set(project.name) description.set("Obsoleting enums with sealed classes of objects") @@ -143,22 +78,60 @@ apiValidation { tasks { val jacocoMergeTest by registering(JacocoMerge::class) { - dependsOn(subprojects.map { it.tasks.jacocoTestReport }) - - destinationFile = file("$buildDir/jacoco/test.exec") - executionData = fileTree(rootDir) { - include("**/build/jacoco/test.exec") - } + val subprojectReporters = listOf( + "ksp", + "processor", + "processing-tests/ksp-tests", + "processing-tests/processor-tests", + "runtime" + ) + + dependsOn(subprojectReporters.map { "${it.replace("/", ":")}:jacocoTestReport" }) + + destinationFile = file("$buildDir/jacoco/jvmTest.exec") + executionData = files( + subprojectReporters + .map { "$rootDir/$it/build/jacoco/jvmTest.exec" } + .map(::file) + .filter(File::exists) + ) } - jacocoTestReport { + val jacocoTestReport by registering(JacocoReport::class) { dependsOn(jacocoMergeTest) - sourceSets(*subprojects.map { it.sourceSets.main.get() }.toTypedArray()) + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + files( + subprojects + .map { + it.buildDir.resolve("classes/kotlin/jvm/main") + } + .flatMap { it.walkBottomUp().toList() } + ) + ) + sourceDirectories.setFrom( + files( + subprojects.flatMap { + listOf( + it.projectDir.resolve("src/commonMain"), + it.projectDir.resolve("src/jvmMain") + ).filter(File::exists) + } + ) + ) reports { html.isEnabled = true xml.isEnabled = true } } + + val detektAll by registering { + allprojects { + this@registering.dependsOn(tasks.withType()) + } + + getByName("check").dependsOn(this) + } } diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 1de60bdc..2b4846aa 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -543,6 +543,7 @@ style: excludedFunctions: 'describeContents' excludeAnnotatedFunction: ['dagger.Provides'] LibraryCodeMustSpecifyReturnType: + excludes: [ '**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**' ] active: true LibraryEntitiesShouldNotBePublic: active: false diff --git a/ksp/build.gradle.kts b/ksp/build.gradle.kts index 94cf9da1..14df2a3c 100644 --- a/ksp/build.gradle.kts +++ b/ksp/build.gradle.kts @@ -1,15 +1,69 @@ plugins { + kotlin("multiplatform") + `java-library` kotlin("kapt") + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") `maven-publish` } +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +kotlin { + explicitApi() + + jvm() + + sourceSets { + val jvmMain by getting { + dependencies { + implementation(projects.runtime) + implementation(projects.processingCommon) + implementation(libs.squareUp.kotlinPoet) + compileOnly(libs.ksp.api) + implementation(libs.autoService.runtime) + configurations["kapt"].dependencies.add(project.dependencies.create(libs.autoService.processor.get())) + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } + + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + dependencies { - implementation(projects.runtime) - implementation(projects.processingCommon) - implementation(libs.squareUp.kotlinPoet) - compileOnly(libs.ksp.api) - implementation(libs.autoService.runtime) - kapt(libs.autoService.processor) + detektPlugins(Dependencies.detektFormatting) } kapt { diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/GenSealedEnumHolder.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/GenSealedEnumHolder.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/GenSealedEnumHolder.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/GenSealedEnumHolder.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/InvalidSubclassVisibilityException.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/InvalidSubclassVisibilityException.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/InvalidSubclassVisibilityException.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/InvalidSubclassVisibilityException.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/KotlinPoetKsp.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/KotlinPoetKsp.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/KotlinPoetKsp.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/KotlinPoetKsp.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/KspUtils.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/KspUtils.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/KspUtils.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/KspUtils.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/NonObjectSealedSubclassException.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/NonObjectSealedSubclassException.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/NonObjectSealedSubclassException.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/NonObjectSealedSubclassException.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/SealedEnumProcessor.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/SealedEnumProcessor.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/SealedEnumProcessor.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/SealedEnumProcessor.kt diff --git a/ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/SuperInterfaces.kt b/ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/SuperInterfaces.kt similarity index 100% rename from ksp/src/main/kotlin/com/livefront/sealedenum/internal/ksp/SuperInterfaces.kt rename to ksp/src/jvmMain/kotlin/com/livefront/sealedenum/internal/ksp/SuperInterfaces.kt diff --git a/processing-common/build.gradle.kts b/processing-common/build.gradle.kts index a2214d25..778e1744 100644 --- a/processing-common/build.gradle.kts +++ b/processing-common/build.gradle.kts @@ -1,8 +1,70 @@ plugins { + kotlin("multiplatform") + `java-library` + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") `maven-publish` } +kotlin { + explicitApi() + + jvm { + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + } + + sourceSets { + val jvmMain by getting { + dependencies { + implementation(projects.runtime) + implementation(libs.squareUp.kotlinPoet) + } + } + + val jvmTest by getting { + dependencies { + implementation(libs.junit.jupiter) + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } + + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + dependencies { + detektPlugins(Dependencies.detektFormatting) + implementation(projects.runtime) implementation(libs.squareUp.kotlinPoet) diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/SealedClassNode.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/SealedClassNode.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/SealedClassNode.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/SealedClassNode.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/TreeUtils.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/TreeUtils.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/TreeUtils.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/TreeUtils.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/Unique.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/Unique.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/Unique.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/Unique.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/Visibility.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/Visibility.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/Visibility.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/Visibility.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/CamelCase.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/CamelCase.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/CamelCase.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/CamelCase.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/EnumForSealedEnumTypeSpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/EnumForSealedEnumTypeSpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/EnumForSealedEnumTypeSpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/EnumForSealedEnumTypeSpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/EnumSealedObjectPropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/EnumSealedObjectPropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/EnumSealedObjectPropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/EnumSealedObjectPropertySpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/MaybeAddOriginatingElement.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/MaybeAddOriginatingElement.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/MaybeAddOriginatingElement.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/MaybeAddOriginatingElement.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedClassExtensions.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedClassExtensions.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedClassExtensions.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedClassExtensions.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumEnumPropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumEnumPropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumEnumPropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumEnumPropertySpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumFileSpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumFileSpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumFileSpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumFileSpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumNamePropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumNamePropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumNamePropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumNamePropertySpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumOrdinalPropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumOrdinalPropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumOrdinalPropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumOrdinalPropertySpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumSealedEnumPropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumSealedEnumPropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumSealedEnumPropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumSealedEnumPropertySpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt similarity index 97% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt index f603d0f6..e57d6b29 100644 --- a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt +++ b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt @@ -14,6 +14,7 @@ import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.asClassName import com.squareup.kotlinpoet.buildCodeBlock import javax.lang.model.element.TypeElement +import kotlin.reflect.KClass /** * A builder for a [SealedEnum] object for the given [sealedClass]. @@ -212,13 +213,13 @@ internal data class SealedEnumTypeSpec( .build() private fun createEnumClassGetter(enumForSealedEnum: ClassName): PropertySpec { - val parameterizedClass = Class::class.asClassName().parameterizedBy(enumForSealedEnum) + val parameterizedClass = KClass::class.asClassName().parameterizedBy(enumForSealedEnum) return PropertySpec.builder("enumClass", parameterizedClass) .addModifiers(KModifier.OVERRIDE) .getter( FunSpec.getterBuilder() - .addStatement("return %T::class.java", enumForSealedEnum) + .addStatement("return %T::class", enumForSealedEnum) .build() ) .build() diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValueOfFunSpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValueOfFunSpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValueOfFunSpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValueOfFunSpec.kt diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValuesPropertySpec.kt b/processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValuesPropertySpec.kt similarity index 100% rename from processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValuesPropertySpec.kt rename to processing-common/src/jvmMain/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumValuesPropertySpec.kt diff --git a/processing-common/src/test/kotlin/com/livefront/sealedenum/internal/common/TreeUtilsTests.kt b/processing-common/src/jvmTest/kotlin/com/livefront/sealedenum/internal/common/TreeUtilsTests.kt similarity index 100% rename from processing-common/src/test/kotlin/com/livefront/sealedenum/internal/common/TreeUtilsTests.kt rename to processing-common/src/jvmTest/kotlin/com/livefront/sealedenum/internal/common/TreeUtilsTests.kt diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceOuterClass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceOuterClass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceOuterClass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceOuterClass.java diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceSubclass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceSubclass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceSubclass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaPrivateInterfaceSubclass.java diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceBaseClass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceBaseClass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceBaseClass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceBaseClass.java diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceSubclass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceSubclass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceSubclass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/JavaProtectedInterfaceSubclass.java diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceBaseClass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceBaseClass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceBaseClass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceBaseClass.java diff --git a/processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceSubclass.java b/processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceSubclass.java similarity index 100% rename from processing-tests/common/test/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceSubclass.java rename to processing-tests/common/src/jvmTest/java/com/livefront/sealedenum/compilation/visibility/subpackage/JavaProtectedInterfaceSubclass.java diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt index 68e6552e..9223fe5b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClass.kt @@ -15,10 +15,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [EmptySealedClass] @@ -46,8 +46,8 @@ public object EmptySealedClassSealedEnum : SealedEnum, public override val values: List = emptyList() - public override val enumClass: Class - get() = EmptySealedClassEnum::class.java + public override val enumClass: KClass + get() = EmptySealedClassEnum::class public override fun ordinalOf(obj: EmptySealedClass): Int = throw AssertionError("Constructing a EmptySealedClass is impossible, since it has no sealed subclasses") diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt similarity index 92% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt index fe672cae..ae5513ed 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedClassTests.kt @@ -23,7 +23,7 @@ class EmptySealedClassTests { @Test fun `correct enum class`() { - assertEquals(EmptySealedClassEnum::class.java, EmptySealedClass.sealedEnum.enumClass) + assertEquals(EmptySealedClassEnum::class, EmptySealedClass.sealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt index bda94693..38094f72 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterface.kt @@ -15,10 +15,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [EmptySealedInterface] @@ -46,8 +46,8 @@ public object EmptySealedInterfaceSealedEnum : SealedEnum, public override val values: List = emptyList() - public override val enumClass: Class - get() = EmptySealedInterfaceEnum::class.java + public override val enumClass: KClass + get() = EmptySealedInterfaceEnum::class public override fun ordinalOf(obj: EmptySealedInterface): Int = throw AssertionError("Constructing a EmptySealedInterface is impossible, since it has no sealed subclasses") diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt similarity index 91% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt index 81e88549..fb603c69 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/EmptySealedInterfaceTests.kt @@ -23,7 +23,7 @@ class EmptySealedInterfaceTests { @Test fun `correct enum class`() { - assertEquals(EmptySealedInterfaceEnum::class.java, EmptySealedInterface.sealedEnum.enumClass) + assertEquals(EmptySealedInterfaceEnum::class, EmptySealedInterface.sealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt index 8520d7ce..45629afd 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt @@ -17,10 +17,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [OneObjectSealedClass] @@ -52,8 +52,8 @@ public object OneObjectSealedClassSealedEnum : SealedEnum, ) - public override val enumClass: Class - get() = OneObjectSealedClassEnum::class.java + public override val enumClass: KClass + get() = OneObjectSealedClassEnum::class public override fun ordinalOf(obj: OneObjectSealedClass): Int = when (obj) { OneObjectSealedClass.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt similarity index 93% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt index 9fe62cb9..d4baf3ec 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClassTests.kt @@ -31,7 +31,7 @@ class OneObjectSealedClassTests { @Test fun `correct enum class`() { - assertEquals(OneObjectSealedClassEnum::class.java, OneObjectSealedClass.sealedEnum.enumClass) + assertEquals(OneObjectSealedClassEnum::class, OneObjectSealedClass.sealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt index 8a43d33f..2191acd0 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt @@ -17,10 +17,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [OneObjectSealedInterface] @@ -52,8 +52,8 @@ public object OneObjectSealedInterfaceSealedEnum : SealedEnum - get() = OneObjectSealedInterfaceEnum::class.java + public override val enumClass: KClass + get() = OneObjectSealedInterfaceEnum::class public override fun ordinalOf(obj: OneObjectSealedInterface): Int = when (obj) { OneObjectSealedInterface.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt similarity index 93% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt index a1aab266..6cb9d3ad 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterfaceTests.kt @@ -31,7 +31,7 @@ class OneObjectSealedInterfaceTests { @Test fun `correct enum class`() { - assertEquals(OneObjectSealedInterfaceEnum::class.java, OneObjectSealedInterface.sealedEnum.enumClass) + assertEquals(OneObjectSealedInterfaceEnum::class, OneObjectSealedInterface.sealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt index 7b1b338f..4d68fb20 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt @@ -19,10 +19,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [TwoObjectSealedClass] @@ -56,8 +56,8 @@ public object TwoObjectSealedClassSealedEnum : SealedEnum, ) - public override val enumClass: Class - get() = TwoObjectSealedClassEnum::class.java + public override val enumClass: KClass + get() = TwoObjectSealedClassEnum::class public override fun ordinalOf(obj: TwoObjectSealedClass): Int = when (obj) { TwoObjectSealedClass.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt similarity index 93% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt index 0a34cae5..9608ff5b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClassTests.kt @@ -37,7 +37,7 @@ class TwoObjectSealedClassTests { @Test fun `correct enum class`() { - assertEquals(TwoObjectSealedClassEnum::class.java, TwoObjectSealedClassSealedEnum.enumClass) + assertEquals(TwoObjectSealedClassEnum::class, TwoObjectSealedClassSealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt index 36ad8c59..d0d40569 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt @@ -19,10 +19,10 @@ package com.livefront.sealedenum.compilation.basic import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [TwoObjectSealedInterface] @@ -56,8 +56,8 @@ public object TwoObjectSealedInterfaceSealedEnum : SealedEnum - get() = TwoObjectSealedInterfaceEnum::class.java + public override val enumClass: KClass + get() = TwoObjectSealedInterfaceEnum::class public override fun ordinalOf(obj: TwoObjectSealedInterface): Int = when (obj) { TwoObjectSealedInterface.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt similarity index 93% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt index 1b8ce0a7..b828f2de 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterfaceTests.kt @@ -37,7 +37,7 @@ class TwoObjectSealedInterfaceTests { @Test fun `correct enum class`() { - assertEquals(TwoObjectSealedInterfaceEnum::class.java, TwoObjectSealedInterface.sealedEnum.enumClass) + assertEquals(TwoObjectSealedInterfaceEnum::class, TwoObjectSealedInterface.sealedEnum.enumClass) } @Test diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt index e8d4e8ef..29bd8a67 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt @@ -23,10 +23,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [OneTypeParameterSealedClass] @@ -62,8 +62,8 @@ public object OneTypeParameterSealedClassSealedEnum : SealedEnum - get() = OneTypeParameterSealedClassEnum::class.java + public override val enumClass: KClass + get() = OneTypeParameterSealedClassEnum::class public override fun ordinalOf(obj: OneTypeParameterSealedClass<*>): Int = when (obj) { OneTypeParameterSealedClass.FirstObject -> 0 @@ -158,10 +158,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [TwoTypeParameterSealedClass] @@ -196,8 +196,8 @@ public object TwoTypeParameterSealedClassSealedEnum : SealedEnum - get() = TwoTypeParameterSealedClassEnum::class.java + public override val enumClass: KClass + get() = TwoTypeParameterSealedClassEnum::class public override fun ordinalOf(obj: TwoTypeParameterSealedClass<*, *>): Int = when (obj) { TwoTypeParameterSealedClass.FirstObject -> 0 @@ -285,10 +285,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [LimitedTypeParameterSealedClass] @@ -325,8 +325,8 @@ public object LimitedTypeParameterSealedClassSealedEnum : ) - public override val enumClass: Class - get() = LimitedTypeParameterSealedClassEnum::class.java + public override val enumClass: KClass + get() = LimitedTypeParameterSealedClassEnum::class public override fun ordinalOf(obj: LimitedTypeParameterSealedClass<*, *>): Int = when (obj) { LimitedTypeParameterSealedClass.FirstObject -> 0 @@ -421,10 +421,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [MultipleBoundsSealedClass] @@ -456,8 +456,8 @@ public object MultipleBoundsSealedClassSealedEnum : SealedEnum - get() = MultipleBoundsSealedClassEnum::class.java + public override val enumClass: KClass + get() = MultipleBoundsSealedClassEnum::class public override fun ordinalOf(obj: MultipleBoundsSealedClass<*>): Int = when (obj) { MultipleBoundsSealedClass.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClassTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClassTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt index f607dd1e..c600130b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClasses.kt @@ -25,11 +25,11 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Any import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [SealedEnumWithAbstractBaseClasses] @@ -63,8 +63,8 @@ public object SealedEnumWithAbstractBaseClassesSealedEnum : public override val values: List = emptyList() - public override val enumClass: Class - get() = SealedEnumWithAbstractBaseClassesEnum::class.java + public override val enumClass: KClass + get() = SealedEnumWithAbstractBaseClassesEnum::class public override fun ordinalOf(obj: SealedEnumWithAbstractBaseClasses): Int = throw AssertionError("Constructing a SealedEnumWithAbstractBaseClasses is impossible, since it has no sealed subclasses") @@ -139,10 +139,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [SealedEnumWithAbstractBaseClassesCovariantType] @@ -179,8 +179,8 @@ public object SealedEnumWithAbstractBaseClassesCovariantTypeSealedEnum : emptyList() - public override val enumClass: Class - get() = SealedEnumWithAbstractBaseClassesCovariantTypeEnum::class.java + public override val enumClass: KClass + get() = SealedEnumWithAbstractBaseClassesCovariantTypeEnum::class public override fun ordinalOf(obj: SealedEnumWithAbstractBaseClassesCovariantType<*>): Int = throw diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClassesTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClassesTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClassesTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithAbstractBaseClassesTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt index 32e09181..19b4d4d5 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt @@ -23,10 +23,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [EmptySealedClassWithInterface] @@ -57,8 +57,8 @@ public object EmptySealedClassWithInterfaceSealedEnum : SealedEnum = emptyList() - public override val enumClass: Class - get() = EmptySealedClassWithInterfaceEnum::class.java + public override val enumClass: KClass + get() = EmptySealedClassWithInterfaceEnum::class public override fun ordinalOf(obj: EmptySealedClassWithInterface): Int = throw AssertionError("Constructing a EmptySealedClassWithInterface is impossible, since it has no sealed subclasses") @@ -128,10 +128,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [OneObjectSealedClassWithInterface] @@ -168,8 +168,8 @@ public object OneObjectSealedClassWithInterfaceSealedEnum : ) - public override val enumClass: Class - get() = OneObjectSealedClassWithInterfaceEnum::class.java + public override val enumClass: KClass + get() = OneObjectSealedClassWithInterfaceEnum::class public override fun ordinalOf(obj: OneObjectSealedClassWithInterface): Int = when (obj) { OneObjectSealedClassWithInterface.FirstObject -> 0 @@ -253,10 +253,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [TwoObjectSealedClassWithGenericInterface] @@ -298,8 +298,8 @@ public object TwoObjectSealedClassWithGenericInterfaceSealedEnum : ) - public override val enumClass: Class - get() = TwoObjectSealedClassWithGenericInterfaceEnum::class.java + public override val enumClass: KClass + get() = TwoObjectSealedClassWithGenericInterfaceEnum::class public override fun ordinalOf(obj: TwoObjectSealedClassWithGenericInterface): Int = when (obj) { @@ -402,10 +402,10 @@ package com.livefront.sealedenum.compilation.generics import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [SealedClassWithGetterInterface] @@ -441,8 +441,8 @@ public object SealedClassWithGetterInterfaceSealedEnum : SealedEnum - get() = SealedClassWithGetterInterfaceEnum::class.java + public override val enumClass: KClass + get() = SealedClassWithGetterInterfaceEnum::class public override fun ordinalOf(obj: SealedClassWithGetterInterface): Int = when (obj) { SealedClassWithGetterInterface.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfacesTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfacesTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfacesTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfacesTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt index 9840d6c3..2e981050 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt @@ -26,10 +26,10 @@ package com.livefront.sealedenum.compilation.hierarchy import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [FirstClassHierarchy.A] @@ -61,8 +61,8 @@ public object FirstClassHierarchy_ASealedEnum : SealedEnum - get() = FirstClassHierarchy_AEnum::class.java + public override val enumClass: KClass + get() = FirstClassHierarchy_AEnum::class public override fun ordinalOf(obj: FirstClassHierarchy.A): Int = when (obj) { FirstClassHierarchy.A.B.C -> 0 @@ -130,10 +130,10 @@ package com.livefront.sealedenum.compilation.hierarchy import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [FirstClassHierarchy.A.B] @@ -165,8 +165,8 @@ public object FirstClassHierarchy_A_BSealedEnum : SealedEnum - get() = FirstClassHierarchy_A_BEnum::class.java + public override val enumClass: KClass + get() = FirstClassHierarchy_A_BEnum::class public override fun ordinalOf(obj: FirstClassHierarchy.A.B): Int = when (obj) { FirstClassHierarchy.A.B.C -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchyTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchyTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchyTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchyTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt index a81996a4..51432cde 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt @@ -26,10 +26,10 @@ package com.livefront.sealedenum.compilation.hierarchy import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [FirstInterfaceHierarchy.A] @@ -61,8 +61,8 @@ public object FirstInterfaceHierarchy_ASealedEnum : SealedEnum - get() = FirstInterfaceHierarchy_AEnum::class.java + public override val enumClass: KClass + get() = FirstInterfaceHierarchy_AEnum::class public override fun ordinalOf(obj: FirstInterfaceHierarchy.A): Int = when (obj) { FirstInterfaceHierarchy.A.B.C -> 0 @@ -130,10 +130,10 @@ package com.livefront.sealedenum.compilation.hierarchy import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [FirstInterfaceHierarchy.A.B] @@ -165,8 +165,8 @@ public object FirstInterfaceHierarchy_A_BSealedEnum : SealedEnum - get() = FirstInterfaceHierarchy_A_BEnum::class.java + public override val enumClass: KClass + get() = FirstInterfaceHierarchy_A_BEnum::class public override fun ordinalOf(obj: FirstInterfaceHierarchy.A.B): Int = when (obj) { FirstInterfaceHierarchy.A.B.C -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchyTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchyTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchyTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchyTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/NestedClassTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/NestedClassTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt index 545a8308..b1d3f6f9 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt @@ -17,10 +17,10 @@ package com.livefront.sealedenum.compilation.location import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [AlphaOutsideSealedClass] @@ -52,8 +52,8 @@ public object AlphaOutsideSealedClassSealedEnum : SealedEnum - get() = AlphaOutsideSealedClassEnum::class.java + public override val enumClass: KClass + get() = AlphaOutsideSealedClassEnum::class public override fun ordinalOf(obj: AlphaOutsideSealedClass): Int = when (obj) { AlphaFirstObject -> 0 @@ -130,10 +130,10 @@ package com.livefront.sealedenum.compilation.location import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [BetaOutsideSealedClass] @@ -167,8 +167,8 @@ public object BetaOutsideSealedClassSealedEnum : SealedEnum - get() = BetaOutsideSealedClassEnum::class.java + public override val enumClass: KClass + get() = BetaOutsideSealedClassEnum::class public override fun ordinalOf(obj: BetaOutsideSealedClass): Int = when (obj) { BetaFirstObject -> 0 @@ -253,10 +253,10 @@ package com.livefront.sealedenum.compilation.location import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [GammaOutsideSealedClass] @@ -292,8 +292,8 @@ public object GammaOutsideSealedClassSealedEnum : SealedEnum - get() = GammaOutsideSealedClassEnum::class.java + public override val enumClass: KClass + get() = GammaOutsideSealedClassEnum::class public override fun ordinalOf(obj: GammaOutsideSealedClass): Int = when (obj) { GammaFirstObject -> 0 @@ -382,10 +382,10 @@ package com.livefront.sealedenum.compilation.location import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [DeltaOutsideSealedClass] @@ -419,8 +419,8 @@ public object DeltaOutsideSealedClassSealedEnum : SealedEnum - get() = DeltaOutsideSealedClassEnum::class.java + public override val enumClass: KClass + get() = DeltaOutsideSealedClassEnum::class public override fun ordinalOf(obj: DeltaOutsideSealedClass): Int = when (obj) { DeltaOutsideSealedClass.DeltaObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClassTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClassTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt index c11ac186..c44bf95e 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt @@ -16,10 +16,10 @@ package com.livefront.sealedenum.compilation.location import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [SplitAcrossFilesSealedClass] @@ -55,8 +55,8 @@ public object SplitAcrossFilesSealedClassSealedEnum : SealedEnum - get() = SplitAcrossFilesSealedClassEnum::class.java + public override val enumClass: KClass + get() = SplitAcrossFilesSealedClassEnum::class public override fun ordinalOf(obj: SplitAcrossFilesSealedClass): Int = when (obj) { SplitAcrossFilesSubclassA -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClassTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClassTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassA.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassA.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassA.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassA.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassB.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassB.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassB.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassB.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassC.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassC.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassC.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSubclassC.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt index eee5faac..f36db486 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt @@ -68,10 +68,10 @@ package com.livefront.sealedenum.compilation.traversal import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [Tree] @@ -128,8 +128,8 @@ public object TreeLevelOrderSealedEnum : SealedEnum, SealedEnumWithEnumPro ) - public override val enumClass: Class - get() = TreeLevelOrderEnum::class.java + public override val enumClass: KClass + get() = TreeLevelOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { Tree.A -> 0 @@ -305,8 +305,8 @@ public object TreePostOrderSealedEnum : SealedEnum, SealedEnumWithEnumProv ) - public override val enumClass: Class - get() = TreePostOrderEnum::class.java + public override val enumClass: KClass + get() = TreePostOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { Tree.B.C.F.G -> 0 @@ -482,8 +482,8 @@ public object TreeInOrderSealedEnum : SealedEnum, SealedEnumWithEnumProvid ) - public override val enumClass: Class - get() = TreeInOrderEnum::class.java + public override val enumClass: KClass + get() = TreeInOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { Tree.A -> 0 @@ -658,8 +658,8 @@ public object TreePreOrderSealedEnum : SealedEnum, SealedEnumWithEnumProvi ) - public override val enumClass: Class - get() = TreePreOrderEnum::class.java + public override val enumClass: KClass + get() = TreePreOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { Tree.A -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrderTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrderTests.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrderTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrderTests.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt index 1c242a18..9062b993 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt @@ -42,10 +42,10 @@ package com.livefront.sealedenum.compilation.usecases import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [Environments] @@ -85,8 +85,8 @@ public object EnvironmentsSealedEnum : SealedEnum, ) - public override val enumClass: Class - get() = EnvironmentsEnum::class.java + public override val enumClass: KClass + get() = EnvironmentsEnum::class public override fun ordinalOf(obj: Environments): Int = when (obj) { Environments.Http.Livefront -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt index 3235bbb9..348c67e6 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnumTests.kt @@ -45,7 +45,7 @@ class EnvironmentsSealedEnumTests { @Test fun `environment manager from sealed enum`() { val environmentManager = EnvironmentManager( - enumClass = Environments.sealedEnum.enumClass, + enumClass = Environments.sealedEnum.enumClass.java, defaultEnvironment = Environments.Https.Livefront.enum ) diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt index c8a32c74..246b1c7c 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt @@ -23,10 +23,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [PrivateInterfaceSealedClass] @@ -60,8 +60,8 @@ public object PrivateInterfaceSealedClassSealedEnum : SealedEnum - get() = PrivateInterfaceSealedClassEnum::class.java + public override val enumClass: KClass + get() = PrivateInterfaceSealedClassEnum::class public override fun ordinalOf(obj: PrivateInterfaceSealedClass): Int = when (obj) { PrivateInterfaceSealedClass.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt index a0565227..2cea3166 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClassTests.kt @@ -42,7 +42,7 @@ class PrivateInterfaceSealedClassTests { @Test fun `sealed class has correct enum class`() { assertEquals( - PrivateInterfaceSealedClassEnum::class.java, + PrivateInterfaceSealedClassEnum::class, PrivateInterfaceSealedClass.sealedEnum.enumClass ) } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt index 5daf2b60..e1c3e9d7 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt @@ -28,10 +28,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class @@ -78,8 +78,8 @@ public object ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassSealedEn public override val enumClass: - Class - get() = ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum::class.java + KClass + get() = ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum::class public override fun ordinalOf(obj: ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass): Int = when (obj) { diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt similarity index 99% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt index aa12aa36..1e28c4da 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassTests.kt @@ -54,7 +54,7 @@ class ProtectedInterfaceSealedClassTests { @Test fun `sealed class has correct enum class`() { assertEquals( - ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum::class.java, + ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum::class, ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.sealedEnum.enumClass ) } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt index b55bc3b7..a3ef34a7 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt @@ -29,10 +29,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class @@ -89,9 +89,9 @@ public object public override val enumClass: - Class + KClass get() = - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum::class.java + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum::class public override fun ordinalOf(obj: ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass): diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt similarity index 98% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt index 509e129e..ce267ea6 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt @@ -42,7 +42,7 @@ class ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests { @Test fun `sealed class has correct enum class`() { assertEquals( - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum::class.java, + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum::class, ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.sealedEnum.enumClass ) } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt similarity index 97% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt index 2d631df8..4f989fbd 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt @@ -23,10 +23,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [InternalObjectsSealedClass] @@ -62,8 +62,8 @@ public object InternalObjectsSealedClassSealedEnum : SealedEnum - get() = InternalObjectsSealedClassEnum::class.java + public override val enumClass: KClass + get() = InternalObjectsSealedClassEnum::class public override fun ordinalOf(obj: InternalObjectsSealedClass): Int = when (obj) { InternalObjectsSealedClass.FirstObject -> 0 @@ -158,10 +158,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [InternalSealedClass] @@ -195,8 +195,8 @@ internal object InternalSealedClassSealedEnum : SealedEnum, ) - public override val enumClass: Class - get() = InternalSealedClassEnum::class.java + public override val enumClass: KClass + get() = InternalSealedClassEnum::class public override fun ordinalOf(obj: InternalSealedClass): Int = when (obj) { InternalSealedClass.FirstObject -> 0 @@ -278,10 +278,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [InternalCompanionSealedClass] @@ -315,8 +315,8 @@ public object InternalCompanionSealedClassSealedEnum : SealedEnum - get() = InternalCompanionSealedClassEnum::class.java + public override val enumClass: KClass + get() = InternalCompanionSealedClassEnum::class public override fun ordinalOf(obj: InternalCompanionSealedClass): Int = when (obj) { InternalCompanionSealedClass.FirstObject -> 0 @@ -403,10 +403,10 @@ package com.livefront.sealedenum.compilation.visibility import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [InternalSealedAndCompanionSealedClass] @@ -444,8 +444,8 @@ internal object InternalSealedAndCompanionSealedClassSealedEnum : ) - public override val enumClass: Class - get() = InternalSealedAndCompanionSealedClassEnum::class.java + public override val enumClass: KClass + get() = InternalSealedAndCompanionSealedClassEnum::class public override fun ordinalOf(obj: InternalSealedAndCompanionSealedClass): Int = when (obj) { InternalSealedAndCompanionSealedClass.FirstObject -> 0 diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt similarity index 96% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt index fedc2981..8c8d9cd8 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClassTests.kt @@ -60,7 +60,7 @@ class VisibilitySealedClassTests { @Test fun `correct enum class`() { - assertEquals(InternalObjectsSealedClassEnum::class.java, InternalObjectsSealedClass.sealedEnum.enumClass) + assertEquals(InternalObjectsSealedClassEnum::class, InternalObjectsSealedClass.sealedEnum.enumClass) } @Test @@ -116,7 +116,7 @@ class VisibilitySealedClassTests { @Test fun `correct enum class`() { - assertEquals(InternalSealedClassEnum::class.java, InternalSealedClass.sealedEnum.enumClass) + assertEquals(InternalSealedClassEnum::class, InternalSealedClass.sealedEnum.enumClass) } @Test @@ -169,7 +169,7 @@ class VisibilitySealedClassTests { @Test fun `correct enum class`() { assertEquals( - InternalCompanionSealedClassEnum::class.java, + InternalCompanionSealedClassEnum::class, InternalCompanionSealedClass.sealedEnum.enumClass ) } @@ -231,7 +231,7 @@ class VisibilitySealedClassTests { @Test fun `correct enum class`() { assertEquals( - InternalSealedAndCompanionSealedClassEnum::class.java, + InternalSealedAndCompanionSealedClassEnum::class, InternalSealedAndCompanionSealedClass.sealedEnum.enumClass ) } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/errors/AnnotationErrors.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/errors/AnnotationErrors.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/errors/AnnotationErrors.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/errors/AnnotationErrors.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/errors/NonObjectErrors.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/errors/NonObjectErrors.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/errors/NonObjectErrors.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/errors/NonObjectErrors.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/CompilationAssertions.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CompilationAssertions.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/CompilationAssertions.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CompilationAssertions.kt diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt similarity index 94% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt index 8a16681f..580b74cb 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt +++ b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/PathsUtils.kt @@ -11,7 +11,8 @@ internal fun getCommonSourceFile(vararg paths: String): SourceFile = SourceFile. Paths.get( "..", "common", - "test", + "src", + "jvmTest", if (paths.last().endsWith(".java")) "java" else "kotlin", "com", "livefront", @@ -27,7 +28,7 @@ internal fun getCommonSourceFile(vararg paths: String): SourceFile = SourceFile. internal fun getSourceFile(vararg paths: String): SourceFile = SourceFile.fromPath( Paths.get( "src", - "test", + "jvmTest", if (paths.last().endsWith(".java")) "java" else "kotlin", "com", "livefront", diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/ProcessingType.kt b/processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/ProcessingType.kt similarity index 100% rename from processing-tests/common/test/kotlin/com/livefront/sealedenum/testing/ProcessingType.kt rename to processing-tests/common/src/jvmTest/kotlin/com/livefront/sealedenum/testing/ProcessingType.kt diff --git a/processing-tests/ksp-tests/build.gradle.kts b/processing-tests/ksp-tests/build.gradle.kts index 3727c5e8..6de675da 100644 --- a/processing-tests/ksp-tests/build.gradle.kts +++ b/processing-tests/ksp-tests/build.gradle.kts @@ -1,18 +1,82 @@ plugins { + kotlin("multiplatform") + `java-library` + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") id("com.google.devtools.ksp") - idea } /** * Swap to `true` to allow debugging `processor-tests` */ val debugProcessor = false + +kotlin { + explicitApi() + + jvm { + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + withJava() + } + + sourceSets { + val jvmTest by getting { + dependencies { + implementation(libs.junit.jupiter) + implementation(libs.kotlinCompileTesting.base) + implementation(libs.kotlinCompileTesting.ksp) + implementation(kotlin("reflect")) + implementation(projects.runtime) + implementation(libs.ksp.runtime) + implementation(libs.ksp.api) + implementation(projects.ksp) + configurations["ksp"].dependencies.add(projects.ksp) + } + if (!debugProcessor) { + kotlin.srcDir("$rootDir/processing-tests/common/src/jvmTest") + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } + + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + if (!debugProcessor) { sourceSets { test { java { - srcDir("$rootDir/processing-tests/common/test/java") - srcDir("$rootDir/processing-tests/common/test/kotlin") + srcDir("$rootDir/processing-tests/common/src/jvmTest/java") } } } @@ -20,23 +84,13 @@ if (!debugProcessor) { detekt { input = files( - "src/main/java", - "src/test/java", - "src/main/kotlin", - "src/test/kotlin", - "$rootDir/processing-tests/common/test/java", - "$rootDir/processing-tests/common/test/kotlin" + "src/jvmMain/kotlin", + "src/jvmTest/kotlin", + "$rootDir/processing-tests/common/src/jvmTest/java", + "$rootDir/processing-tests/common/src/jvmTest/kotlin" ) } dependencies { - testImplementation(libs.junit.jupiter) - testImplementation(libs.kotlinCompileTesting.base) - testImplementation(libs.kotlinCompileTesting.ksp) - testImplementation(kotlin("reflect")) - testImplementation(projects.runtime) - testImplementation(libs.ksp.runtime) - testImplementation(libs.ksp.api) - testImplementation(projects.ksp) - kspTest(projects.ksp) + detektPlugins(Dependencies.detektFormatting) } diff --git a/processing-tests/ksp-tests/src/test/kotlin/com/livefront/sealedenum/testing/Compilation.kt b/processing-tests/ksp-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/Compilation.kt similarity index 100% rename from processing-tests/ksp-tests/src/test/kotlin/com/livefront/sealedenum/testing/Compilation.kt rename to processing-tests/ksp-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/Compilation.kt diff --git a/processing-tests/ksp-tests/src/test/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt b/processing-tests/ksp-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt similarity index 100% rename from processing-tests/ksp-tests/src/test/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt rename to processing-tests/ksp-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt diff --git a/processing-tests/processor-tests/build.gradle.kts b/processing-tests/processor-tests/build.gradle.kts index 6ab2a9e7..be71dc85 100644 --- a/processing-tests/processor-tests/build.gradle.kts +++ b/processing-tests/processor-tests/build.gradle.kts @@ -1,18 +1,79 @@ plugins { + kotlin("multiplatform") + `java-library` kotlin("kapt") - idea + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") } /** * Swap to `true` to allow debugging `ksp-tests` */ val debugKsp = false + +kotlin { + explicitApi() + + jvm { + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + withJava() + } + + sourceSets { + val jvmTest by getting { + dependencies { + implementation(libs.junit.jupiter) + implementation(libs.kotlinCompileTesting.base) + implementation(kotlin("reflect")) + implementation(projects.runtime) + implementation(projects.processor) + configurations["kaptTest"].dependencies.add(projects.processor) + } + if (!debugKsp) { + kotlin.srcDir("$rootDir/processing-tests/common/src/jvmTest") + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } + + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + if (!debugKsp) { sourceSets { test { java { - srcDir("$rootDir/processing-tests/common/test/java") - srcDir("$rootDir/processing-tests/common/test/kotlin") + srcDir("$rootDir/processing-tests/common/src/jvmTest/java") } } } @@ -20,20 +81,13 @@ if (!debugKsp) { detekt { input = files( - "src/main/java", - "src/test/java", - "src/main/kotlin", - "src/test/kotlin", - "$rootDir/processing-tests/common/test/java", - "$rootDir/processing-tests/common/test/kotlin" + "src/jvmMain/kotlin", + "src/jvmTest/kotlin", + "$rootDir/processing-tests/common/src/jvmTest/java", + "$rootDir/processing-tests/common/src/jvmTest/kotlin" ) } dependencies { - testImplementation(libs.junit.jupiter) - testImplementation(libs.kotlinCompileTesting.base) - testImplementation(kotlin("reflect")) - testImplementation(projects.runtime) - testImplementation(projects.processor) - kaptTest(projects.processor) + detektPlugins(Dependencies.detektFormatting) } diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaFirstBaseClass.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaFirstBaseClass.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaFirstBaseClass.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaFirstBaseClass.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface1.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface1.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface1.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface1.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface2.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface2.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface2.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface2.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface3.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface3.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface3.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface3.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface4.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface4.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface4.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface4.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface5.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface5.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface5.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaInterface5.java diff --git a/processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaSecondBaseClass.java b/processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaSecondBaseClass.java similarity index 100% rename from processing-tests/processor-tests/src/test/java/com/livefront/sealedenum/compilation/kitchensink/JavaSecondBaseClass.java rename to processing-tests/processor-tests/src/jvmTest/java/com/livefront/sealedenum/compilation/kitchensink/JavaSecondBaseClass.java diff --git a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt b/processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt similarity index 97% rename from processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt rename to processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt index f8b7ada7..f1b9925d 100644 --- a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt +++ b/processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt @@ -45,11 +45,11 @@ package com.livefront.sealedenum.compilation.kitchensink import com.livefront.sealedenum.EnumForSealedEnumProvider import com.livefront.sealedenum.SealedEnum import com.livefront.sealedenum.SealedEnumWithEnumProvider -import java.lang.Class import kotlin.Double import kotlin.Int import kotlin.String import kotlin.collections.List +import kotlin.reflect.KClass /** * An isomorphic enum for the sealed class [JavaBaseClassesSealedClass] @@ -91,8 +91,8 @@ public object JavaBaseClassesSealedClassSealedEnum : SealedEnum - get() = JavaBaseClassesSealedClassEnum::class.java + public override val enumClass: KClass + get() = JavaBaseClassesSealedClassEnum::class public override fun ordinalOf(obj: JavaBaseClassesSealedClass<*>): Int = when (obj) { JavaBaseClassesSealedClass.FirstObject -> 0 diff --git a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClassesTests.kt b/processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClassesTests.kt similarity index 100% rename from processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClassesTests.kt rename to processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClassesTests.kt diff --git a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/testing/Compilation.kt b/processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/Compilation.kt similarity index 100% rename from processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/testing/Compilation.kt rename to processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/Compilation.kt diff --git a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt b/processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt similarity index 100% rename from processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt rename to processing-tests/processor-tests/src/jvmTest/kotlin/com/livefront/sealedenum/testing/CurrentProcessingType.kt diff --git a/processor/build.gradle.kts b/processor/build.gradle.kts index 19b601a7..ff6b4839 100644 --- a/processor/build.gradle.kts +++ b/processor/build.gradle.kts @@ -1,19 +1,72 @@ plugins { + kotlin("multiplatform") + `java-library` kotlin("kapt") + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") `maven-publish` } +kotlin { + explicitApi() + + jvm { + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + } + + sourceSets { + val jvmMain by getting { + dependencies { + implementation(projects.runtime) + implementation(projects.processingCommon) + implementation(libs.squareUp.kotlinPoet) + implementation(libs.squareUp.kotlinPoetClassInspectorElements) + implementation(libs.squareUp.kotlinPoetMetadata) + implementation(libs.squareUp.kotlinPoetMetadataSpecs) + implementation(libs.autoService.runtime) + configurations["kapt"].dependencies.add(project.dependencies.create(libs.autoService.processor.get())) + implementation(libs.incap.runtime) + configurations["kapt"].dependencies.add(project.dependencies.create(libs.incap.processor.get())) + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } + + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } +} + dependencies { - implementation(projects.runtime) - implementation(projects.processingCommon) - implementation(libs.squareUp.kotlinPoet) - implementation(libs.squareUp.kotlinPoetClassInspectorElements) - implementation(libs.squareUp.kotlinPoetMetadata) - implementation(libs.squareUp.kotlinPoetMetadataSpecs) - implementation(libs.autoService.runtime) - kapt(libs.autoService.processor) - implementation(libs.incap.runtime) - kapt(libs.incap.processor) + detektPlugins(Dependencies.detektFormatting) } kapt { diff --git a/processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/InvalidSubclassVisibilityException.kt b/processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/InvalidSubclassVisibilityException.kt similarity index 100% rename from processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/InvalidSubclassVisibilityException.kt rename to processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/InvalidSubclassVisibilityException.kt diff --git a/processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/NonObjectSealedSubclassException.kt b/processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/NonObjectSealedSubclassException.kt similarity index 100% rename from processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/NonObjectSealedSubclassException.kt rename to processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/NonObjectSealedSubclassException.kt diff --git a/processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/SealedEnumProcessor.kt b/processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/SealedEnumProcessor.kt similarity index 100% rename from processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/SealedEnumProcessor.kt rename to processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/SealedEnumProcessor.kt diff --git a/processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/SuperInterfaces.kt b/processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/SuperInterfaces.kt similarity index 100% rename from processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/SuperInterfaces.kt rename to processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/SuperInterfaces.kt diff --git a/processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/WildcardedTypeParameters.kt b/processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/WildcardedTypeParameters.kt similarity index 100% rename from processor/src/main/kotlin/com/livefront/sealedenum/internal/processor/WildcardedTypeParameters.kt rename to processor/src/jvmMain/kotlin/com/livefront/sealedenum/internal/processor/WildcardedTypeParameters.kt diff --git a/runtime/api/runtime.api b/runtime/api/runtime.api index aee13d5a..4374bd7d 100644 --- a/runtime/api/runtime.api +++ b/runtime/api/runtime.api @@ -1,6 +1,6 @@ public abstract interface class com/livefront/sealedenum/EnumForSealedEnumProvider { public abstract fun enumToSealedObject (Ljava/lang/Enum;)Ljava/lang/Object; - public abstract fun getEnumClass ()Ljava/lang/Class; + public abstract fun getEnumClass ()Lkotlin/reflect/KClass; public abstract fun sealedObjectToEnum (Ljava/lang/Object;)Ljava/lang/Enum; } @@ -26,7 +26,7 @@ public final class com/livefront/sealedenum/SealedEnum$DefaultImpls { } public final class com/livefront/sealedenum/SealedEnumKt { - public static final fun createSealedEnumFromEnumArray ([Ljava/lang/Enum;Ljava/lang/Class;)Lcom/livefront/sealedenum/SealedEnumWithEnumProvider; + public static final fun createSealedEnumFromEnumArray ([Ljava/lang/Enum;Lkotlin/reflect/KClass;)Lcom/livefront/sealedenum/SealedEnumWithEnumProvider; } public abstract interface class com/livefront/sealedenum/SealedEnumWithEnumProvider : com/livefront/sealedenum/EnumForSealedEnumProvider, com/livefront/sealedenum/SealedEnum { diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index 8f72d4af..c2a4d0ec 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -1,7 +1,71 @@ plugins { + kotlin("multiplatform") + `java-library` + jacoco + id("io.gitlab.arturbosch.detekt") + id("org.jetbrains.dokka") `maven-publish` } +kotlin { + explicitApi() + + jvm { + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + } + js(IR) { + browser() + nodejs() + } + + macosX64() + iosArm32(); iosArm64(); iosX64() + watchosArm32(); watchosArm64(); watchosX86() + + linuxArm64(); linuxX64() + mingwX64() + + sourceSets { + val commonTest by getting { + dependencies { + implementation(kotlin("test")) + } + } + } +} + +jacoco { + toolVersion = Versions.jacoco +} + +tasks { + withType { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + jacocoTestReport { + dependsOn("jvmTest") + + executionData.setFrom("$buildDir/jacoco/jvmTest.exec") + classDirectories.setFrom( + File("$buildDir/classes/kotlin/jvm/main").walkBottomUp().toList() + ) + sourceDirectories.setFrom( + files( + "src/commonMain", + "src/jvmMain" + ) + ) + + reports { + html.isEnabled = true + xml.isEnabled = true + } + } +} + dependencies { - testImplementation(libs.junit.jupiter) + detektPlugins(Dependencies.detektFormatting) } diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt similarity index 91% rename from runtime/src/main/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt rename to runtime/src/commonMain/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt index 362e018a..c3fdf8a2 100644 --- a/runtime/src/main/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt +++ b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/EnumForSealedEnumProvider.kt @@ -1,5 +1,7 @@ package com.livefront.sealedenum +import kotlin.reflect.KClass + /** * Defines a provider for interoperability between a [SealedEnum] for type [T] and a normal enum class [E]. */ @@ -19,5 +21,5 @@ public interface EnumForSealedEnumProvider> { /** * The class object for the enum. */ - public val enumClass: Class + public val enumClass: KClass } diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/GenSealedEnum.kt similarity index 98% rename from runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt rename to runtime/src/commonMain/kotlin/com/livefront/sealedenum/GenSealedEnum.kt index 53b06139..2b979ce0 100644 --- a/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt +++ b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/GenSealedEnum.kt @@ -194,8 +194,7 @@ package com.livefront.sealedenum * determined by [traversalOrder]), and the names of the sealed objects (as given by [SealedEnum.nameOf] and * [SealedEnum.valueOf]) will match the names of the enum constants (assuming no obfuscation occurs). */ -@Suppress("DEPRECATED_JAVA_ANNOTATION") -@java.lang.annotation.Repeatable(GenSealedEnums::class) +@RepeatableContainer(GenSealedEnums::class) @Retention(AnnotationRetention.SOURCE) @Target(AnnotationTarget.CLASS) @Repeatable diff --git a/runtime/src/commonMain/kotlin/com/livefront/sealedenum/RepeatableContainer.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/RepeatableContainer.kt new file mode 100644 index 00000000..e9e522cc --- /dev/null +++ b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/RepeatableContainer.kt @@ -0,0 +1,10 @@ +package com.livefront.sealedenum + +import kotlin.reflect.KClass + +/** + * A multiplatform expectation for the Java Repeatable annotation. + */ +@OptIn(ExperimentalMultiplatform::class) +@OptionalExpectation +public expect annotation class RepeatableContainer(val value: KClass) diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/SealedEnum.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/SealedEnum.kt similarity index 89% rename from runtime/src/main/kotlin/com/livefront/sealedenum/SealedEnum.kt rename to runtime/src/commonMain/kotlin/com/livefront/sealedenum/SealedEnum.kt index 070f0cc1..739e2271 100644 --- a/runtime/src/main/kotlin/com/livefront/sealedenum/SealedEnum.kt +++ b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/SealedEnum.kt @@ -1,5 +1,7 @@ package com.livefront.sealedenum +import kotlin.reflect.KClass + /** * An interface providing `Enum`-like methods in a generic manner, for sealed classes that only have objects as * subclasses. @@ -32,27 +34,27 @@ public interface SealedEnum : Comparator { */ public fun valueOf(name: String): T - public override fun compare(first: T, second: T): Int = ordinalOf(first) - ordinalOf(second) + public override fun compare(a: T, b: T): Int = ordinalOf(a) - ordinalOf(b) } /** * Creates a [SealedEnumWithEnumProvider] for the enum [E]. */ public inline fun > createSealedEnumFromEnum(): SealedEnumWithEnumProvider = - createSealedEnumFromEnumArray(enumValues(), E::class.java) + createSealedEnumFromEnumArray(enumValues(), E::class) /** * Creates a [SealedEnumWithEnumProvider] for the enum [E] with the given array of enum values. */ public fun > createSealedEnumFromEnumArray( values: Array, - enumClass: Class + enumClass: KClass ): SealedEnumWithEnumProvider = object : SealedEnumWithEnumProvider { val nameToValueMap: Map by lazy(LazyThreadSafetyMode.PUBLICATION) { values.associateBy { it.name } } - override val enumClass: Class = enumClass + override val enumClass: KClass = enumClass override val values: List = values.toList() diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/SealedEnumWithEnumProvider.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/SealedEnumWithEnumProvider.kt similarity index 100% rename from runtime/src/main/kotlin/com/livefront/sealedenum/SealedEnumWithEnumProvider.kt rename to runtime/src/commonMain/kotlin/com/livefront/sealedenum/SealedEnumWithEnumProvider.kt diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/TreeTraversalOrder.kt b/runtime/src/commonMain/kotlin/com/livefront/sealedenum/TreeTraversalOrder.kt similarity index 100% rename from runtime/src/main/kotlin/com/livefront/sealedenum/TreeTraversalOrder.kt rename to runtime/src/commonMain/kotlin/com/livefront/sealedenum/TreeTraversalOrder.kt diff --git a/runtime/src/commonTest/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt b/runtime/src/commonTest/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt new file mode 100644 index 00000000..3c8a2559 --- /dev/null +++ b/runtime/src/commonTest/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt @@ -0,0 +1,130 @@ +package com.livefront.sealedenum + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.fail + +enum class AlphaEnum { BETA, GAMMA, DELTA } + +class CreateSealedEnumFromEnumTests { + + private val alphaEnumSealedEnum = createSealedEnumFromEnum() + + @Test + fun verify_values_are_correct() { + assertEquals(listOf(AlphaEnum.BETA, AlphaEnum.GAMMA, AlphaEnum.DELTA), alphaEnumSealedEnum.values) + } + + @Test + fun verify_ordinal_of_BETA_is_correct() { + assertEquals(0, alphaEnumSealedEnum.ordinalOf(AlphaEnum.BETA)) + } + + @Test + fun verify_ordinal_of_GAMMA_is_correct() { + assertEquals(1, alphaEnumSealedEnum.ordinalOf(AlphaEnum.GAMMA)) + } + + @Test + fun verify_ordinal_of_DELTA_is_correct() { + assertEquals(2, alphaEnumSealedEnum.ordinalOf(AlphaEnum.DELTA)) + } + + data class ComparatorConfig( + val first: AlphaEnum, + val second: AlphaEnum, + val compareValue: Int + ) + + @Test + fun verify_compareTo_is_correct() { + listOf( + ComparatorConfig(AlphaEnum.BETA, AlphaEnum.BETA, 0), + ComparatorConfig(AlphaEnum.BETA, AlphaEnum.GAMMA, -1), + ComparatorConfig(AlphaEnum.BETA, AlphaEnum.DELTA, -2), + ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.BETA, 1), + ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.GAMMA, 0), + ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.DELTA, -1), + ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.BETA, 2), + ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.GAMMA, 1), + ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.DELTA, 0) + ).forEach { config -> + assertEquals(config.compareValue, alphaEnumSealedEnum.compare(config.first, config.second)) + } + } + + @Test + fun verify_name_of_BETA_is_correct() { + assertEquals("BETA", alphaEnumSealedEnum.nameOf(AlphaEnum.BETA)) + } + + @Test + fun verify_name_of_GAMMA_is_correct() { + assertEquals("GAMMA", alphaEnumSealedEnum.nameOf(AlphaEnum.GAMMA)) + } + + @Test + fun verify_name_of_DELTA_is_correct() { + assertEquals("DELTA", alphaEnumSealedEnum.nameOf(AlphaEnum.DELTA)) + } + + @Test + fun verify_valueOf_of_BETA_is_correct() { + assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.valueOf("BETA")) + } + + @Test + fun verify_valueOf_of_GAMMA_is_correct() { + assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.valueOf("GAMMA")) + } + + @Test + fun verify_valueOf_of_DELTA_is_correct() { + assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.valueOf("DELTA")) + } + + @Test + fun verify_valueOf_of_EPSILON_throws_exception() { + try { + alphaEnumSealedEnum.valueOf("EPSILON") + fail() + } catch (exception: IllegalArgumentException) { + // expected to throw + } + } + + @Test + fun verify_enum_class_is_correct() { + assertEquals(AlphaEnum::class, alphaEnumSealedEnum.enumClass) + } + + @Test + fun verify_sealed_enum_to_object_is_correct_for_BETA() { + assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.BETA)) + } + + @Test + fun verify_sealed_enum_to_object_is_correct_for_GAMMA() { + assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.GAMMA)) + } + + @Test + fun verify_sealed_enum_to_object_is_correct_for_DELTA() { + assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.DELTA)) + } + + @Test + fun verify_object_to_sealed_enum_is_correct_for_BETA() { + assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.BETA)) + } + + @Test + fun verify_object_to_sealed_enum_is_correct_for_GAMMA() { + assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.GAMMA)) + } + + @Test + fun verify_object_to_sealed_enum_is_correct_for_DELTA() { + assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.DELTA)) + } +} diff --git a/runtime/src/jvmMain/kotlin/com/livefront/sealedenum/RepeatableContainer.jvm.kt b/runtime/src/jvmMain/kotlin/com/livefront/sealedenum/RepeatableContainer.jvm.kt new file mode 100644 index 00000000..694207b7 --- /dev/null +++ b/runtime/src/jvmMain/kotlin/com/livefront/sealedenum/RepeatableContainer.jvm.kt @@ -0,0 +1,8 @@ +package com.livefront.sealedenum + +import java.lang.annotation.Repeatable + +/** + * The mapping of [RepeatableContainer] to [Repeatable] + */ +public actual typealias RepeatableContainer = Repeatable diff --git a/runtime/src/test/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt b/runtime/src/test/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt deleted file mode 100644 index 1c89aeac..00000000 --- a/runtime/src/test/kotlin/com/livefront/sealedenum/CreateSealedEnumFromEnumTests.kt +++ /dev/null @@ -1,137 +0,0 @@ -package com.livefront.sealedenum - -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.assertThrows -import org.junit.jupiter.api.extension.ExtensionContext -import org.junit.jupiter.params.ParameterizedTest -import org.junit.jupiter.params.provider.Arguments -import org.junit.jupiter.params.provider.ArgumentsProvider -import org.junit.jupiter.params.provider.ArgumentsSource -import java.util.stream.Stream - -enum class AlphaEnum { BETA, GAMMA, DELTA } - -class CreateSealedEnumFromEnumTests { - - private val alphaEnumSealedEnum = createSealedEnumFromEnum() - - @Test - fun `verify values are correct`() { - assertEquals(listOf(AlphaEnum.BETA, AlphaEnum.GAMMA, AlphaEnum.DELTA), alphaEnumSealedEnum.values) - } - - @Test - fun `verify ordinal of BETA is correct`() { - assertEquals(0, alphaEnumSealedEnum.ordinalOf(AlphaEnum.BETA)) - } - - @Test - fun `verify ordinal of GAMMA is correct`() { - assertEquals(1, alphaEnumSealedEnum.ordinalOf(AlphaEnum.GAMMA)) - } - - @Test - fun `verify ordinal of DELTA is correct`() { - assertEquals(2, alphaEnumSealedEnum.ordinalOf(AlphaEnum.DELTA)) - } - - data class ComparatorConfig( - val first: AlphaEnum, - val second: AlphaEnum, - val compareValue: Int - ) { - class Provider : ArgumentsProvider { - override fun provideArguments(context: ExtensionContext?): Stream = - listOf( - ComparatorConfig(AlphaEnum.BETA, AlphaEnum.BETA, 0), - ComparatorConfig(AlphaEnum.BETA, AlphaEnum.GAMMA, -1), - ComparatorConfig(AlphaEnum.BETA, AlphaEnum.DELTA, -2), - ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.BETA, 1), - ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.GAMMA, 0), - ComparatorConfig(AlphaEnum.GAMMA, AlphaEnum.DELTA, -1), - ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.BETA, 2), - ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.GAMMA, 1), - ComparatorConfig(AlphaEnum.DELTA, AlphaEnum.DELTA, 0) - ).map { Arguments.of(it) }.stream() - } - } - - @ParameterizedTest - @ArgumentsSource(ComparatorConfig.Provider::class) - fun `verify compareTo is correct`(config: ComparatorConfig) { - assertEquals(config.compareValue, alphaEnumSealedEnum.compare(config.first, config.second)) - } - - @Test - fun `verify name of BETA is correct`() { - assertEquals("BETA", alphaEnumSealedEnum.nameOf(AlphaEnum.BETA)) - } - - @Test - fun `verify name of GAMMA is correct`() { - assertEquals("GAMMA", alphaEnumSealedEnum.nameOf(AlphaEnum.GAMMA)) - } - - @Test - fun `verify name of DELTA is correct`() { - assertEquals("DELTA", alphaEnumSealedEnum.nameOf(AlphaEnum.DELTA)) - } - - @Test - fun `verify valueOf of BETA is correct`() { - assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.valueOf("BETA")) - } - - @Test - fun `verify valueOf of GAMMA is correct`() { - assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.valueOf("GAMMA")) - } - - @Test - fun `verify valueOf of DELTA is correct`() { - assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.valueOf("DELTA")) - } - - @Test - fun `verify valueOf of EPSILON throws exception`() { - assertThrows { - alphaEnumSealedEnum.valueOf("EPSILON") - } - } - - @Test - fun `verify enum class is correct`() { - assertEquals(AlphaEnum::class.java, alphaEnumSealedEnum.enumClass) - } - - @Test - fun `verify sealed enum to object is correct for BETA`() { - assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.BETA)) - } - - @Test - fun `verify sealed enum to object is correct for GAMMA`() { - assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.GAMMA)) - } - - @Test - fun `verify sealed enum to object is correct for DELTA`() { - assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.sealedObjectToEnum(AlphaEnum.DELTA)) - } - - @Test - fun `verify object to sealed enum is correct for BETA`() { - assertEquals(AlphaEnum.BETA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.BETA)) - } - - @Test - fun `verify object to sealed enum is correct for GAMMA`() { - assertEquals(AlphaEnum.GAMMA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.GAMMA)) - } - - @Test - fun `verify object to sealed enum is correct for DELTA`() { - assertEquals(AlphaEnum.DELTA, alphaEnumSealedEnum.enumToSealedObject(AlphaEnum.DELTA)) - } -}