@@ -29,6 +29,8 @@ val VARARGS = 10
29
29
val TARGET_MAIN = s " ${project.getBasedir()}/src-gen/main/java "
30
30
val TARGET_TEST = s " ${project.getBasedir()}/src-gen/test/java "
31
31
val CHARSET = java.nio.charset.StandardCharsets .UTF_8
32
+ val comment = " //"
33
+ val javadoc = " **"
32
34
33
35
/**
34
36
* ENTRY POINT
@@ -43,9 +45,6 @@ def run(): Unit = {
43
45
*/
44
46
def generateMainClasses (): Unit = {
45
47
46
- // Workaround: Use /$javadoc instead of /** in a StringContext when IntelliJ IDEA otherwise shows up errors in the editor
47
- val javadoc = " **"
48
-
49
48
genAPI()
50
49
genFunctions()
51
50
genTuples()
@@ -3216,9 +3215,9 @@ def generateTestClasses(): Unit = {
3216
3215
// should return memoized value of second apply()
3217
3216
$assertThat(memo.apply( ${(1 to i).gen(j => s " $j" )(" , " )})).isEqualTo(expected);
3218
3217
${(i > 0 ).gen(xs """
3219
- // should calculate new values when called subsequently with different parameters
3218
+ $comment should calculate new values when called subsequently with different parameters
3220
3219
$assertThat(memo.apply( ${(1 to i).gen(j => s " ${j + 1 } " )(" , " )})).isEqualTo( ${(1 to i).gen(j => s " ${j + 1 } " )(" + " )} + 1);
3221
- // should return memoized value of second apply() (for new value)
3220
+ $comment should return memoized value of second apply() (for new value)
3222
3221
$assertThat(memo.apply( ${(1 to i).gen(j => s " ${j + 1 } " )(" , " )})).isEqualTo( ${(1 to i).gen(j => s " ${j + 1 } " )(" + " )} + 1);
3223
3222
""" )}
3224
3223
}
@@ -3265,7 +3264,7 @@ def generateTestClasses(): Unit = {
3265
3264
assertThat(pf.isDefinedAt(0)).isTrue();
3266
3265
assertThat(pf.isDefinedAt(1)).isFalse();
3267
3266
assertThat(pf.apply(0)).isEqualTo("0");
3268
- assertThat(pf.apply(1)).isEqualTo("1"); // it is valid to return a value, even if isDefinedAt returns false
3267
+ assertThat(pf.apply(1)).isEqualTo("1"); $comment it is valid to return a value, even if isDefinedAt returns false
3269
3268
}
3270
3269
""" })}
3271
3270
@@ -3337,7 +3336,7 @@ def generateTestClasses(): Unit = {
3337
3336
$assertThrows( ${im.getType(" java.security.NoSuchAlgorithmException" )}.class, () -> {
3338
3337
$name$i<MessageDigest> digest = () -> ${im.getType(" java.security.MessageDigest" )}.getInstance("Unknown");
3339
3338
Function $i<MessageDigest> unchecked = digest.unchecked();
3340
- unchecked.apply(); // Look ma, we throw an undeclared checked exception!
3339
+ unchecked.apply(); $comment Look ma, we throw an undeclared checked exception!
3341
3340
});
3342
3341
}
3343
3342
@@ -3404,7 +3403,7 @@ def generateTestClasses(): Unit = {
3404
3403
public void shouldUncheckedThrowIllegalState() {
3405
3404
$assertThrows( ${im.getType(" java.security.NoSuchAlgorithmException" )}.class, () -> {
3406
3405
final Function $i< ${(1 to i).gen(j => " String" )(" , " )}, MessageDigest> unchecked = digest.unchecked();
3407
- unchecked.apply( ${toArgList(" Unknown" )}); // Look ma, we throw an undeclared checked exception!
3406
+ unchecked.apply( ${toArgList(" Unknown" )}); $comment Look ma, we throw an undeclared checked exception!
3408
3407
});
3409
3408
}
3410
3409
0 commit comments