Skip to content

Category Archives: java

Java is dead/alive

Funniest thing I read today:
"Autoboxing was a misguided effort to paper over Java’s early decision to have a segregated type system for primitives and objects. It was Java’s Plessy v. Ferguson decision that pretended primitives and objects were separate but equal; but the claim was no more true in Java than it was in American [...]

Proleptic apoplexy

I spent a few hours this week trying to figure out why some date manipulation methods I was writing weren't working. In my test case, I had two instances of GregorianCalendar which I was comparing, an original and one that had been round-tripped through some conversion methods, via oracle.jbo.doman.Timestamp. Using the equals method, [...]

TestNG, part 2

Since migrating from JUnit 3, TestNG has been wonderful. Groups are the killer feature of TestNG that really make it worth the migration cost. When wanting to test a single method, I no longer need to manually comment or uncomment method names in the suite() method, I can just add a new group [...]

Shards in your Latte

Here are the slides from my "Shards in your Latte" PJUG presentation on January 15:
javasharpedges.pdf
The Josh Bloch / Bill Pugh puzzlers talk from JavaOne given at Google. The Elvis example comes straight from here, and they do a better example of describing it than I did.
The Java Puzzlers book.
A couple of things that came [...]

Bubble, bubble, toil and Double

Inspired by Weiqi Gao's Friday Java Quiz this week, I came up with a few more curiosities of Java double. What do each of the calls to larger() print? Hint: this puzzle has nothing to do with type conversion loss of precision, it is only about the specified behavior of doubles.

public class Foo [...]

String Theory

No, not that string theory. This string theory is testable. In fact, the moral of this story is this: don't make any assumptions about Java. The compiler or the VM. They do crazy stuff, like make your code run better. If you think you have an inefficiency in your [...]