• Post Reply Bookmark Topic Watch Topic
  • New Topic

VM bug? Report to Sun? Or simple explanation  RSS feed

 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I met a strange problem. I have a class which represents a song. It inherited from some base class with abstract getter/setter methods methods.


To allow sorting songs in collections, my class implements Comparable,

Not, such implementation worked fine, except one case, when elements of collection weren't be sorted just after changing SORT property.
I've added debug printout and discovered that .properties[SORT] != ((Integer)get(SORT)).intValue() in method compareTo. Say more, I've added debug printout in the beginning of get, and it wasn't executed, although get returned correct value. It happens only in one place of code when I do sorting after dropping. In all other cases properties[SORT] == ((Integer)get(SORT)).intValue() in compareTo and get(..) gets traced.
Since I use JDK 5.0, I can't (or do not know) use eclipse debugger. Any ideas? clues?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on the little you've shown, it seems like there's a broad range of possible typos and other small problems that could lead to this behavior. You're not showing us real cut-and-paste code here, so our close inspection isn't going to help. Maybe if we saw more, and it was real, we could have a better idea.

But I wouldn't be emailing Sun about this just yet!
 
D Rog
Ranch Hand
Posts: 472
Linux Objective C Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is quite big to get it here, however it's available as open source. If you have any interest, then let me know.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!