Skip to content

Commit 50dda19

Browse files
author
Christian Wimmer
committed
Use StringBuilder instead of Formatter
1 parent a6eff68 commit 50dda19

File tree

1 file changed

+7
-9
lines changed
  • compiler/src/org.graalvm.compiler.options/src/org/graalvm/compiler/options

1 file changed

+7
-9
lines changed

compiler/src/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionKey.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
*/
2525
package org.graalvm.compiler.options;
2626

27-
import java.util.Formatter;
28-
2927
import org.graalvm.collections.EconomicMap;
3028
import org.graalvm.collections.UnmodifiableEconomicMap;
3129

@@ -64,19 +62,19 @@ public final OptionDescriptor getDescriptor() {
6462
protected boolean checkDescriptorExists() {
6563
OptionKey.Lazy.init();
6664
if (descriptor == null) {
67-
Formatter buf = new Formatter();
68-
buf.format("Could not find a descriptor for an option key. The most likely cause is " +
69-
"a dependency on the %s annotation without a dependency on the " +
70-
"org.graalvm.compiler.options.processor.OptionProcessor annotation processor.", Option.class.getName());
65+
StringBuilder result = new StringBuilder();
66+
result.append("Could not find a descriptor for an option key. The most likely cause is a dependency on the ");
67+
result.append(Option.class.getName());
68+
result.append(" annotation without a dependency on the org.graalvm.compiler.options.processor.OptionProcessor annotation processor.");
7169
StackTraceElement[] stackTrace = new Exception().getStackTrace();
7270
if (stackTrace.length > 2 &&
7371
stackTrace[1].getClassName().equals(OptionKey.class.getName()) &&
7472
stackTrace[1].getMethodName().equals("getValue")) {
7573
String caller = stackTrace[2].getClassName();
76-
buf.format(" In suite.py, add GRAAL_OPTIONS_PROCESSOR to the \"annotationProcessors\" attribute of the project " +
77-
"containing %s.", caller);
74+
result.append(" In suite.py, add GRAAL_OPTIONS_PROCESSOR to the \"annotationProcessors\" attribute of the project containing ");
75+
result.append(caller);
7876
}
79-
throw new AssertionError(buf.toString());
77+
throw new AssertionError(result.toString());
8078
}
8179
return true;
8280
}

0 commit comments

Comments
 (0)