Factor out some common Javassist code