title: Eclipse: Custom warnings (Rhino String params)
body: <p>Is there a way to define a custom warning in Eclipse?  How?</p>
  <h3>My motivation</h3>
  <p>I have a Large Number of classes that are exposed as JavaScript objects via Mozilla Rhino.  I've run across a couple bugs like this:</p>
  <pre><code>public void jsFunction_foo(String bar) {
    if (bar != null) {
      ...
    } else {
      ...
    }
  }
  </code></pre>
  <p>The Bug: A String parameter in a <code>jsFunction_</code> IS NEVER NULL.  If the JavaScript calls <code>foo(null)</code>, the parameter that arrives is <code>&quot;null&quot;</code>, not <code>null</code>.  HUGE difference.</p>
  <p>The solution is to declare the parameter as <code>Scriptable</code>, and then convert it if present:</p>
  <pre><code>public void jsFunction_foo(Scriptable bar) {
    if (bar != null) {
      String barStr = convertToString(bar);
      ...
    } else {
      ...
    }
  }
  </code></pre>
  <p>So anyway.  We have 50+ classes we expose in JavaScript.  Rather than schlepping through them all by hand, I'd like to automate the process.  Something like:</p>
  <pre><code>if (function.name.indexOf(&quot;jsFunction_&quot;) == 0 &amp;&amp;
      function.paramTypes.contains(String.class) &amp;&amp;
      stringParamComparedToNull(function))
    addWarning(function.lineNum, &quot;It doesn't work like that!&quot;);
  </code></pre>
  <p>Ideally this custom warning would be shared across my team (or even with the Mozilla Rhino project itself) so other folks won't keep making the same mistakes.</p>
  <p>A way to crash Eclipse for people that compare to &quot;null&quot; would be good too.  Grr.</p>