Buggy code:
public class GenUtil { public static Statement [ ] generateCallParameters ( Context context , Object ... parameters ) { } public static Statement [ ] generateCallParameters ( MetaMethod method , Context context , Object ... parameters ) { } public static Statement generate ( Context context , Object o ) { } public static void assertIsIterable ( Statement statement ) { } public static void assertAssignableTypes ( MetaClass from , MetaClass to ) { } public static Statement convert ( Context context , Object input , MetaClass targetType ) { } public static String classesAsStrings ( MetaClass ... stmt ) { } public static MetaClass [ ] fromParameters ( MetaParameter ... parms ) { } public static MetaClass [ ] classToMeta ( Class < ? > [ ] types ) { } public static Map < String , MetaClass > determineTypeVariables ( MetaMethod method ) { } private static void resolveTypeVariable ( Map < String , MetaClass > typeVariables , MetaType methodParmType , MetaType callParmType ) { } public static Scope scopeOf ( MetaClass clazz ) { } public static Scope scopeOf ( MetaClassMember member ) { } public static DefModifiers modifiersOf ( MetaClassMember member ) { } public static boolean equals ( MetaField a , MetaField b ) { } public static boolean equals ( MetaConstructor a , MetaConstructor b ) { } public static boolean equals ( MetaMethod a , MetaMethod b ) { } public static boolean equals ( MetaParameter a , MetaParameter b ) { } private static final String JAVA_REFL_FLD_UTIL_METH = "_getAccessibleField" ; public static void createJavaReflectionFieldInitializerUtilMethod ( ClassStructureBuilder < ? > classBuilder ) { } private static final String JAVA_REFL_METH_UTIL_METH = "_getAccessibleMethod" ; public static void createJavaReflectionMethodInitializerUtilMethod ( ClassStructureBuilder < ? > classBuilder ) { } public static String initCachedField ( ClassStructureBuilder < ? > classBuilder , MetaField f ) { } public static String initCachedMethod ( ClassStructureBuilder < ? > classBuilder , MetaMethod m ) { } public static void addPrivateAccessStubs ( boolean useJSNIStubs , ClassStructureBuilder < ? > classBuilder , MetaField f ) { } private static String _getReflectionFieldMethGetName ( MetaField f ) { } private static String _getReflectionFieldMethSetName ( MetaField f ) { } public static void addPrivateAccessStubs ( boolean useJSNIStubs , ClassStructureBuilder < ? > classBuilder , MetaMethod m ) { List < Parameter > wrapperDefParms = new ArrayList < Parameter > ( ) ; <START_BUG> wrapperDefParms . add ( Parameter . of ( m . getDeclaringClass ( ) , "instance" ) ) ; <END_BUG> List < Parameter > methodDefParms = DefParameters . from ( m ) . getParameters ( ) ; wrapperDefParms . addAll ( methodDefParms ) ; if ( useJSNIStubs ) { classBuilder . publicMethod ( m . getReturnType ( ) , GenUtil . getPrivateMethodName ( m ) ) . parameters ( new DefParameters ( wrapperDefParms ) ) . modifiers ( Static , JSNI ) . body ( ) . append ( new org . jboss . errai . codegen . framework . StringStatement ( JSNIUtil . methodAccess ( m ) ) ) . finish ( ) ; } else { String cachedMethod = GenUtil . initCachedMethod ( classBuilder , m ) ; Object [ ] args = new Object [ methodDefParms . size ( ) ] ; int i = 0 ; for ( Parameter p : methodDefParms ) { args [ ( i ++ ) ] = Refs . get ( p . getName ( ) ) ; } BlockBuilder < ? extends ClassStructureBuilder > body = classBuilder . publicMethod ( m . getReturnType ( ) , GenUtil . getPrivateMethodName ( m ) ) . parameters ( new DefParameters ( wrapperDefParms ) ) . modifiers ( Static ) . body ( ) ; BlockBuilder < CatchBlockBuilder > tryBuilder = Stmt . try_ ( ) ; ContextualStatementBuilder statementBuilder = Stmt . loadVariable ( cachedMethod ) . invoke ( "invoke" , Refs . get ( "instance" ) , args ) ; if ( m . getReturnType ( ) . isVoid ( ) ) { tryBuilder . append ( statementBuilder ) ; } else { tryBuilder . append ( statementBuilder . returnValue ( ) ) ; } body . append ( tryBuilder . finish ( ) . catch_ ( Throwable . class , "e" ) . append ( Stmt . loadVariable ( "e" ) . invoke ( "printStackTrace" ) ) . append ( Stmt . throw_ ( RuntimeException . class , Refs . get ( "e" ) ) ) . finish ( ) ) . finish ( ) ; } } public static String getPrivateFieldInjectorName ( MetaField field ) { } public static String getPrivateMethodName ( MetaMethod method ) { } public static MetaClass getPrimitiveWrapper ( MetaClass clazz ) { } public static boolean isPrimitiveWrapper ( MetaClass clazz ) { } public static int getArrayDimensions ( MetaClass type ) { } public static MetaMethod findCaseInsensitiveMatch ( MetaClass retType , MetaClass clazz , String name , MetaClass ... parms ) { } public static void throwIfUnhandled ( String error , Throwable t ) { } No newline ; at end ; of file ; }

Fix:
wrapperDefParms . add ( Parameter . of ( m . getDeclaringClass ( ) . getErased ( ) , "instance" ) ) ;