Interesting blog post on the Oracle Google thing by Charles Nutter

As you've probably heard by now, Oracle has decided to file suit against Google, claiming multiple counts of infringement against Java or JVM patents and copyrights they acquired when they assimilated Sun Microsystems this past year. Since I'm unlikely to keep my mouth shut about even trivial matters, something this big obviously requires at least a couple thousand words.

It's long, but he has some interesting thoughts and a decent amount of background that I wasn't necessarily aware of. It's nice that he lists all of the patents, too.

Oracle Sues Google over using Java in Android

Oracle has filed a lawsuit against Google, charging that its Android phone software infringes Oracle patents and copyrights related to Java, Oracle said Thursday.

"In developing Android, Google knowingly, directly and repeatedly infringed Oracle's Java-related intellectual property. This lawsuit seeks appropriate remedies for their infringement," Oracle spokeswoman Karen Tillman said in a statement.

It seems like the many people that have worried about Java being a company controlled language as opposed to a community controlled one are correct, especially those that suspected that Oracle would be much more closed about it than Sun was... This is a great way to kill the language and make people afraid to use OpenJDK in any commercial software.

Fun with constants in Java

The following code does not compile:

public class A {    public static void main(String[] args) {        int i = Integer.parseInt(args[0]);        switch (i) {            case X: System.out.println("ONE!"); break;            case Y: System.out.println("TWO!"); break;            default: System.out.println("ZERO!"); break;        }    }    public static final int X = B.getNumber("X");    public static final int Y = B.getNumber("Y");}class B {    public static int getNumber(String s) {        if (s.equals("X")) {            return 1;        }        else if (s.equals("Y")) {            return 2;        }        else {            return 0;        }    }}

The compile error is:

A.java:5: constant expression required            case X: System.out.println("ONE!"); break;                 ^A.java:6: constant expression required            case Y: System.out.println("TWO!"); break;                 ^2 errors

I think I'll leave explaining why as an exercise for the reader. (Or for a future post. ;-)

JRuby lead developer expounds on useful JVM flags

I probably start up a JVM a thousand times a day. Test runs, benchmark runs, bug confirmation, API exploration, or running actual apps. And in many of these runs, I use various JVM switches to tweak performance or investigate runtime metrics. Here's a short list of my favorite JVM switches (note these are Hotspot/OpenJDK/SunJDK switches, and may or may not work on yours. Apple JVM is basically the same, so these work).

If you write any serious Java at all, I highly recommend that you click the link above and read his post. It is full of many amazing gems that I can see being really useful for optimizing and debugging Java applications.

Mock Objects

Brett shared this post from the Google Open Source blog. While I'm not into Python, a mock object generator seems totally awesome. (Why didn't anyone tell me about this earlier?) Anyways, the Google Blog post linked to EasyMock, which is a mock object generator for Java. Now that looks really useful, since I spend my day job hacking on a very large Java system with not enough tests. EasyMock has quickly made it onto the short list of things I need to look into.