Buggy code:
public class JBossDeploymentStructureParser10 implements XMLElementReader < ParseResult > { public static final JBossDeploymentStructureParser10 INSTANCE = new JBossDeploymentStructureParser10 ( ) ; public static final String NAMESPACE_1_0 = "urn:jboss:deployment-structure:1.0" ; enum Element { JBOSS_DEPLOYMENT_STRUCTURE , EAR_SUBDEPLOYMENTS_ISOLATED , DEPLOYMENT , SUB_DEPLOYMENT , MODULE , DEPENDENCIES , EXPORTS , IMPORTS , INCLUDE , INCLUDE_SET , EXCLUDE , EXCLUDE_SET , RESOURCES , RESOURCE_ROOT , PATH , FILTER , TRANSFORMERS , TRANSFORMER , EXCLUSIONS , UNKNOWN ; private static final Map < QName , JBossDeploymentStructureParser10 . Element > elements ; static JBossDeploymentStructureParser10 . Element of ( QName qName ) { } } enum Attribute { NAME , SLOT , EXPORT , SERVICES , PATH , OPTIONAL , CLASS , VALUE , UNKNOWN ; private static final Map < QName , JBossDeploymentStructureParser10 . Attribute > attributes ; static JBossDeploymentStructureParser10 . Attribute of ( QName qName ) { } } enum Disposition { NONE ( "none" ) , IMPORT ( "import" ) , EXPORT ( "export" ) ; private static final Map < String , JBossDeploymentStructureParser10 . Disposition > values ; private final String value ; Disposition ( String value ) { } static JBossDeploymentStructureParser10 . Disposition of ( final String value ) { } } private JBossDeploymentStructureParser10 ( ) { } @ Override public void readElement ( final XMLExtendedStreamReader reader , final ParseResult result ) throws XMLStreamException { } private static void parseDeployment ( final XMLStreamReader reader , final ParseResult result ) throws XMLStreamException { } private static void parseSubDeployment ( final XMLStreamReader reader , final ParseResult result ) throws XMLStreamException { } private static void parseModule ( final XMLStreamReader reader , final ParseResult result ) throws XMLStreamException { } private static void parseModuleStructureSpec ( final DeploymentUnit deploymentUnit , final XMLStreamReader reader , final ModuleStructureSpec moduleSpec , final ModuleLoader moduleLoader ) throws XMLStreamException { } private static void parseDependencies ( final XMLStreamReader reader , final ModuleStructureSpec specBuilder , ModuleLoader moduleLoader ) throws XMLStreamException { } private static void parseModuleDependency ( final XMLStreamReader reader , final ModuleStructureSpec specBuilder , ModuleLoader moduleLoader ) throws XMLStreamException { String name = null ; String slot = null ; boolean export = false ; boolean optional = false ; JBossDeploymentStructureParser10 . Disposition services = JBossDeploymentStructureParser10 . Disposition . NONE ; final Set < JBossDeploymentStructureParser10 . Attribute > required = EnumSet . of ( JBossDeploymentStructureParser10 . Attribute . NAME ) ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final JBossDeploymentStructureParser10 . Attribute attribute = JBossDeploymentStructureParser10 . Attribute . of ( reader . getAttributeName ( i ) ) ; required . remove ( attribute ) ; switch ( attribute ) { case NAME : name = reader . getAttributeValue ( i ) ; break ; case SLOT : slot = reader . getAttributeValue ( i ) ; break ; case EXPORT : export = Boolean . parseBoolean ( reader . getAttributeValue ( i ) ) ; break ; case SERVICES : services = JBossDeploymentStructureParser10 . Disposition . of ( reader . getAttributeValue ( i ) ) ; break ; case OPTIONAL : optional = Boolean . parseBoolean ( reader . getAttributeValue ( i ) ) ; break ; default : throw JBossDeploymentStructureParser10 . unexpectedContent ( reader ) ; } } if ( ! ( required . isEmpty ( ) ) ) { throw JBossDeploymentStructureParser10 . missingAttributes ( reader . getLocation ( ) , required ) ; } <START_BUG> ModuleDependency dependency = new ModuleDependency ( moduleLoader , ModuleIdentifier . create ( name , slot ) , optional , export , ( services == ( JBossDeploymentStructureParser10 . Disposition . IMPORT ) ) ) ; <END_BUG> specBuilder . addModuleDependency ( dependency ) ; while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case XMLStreamConstants . END_ELEMENT : { if ( services == ( JBossDeploymentStructureParser10 . Disposition . EXPORT ) ) { dependency . addExportFilter ( PathFilters . getMetaInfServicesFilter ( ) , true ) ; } if ( export ) { dependency . addExportFilter ( PathFilters . getMetaInfSubdirectoriesFilter ( ) , false ) ; dependency . addExportFilter ( PathFilters . getMetaInfFilter ( ) , false ) ; } if ( dependency . getImportFilters ( ) . isEmpty ( ) ) { dependency . addImportFilter ( ( services == ( JBossDeploymentStructureParser10 . Disposition . NONE ) ? PathFilters . getDefaultImportFilter ( ) : PathFilters . getDefaultImportFilterWithServices ( ) ) , true ) ; } else { if ( services != ( JBossDeploymentStructureParser10 . Disposition . NONE ) ) { dependency . addImportFilter ( PathFilters . getMetaInfServicesFilter ( ) , true ) ; } dependency . addImportFilter ( PathFilters . getMetaInfSubdirectoriesFilter ( ) , false ) ; dependency . addImportFilter ( PathFilters . getMetaInfFilter ( ) , false ) ; } specBuilder . addModuleDependency ( dependency ) ; return ; } case XMLStreamConstants . START_ELEMENT : { switch ( JBossDeploymentStructureParser10 . Element . of ( reader . getName ( ) ) ) { case EXPORTS : JBossDeploymentStructureParser10 . parseFilterList ( reader , dependency . getExportFilters ( ) ) ; break ; case IMPORTS : JBossDeploymentStructureParser10 . parseFilterList ( reader , dependency . getImportFilters ( ) ) ; break ; default : throw JBossDeploymentStructureParser10 . unexpectedContent ( reader ) ; } break ; } default : { throw JBossDeploymentStructureParser10 . unexpectedContent ( reader ) ; } } } } private static void parseResources ( final DeploymentUnit deploymentUnit , final XMLStreamReader reader , final ModuleStructureSpec specBuilder ) throws XMLStreamException { } private static void parseResourceRoot ( final DeploymentUnit deploymentUnit , final XMLStreamReader reader , final ModuleStructureSpec specBuilder ) throws XMLStreamException { } private static void parseFilterList ( final XMLStreamReader reader , final List < FilterSpecification > filters ) throws XMLStreamException { } private static void parsePath ( final XMLStreamReader reader , final boolean include , final List < FilterSpecification > filters ) throws XMLStreamException { }

Fix:
ModuleDependency dependency = new ModuleDependency ( moduleLoader , ModuleIdentifier . create ( name , slot ) , optional , export , ( services == ( JBossDeploymentStructureParser10 . Disposition . IMPORT ) ) , true ) ;