Skip to content

Commit

Permalink
Improve static error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
gchallen committed Jun 30, 2021
1 parent 8bb56b4 commit 27e20db
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/Submission.kt
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ class SubmissionDesignExtraFieldError(klass: Class<*>, field: Field) : Submissio
)

class SubmissionStaticFieldError(klass: Class<*>, field: Field) : SubmissionDesignError(
"Field ${field.fullName()} is static in submission class ${klass.name} but no current support for static fields"
"Field ${field.fullName()} is static in submission class ${klass.name}, " +
"but static fields are not used by the solution"
)

class SubmissionDesignClassError(klass: Class<*>, message: String) : SubmissionDesignError(
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2021.6.7
version=2021.6.8
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ class TestJavaExamples : StringSpec(
examples.java.noreceiver.arrayreturn.Correct::class.java.also {
"${it.testName()}" { it.test() }
}
examples.java.receiver.rejectstaticfield.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,9 @@
package examples.java.receiver.rejectstaticfield;

public class Correct {
private int i = 0;

public int increment() {
return i++;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package examples.java.receiver.rejectstaticfield;

public class Design0 {
private static int i = 0;

public int increment() {
return i++;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package examples.java.receiver.rejectstaticfield;

public class Incorrect0 {
private int i = 0;

public int increment() {
return ++i;
}
}

0 comments on commit 27e20db

Please sign in to comment.