Buggy code:
} enum Attribute { NAME , SLOT , EXPORT , SERVICES , PATH , OPTIONAL , CLASS , VALUE , USE_PHYSICAL_CODE_SOURCE , ANNOTATIONS , META_INF , UNKNOWN ; private static final Map < QName , JBossDeploymentStructureParser11 . Attribute > attributes ; static JBossDeploymentStructureParser11 . Attribute of ( QName qName ) { } } enum Disposition { NONE ( "none" ) , IMPORT ( "import" ) , EXPORT ( "export" ) ; private static final Map < String , JBossDeploymentStructureParser11 . Disposition > values ; private final String value ; Disposition ( String value ) { } static JBossDeploymentStructureParser11 . Disposition of ( final String value ) { } } private JBossDeploymentStructureParser11 ( ) { } @ 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 ( XMLStreamReader reader , ParseResult result ) throws XMLStreamException { } private static void parseModule ( XMLStreamReader reader , 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 parseModuleAlias ( final XMLStreamReader reader , final ModuleStructureSpec moduleSpec ) throws XMLStreamException { } private static void parseDependencies ( final XMLStreamReader reader , final ModuleStructureSpec specBuilder , final ModuleLoader moduleLoader ) throws XMLStreamException { } private static void parseSystemDependency ( final XMLStreamReader reader , final ModuleStructureSpec specBuilder ) throws XMLStreamException { } private static void parseSet ( final XMLStreamReader reader , final boolean include , final MultiplePathFilterBuilder builder ) throws XMLStreamException { } private static Set < String > parseSet ( final XMLStreamReader reader ) throws XMLStreamException { } private static void parseFilterList ( final XMLStreamReader reader , final MultiplePathFilterBuilder builder ) throws XMLStreamException { } private static void parsePath ( final XMLStreamReader reader , final boolean include , final MultiplePathFilterBuilder builder ) 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 ; boolean annotations = false ; JBossDeploymentStructureParser11 . Disposition services = JBossDeploymentStructureParser11 . Disposition . NONE ; JBossDeploymentStructureParser11 . Disposition metaInf = JBossDeploymentStructureParser11 . Disposition . NONE ; final Set < JBossDeploymentStructureParser11 . Attribute > required = EnumSet . of ( JBossDeploymentStructureParser11 . Attribute . NAME ) ; final int count = reader . getAttributeCount ( ) ; for ( int i = 0 ; i < count ; i ++ ) { final JBossDeploymentStructureParser11 . Attribute attribute = JBossDeploymentStructureParser11 . 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 = JBossDeploymentStructureParser11 . Disposition . of ( reader . getAttributeValue ( i ) ) ; break ; case OPTIONAL : optional = Boolean . parseBoolean ( reader . getAttributeValue ( i ) ) ; break ; case ANNOTATIONS : annotations = Boolean . parseBoolean ( reader . getAttributeValue ( i ) ) ; break ; case META_INF : metaInf = JBossDeploymentStructureParser11 . Disposition . of ( reader . getAttributeValue ( i ) ) ; break ; default : throw JBossDeploymentStructureParser11 . unexpectedContent ( reader ) ; } } if ( ! ( required . isEmpty ( ) ) ) { throw JBossDeploymentStructureParser11 . missingAttributes ( reader . getLocation ( ) , required ) ; } final ModuleIdentifier identifier = ModuleIdentifier . create ( name , slot ) ; <START_BUG> final ModuleDependency dependency = new ModuleDependency ( moduleLoader , identifier , optional , export , ( services == ( JBossDeploymentStructureParser11 . Disposition . IMPORT ) ) ) ; <END_BUG> if ( annotations ) { specBuilder . addAnnotationModule ( identifier ) ; } switch ( metaInf ) { case EXPORT : { dependency . addImportFilter ( PathFilters . getMetaInfSubdirectoriesFilter ( ) , true ) ; dependency . addExportFilter ( PathFilters . getMetaInfSubdirectoriesFilter ( ) , true ) ; break ; } case IMPORT : { dependency . addImportFilter ( PathFilters . getMetaInfSubdirectoriesFilter ( ) , true ) ; break ; } } specBuilder . addModuleDependency ( dependency ) ; while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case XMLStreamConstants . END_ELEMENT : { if ( services == ( JBossDeploymentStructureParser11 . 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 == ( JBossDeploymentStructureParser11 . Disposition . NONE ) ? PathFilters . getDefaultImportFilter ( ) : PathFilters . getDefaultImportFilterWithServices ( ) ) , true ) ; } else { if ( services != ( JBossDeploymentStructureParser11 . 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 ( JBossDeploymentStructureParser11 . Element . of ( reader . getName ( ) ) ) { case EXPORTS : JBossDeploymentStructureParser11 . parseFilterList ( reader , dependency . getExportFilters ( ) ) ; break ;

Fix:
final ModuleDependency dependency = new ModuleDependency ( moduleLoader , identifier , optional , export , ( services == ( JBossDeploymentStructureParser11 . Disposition . IMPORT ) ) , true ) ;