Skip to content

Commit 578bc00

Browse files
committed
Support different types in BuildInformation
1 parent d1f8516 commit 578bc00

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/processor/java/org/truffleruby/processor/BuildInformationProcessor.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private void processBuildInformation(TypeElement element) throws Exception {
174174
if (e instanceof ExecutableElement) {
175175
final String name = e.getSimpleName().toString();
176176

177-
final String value;
177+
final Object value;
178178
switch (name) {
179179
case "getBuildName":
180180
value = buildName;
@@ -185,6 +185,9 @@ private void processBuildInformation(TypeElement element) throws Exception {
185185
case "getFullRevision":
186186
value = fullRevision;
187187
break;
188+
case "isDirty":
189+
value = isDirty;
190+
break;
188191
case "getCopyrightYear":
189192
value = copyrightYear;
190193
break;
@@ -199,11 +202,13 @@ private void processBuildInformation(TypeElement element) throws Exception {
199202
}
200203

201204
stream.println(" @Override");
202-
stream.println(" public String " + name + "() {");
205+
stream.println(" public " + ((ExecutableElement) e).getReturnType() + " " + name + "() {");
203206
if (value == null) {
204207
stream.println(" return null;");
205-
} else {
208+
} else if (value instanceof String) {
206209
stream.println(" return \"" + value + "\";");
210+
} else {
211+
stream.println(" return " + value + ";");
207212
}
208213
stream.println(" }");
209214
stream.println();

0 commit comments

Comments
 (0)