From: SourceForge.net <no...@so...> - 2005-07-06 09:39:14
|
Bugs item #1233297, was opened at 2005-07-06 15:39 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1233297&group_id=44253 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: DynamicJava Group: Serious Status: Open Resolution: None Priority: 5 Submitted By: Maruf Muqtadir (ninarekcah) Assigned to: Nobody/Anonymous (nobody) Summary: illigal class casting is allowed in the interaction pane Initial Comment: Consider the following classes. public class SuperClass{ public void methodA(){ System.out.println("methodA of superClass"); } } public class ChildB extends SuperClass{ public void methodA(){ System.out.println("methodA of ChildB"); } } public class ChildA extends SuperClass{ public void methodA(){ System.out.println("methodA of ChildA"); } } In the interaction pane, if I create an object of say, ChildB and points that with a SuperClass reference, and then tries to cast the reference to a ChildA type object, and try to print the object, the interaction pane allows me to do so, and prints that the object is of type ChildB and the identifier for that object. Which is obviously an error. Though, when I try to compile and run such illigal things with DrJava interface, it throws an exception stating that the actual object is of type ChildB and cannot be casted to ChildA, which is a valid complain. I am using JDK1.4 and drjava-beta-20050610-1655. The interaction pane is a very useful feature for the students. But, if it allows such illigal things to carry on successfully, it will just confuse the students more. If you need any further clarification about the problem, please inform me. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1233297&group_id=44253 |