Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse debugger is jumping to the wrong return statement
    primarykey
    data
    text
    <p>I've run into a really weird situation. I'm doing the following in Java (through Eclipse Galileo) on the Android 2.1 platform:</p> <pre><code>// Get gravity &amp; geomagnetic data to return to the caller. final int SIZE_GRAVITY = 3, SIZE_GEOMAGNETIC = 3; final float[] NOT_USED = null; float[] outGravity = new float[SIZE_GRAVITY]; float[] outGeomagnetic = new float[SIZE_GEOMAGNETIC]; final String NO_DATA_COULD_BE_READ = null; boolean succeeded = SensorManager.getRotationMatrix(NOT_USED, NOT_USED, outGravity, outGeomagnetic); if (!succeeded) { return NO_DATA_COULD_BE_READ; } Log.v("Test", "This should be printed - but it isn't!!"); // Prepare the data to return. final int X = 0, Y = 1, Z = 2; final String FIELD_SEPARATOR = ",", VECTOR_SEPARATOR = ";"; String returnValue = "" + outGravity[X] + FIELD_SEPARATOR + outGravity[Y] + FIELD_SEPARATOR + outGravity[Z] + VECTOR_SEPARATOR + outGeomagnetic[X] + FIELD_SEPARATOR + outGeomagnetic[Y] + FIELD_SEPARATOR + outGeomagnetic[Z]; // Return data. return returnValue; </code></pre> <p>When <code>SensorManager.getRotationMatrix(...)</code> returns <code>false</code>, the Eclipse debugger shows that the if-statement that says <code>if (!succeeded)</code> suddenly jumps to <code>return returnValue;</code>. No exception is thrown and LogCat - even on verbose mode - receives no unusual message. It doesn't even receive the message I put in the code. I tried the obvious clean-and-restart-Eclipse approach and that didn't help. I'm very confused.</p> <p>The Eclipse debugger is telling me that the second <code>return</code> statement is being called. However, putting additional print statements in shows that the first <code>return</code> statement is actually the one being reached. Perhaps I've stumbled across an Eclipse bug? Or anyone could explain this anomaly?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload