title: Boolean.TRUE == someMethod(), where return type is Boolean for someMethod() and it returns a literal true
body: <p>Please have a look at the below program :-</p>
  
  <pre><code>class Main {
  
    public static void main(String[] args) {
      System.out.println(Boolean.TRUE == new Main().getBoolean());
    }
  
    public Boolean getBoolean() {
      return true;
    }
  }
  </code></pre>
  
  <p>If I check the Java Mnemonics for this, I get :-</p>
  
  <pre><code>Compiled from "Main.java"
  class com.testing.Main {
    com.testing.Main();
      Code:
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."&lt;init&gt;":()V
         4: return
  
    public static void main(java.lang.String[]);
      Code:
         0: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
         3: getstatic     #3                  // Field java/lang/Boolean.TRUE:Ljava/lang/Boolean;
         6: new           #4                  // class com/testing/Main
         9: dup
        10: invokespecial #5                  // Method "&lt;init&gt;":()V
        13: invokevirtual #6                  // Method getBoolean:()Ljava/lang/Boolean;
        16: if_acmpne     23
        19: iconst_1
        20: goto          24
        23: iconst_0
        24: invokevirtual #7                  // Method java/io/PrintStream.println:(Z)V
        27: return
  
    public java.lang.Boolean getBoolean();
      Code:
         0: iconst_1
         1: invokestatic  #8                  // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
         4: areturn
  }
  </code></pre>
  
  <p>Therefore, in Java Mnemonics :
  for line no. 0 and 1 of the last method i.e. <code>getBoolean() method</code>, 
  we see auto-boxing happening, i.e. <code>iconst_1</code> i.e. <code>int 1</code> (which means 'true' here) (in line 0) is passed to  <code>Boolean.valueOf()</code> method (in line 1).<br>
  And <code>Boolean.valueOf(boolean b)</code> method in <code>Java.Lang</code>, returns a constant <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>.</p>
  
  <p>Therefore, the <code>==</code> check should always work fine, in the program <code>main</code> method, 
  or in the Java Mnemonics : Line no 16.<br>
  But in some environments, I see this returning false.
  How is it possible?</p>
  
  <blockquote>
    <p>Edit :  Here, in my case, to be precise : Hibernate fetches a BIT from
    the DB and sets into a Boolean field. This Boolean field has a getter,
    which is the <code>getBoolean()</code> in my above program.</p>
  </blockquote>