title: Is it possible that in Java 7 (byte) ((char) ByteBuffer.get(X)) != ByteBuffer.get(X)?
body: <p>The following code (this is a simplified version) used to run fine in jdk1.6 and now the assertion fails under jdk 1.7.</p>
  
  <pre><code>ByteBuffer buffer = ...;
  buffer.mark();
  char c = (char) buffer.get();
  buffer.reset();
  
  switch(c) {
    ...
    case 'H':
      byte b = buffer.get(); 
      //Here I get -106 for b and 72 for (byte) c
      assert( b == ((byte) c) );
      break;
    ...
  }
  </code></pre>
  
  <p>I read <a href="http://www.oracle.com/technetwork/java/javase/compatibility-417013.html" rel="nofollow">oracle's compatibility page</a> and didn't find anything that would explain it. Maybe the 5- and 6- forms of utf8 but I don't think that is the case.
  It could also be a race condition which I'm am still investigating, but I thought it wouldn't hurt to ask stackoverflow :-)</p>