I'm up to day 6 and can't compile Storefront correctly to move forward.
I receive the following error message:
c:\j21work\org\cadenhead\ecommerce>javac -classpath "" *.java
Note: Storefront.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details..
Any help much appreciated.
Ross Bamford - 22 Oct 2005 15:19 GMT
> I'm up to day 6 and can't compile Storefront correctly to move forward.
> I receive the following error message:
[quoted text clipped - 4 lines]
>
> Any help much appreciated.
Don't worry too much about it - these are only warnings, and occur because
some of the code does some slightly hairy stuff with typing. Reasons
include:
+ It was written when no alternative means was available.
+ It deliberately avoids type safety for the sake of example.
+ The programmer made a (often valid) decision that he knew something the
compiler didn't.
If you add the -Xlint:unchecked argument to the javac command, you'll see
a detailed list of the warnings. It's probably best to ignore them for
now, though, and concentrate on the basic concepts from your book.

Signature
Ross Bamford - rosco@roscopeco.remove.co.uk
Chris Uppal - 22 Oct 2005 15:29 GMT
> c:\j21work\org\cadenhead\ecommerce>javac -classpath "" *.java
> Note: Storefront.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details..
That's because Sun introduced some extensions into the most recent version of
Java, and the compiler is trying to force you to use them. Leaving aside the
question of whether the extensions are a good thing or not, they are a
complication that you don't need at this stage, and especially not while you a
trying to follow a book which pre-dates them.
The easiest way of sorting the problem is just to ignore the messages ;-) but
if you prefer you can tell the compiler that you are writing in "old" Java:
javac - source 1.4 -classpath ....etc...
-- chris
Roedy Green - 23 Oct 2005 11:31 GMT
>Note: Recompile with -Xlint:unchecked for details..
Chris's advice is practical. If you want to see the errors type
javac -source 1.5 -target 1.5 -Xlint:unchecked *.java
That will show you the warnings, which will have to do with missing
generic declarations. If you feel up to tackling them, read
http://mindprod.com/generics.html
Otherwise, for now, just ignore the warning messages about "unchecked"
stuff.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Nick - 24 Oct 2005 22:31 GMT
Thank you all for the prompt advice. It's working so on to day 7. Not
as fast as I'd like of course.