From: SourceForge.net <no...@so...> - 2005-08-22 00:18:39
|
Bugs item #1265806, was opened at 2005-08-22 00:18 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=1265806&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: None Group: Would be nice if fixed ... Status: Open Resolution: None Priority: 5 Submitted By: Michael Dyrby Jensen (dyrby76) Assigned to: Nobody/Anonymous (nobody) Summary: Assert doesn't work as expected in DrJava. Initial Comment: Previous when dealing with Java 1.4, we added the option of allowing the assert keyword in the Definitionspane, that options is still present in our preferences. This option is set to false (unchecked) as default. When you are running DrJava with 1.5 and you are using an assert statement, you get an unexpected behaviour, as the assert statement (even when not true) is ignored. This makes the programmer think his assert statement yielded true, while it infact didn't. Example: class A{ public static void main(String[] args){ int x =5; assert x==6; } } Running java 1.5.. Without enabling the option to allow assert in java 1.4 in our preferences, this code compiles and runs without any error messages. If you enable the assert for 1.4, and compile and run the code again, you will get an AssertionError: AssertionError: at A.main(A.java:5) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) Why is the option still there in the preferences? Should it be removed and always allow assert to be used? I believe we added the option to allow users legacy code still to work, as they could have used "assert" as a variable name, where as from 1.4 it was a keyword. Our new releases of DrJava dont support java 1.3, so should we not remove this option? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1265806&group_id=44253 |