Source:
public void testDeepAttributeRemoval ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\"\n" ) + " tools:remove=\"theme, exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:screenOrientation=\"landscape\"\n" ) + " android:theme=\"@oldtheme\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String evenLowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:theme=\"@oldtheme\"\n" ) + " android:exported=\"true\"/>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument highPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "highPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument lowPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowPriority" ) , lowerPriority ) ; com.android.manifmerger.XmlDocument lowestPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowestPriority" ) , evenLowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = highPriority.merge ( lowPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; result = resultDocument.merge ( lowestPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.util.List < com.android.manifmerger.XmlAttribute > attributes = activityOne.get ( ) . getAttributes ( ) ; assertEquals ( 2 , attributes.size ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:name" ) ) . isPresent ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:screenOrientation" ) ) . isPresent ( ) ) ; com.google.common.collect.ImmutableMap < java.lang.String , com.android.manifmerger.ActionRecorder.DecisionTreeRecord > allRecords = mergingReportBuilder.getActionRecorder ( ) . build ( ) . getAllRecords ( ) ; com.android.manifmerger.ActionRecorder.DecisionTreeRecord activityOneRecords = allRecords.get ( activityOne.get ( ) . getId ( ) ) ; assertNotNull ( activityOneRecords ) ; java.util.List < com.android.manifmerger.ActionRecorder.AttributeRecord > attributeRecords = activityOneRecords.getAttributeRecords ( com.android.manifmerger.XmlNode.fromXmlName ( "android:theme" ) ) ; assertNotNull ( attributeRecords ) ; assertEquals ( 2 , attributeRecords.size ( ) ) ; com.android.manifmerger.ActionRecorder.AttributeRecord attributeRecord = attributeRecords.get ( 0 ) ; assertEquals ( ActionRecorder.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 8 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; attributeRecord = attributeRecords.get ( 1 ) ; assertEquals ( ActionRecorder.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowestPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 7 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; }

Target:
public void testDeepAttributeRemoval ( ) throws java.io.IOException , javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException { java.lang.String higherPriority = "" + ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\"\n" ) + " tools:remove=\"theme, exported\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String lowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:screenOrientation=\"landscape\"\n" ) + " android:theme=\"@oldtheme\"/>\n" ) + "\n" ) + "</manifest>" ) ; java.lang.String evenLowerPriority = "" + ( ( ( ( ( ( ( ( ( "<manifest\n" + " xmlns:android=\"http://schemas.android.com/apk/res/android\"\n" ) + " xmlns:tools=\"http://schemas.android.com/tools\"\n" ) + " package=\"com.example.lib3\">\n" ) + "\n" ) + " <activity android:name=\"activityOne\" \n" ) + " android:theme=\"@oldtheme\"\n" ) + " android:exported=\"true\"/>\n" ) + "\n" ) + "</manifest>" ) ; com.android.manifmerger.XmlDocument highPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "highPriority" ) , higherPriority ) ; com.android.manifmerger.XmlDocument lowPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowPriority" ) , lowerPriority ) ; com.android.manifmerger.XmlDocument lowestPriority = com.android.manifmerger.TestUtils.xmlDocumentFromString ( new com.android.manifmerger.TestUtils.TestSourceLocation ( getClass ( ) , "lowestPriority" ) , evenLowerPriority ) ; com.android.manifmerger.MergingReport.Builder mergingReportBuilder = new com.android.manifmerger.MergingReport.Builder ( new com.android.utils.StdLogger ( StdLogger.Level.VERBOSE ) ) ; com.google.common.base.Optional < com.android.manifmerger.XmlDocument > result = highPriority.merge ( lowPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; com.android.manifmerger.XmlDocument resultDocument = result.get ( ) ; result = resultDocument.merge ( lowestPriority , mergingReportBuilder ) ; assertTrue ( result.isPresent ( ) ) ; resultDocument = result.get ( ) ; com.google.common.base.Optional < com.android.manifmerger.XmlElement > activityOne = resultDocument.getRootNode ( ) . getNodeByTypeAndKey ( ManifestModel.NodeTypes.ACTIVITY , "com.example.lib3.activityOne" ) ; assertTrue ( activityOne.isPresent ( ) ) ; java.util.List < com.android.manifmerger.XmlAttribute > attributes = activityOne.get ( ) . getAttributes ( ) ; assertEquals ( 2 , attributes.size ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:name" ) ) . isPresent ( ) ) ; assertTrue ( activityOne.get ( ) . getAttribute ( com.android.manifmerger.XmlNode.fromXmlName ( "android:screenOrientation" ) ) . isPresent ( ) ) ; com.android.manifmerger.Actions actions = mergingReportBuilder.getActionRecorder ( ) . build ( ) ; java.util.List < com.android.manifmerger.Actions.AttributeRecord > attributeRecords = actions.getAttributeRecords ( activityOne.get ( ) . getId ( ) , com.android.manifmerger.XmlNode.fromXmlName ( "android:theme" ) ) ; assertNotNull ( attributeRecords ) ; assertEquals ( 2 , attributeRecords.size ( ) ) ; com.android.manifmerger.Actions.AttributeRecord attributeRecord = attributeRecords.get ( 0 ) ; assertEquals ( Actions.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 8 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; attributeRecord = attributeRecords.get ( 1 ) ; assertEquals ( Actions.ActionType.REJECTED , attributeRecord.getActionType ( ) ) ; assertEquals ( AttributeOperationType.REMOVE , attributeRecord.getOperationType ( ) ) ; assertEquals ( "XmlAttributeTest#lowestPriority" , attributeRecord.getActionLocation ( ) . getSourceLocation ( ) . print ( true ) ) ; assertEquals ( 7 , attributeRecord.getActionLocation ( ) . getPosition ( ) . getLine ( ) ) ; }