|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.microedition.midlet.MIDlet | +--com.markcrocker.purifier.testcases.ProblemCases
The ProblemCases class contains methods that are intended to illustrate cases where the Purifier has problems. It is also the home of several test cases that don't test what they're intended to test... this is a work area for getting them do work correctly.
Field Summary | |
(package private) javax.microedition.lcdui.Display |
display
|
(package private) javax.microedition.lcdui.TextBox |
Hello
|
(package private) java.util.Vector |
vector
|
Constructor Summary | |
ProblemCases()
|
Method Summary | |
void |
catchesThrowable(java.util.Hashtable ht)
|
void |
catchesThrowableFinally(java.util.Hashtable ht)
|
void |
commandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable d)
|
void |
destroyApp(boolean unconditional)
|
void |
exceptionHandlerObjectConflict()
This shows how an Exception handler will put it's Exception type into the same LocalVariables slot as a working variable and, for some reason, Sun's preverifier will resolve the conflict by saying the data is type java.lang.Object. |
void |
exceptionHandlerPrimitiveConflict()
This is almost identical to the exceptionHandlerObjectConflict except that the conflict is between an exception and a primitive. |
void |
excessiveMerging()
excessiveMerging demonstrates a case where the merging of a Frame from normal execution flow and a Frame from the fall through of an exception handler produce results in JustIce that disagree with Sun's preverifier. |
void |
excessiveMerging2()
just demonstrates that cause of problem with excessiveMerging is not related to the fact that the problem is with a return instruction immediately following an exception fall through. |
void |
excessiveMerging3()
|
void |
excessiveMerging4()
|
void |
excessiveMerging4b()
Still has excessive merge problem even though this uses an invokeinterface instruction just like the requiresPostExceptionMerge4 method. |
void |
excessiveMerging4c()
Still has excessive merge problem even though this returns a primitive just like the excessiveMerging4. |
void |
failsPass3a()
Fails JustIce verification pass3a. |
void |
itemStateChanged(javax.microedition.lcdui.Item item)
|
void |
messedUpArgs(java.lang.Integer[] I)
|
void |
minimalExcessiveMerging()
|
void |
minimalExcessiveMergingb()
Uses a custom class that has a private inner class that implements an interface and a method that returns that inner class. |
void |
minimalRequiresPostExceptionMerge()
|
void |
nestedExceptionHandlersConflict(java.lang.Integer[] I)
Intended to show uninitialized try block frame, but fails for two totally unrelated reasons. |
void |
nullObjectLateInit()
This is a counter example to the nullObjectNeverInit case. |
void |
nullObjectNeverInit()
This is very similar to the last method except that the String array is never intialized to point to a real reference. |
void |
nullObjectNeverInit2()
This is very similar to the unresolvedNullObject method except that the String array is
never intialized to point to a real reference. |
void |
passesPass3a()
Almost identical to failsPass3a, but passes JustIce verification pass3a. |
void |
pauseApp()
|
void |
postExceptionMergeNotRequired()
Almost identical to requiresPostExceptionMerge3, but doesn't have the same issue because the array is declared before the try block. |
void |
postExceptionMergeNotRequired2()
Almost identical to requiresPostExceptionMerge3, but doesn't have the same issue because the vector variable shows up in the catch statement. |
void |
remove(int index)
Adds a null to the LocalVariables that is mysteriously converted to a java.lang.Object by BCEL JustICE Verifier (well Pass3bVerifier actually). |
void |
remove2(int index)
Counter example to the remove(int) method above. |
void |
requiresPostExceptionMerge()
Modified version of nullObjectNeverInit intended to illustrate problems with merging Frames from Exception handlers with Frames from normal execution |
void |
requiresPostExceptionMerge2()
|
void |
requiresPostExceptionMerge3()
|
void |
requiresPostExceptionMerge4()
Doesn't have the same problem as excessiveMerging4 despite being virtually identical. |
void |
retrievesAPrimitiveArray(java.lang.Integer[] I)
intended to show a problem that occurs with anewarry, but isn't formulated correctly to show that situation. |
void |
startApp()
|
void |
unreferencedObjectSignature()
Has an object signature that isn't in the ConstantPool Doesn't work with all of these other methods in this class too. |
void |
unresolvedNullObject()
Test case the illustrates the Unresolved Null Object Issue. |
Methods inherited from class javax.microedition.midlet.MIDlet |
getAppProperty, notifyDestroyed, notifyPaused, resumeRequest |
Methods inherited from class java.lang.Object |
|
Field Detail |
javax.microedition.lcdui.Display display
javax.microedition.lcdui.TextBox Hello
java.util.Vector vector
Constructor Detail |
public ProblemCases()
Method Detail |
public void startApp() throws javax.microedition.midlet.MIDletStateChangeException
startApp
in class javax.microedition.midlet.MIDlet
public void pauseApp()
pauseApp
in class javax.microedition.midlet.MIDlet
public void destroyApp(boolean unconditional) throws javax.microedition.midlet.MIDletStateChangeException
destroyApp
in class javax.microedition.midlet.MIDlet
public void itemStateChanged(javax.microedition.lcdui.Item item)
itemStateChanged
in interface javax.microedition.lcdui.ItemStateListener
public void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
commandAction
in interface javax.microedition.lcdui.CommandListener
public void unresolvedNullObject()
method
to ensure that the solution to this special case doesn't remove ITEM_Null objects where they really belong.public void nullObjectNeverInit()
last method
except that the String array is never intialized to point to a real reference. In this case, the StackMap should, and does, have an ITEM_Null in slot 1.
Althogh unintentional, this also has the exceptionHandlerObjectConflict problem
. See the nullObjectNeverInit2 method
for an example that illustrates the case that this was intended to illustrate without the Exception problem in the way.public void requiresPostExceptionMerge()
public void requiresPostExceptionMerge2()
public void requiresPostExceptionMerge3()
public void postExceptionMergeNotRequired()
public void nullObjectLateInit()
public void nullObjectNeverInit2()
unresolvedNullObject method
except that the String array is
never intialized to point to a real reference. In this case, the StackMap should, and does, have an ITEM_Null in slot 1. Unlike the nullObjectNeverInit method
, this case has been modified even mroe to avoid the exceptionHandlerObjectConflict problem
, so it is somewhat less like the unresolvedNullObject case than the nullObjectNeverInit case is.public void exceptionHandlerObjectConflict()
public void exceptionHandlerPrimitiveConflict()
public void nestedExceptionHandlersConflict(java.lang.Integer[] I)
0: iconst_0 1: istore_2 2: iload_2 3: ifne #33 6: aload_1 7: iload_2 8: aaload 9: astore_3 10: aload_3 11: invokevirtual java.lang.Integer.toString ()Ljava/lang/String; (11) 14: astore %4 16: goto #24 19: astore %4 21: bipush 7 23: istore_2 24: goto #30 27: astore_3 28: iconst_3 29: istore_2 30: iinc %2 1 33: returnAt offset 24 there is a conflict between the String t, which is stored in LocalVariables slot 4 by the astore %4 instruction at offset 14 and the NullPointerException that also gets stored in slot 4 by the inner excetion handler at offset 19. The Purifier's resolveConflicts method sees that these are different and incompatible and sets the slot to null assuming that these are junk variables. Sun's StackMap has:
offset = 24 locals = { (type=Object, (23)class=com.markcrocker.purifier.testcases.ProblemCases), (type=Object, (102)class=[Ljava.lang.Integer;), (type=Integer), (type=Object, (21)class=java.lang.Integer), (type=Object, (104)class=java.lang.Object) }Note that the JavaDoc generator messes up the formatting of this. See the actual source code for better formatting. The Purifier produces a StackMap that has the last entry as
(type=Object, class=java.lang.NullPointerException)There seems to be a problem with what Sun's preverifier does... it assigns this slot to java.lang.Object. This doesn't make sense. The Purifier resolveConflicts method sets the entry to null. Setting it to anything else makes no sense because nothing after offset 24 uses slot 4. This may be one of those cases where it might work on an actual device despite a difference between Purifier and preverifier. The error in the StackMap at offset 30 is wrong because it depends on the offset at offset 24. This time, the resolveConflicts method does think it's junk and sets slot 4 to null. There is a similar test case in the UniqueProblemCases class:
UniqueProblemCases.nestedExceptionHandlersConflictWithUnknown(java.lang.Integer[])
public void unreferencedObjectSignature()
public void retrievesAPrimitiveArray(java.lang.Integer[] I)
public void remove(int index)
public void remove2(int index)
public void excessiveMerging()
public void minimalExcessiveMerging()
public void minimalRequiresPostExceptionMerge()
public void minimalExcessiveMergingb()
public void excessiveMerging2()
public void excessiveMerging3()
public void excessiveMerging4()
public void excessiveMerging4b()
public void excessiveMerging4c()
public void requiresPostExceptionMerge4()
public void catchesThrowable(java.util.Hashtable ht)
public void catchesThrowableFinally(java.util.Hashtable ht)
public void messedUpArgs(java.lang.Integer[] I)
public void passesPass3a()
public void failsPass3a()
public void postExceptionMergeNotRequired2()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |