ash said:
OK , What i am trying to implement here is a visualization software
that would dynamically load a class to the jvm and then execute java
code with at the user desire. the user may want to execute an
algorithm step by step (that means line by line). That's why i am
trying to invoke a method line by line. What i am doing right now is
that i am putting each of the algorithm's statements in a separate
method but i don't like that design and i am trying to change it to
something more cleaner.
Incidentally, the actual requirement, line-by-line execution, is far
more Java-compatible than the attempted solution, invoking an arbitrary
line in a method.
The compile time rules for definite assignment depend on invariants
related to the possible execution ordering of statements within the
method. Line-by-line execution maintains those invariants, so if the
method compiles each uninitialized local variable is the target of an
assignment prior to any use. Execution of an arbitrary statement in the
middle of a method could break the definite assignment invariants,
leading to the use of a local variable that does not have a defined value.
Patricia