Sync bndlib source

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1364196 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java b/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
index 5d16b9a..e66ad0c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
@@ -23,16 +23,16 @@
 		if (sc != null && sc.trim().length() > 0)
 			names.add(sc);
 
-		for (Iterator<Clazz> i = list.iterator(); i.hasNext();) {
+		for (Clazz c: list) {
 			for (Instruction instruction : instructions.keySet()) {
-				Clazz c = i.next();
 
 				if (instruction.matches(c.getFQN())) {
 					if (instruction.isNegated())
-						i.remove();
+						break;
 					else {
 						ComponentDef definition = AnnotationReader.getDefinition(c, analyzer);
 						if (definition != null) {
+							definition.sortReferences();
 							definition.prepare(analyzer);
 							String name = "OSGI-INF/" + definition.name + ".xml";
 							names.add(name);