AJDT and Ant

February 27, 2009

I’ve just had one of those mornings where you spend hours trying to crack a problem and just getting nowhere.

The problem was getting AspectJ to work under Ant but only by using the AJDT 1.6.3 Eclipse plugin.

Unfortunately, this is very poorly documented. Fortunately, this helps you make the right decision: don’t use AspectJ in Ant by relying on AJDT.

There is a very good reason for this (beyond it being hard to get working): you cannot rely on AJDT being available when compiling in anything other than Eclipse (e.g. from a CI server).

What’s the alternative? Download AspectJ and use these libraries directly in Ant – they’re well documented and just work.

Advertisements

Bug in Annotation Processing (Java 6 Update 12 / Eclipse)

February 26, 2009

Just uncovered a fun bug in one of the Java Compiler / Eclipse (haven’t checked to see which one is behaving exactly correctly).

If you are working Eclipse then the Eclipse compiler believes the following snippet of code is OK:

@org.hibernate.annotations.Table(
  appliesTo = "PendingVotes",
  indexes = {
    @Index(name = "VoteId", columnNames = { "VoteId" }),
  })

However, the Java compiler (Version 6, update 12) will report the following error:

annotation.java:6: illegal start of expression
})
^

Now, I’ll display that snippet again and highlight the problem:

@org.hibernate.annotations.Table(
  appliesTo = "PendingVotes",
  indexes = {
    @Index(name = "VoteId", columnNames = { "VoteId" }),
  })

See that sneaky little comma at the end? I believe this is valid syntax (it allows someone to add another item later and only alter a single line – useful for generating diffs).

Remove that comma and everything becomes pain free again.


Hello!

February 25, 2009

My view of blogging is that it is traditional to have a first post that says something profound about why the blog exists.

I’m not really sure what I am going to be putting on here. It’s mainly going to be technical and startup related… but I’m not going to put limits on it.

So, no grand purpose and nothing profound – yet. Watch this space.