Fixes issue #2334; native method within enum breaks in hosted mode.

Previously, JsniInjector worked by dropping static initializer blocks into the start of any class containing native methods.  These static initializer blocks would inject native method definitions into the browser window at class load time, so they would subsequently be available to be called.

However, there is no possible way to produce static initializer code in an enum that runs before that 
enum's fields get initialized; trying to put a static initializer block over the enum declaration is a syntax error.  It's important that native methods initialize before the enum values are constructed, because the constructors could potentially rely on calling those native methods.

The solution is a complete redo of how native methods are injected.  I removed the static initializers method in favor of injecting a class-level annotation, @JsniMethods, into the source code containing all of necessary information for CompilingClassLoader to inject the methods when the class is loaded, before it has a chance to initialize.

Found by: cromwellian
Review by: jat


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2577 8db76d5a-ed1c-0410-87a9-c151d255dfc7
9 files changed