[jboss-jira] [JBoss JIRA] (LOGTOOL-45) Avoid unnecessary calls to String#format()
James Perkins (JIRA)
jira-events at lists.jboss.org
Thu Mar 29 20:06:47 EDT 2012
[ https://issues.jboss.org/browse/LOGTOOL-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680477#comment-12680477 ]
James Perkins commented on LOGTOOL-45:
--------------------------------------
This was actually done on purpose. It is possible, I know I've done it, to not require arguments in a string format, but still use a format. e.g.
{code} String.format("Some messages%n") {code}
The only real way to do this would be to tear apart the message and look for format arguments that don't require parameters. I'm open to debate whether parsing the string for values is worth the effort though :-) I don't think the performance would be a huge disadvantage, but I do realize there is a cost there.
> Avoid unnecessary calls to String#format()
> ------------------------------------------
>
> Key: LOGTOOL-45
> URL: https://issues.jboss.org/browse/LOGTOOL-45
> Project: Log Tool
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Reporter: Gunnar Morling
> Assignee: James Perkins
>
> Generated message bundle methods always contain an invocation of {{String#format()}} also if there actually is no parameter to be replaced, e.g. like this:
> {code}
> @Override
> public final String mustNotBeNull() {
> String result = String.format(mustNotBeNull0$str());
> return result;
> }
> {code}
> AFAICS the invocation of {{format()}} seems superfluous, instead the String might directly be returned for performance reasons.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list