Menu

#323 Option to Require Explicit Downcasting

open
nobody
None
5
2008-01-10
2008-01-10
Dave
No

This is similar to feature request 1866162: http://sourceforge.net/tracker/index.php?func=detail&aid=1866162&group_id=44253&atid=438938

The Dr Java interactions window allows one to omit the explicit downcast required when assigning a subtype variable to reference a supertype object; e.g.

CharSequence cs = "abc";
String s = cs; // should be String s = (String) cs;

Since the omission of this cast is an error when compiling a Java program, it would be helpful to those using Java to teach to have an option to make the interactive interpreter show the same behavior as the compiler; i.e., report an error when the explicit downcast is omitted, so that students are not confused when a piece of code works in the interpreter but not the compiler.

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.