Hemal Pandya wrote:
>> With regard to assertions it appears that the compiler default has
>> changed from 1.4 to 1.5. The 1.5 default compiles as-if "-source
[quoted text clipped - 19 lines]
> ^
> 1 warning
I get warings and errors for the following class:
class Test {int assert;}
Comiling with javac -version 1.6.0
leads to "invalid source release", when I use [-source 1.0, 1.1 and
earlier ;-)]
leads to "compiler warnings", when I use [-source 1.2 and 1.3]
leads to "compiler errors", when I use [-source 1.4, 1.5 and 1.6]
By the way: For the java certification, have a look at the new
"Mock-Exam" I wrote for my students:
http://www.santis.ch/training/java/jcp/selftester/
Greetings and good luck for the Java Certification exam
phi
jupiter - 23 Dec 2006 03:28 GMT
> Hemal Pandya wrote:
>>> With regard to assertions it appears that the compiler default
[quoted text clipped - 36 lines]
> leads to "compiler warnings", when I use [-source 1.2 and 1.3]
> leads to "compiler errors", when I use [-source 1.4, 1.5 and 1.6]
Hi, Phi, and I think that is all correct behavior. With -source
1.4 you cannot use "assert" as an identifer.
The problem I was creating was tyring to use an assert identifier
*plus* assert keywords in the same class. One or the other, with
the correct command line, is OK, but not both together.
Makes sense. My faux pas.
> By the way: For the java certification, have a look at the new
> "Mock-Exam" I wrote for my students:
[quoted text clipped - 3 lines]
>
> phi
Very cool! I'll be checking this out over the weekend. What gave
you the inspiration to do the work?
>> With regard to assertions it appears that the compiler default
>> has
[quoted text clipped - 14 lines]
>
> I get only a warning with 1.5.0_09:
I get it: I was trying to use identifer=assert plus assert
keywords. No can do; can do one but not both.
So, "javac -source 1.3 AssertIdentifier.java" with an "assert"
identifier will compile with only a warning. That is correct and
expected, I believe. That is the same as (purportedly) 1.4.
Good, that makes me feel better. The world is a good and stable
place again.
Thanks, Hemal.