Skip to content

Commit a430dea

Browse files
authored
Replace string literal for comment initiation to help IDE (#3017)
1 parent 34745e2 commit a430dea

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

vavr/generator/Generator.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ val VARARGS = 10
2929
val TARGET_MAIN = s"${project.getBasedir()}/src-gen/main/java"
3030
val TARGET_TEST = s"${project.getBasedir()}/src-gen/test/java"
3131
val CHARSET = java.nio.charset.StandardCharsets.UTF_8
32+
val comment = "//"
33+
val javadoc = "**"
3234

3335
/**
3436
* ENTRY POINT
@@ -43,9 +45,6 @@ def run(): Unit = {
4345
*/
4446
def generateMainClasses(): Unit = {
4547

46-
// Workaround: Use /$javadoc instead of /** in a StringContext when IntelliJ IDEA otherwise shows up errors in the editor
47-
val javadoc = "**"
48-
4948
genAPI()
5049
genFunctions()
5150
genTuples()
@@ -3186,9 +3185,9 @@ def generateTestClasses(): Unit = {
31863185
// should return memoized value of second apply()
31873186
$assertThat(memo.apply(${(1 to i).gen(j => s"$j")(", ")})).isEqualTo(expected);
31883187
${(i > 0).gen(xs"""
3189-
// should calculate new values when called subsequently with different parameters
3188+
$comment should calculate new values when called subsequently with different parameters
31903189
$assertThat(memo.apply(${(1 to i).gen(j => s"${j + 1} ")(", ")})).isEqualTo(${(1 to i).gen(j => s"${j + 1} ")(" + ")} + 1);
3191-
// should return memoized value of second apply() (for new value)
3190+
$comment should return memoized value of second apply() (for new value)
31923191
$assertThat(memo.apply(${(1 to i).gen(j => s"${j + 1} ")(", ")})).isEqualTo(${(1 to i).gen(j => s"${j + 1} ")(" + ")} + 1);
31933192
""")}
31943193
}
@@ -3235,7 +3234,7 @@ def generateTestClasses(): Unit = {
32353234
assertThat(pf.isDefinedAt(0)).isTrue();
32363235
assertThat(pf.isDefinedAt(1)).isFalse();
32373236
assertThat(pf.apply(0)).isEqualTo("0");
3238-
assertThat(pf.apply(1)).isEqualTo("1"); // it is valid to return a value, even if isDefinedAt returns false
3237+
assertThat(pf.apply(1)).isEqualTo("1"); $comment it is valid to return a value, even if isDefinedAt returns false
32393238
}
32403239
"""})}
32413240

@@ -3307,7 +3306,7 @@ def generateTestClasses(): Unit = {
33073306
$assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> {
33083307
$name$i<MessageDigest> digest = () -> ${im.getType("java.security.MessageDigest")}.getInstance("Unknown");
33093308
Function$i<MessageDigest> unchecked = digest.unchecked();
3310-
unchecked.apply(); // Look ma, we throw an undeclared checked exception!
3309+
unchecked.apply(); $comment Look ma, we throw an undeclared checked exception!
33113310
});
33123311
}
33133312

@@ -3374,7 +3373,7 @@ def generateTestClasses(): Unit = {
33743373
public void shouldUncheckedThrowIllegalState() {
33753374
$assertThrows(${im.getType("java.security.NoSuchAlgorithmException")}.class, () -> {
33763375
final Function$i<${(1 to i).gen(j => "String")(", ")}, MessageDigest> unchecked = digest.unchecked();
3377-
unchecked.apply(${toArgList("Unknown")}); // Look ma, we throw an undeclared checked exception!
3376+
unchecked.apply(${toArgList("Unknown")}); $comment Look ma, we throw an undeclared checked exception!
33783377
});
33793378
}
33803379

0 commit comments

Comments
 (0)