Skip to content

Commit

Permalink
Improve type parameter handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Oct 4, 2021
1 parent 2943291 commit f630d9c
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.util.Properties
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "com.github.cs125-illinois"
version = "2021.10.0"
version = "2021.10.1"

plugins {
kotlin("jvm") version "1.5.31"
Expand All @@ -25,7 +25,7 @@ repositories {
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:1.5.31")
implementation("io.github.classgraph:classgraph:4.8.120")
implementation("io.github.classgraph:classgraph:4.8.121")
implementation("io.github.kostaskougios:cloning:1.10.3")

testImplementation("io.kotest:kotest-runner-junit5:4.6.3")
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/Solution.kt
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ fun compareParameters(
) {
continue
}
if (submissionTypeArgument.typeName.removePrefix("? extends").trim()
== solutionTypeArgument.typeName
) {
continue
}
if (solutionTypeArgument != submissionTypeArgument) {
matches = false
break
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2021.9.4
version=2021.10.0
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ class TestJavaExamples : StringSpec(
examples.java.noreceiver.kotlinobjectlist.Correct::class.java.also {
"${it.testName()}" { it.test() }
}
examples.java.noreceiver.kotlinparameterizedlist.Correct::class.java.also {
"${it.testName()}" { it.test() }
}
examples.java.receiver.timeouttest.Correct::class.java.also {
"${it.testName()}" {
val runnable = object : Runnable {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package examples.java.noreceiver.kotlinparameterizedlist;

import edu.illinois.cs.cs125.jenisol.core.FixedParameters;
import edu.illinois.cs.cs125.jenisol.core.RandomParameters;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class Correct {
public static int listSize(List<Item> values) {
return values.size();
}

@FixedParameters private static final List<List<Item>> FIXED = Arrays.asList(null, List.of());

@RandomParameters
private static List<Item> randomParameters(Random random) {
return Arrays.asList(new Item[random.nextInt(32)]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package examples.java.noreceiver.kotlinparameterizedlist

fun listSize(values: List<Item>): Int {
return values.size
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package examples.java.noreceiver.kotlinparameterizedlist;

import java.util.List;

public class Incorrect0 {
public static int listSize(List<Item> values) {
return 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package examples.java.noreceiver.kotlinparameterizedlist;

public class Item {}

0 comments on commit f630d9c

Please sign in to comment.