That's a good solution. The static is an atomic integer as attachments may be constructed in a multi-threaded manner (though primitive types smaller than long and double are guaranteed to be atomic in Java anyways...).
I think it'd be best if the Guava AtomicInteger shim was part of the libGDX HTML5 backend. Could you file an issue on the libGDX tracker for that to happen?