aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Evans <evonsdesigns@gmail.com>2018-02-06 13:09:17 -0600
committerGitHub <noreply@github.com>2018-02-06 13:09:17 -0600
commita4966ff80be8a1535fedf7313231161c3fdf46c1 (patch)
tree7e378181c91ab13aa0ed5d53ab7f7333057fc12c
parentd509342092ce1bd7755066b041dee2fe0f25bd23 (diff)
downloadjavapoet-a4966ff80be8a1535fedf7313231161c3fdf46c1.tar.gz
Correct usage of toString()
Should have return type of `String`, not `void`.
-rw-r--r--README.md3
1 files changed, 2 insertions, 1 deletions
diff --git a/README.md b/README.md
index be866b5..989b591 100644
--- a/README.md
+++ b/README.md
@@ -634,6 +634,7 @@ TypeSpec helloWorld = TypeSpec.enumBuilder("Roshambo")
.addAnnotation(Override.class)
.addModifiers(Modifier.PUBLIC)
.addStatement("return $S", "avalanche!")
+ .returns(String.class)
.build())
.build())
.addEnumConstant("SCISSORS", TypeSpec.anonymousClassBuilder("$S", "peace")
@@ -654,7 +655,7 @@ Which generates this:
public enum Roshambo {
ROCK("fist") {
@Override
- public void toString() {
+ public String toString() {
return "avalanche!";
}
},