Buggy code:
public class GriffonArtifactASTInjector extends AbstractASTInjector { private static final ClassNode GRIFFON_APPLICATION_CLASS = ClassHelper . makeWithoutCaching ( GriffonApplication . class ) ; private static final ClassNode GRIFFON_CLASS_CLASS = ClassHelper . makeWithoutCaching ( GriffonClass . class ) ; private static final ClassNode GAH_CLASS = ClassHelper . makeWithoutCaching ( GriffonApplicationHelper . class ) ; private static final ClassNode LOGGER_CLASS = ClassHelper . makeWithoutCaching ( Logger . class ) ; private static final ClassNode LOGGER_FACTORY_CLASS = ClassHelper . makeWithoutCaching ( LoggerFactory . class ) ; private static final ClassNode GROOVY_SYSTEM_CLASS = ClassHelper . makeWithoutCaching ( GroovySystem . class ) ; private static final ClassNode ABSTRACT_GRIFFON_ARTIFACT_CLASS = ClassHelper . makeWithoutCaching ( AbstractGriffonArtifact . class ) ; private static final ClassNode EXPANDO_METACLASS_CLASS = ClassHelper . makeWithoutCaching ( ExpandoMetaClass . class ) ; public static final String APP = "app" ; public void inject ( ClassNode classNode , String artifactType ) { injectProperty ( classNode , GriffonArtifactASTInjector . APP , ACC_PUBLIC , GriffonArtifactASTInjector . GRIFFON_APPLICATION_CLASS ) ; FieldNode _metaClass = injectField ( classNode , "_metaClass" , ( ( ACC_PRIVATE ) | ( ACC_SYNTHETIC ) ) , METACLASS_TYPE , NULL ) ; injectMethod ( classNode , new MethodNode ( "getMetaClass" , ACC_PUBLIC , ClassHelper . METACLASS_TYPE , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , block ( ifs ( ne ( field ( _metaClass ) , NULL ) , field ( _metaClass ) ) , decls ( var ( "mc" , METACLASS_TYPE ) , NULL ) , ifs_no_return ( iof ( THIS , GriffonArtifactASTInjector . EXPANDO_METACLASS_CLASS ) , assigns ( field ( _metaClass ) , var ( "mc" ) ) , assigns ( field ( _metaClass ) , call ( GriffonArtifactASTInjector . ABSTRACT_GRIFFON_ARTIFACT_CLASS , "metaClassOf" , args ( THIS ) ) ) ) , returns ( field ( _metaClass ) ) ) ) ) ; injectMethod ( classNode , new MethodNode ( "setMetaClass" , ACC_PUBLIC , ClassHelper . VOID_TYPE , params ( param ( METACLASS_TYPE , "mc" ) ) , ClassNode . EMPTY_ARRAY , block ( assigns ( field ( _metaClass ) , var ( "mc" ) ) , stmnt ( call ( call ( GriffonArtifactASTInjector . GROOVY_SYSTEM_CLASS , "getMetaClassRegistry" , NO_ARGS ) , "setMetaClass" , args ( call ( THIS , "getClass" , NO_ARGS ) , var ( "mc" ) ) ) ) ) ) ) ; <START_BUG> injectMethod ( classNode , new MethodNode ( "getGriffonClass" , ACC_PUBLIC , GriffonArtifactASTInjector . GRIFFON_CLASS_CLASS , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , returns ( call ( call ( call ( THIS , "getApp" , NO_ARGS ) , "getArtifactManager" , NO_ARGS ) , "findGriffonClass" , args ( classx ( classNode ) ) ) ) ) ) ; <END_BUG> injectMethod ( classNode , new MethodNode ( "newInstance" , ACC_PUBLIC , newClass ( OBJECT_TYPE ) , params ( param ( newClass ( CLASS_Type ) , "clazz" ) , param ( STRING_TYPE , "type" ) ) , ClassNode . EMPTY_ARRAY , returns ( call ( GriffonArtifactASTInjector . GAH_CLASS , "newInstance" , vars ( GriffonArtifactASTInjector . APP , "clazz" , "type" ) ) ) ) ) ; String loggerCategory = ( ( "griffon.app." + artifactType ) + "." ) + ( classNode . getName ( ) ) ; FieldNode loggerField = injectField ( classNode , "this$logger" , ( ( ( ACC_FINAL ) | ( ACC_PRIVATE ) ) | ( ACC_SYNTHETIC ) ) , GriffonArtifactASTInjector . LOGGER_CLASS , call ( GriffonArtifactASTInjector . LOGGER_FACTORY_CLASS , "getLogger" , args ( constx ( loggerCategory ) ) ) ) ; injectMethod ( classNode , new MethodNode ( "getLog" , ACC_PUBLIC , GriffonArtifactASTInjector . LOGGER_CLASS , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , returns ( field ( loggerField ) ) ) ) ; ThreadingAwareASTTransformation . apply ( classNode ) ; MVCAwareASTTransformation . apply ( classNode ) ; } }

Fix:
injectMethod ( classNode , new MethodNode ( "getGriffonClass" , ACC_PUBLIC , GriffonArtifactASTInjector . GRIFFON_CLASS_CLASS , Parameter . EMPTY_ARRAY , ClassNode . EMPTY_ARRAY , returns ( call ( call ( call ( THIS , "getApp" , NO_ARGS ) , "getArtifactManager" , NO_ARGS ) , "findGriffonClass" , args ( call ( THIS , "getClass" , NO_ARGS ) ) ) ) ) ) ;