Buggy code:
public void compile ( XmlSchema schema ) throws SchemaCompilationException { } private void compile ( XmlSchema schema , boolean isPartofGroup ) throws SchemaCompilationException { } private void finalizeSchemaCompilation ( ) throws SchemaCompilationException { } public Properties getCompilerProperties ( ) { } private void writeElement ( XmlSchemaElement xsElt ) throws SchemaCompilationException { } private void processElement ( XmlSchemaElement xsElt , Map < QName , String > innerElementMap , List < QName > localNillableList , XmlSchema parentSchema ) throws SchemaCompilationException { } private void processElement ( XmlSchemaElement xsElt , XmlSchema parentSchema ) throws SchemaCompilationException { } private void processElement ( XmlSchemaElement xsElt , boolean isOuter , Map < QName , String > innerElementMap , List < QName > localNillableList , XmlSchema parentSchema ) throws SchemaCompilationException { if ( xsElt == null ) { throw new SchemaCompilationException ( SchemaCompilerMessages . getMessage ( "schema.elementNull" ) ) ; } if ( isOuter && ( processedElementList . contains ( xsElt . getQName ( ) ) ) ) { return ; } XmlSchemaType schemaType = xsElt . getSchemaType ( ) ; if ( schemaType != null ) { processSchema ( xsElt , schemaType , parentSchema , false ) ; if ( ! isOuter ) { if ( ( schemaType . getName ( ) ) != null ) { String className = findClassName ( schemaType . getQName ( ) , isArray ( xsElt ) ) ; innerElementMap . put ( xsElt . getWireName ( ) , className ) ; if ( ( options . isUseWrapperClasses ( ) ) && ( PrimitiveTypeFinder . isPrimitive ( className ) ) ) { className = PrimitiveTypeWrapper . getWrapper ( className ) ; } schemaType . addMetaInfo ( CLASSNAME_KEY , className ) ; xsElt . addMetaInfo ( CLASSNAME_KEY , className ) ; if ( baseSchemaTypeMap . containsValue ( className ) ) { schemaType . addMetaInfo ( CLASSNAME_PRIMITVE_KEY , Boolean . TRUE ) ; } } else { QName generatedTypeName = generateTypeQName ( xsElt . getWireName ( ) , parentSchema ) ; if ( schemaType instanceof XmlSchemaComplexType ) { schemaType . setName ( generatedTypeName . getLocalPart ( ) ) ; changedComplexTypeSet . add ( ( ( XmlSchemaComplexType ) ( schemaType ) ) ) ; String fullyQualifiedClassName = writer . makeFullyQualifiedClassName ( schemaType . getQName ( ) ) ; processedTypemap . put ( schemaType . getQName ( ) , fullyQualifiedClassName ) ; BeanWriterMetaInfoHolder metaInfHolder = processedAnonymousComplexTypesMap . get ( xsElt ) ; metaInfHolder . setOwnQname ( schemaType . getQName ( ) ) ; metaInfHolder . setOwnClassName ( fullyQualifiedClassName ) ; writeComplexType ( ( ( XmlSchemaComplexType ) ( schemaType ) ) , metaInfHolder ) ; processedAnonymousComplexTypesMap . remove ( xsElt ) ; String className = findClassName ( schemaType . getQName ( ) , isArray ( xsElt ) ) ; innerElementMap . put ( xsElt . getWireName ( ) , className ) ; xsElt . addMetaInfo ( CLASSNAME_KEY , className ) ; } else if ( schemaType instanceof XmlSchemaSimpleType ) { schemaType . setName ( generatedTypeName . getLocalPart ( ) ) ; changedSimpleTypeSet . add ( ( ( XmlSchemaSimpleType ) ( schemaType ) ) ) ; String fullyQualifiedClassName = writer . makeFullyQualifiedClassName ( schemaType . getQName ( ) ) ; processedTypemap . put ( schemaType . getQName ( ) , fullyQualifiedClassName ) ; BeanWriterMetaInfoHolder metaInfHolder = processedAnonymousComplexTypesMap . get ( xsElt ) ; metaInfHolder . setOwnQname ( schemaType . getQName ( ) ) ; metaInfHolder . setOwnClassName ( fullyQualifiedClassName ) ; writeSimpleType ( ( ( XmlSchemaSimpleType ) ( schemaType ) ) , metaInfHolder ) ; processedAnonymousComplexTypesMap . remove ( xsElt ) ; String className = findClassName ( schemaType . getQName ( ) , isArray ( xsElt ) ) ; <START_BUG> innerElementMap . put ( xsElt . getQName ( ) , className ) ; <END_BUG> xsElt . addMetaInfo ( CLASSNAME_KEY , className ) ; } } } else { this . processedElementList . add ( xsElt . getQName ( ) ) ; } } else if ( ( xsElt . getRef ( ) . getTargetQName ( ) ) != null ) { if ( xsElt . getRef ( ) . getTargetQName ( ) . equals ( XSD_SCHEMA ) ) { innerElementMap . put ( xsElt . getQName ( ) , writer . getDefaultClassName ( ) ) ; return ; } XmlSchema resolvedSchema = getParentSchema ( parentSchema , xsElt . getRef ( ) . getTargetQName ( ) , SchemaCompiler . COMPONENT_ELEMENT ) ; if ( resolvedSchema == null ) { throw new SchemaCompilationException ( ( ( ( "can<seq2seq4repair_space>not<seq2seq4repair_space>find<seq2seq4repair_space>the<seq2seq4repair_space>element<seq2seq4repair_space>" + ( xsElt . getRef ( ) . getTargetQName ( ) ) ) + "<seq2seq4repair_space>from<seq2seq4repair_space>the<seq2seq4repair_space>parent<seq2seq4repair_space>schema<seq2seq4repair_space>" ) + ( parentSchema . getTargetNamespace ( ) ) ) ) ; } XmlSchemaElement referencedElement = resolvedSchema . getElementByName ( xsElt . getRef ( ) . getTargetQName ( ) ) ; if ( referencedElement == null ) { throw new SchemaCompilationException ( SchemaCompilerMessages . getMessage ( "schema.referencedElementNotFound" , xsElt . getRef ( ) . getTargetQName ( ) . toString ( ) ) ) ; } if ( ( ( referencedElement . getSchemaType ( ) ) != null ) && ( ( referencedElement . getSchemaType ( ) . getQName ( ) ) != null ) ) { if ( ! ( this . processedElementRefMap . containsKey ( referencedElement . getQName ( ) ) ) ) { if ( this . baseSchemaTypeMap . containsKey ( referencedElement . getSchemaTypeName ( ) ) ) { this . processedElementRefMap . put ( referencedElement . getQName ( ) , this . baseSchemaTypeMap . get ( referencedElement . getSchemaTypeName ( ) ) ) ; } else { XmlSchema resolvedTypeSchema = getParentSchema ( resolvedSchema , referencedElement . getSchemaTypeName ( ) , SchemaCompiler . COMPONENT_TYPE ) ; XmlSchemaType xmlSchemaType = resolvedTypeSchema . getTypeByName ( referencedElement . getSchemaTypeName ( ) . getLocalPart ( ) ) ; processSchema ( referencedElement , xmlSchemaType , resolvedTypeSchema , true ) ; this . processedElementRefMap . put ( referencedElement . getQName ( ) , this . processedTypemap . get ( referencedElement . getSchemaTypeName ( ) ) ) ; }

Fix:
innerElementMap . put ( xsElt . getWireName ( ) , className ) ;