Latest bnd code

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/EnumerationIterator.java b/bundleplugin/src/main/java/aQute/lib/collections/EnumerationIterator.java
index ec7aec6..1bb9f0d 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/EnumerationIterator.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/EnumerationIterator.java
@@ -8,11 +8,11 @@
  * @param <T>
  */
 public class EnumerationIterator<T> implements Iterable<T>, Iterator<T> {
-	
+
 	public static <T> EnumerationIterator<T> iterator(Enumeration<T> e) {
 		return new EnumerationIterator<T>(e);
 	}
-	
+
 	final Enumeration<T>	enumerator;
 	volatile boolean		done	= false;
 
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/ExtList.java b/bundleplugin/src/main/java/aQute/lib/collections/ExtList.java
index 4c4f558..40c80ca 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/ExtList.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/ExtList.java
@@ -5,24 +5,24 @@
 public class ExtList<T> extends ArrayList<T> {
 	private static final long	serialVersionUID	= 1L;
 
-	public ExtList(T ... ts) {
+	public ExtList(T... ts) {
 		super(ts.length);
-		for (T t : ts){
+		for (T t : ts) {
 			add(t);
 		}
 	}
-	
+
 	public String join() {
 		return join(",");
 	}
 
 	public String join(String del) {
 		StringBuilder sb = new StringBuilder();
-		String d= "";
-		for ( T t : this) {
+		String d = "";
+		for (T t : this) {
 			sb.append(d);
-			d=del;
-			if ( t != null)
+			d = del;
+			if (t != null)
 				sb.append(t.toString());
 		}
 		return sb.toString();
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/IteratorList.java b/bundleplugin/src/main/java/aQute/lib/collections/IteratorList.java
index cb96d16..63ddbeb 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/IteratorList.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/IteratorList.java
@@ -5,8 +5,8 @@
 public class IteratorList<T> extends ArrayList<T> {
 	private static final long	serialVersionUID	= 1L;
 
-	public IteratorList(Iterator<T> i){
-		while(i.hasNext())
+	public IteratorList(Iterator<T> i) {
+		while (i.hasNext())
 			add(i.next());
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/LineCollection.java b/bundleplugin/src/main/java/aQute/lib/collections/LineCollection.java
index a04ab36..0670712 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/LineCollection.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/LineCollection.java
@@ -12,7 +12,7 @@
 	}
 
 	public LineCollection(File in) throws IOException {
-		this(new InputStreamReader( new FileInputStream(in),"UTF-8"));
+		this(new InputStreamReader(new FileInputStream(in), "UTF-8"));
 	}
 
 	public LineCollection(Reader reader) throws IOException {
@@ -37,7 +37,8 @@
 			if (next == null)
 				reader.close();
 			return result;
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// ignore
 			return null;
 		}
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/Logic.java b/bundleplugin/src/main/java/aQute/lib/collections/Logic.java
index 75322dd..6daeaad 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/Logic.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/Logic.java
@@ -3,18 +3,18 @@
 import java.util.*;
 
 public class Logic {
-	
-	public static <T> Collection<T> retain( Collection<T> first, Collection<T> ... sets) {
+
+	public static <T> Collection<T> retain(Collection<T> first, Collection<T>... sets) {
 		Set<T> result = new HashSet<T>(first);
-		for ( Collection<T> set : sets ) {
+		for (Collection<T> set : sets) {
 			result.retainAll(set);
 		}
 		return result;
 	}
-	
-	public static <T> Collection<T> remove( Collection<T> first, Collection<T> ... sets) {
+
+	public static <T> Collection<T> remove(Collection<T> first, Collection<T>... sets) {
 		Set<T> result = new HashSet<T>(first);
-		for ( Collection<T> set : sets ) {
+		for (Collection<T> set : sets) {
 			result.removeAll(set);
 		}
 		return result;
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/MultiMap.java b/bundleplugin/src/main/java/aQute/lib/collections/MultiMap.java
index fcf28ac..21c1509 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/MultiMap.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/MultiMap.java
@@ -2,110 +2,111 @@
 
 import java.util.*;
 
-public class MultiMap<K,V> extends HashMap<K,List<V>> {
+public class MultiMap<K, V> extends HashMap<K,List<V>> {
 	private static final long	serialVersionUID	= 1L;
-	final boolean noduplicates;
-	final Class<?> keyClass;
-	final Class<?> valueClass;
-	
-	final Set<V> EMPTY = Collections.emptySet();
-	
+	final boolean				noduplicates;
+	final Class< ? >			keyClass;
+	final Class< ? >			valueClass;
+
+	final Set<V>				EMPTY				= Collections.emptySet();
+
 	public MultiMap() {
 		noduplicates = false;
 		keyClass = Object.class;
 		valueClass = Object.class;
 	}
-	
-	public MultiMap(Class<K> keyClass, Class<V> valueClass, boolean noduplicates ) {
-		this.noduplicates = noduplicates;		
+
+	public MultiMap(Class<K> keyClass, Class<V> valueClass, boolean noduplicates) {
+		this.noduplicates = noduplicates;
 		this.keyClass = keyClass;
 		this.valueClass = valueClass;
 	}
-	
-	@SuppressWarnings("unchecked") public boolean add( K key, V value ) {
+
+	@SuppressWarnings("unchecked")
+	public boolean add(K key, V value) {
 		assert keyClass.isInstance(key);
 		assert valueClass.isInstance(value);
-		
+
 		List<V> set = get(key);
-		if ( set == null) {
-			set=new ArrayList<V>();
-			if ( valueClass != Object.class) {
-				set = Collections.checkedList(set, (Class<V>)valueClass);
+		if (set == null) {
+			set = new ArrayList<V>();
+			if (valueClass != Object.class) {
+				set = Collections.checkedList(set, (Class<V>) valueClass);
 			}
-			put(key,set);
-		}else {
+			put(key, set);
+		} else {
 			if (noduplicates) {
-				if ( set.contains(value))
+				if (set.contains(value))
 					return false;
 			}
 		}
 		return set.add(value);
 	}
-	
-	@SuppressWarnings("unchecked") public boolean addAll( K key, Collection<? extends V> value ) {
+
+	@SuppressWarnings("unchecked")
+	public boolean addAll(K key, Collection< ? extends V> value) {
 		assert keyClass.isInstance(key);
 		List<V> set = get(key);
-		if ( set == null) {
-			set=new ArrayList<V>();
-			if ( valueClass != Object.class) {
-				set = Collections.checkedList(set, (Class<V>)valueClass);
+		if (set == null) {
+			set = new ArrayList<V>();
+			if (valueClass != Object.class) {
+				set = Collections.checkedList(set, (Class<V>) valueClass);
 			}
-			put(key,set);
-		} else
-		if ( noduplicates) {
-			boolean r=false;
-			for ( V v : value) {
+			put(key, set);
+		} else if (noduplicates) {
+			boolean r = false;
+			for (V v : value) {
 				assert valueClass.isInstance(v);
-				if ( !set.contains(value))
-					r|=set.add(v);
+				if (!set.contains(value))
+					r |= set.add(v);
 			}
 			return r;
 		}
 		return set.addAll(value);
 	}
-	
-	public boolean remove( K key, V value ) {
+
+	public boolean remove(K key, V value) {
 		assert keyClass.isInstance(key);
 		assert valueClass.isInstance(value);
-		
+
 		List<V> set = get(key);
-		if ( set == null) {
+		if (set == null) {
 			return false;
 		}
 		boolean result = set.remove(value);
-		if ( set.isEmpty())
+		if (set.isEmpty())
 			remove(key);
 		return result;
 	}
-	
-	public boolean removeAll( K key, Collection<V> value ) {
+
+	public boolean removeAll(K key, Collection<V> value) {
 		assert keyClass.isInstance(key);
 		List<V> set = get(key);
-		if ( set == null) {
+		if (set == null) {
 			return false;
 		}
 		boolean result = set.removeAll(value);
-		if ( set.isEmpty())
+		if (set.isEmpty())
 			remove(key);
 		return result;
 	}
-	
+
 	public Iterator<V> iterate(K key) {
 		assert keyClass.isInstance(key);
 		List<V> set = get(key);
-		if ( set == null)
+		if (set == null)
 			return EMPTY.iterator();
 		return set.iterator();
 	}
-	
+
 	public Iterator<V> all() {
 		return new Iterator<V>() {
-			Iterator<List<V>> master = values().iterator();
-			Iterator<V> current = null;
-			
+			Iterator<List<V>>	master	= values().iterator();
+			Iterator<V>			current	= null;
+
 			public boolean hasNext() {
-				if ( current == null || !current.hasNext()) {
-					if ( master.hasNext()) {
+				if (current == null || !current.hasNext()) {
+					if (master.hasNext()) {
 						current = master.next().iterator();
 						return current.hasNext();
 					}
@@ -121,35 +122,35 @@
 			public void remove() {
 				current.remove();
 			}
-			
+
 		};
 	}
-	
+
 	public Map<K,V> flatten() {
 		Map<K,V> map = new LinkedHashMap<K,V>();
-		for ( Map.Entry<K, List<V>> entry : entrySet()) {
+		for (Map.Entry<K,List<V>> entry : entrySet()) {
 			List<V> v = entry.getValue();
-			if ( v == null || v.isEmpty())
+			if (v == null || v.isEmpty())
 				continue;
 
 			map.put(entry.getKey(), v.get(0));
 		}
 		return map;
 	}
-	
+
 	public MultiMap<V,K> transpose() {
 		MultiMap<V,K> inverted = new MultiMap<V,K>();
-		for ( Map.Entry<K, List<V>> entry : entrySet()) {
+		for (Map.Entry<K,List<V>> entry : entrySet()) {
 			K key = entry.getKey();
-			
+
 			List<V> value = entry.getValue();
-			if ( value == null)
+			if (value == null)
 				continue;
-			
-			for ( V v : value)
+
+			for (V v : value)
 				inverted.add(v, key);
 		}
-		
+
 		return inverted;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/collections/SortedList.java b/bundleplugin/src/main/java/aQute/lib/collections/SortedList.java
index 220d875..ad5ef4c 100644
--- a/bundleplugin/src/main/java/aQute/lib/collections/SortedList.java
+++ b/bundleplugin/src/main/java/aQute/lib/collections/SortedList.java
@@ -5,30 +5,28 @@
 /**
  * An immutbale list that sorts objects by their natural order or through a
  * comparator. It has convenient methods/constructors to create it from
- * collections and iterators.
- * 
- * Why not maintain the lists in their sorted form? Well, TreeMaps are quite
- * expensive ... I once profiled bnd and was shocked how much memory the Jar
- * class took due to the TreeMaps. I could not easily change it unfortunately.
- * The other reason is that Parameters uses a LinkedHashMap because the
- * preferred order should be the declaration order. However, sometimes you need
- * to sort the keys by name.
- * 
- * Last, and most important reason, is that sometimes you do not know what
- * collection you have or it is not available in a sort ordering (MultiMap for
- * example) ... I found myself sorting these things over and over again and
- * decided to just make an immutable SortedList that is easy to slice and dice
+ * collections and iterators. Why not maintain the lists in their sorted form?
+ * Well, TreeMaps are quite expensive ... I once profiled bnd and was shocked
+ * how much memory the Jar class took due to the TreeMaps. I could not easily
+ * change it unfortunately. The other reason is that Parameters uses a
+ * LinkedHashMap because the preferred order should be the declaration order.
+ * However, sometimes you need to sort the keys by name. Last, and most
+ * important reason, is that sometimes you do not know what collection you have
+ * or it is not available in a sort ordering (MultiMap for example) ... I found
+ * myself sorting these things over and over again and decided to just make an
+ * immutable SortedList that is easy to slice and dice
  * 
  * @param <T>
  */
-@SuppressWarnings("unchecked") public class SortedList<T> implements SortedSet<T>, List<T> {
-	static SortedList<?>		empty		= new SortedList<Object>();
+@SuppressWarnings("unchecked")
+public class SortedList<T> implements SortedSet<T>, List<T> {
+	static SortedList< ? >		empty		= new SortedList<Object>();
 
 	final T[]					list;
 	final int					start;
 	final int					end;
 	final Comparator<T>			cmp;
-	Class<?>					type;
+	Class< ? >					type;
 	static Comparator<Object>	comparator	= //
 
 											new Comparator<Object>() {
@@ -78,20 +76,23 @@
 			return (n - 1) - start;
 		}
 
-		@Deprecated public void remove() {
+		@Deprecated
+		public void remove() {
 			throw new UnsupportedOperationException("Immutable");
 		}
 
-		@Deprecated public void set(T e) {
+		@Deprecated
+		public void set(T e) {
 			throw new UnsupportedOperationException("Immutable");
 		}
 
-		@Deprecated public void add(T e) {
+		@Deprecated
+		public void add(T e) {
 			throw new UnsupportedOperationException("Immutable");
 		}
 	}
 
-	public SortedList(Collection<? extends Comparable<?>> x) {
+	public SortedList(Collection< ? extends Comparable< ? >> x) {
 		this((Collection<T>) x, 0, x.size(), (Comparator<T>) comparator);
 	}
 
@@ -135,7 +136,7 @@
 		this.cmp = comparator2;
 	}
 
-	public SortedList(Collection<? extends T> x, int start, int end, Comparator<T> cmp) {
+	public SortedList(Collection< ? extends T> x, int start, int end, Comparator<T> cmp) {
 		if (start > end) {
 			int tmp = start;
 			start = end;
@@ -183,7 +184,8 @@
 		return list.clone();
 	}
 
-	@SuppressWarnings("hiding") public <T> T[] toArray(T[] a) {
+	@SuppressWarnings("hiding")
+	public <T> T[] toArray(T[] a) {
 		if (a == null || a.length < list.length) {
 			return (T[]) list.clone();
 		}
@@ -199,7 +201,7 @@
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	public boolean containsAll(Collection<?> c) {
+	public boolean containsAll(Collection< ? > c) {
 		if (c.isEmpty())
 			return true;
 
@@ -215,15 +217,15 @@
 		return false;
 	}
 
-	public boolean addAll(Collection<? extends T> c) {
+	public boolean addAll(Collection< ? extends T> c) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	public boolean retainAll(Collection<?> c) {
+	public boolean retainAll(Collection< ? > c) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	public boolean removeAll(Collection<?> c) {
+	public boolean removeAll(Collection< ? > c) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
@@ -231,7 +233,7 @@
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	public Comparator<? super T> comparator() {
+	public Comparator< ? super T> comparator() {
 		return cmp;
 	}
 
@@ -299,7 +301,8 @@
 		return get(end - 1);
 	}
 
-	@Deprecated public boolean addAll(int index, Collection<? extends T> c) {
+	@Deprecated
+	public boolean addAll(int index, Collection< ? extends T> c) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
@@ -307,15 +310,18 @@
 		return list[index + start];
 	}
 
-	@Deprecated public T set(int index, T element) {
+	@Deprecated
+	public T set(int index, T element) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	@Deprecated public void add(int index, T element) {
+	@Deprecated
+	public void add(int index, T element) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
-	@Deprecated public T remove(int index) {
+	@Deprecated
+	public T remove(int index) {
 		throw new UnsupportedOperationException("Immutable");
 	}
 
@@ -358,11 +364,13 @@
 		return new SortedList<T>(this, fromIndex, toIndex);
 	}
 
-	@Deprecated public boolean equals(Object other) {
+	@Deprecated
+	public boolean equals(Object other) {
 		return super.equals(other);
 	}
 
-	@Deprecated public int hashCode() {
+	@Deprecated
+	public int hashCode() {
 		return super.hashCode();
 	}
 
@@ -377,11 +385,11 @@
 		return true;
 	}
 
-	public Class<?> getType() {
+	public Class< ? > getType() {
 		return type;
 	}
 
-	public void setType(Class<?> type) {
+	public void setType(Class< ? > type) {
 		this.type = type;
 	}
 
@@ -411,7 +419,7 @@
 		return false;
 	}
 
-	public static <T extends Comparable<?>> SortedList<T> fromIterator(Iterator<T> it) {
+	public static <T extends Comparable< ? >> SortedList<T> fromIterator(Iterator<T> it) {
 		IteratorList<T> l = new IteratorList<T>(it);
 		return new SortedList<T>(l);
 	}