Meaningless Drivel is fun!
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

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
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 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
Why is this so?
On compiling 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,

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
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.
I agree. Here's the link:
subject: Class compilation confusion.....
It's not a secret anymore!