mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
23 lines
1.1 KiB
HTML
23 lines
1.1 KiB
HTML
<html>
|
|
<body>
|
|
Reports format strings that don't comply with the standard Java syntax.
|
|
<p>By default, the inspection considers a compile-time constant a format string if it's used as an argument to the corresponding methods on
|
|
<code>java.util.Formatter</code>, <code>java.lang.String</code>, <code>java.io.PrintWriter</code> or <code>java.io.PrintStream</code>.
|
|
</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
String.format("x = %d, y = %d", 42);
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Use the inspection settings to mark additional classes and methods as related to string formatting.</p>
|
|
<p>As an alternative, you can use the <code>org.intellij.lang.annotations.PrintFormat</code> annotation
|
|
to mark the format string method parameter. In this case,
|
|
the format arguments parameter must immediately follow the format string and be the last method parameter. Example:</p>
|
|
<pre><code>
|
|
void myFormatMethod(int mode, @PrintFormat String formatString, Object... args) {...}
|
|
</code></pre>
|
|
<p>
|
|
Methods annotated in this way will also be recognized by this inspection.
|
|
</p>
|
|
</body>
|
|
</html> |