Buggy code:
public final class LambdaValue extends ASTNode implements ITypeContext , IClassCompilable , IContext , IValue , IValued { public static final Handle BOOTSTRAP = new Handle ( MethodWriter . H_INVOKESTATIC , "java//lang//invoke//LambdaMetafactory" , "metafactory" , ( "(Ljava//lang//invoke//MethodHandles$Lookup;" + ( ( ( ( ( "Ljava//lang//String;" + "Ljava//lang//invoke//MethodType;" ) + "Ljava//lang//invoke//MethodType;" ) + "Ljava//lang//invoke//MethodHandle;" ) + "Ljava//lang//invoke//MethodType;)" ) + "Ljava//lang//invoke//CallSite;" ) ) ) ; public LambdaParameter [ ] parameters ; public int parameterCount ; public IValue value ; protected IType type ; protected IMethod method ; private IContext context ; private int index ; private String owner ; private String name ; private String lambdaDesc ; private IType returnType ; private IVariable [ ] capturedFields ; private int capturedFieldCount ; private IType thisType ; public LambdaValue ( ICodePosition position ) { } public LambdaValue ( ICodePosition position , LambdaParameter param ) { } public LambdaValue ( ICodePosition position , LambdaParameter [ ] params ) { } @ Override public int getValueType ( ) { } @ Override public boolean isPrimitive ( ) { } @ Override public void setValue ( IValue value ) { } @ Override public IValue getValue ( ) { } @ Override public void setType ( IType type ) { } @ Override public IType getType ( ) { } @ Override public IValue withType ( IType type ) { } @ Override public boolean isType ( IType type ) { } @ Override public int getTypeMatch ( IType type ) { } @ Override public IType resolveType ( String name ) { } @ Override public void resolveTypes ( MarkerList markers , IContext context ) { } @ Override public IValue resolve ( MarkerList markers , IContext context ) { } @ Override public void check ( MarkerList markers , IContext context ) { } @ Override public IValue foldConstants ( ) { } @ Override public boolean isStatic ( ) { } @ Override public IType getThisType ( ) { } @ Override public Package resolvePackage ( String name ) { } @ Override public IClass resolveClass ( String name ) { } @ Override public FieldMatch resolveField ( String name ) { } @ Override public MethodMatch resolveMethod ( IValue instance , String name , IArguments arguments ) { } @ Override public void getMethodMatches ( List < MethodMatch > list , IValue instance , String name , IArguments arguments ) { } @ Override public MethodMatch resolveConstructor ( IArguments arguments ) { } @ Override public void getConstructorMatches ( List < MethodMatch > list , IArguments arguments ) { } @ Override public byte getAccessibility ( IMember member ) { } @ Override public void writeExpression ( MethodWriter writer ) { } @ Override public void writeStatement ( MethodWriter writer ) { } private String getName ( ) { } private String getInvokeDescriptor ( ) { } private String getSpecialDescriptor ( ) { } private String getLambdaDescriptor ( ) { } @ Override public void write ( ClassWriter writer ) { boolean instance = ( this . thisType ) != null ; int modifiers = ( instance ) ? ( Modifiers . PRIVATE ) | ( Modifiers . SYNTHETIC ) : ( ( Modifiers . PRIVATE ) | ( Modifiers . STATIC ) ) | ( Modifiers . SYNTHETIC ) ; MethodWriter mw = new dyvil . tools . compiler . backend . MethodWriterImpl ( writer , writer . visitMethod ( modifiers , this . getName ( ) , this . getLambdaDescriptor ( ) , null , null ) ) ; int [ ] prevIndex = null ; if ( instance ) { mw . registerLocal ( this . thisType ) ; } if ( ( this . capturedFieldCount ) > 0 ) { prevIndex = new int [ this . capturedFieldCount ] ; for ( int i = 0 ; i < ( this . capturedFieldCount ) ; i ++ ) { IVariable var = this . capturedFields [ i ] ; prevIndex [ i ] = var . getIndex ( ) ; var . setIndex ( mw . registerParameter ( var . getQualifiedName ( ) , var . getType ( ) ) ) ; } } for ( int i = 0 ; i < ( this . parameterCount ) ; i ++ ) { LambdaParameter param = this . parameters [ i ] ; param . index = mw . registerParameter ( param . qualifiedName , param . type ) ; } mw . begin ( ) ; this . value . writeExpression ( mw ) ; mw . end ( this . method . getType ( ) ) ; <START_BUG> for ( int i = 0 ; i < ( this . parameterCount ) ; i ++ ) { <END_BUG> IVariable var = this . capturedFields [ i ] ; var . setIndex ( prevIndex [ i ] ) ; } } @ Override public void toString ( String prefix , StringBuilder buffer ) { } }

Fix:
for ( int i = 0 ; i < ( this . capturedFieldCount ) ; i ++ ) {