Geeks With Blogs

The Life and Times of a Dev Yes, we're really that weird

I'm a .net (c#) programmer, through and through, but work needed someone to port an API that I had recently written in C# to Java, so guess who got the job!

So for the last 3 days, I've been fighting an issue with Java and Eclipse 3.2 and my own code.  I've been getting the dreaded NoClassDefFound exception, and been unable, completely unable, to debug eclipse.  Basically, when I attempted to instantiate a particular class, the NoClassDefFound exception was thrown, even though other classes in the same package could be created!  Bizzare, and nobody could figure it out, nor could I find anything on the internet.

Once I was able to narrow it down to that particular class, I removed all of the code from the class and slowly started to add it back until I found the code that was causing the break.

Turns out that Java uses the hashCode() method when it creates a class, and I happened to have a bug in my hashCode() method (a bug that resulted from the port from c# no less).

This:

(_deathDate==null ? 0: _deathDate).hashCode() ^

Is not valid.  It should be:

(_deathDate==null ? 0: _deathDate.hashCode()) ^

Just a simple miss placed parenthesis in the hash code creation, and NO WAY TO FIGURE IT OUT!  You'd think I'd get an exception or SOMETHING that pointed me to the hashCode function, but there was nothing.  All I could find was that the classPath had to, in some way, be messed up, which cost me quite a bit of time determining that my class path was, in fact, fine.

Does anybody know how Java uses the hashCode() on creation of an object?  Anybody have any good documents on this?

Robert

Posted on Tuesday, September 19, 2006 8:10 AM Work | Back to top


Comments on this post: Ugh--I hate Java.

# re: Ugh--I hate Java.
Requesting Gravatar...
I hate Java, After doing programming in machine language, Assembly language, Fortran, Matlab(not really a programming language, but close enough), Dark Basic, VB, Python, C++, Maxscript, some weird language I forgot the name of...

Java, is just driving me nuts, I see its C++ traits, why o why can we not have a programming language that lets us actually write code, rather than punish us and forces us to learn a ton of language specific methodology in order to do just the simplest thing, how on earth you define this as "High Level Language" is beyond me.

Java et al (C++) are not High level Languages, they are cryptic piles of horseshit, designed so that programmers life becomes unbearable, so that only the few "Elite" snobs that actually waste there lives fighting to get it to work (something that any other programming language could have completed and left your sanity intact) then get to sit high upon the mighty throne of "Java" programmers inner dark circles, that they hold mass every Sunday (as in the "Sun" Microsystems Worship Day). Finally when you get into the circle and ask what the High priest wrote in his last program and how he avoided any Java type programs he shocking replies

"Good God! I would never program in Java, what do you think I am an Idiot?"


Anhar Hussain Miah
Left by Anhar Hussain Miah on Oct 15, 2007 3:20 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
Love the joke! Anhar
Left by Joe Black on Nov 07, 2007 5:52 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
I hate Java and anything developed with it.

I have never seen a decent Windows application written in Java. Indeed none of them looked like a real software.
In Linux they work but just for the sake of working and we use them as a result of lack of alternatives.

I have seen very few properly working web applications written in Java. And the ones with problems cause major problems. (Crash, freeze, etc)

I have seen very few mobile applications written in Java that is usable. They tend to crash on themselves.

And then they call it cross-platform. Cross platform my ass.


I don't know if there is a problem with Java but I'm sure there is a huge problem with Java programmers, programming and development.

For practical purposes Java is nothing other than headache. Even if Java itself was perfect it is obvious that few if not nobody can use it.

People should'nt insist on developing Java applications just because they know it, aim cross-platform and such purposes. It's not working people it's not. It's a pain in the ass and nothing else.
Left by Nihat Mala on Nov 16, 2007 3:25 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
Java is a conspiracy against rising talent. It serve no other purpose than to subjugate budding programmers, intellectually and physically constrain them to a cubicle.
Left by Peteris. on Feb 02, 2009 12:42 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
The most cross-platform language is Perl.
Left by Ranxerox on Mar 31, 2010 4:50 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
I hate the fact that everyone thinks java is a good programming language. when in fact its the biggest bloated pig of a language ever made.
Left by Xyberviri on Oct 05, 2011 2:01 PM

# re: Ugh--I hate Java.
Requesting Gravatar...
I hate java bcoz java software is not working in my java device
Left by Manzoor mughol on Jul 30, 2013 6:35 AM

Your comment:
 (will show your gravatar)


Copyright © Robert May | Powered by: GeeksWithBlogs.net