From: SourceForge.net <no...@so...> - 2004-07-22 06:32:50
|
Bugs item #995715, was opened at 2004-07-21 23:32 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=995715&group_id=44253 Category: None Group: None Status: Open Resolution: None Priority: 6 Submitted By: Neal Horowitz (nrhorowitz) Assigned to: Nobody/Anonymous (nobody) Summary: local methods, return value Initial Comment: Local methods in the interactions pane will be accepted even if they do not correctly return a value, in which case they will return null. It is particularly bad in the case of a function that returns a primitive. For example: > int x() { } > int i = x(); > Integer iBox = i; // autoboxing causes error here (same error if you call new Integer(i) explicitly): IllegalArgumentException: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) > int j = i + 1 NullPointerException: This is pretty ugly behavior. A primitive should never be allowed to become null; perhaps now that we're taken control of dynamicjava we can do something about this. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=995715&group_id=44253 |