I feel so dirty

For this current project I’m on, I’ve resolved to give Eclipse a try. This is a major step for me, because my fingers have been typing vi commands for 20 years now, and it’s really hard to get out of the habit of typing “[escape]jjjjj” or “ZZ”. Everybody else here laughs at me because besides etags and the syntax colouring of gvim, I don’t have all the fancy stuff that they have. On the other hand, I can do everything through a ssh connection and can keep my hands on the home row.

Oh well. Welcome to the 21st century. Here’s your kazoo.

How the hell did I miss that?

I’ve been doing Java since 1998, and yet I only just discovered this interesting fact. If you have a class called, say, DBAsset that has a bunch of static methods in it, and you have some static member variables, and you initialize the static member variables, like so:

class DBAsset
{
static PreparedStatement insertStmt = null;
static PreparedStatement deleteStmt = null;

Then calling multiple static methods from within DBAsset’s static main using just the unadorned method name doesn’t do anything to those variables, but each time you call one of those static methods from some other class using DBAsset.methodname, those static variables get reinitialized to null. Huh.

Update: Figured it out. The code that initialized the variables was getting called *before* the code that set it to null, because I had a static DBAsset theAsset = new DBAsset(); before the static initializers. I’m such a slaphead.