title: Why does Java think my constructor call is ambiguous?
body: <p>I have the following code in a java application:   </p>
  
  <pre><code>UserMessage um = new UserMessage("a string", 
                                   false, 
                                   "another String", 
                                   "one last string");
  </code></pre>
  
  <p>Eclipse is telling me there's an error with this line of code with:</p>
  
  <pre><code>The constructor UserMessage(String, Object[]) is ambiguous  
  </code></pre>
  
  <p>The signatures for all of the constructors for UserMessage are:</p>
  
  <pre><code>1. public UserMessage(String key)
  2. public UserMessage(String key, boolean escapeHTML, Object... args)
  3. public UserMessage(String key, Object... args)
  4. public UserMessage(ErrorCode code)
  5. public UserMessage(ErrorCode code, Object... args)
  </code></pre>
  
  <p>To me it seems obvious that the constructor I'm calling should point to #2 above. The error seems to suggest to me that it thinks that it can potentially point to the third constructor.</p>
  
  <p>Why is there any ambiguity to this call? The only thing I can think of is if <code>false</code> is, for some reason cast to a <code>Boolean</code> object, but clearly that's not what my code does - so this would have to be something the java compiler does on its own.</p>