wood burning stoves*
The moose likes Java in General and the fly likes Class compilation confusion..... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class compilation confusion....." Watch "Class compilation confusion....." New topic
Author

Class compilation confusion.....

Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
Hi all,
I have a utility class(SmartData.class),which will do things such as Date,Time parsing for me.
Previously, I had "seconds" (public)member variable in this class as "float".
But after introdusing support for milli-seconds,we decided to change it to
"double".
Now comes a another class(DataUser.class) which is using SmartData inside some of its api's.
And accesses the seconds member var of this class.
The problem started when I just compiled SmartData.java and updated my jar with it.
When the code was run and the particular part accessing seconds member var
of SmartData was accessed by DataUser's api's,it gave me a illegal access
exception.
Why is this so?
On compiling DataUser.java with the latest jar in the classpath,we could
elimnate that exception.
I understand about class dependencies.
But why would a static change like changing the data type of a public member
give me an illegal access exception.
This is something which I didnt know.......
Thanks in advance,
Chinmay


The strength of the Wolf is the pack & the strength of the pack is the wolf....Rudyard Kipling
Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
hi,
Has anybody read this??
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
You've got one part of your program that thinks this variable is a double, and another that thinks it's a long. Why should it be surprising this causes a problem? At least in Java this happens in a well-defined way-- in C or C++ your program would simply mysteriously crash, but precisely where and how would be hard to predict.
 
Consider Paul's rocket mass heater.
 
subject: Class compilation confusion.....
 
Similar Threads
question from JQ+
Access Modifiers
Sample Question from Sun site
Illegal Access Exception
Configuring transcation timeouts