diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/ConsumerType.java b/bundleplugin/src/main/java/aQute/bnd/annotation/ConsumerType.java
index cbbc17b..14d6822 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/ConsumerType.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/ConsumerType.java
@@ -7,8 +7,9 @@
  * that package will not change this interface in a minor update. Any backward
  * compatible change to this interface requires a major update of the version of
  * this package.
- * 
  */
-@Retention(RetentionPolicy.CLASS) @Target(ElementType.TYPE) public @interface ConsumerType {
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface ConsumerType {
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/Export.java b/bundleplugin/src/main/java/aQute/bnd/annotation/Export.java
index 27ea389..72526af 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/Export.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/Export.java
@@ -5,26 +5,26 @@
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.PACKAGE)
 public @interface Export {
-    String MANDATORY = "mandatory";
-    String OPTIONAL  = "optional";
-    String USES      = "uses";
-    String EXCLUDE   = "exclude";
-    String INCLUDE   = "include";
+	String	MANDATORY	= "mandatory";
+	String	OPTIONAL	= "optional";
+	String	USES		= "uses";
+	String	EXCLUDE		= "exclude";
+	String	INCLUDE		= "include";
 
-    String[] mandatory() default "";
+	String[] mandatory() default "";
 
-    String[] optional() default "";
+	String[] optional() default "";
 
-    Class<?>[] exclude() default Object.class;
+	Class< ? >[] exclude() default Object.class;
 
-    Class<?>[] include() default Object.class;
-    
-    /**
-     * Use {@link @Version} annotation instead
-     * @return
-     */
-    @Deprecated()
-    String version() default "";
-    
-    
+	Class< ? >[] include() default Object.class;
+
+	/**
+	 * Use {@link @Version} annotation instead
+	 * 
+	 * @return
+	 */
+	@Deprecated()
+	String version() default "";
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/ProviderType.java b/bundleplugin/src/main/java/aQute/bnd/annotation/ProviderType.java
index 15ee17e..183ef7b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/ProviderType.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/ProviderType.java
@@ -3,14 +3,10 @@
 import java.lang.annotation.*;
 
 /**
- * This type is provided for convenience because it is the default. A change 
- * in a provider type (that is all except Consumer types) can be changed with
- * only a minor update to the package API version number.
- * 
- * This interface is similar to the Eclipse @noextend and @noimplement annotations.
- * 
- * 
- * 
+ * This type is provided for convenience because it is the default. A change in
+ * a provider type (that is all except Consumer types) can be changed with only
+ * a minor update to the package API version number. This interface is similar
+ * to the Eclipse @noextend and @noimplement annotations.
  */
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.TYPE)
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/UsePolicy.java b/bundleplugin/src/main/java/aQute/bnd/annotation/UsePolicy.java
index 36f0eaf..d4db6d9 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/UsePolicy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/UsePolicy.java
@@ -7,14 +7,14 @@
  * treated as a use policy, not an implementation policy. Many package have
  * interfaces that are very stable and can be maintained backward compatible for
  * implementers during minor changes. For example, in Event Admin, the
- * EventAdmin implementers should follow the minor version, e.g. [1.1,1.2), however,
- * an implementer of EventHandler should not require such a small range. Therefore
- * an interface like EventHandler should use this anotation.
+ * EventAdmin implementers should follow the minor version, e.g. [1.1,1.2),
+ * however, an implementer of EventHandler should not require such a small
+ * range. Therefore an interface like EventHandler should use this anotation.
  */
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.TYPE)
 @Deprecated
 public @interface UsePolicy {
-    String RNAME = "LaQute/bnd/annotation/UsePolicy;";
+	String	RNAME	= "LaQute/bnd/annotation/UsePolicy;";
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/Version.java b/bundleplugin/src/main/java/aQute/bnd/annotation/Version.java
index fae42b1..4fe1c56 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/Version.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/Version.java
@@ -3,7 +3,9 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.CLASS)
-@Target({ElementType.PACKAGE})
+@Target({
+	ElementType.PACKAGE
+})
 public @interface Version {
 	String value();
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Activate.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Activate.java
index 52284a0..e731669 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Activate.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Activate.java
@@ -5,6 +5,6 @@
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.METHOD)
 public @interface Activate {
-    String RNAME = "LaQute/bnd/annotation/component/Activate;";
-    
+	String	RNAME	= "LaQute/bnd/annotation/component/Activate;";
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Component.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Component.java
index 1fb39d6..1d733ac 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Component.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Component.java
@@ -2,7 +2,9 @@
 
 import java.lang.annotation.*;
 
-@Retention(RetentionPolicy.CLASS) @Target(ElementType.TYPE) public @interface Component {
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface Component {
 	String	RNAME					= "LaQute/bnd/annotation/component/Component;";
 	String	PROVIDE					= "provide";
 	String	NAME					= "name";
@@ -18,7 +20,7 @@
 
 	String name() default "";
 
-	Class<?>[] provide() default Object.class;
+	Class< ? >[] provide() default Object.class;
 
 	String factory() default "";
 
@@ -32,7 +34,7 @@
 
 	String[] properties() default {};
 
-	Class<?> designate() default Object.class;
+	Class< ? > designate() default Object.class;
 
-	Class<?> designateFactory() default Object.class;
+	Class< ? > designateFactory() default Object.class;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/ConfigurationPolicy.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/ConfigurationPolicy.java
index 7651557..9e10951 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/ConfigurationPolicy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/ConfigurationPolicy.java
@@ -1,5 +1,5 @@
 package aQute.bnd.annotation.component;
 
 public enum ConfigurationPolicy {
-    optional, require, ignore;
+	optional, require, ignore;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Deactivate.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Deactivate.java
index 5858ea0..60c7be4 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Deactivate.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Deactivate.java
@@ -5,6 +5,6 @@
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.METHOD)
 public @interface Deactivate {
-    String RNAME = "LaQute/bnd/annotation/component/Deactivate;";
+	String	RNAME	= "LaQute/bnd/annotation/component/Deactivate;";
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Modified.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Modified.java
index 655a535..ae36b7f 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Modified.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Modified.java
@@ -5,6 +5,6 @@
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.METHOD)
 public @interface Modified {
-    String RNAME = "LaQute/bnd/annotation/component/Modified;";
+	String	RNAME	= "LaQute/bnd/annotation/component/Modified;";
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Reference.java b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Reference.java
index 58894dd..2a71bac 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/component/Reference.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/component/Reference.java
@@ -5,29 +5,29 @@
 @Retention(RetentionPolicy.CLASS)
 @Target(ElementType.METHOD)
 public @interface Reference {
-    String RNAME    = "LaQute/bnd/annotation/component/Reference;";
-    String NAME     = "name";
-    String SERVICE  = "service";
-    String OPTIONAL = "optional";
-    String MULTIPLE = "multiple";
-    String DYNAMIC  = "dynamic";
-    String TARGET   = "target";
-    String TYPE     = "type";
-    String UNBIND   = "unbind";
+	String	RNAME		= "LaQute/bnd/annotation/component/Reference;";
+	String	NAME		= "name";
+	String	SERVICE		= "service";
+	String	OPTIONAL	= "optional";
+	String	MULTIPLE	= "multiple";
+	String	DYNAMIC		= "dynamic";
+	String	TARGET		= "target";
+	String	TYPE		= "type";
+	String	UNBIND		= "unbind";
 
-    String name() default "";
+	String name() default "";
 
-    Class<?> service() default Object.class;
+	Class< ? > service() default Object.class;
 
-    boolean optional() default false;
+	boolean optional() default false;
 
-    boolean multiple() default false;
+	boolean multiple() default false;
 
-    boolean dynamic() default false;
+	boolean dynamic() default false;
 
-    String target() default "";
-    
-    String unbind() default "";
+	String target() default "";
 
-    char type() default 0;
+	String unbind() default "";
+
+	char type() default 0;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Configurable.java b/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Configurable.java
index ecaaa7b..3dcaae5 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Configurable.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Configurable.java
@@ -4,17 +4,21 @@
 import java.util.*;
 import java.util.regex.*;
 
-@SuppressWarnings( { "unchecked", "rawtypes" }) public class Configurable<T> {
-	
-	public static <T> T createConfigurable(Class<T> c, Map<?, ?> properties) {
-		Object o = Proxy.newProxyInstance(c.getClassLoader(), new Class<?>[] { c },
-				new ConfigurableHandler(properties, c.getClassLoader()));
+@SuppressWarnings({
+		"unchecked", "rawtypes"
+})
+public class Configurable<T> {
+
+	public static <T> T createConfigurable(Class<T> c, Map< ? , ? > properties) {
+		Object o = Proxy.newProxyInstance(c.getClassLoader(), new Class< ? >[] {
+			c
+		}, new ConfigurableHandler(properties, c.getClassLoader()));
 		return c.cast(o);
 	}
 
-	public static <T> T createConfigurable(Class<T> c, Dictionary<?, ?> properties) {
+	public static <T> T createConfigurable(Class<T> c, Dictionary< ? , ? > properties) {
 		Map<Object,Object> alt = new HashMap<Object,Object>();
-		for( Enumeration<?> e = properties.keys(); e.hasMoreElements(); ) {
+		for (Enumeration< ? > e = properties.keys(); e.hasMoreElements();) {
 			Object key = e.nextElement();
 			alt.put(key, properties.get(key));
 		}
@@ -22,10 +26,10 @@
 	}
 
 	static class ConfigurableHandler implements InvocationHandler {
-		final Map<?, ?>	properties;
-		final ClassLoader			loader;
+		final Map< ? , ? >	properties;
+		final ClassLoader	loader;
 
-		ConfigurableHandler(Map<?, ?> properties, ClassLoader loader) {
+		ConfigurableHandler(Map< ? , ? > properties, ClassLoader loader) {
 			this.properties = properties;
 			this.loader = loader;
 		}
@@ -42,8 +46,7 @@
 			if (o == null) {
 				if (ad != null) {
 					if (ad.required())
-						throw new IllegalStateException("Attribute is required but not set "
-								+ method.getName());
+						throw new IllegalStateException("Attribute is required but not set " + method.getName());
 
 					o = ad.deflt();
 					if (o.equals(Meta.NULL))
@@ -51,10 +54,10 @@
 				}
 			}
 			if (o == null) {
-				Class<?> rt = method.getReturnType();
-				if ( rt == boolean.class || rt==Boolean.class)
+				Class< ? > rt = method.getReturnType();
+				if (rt == boolean.class || rt == Boolean.class)
 					return false;
-				
+
 				if (method.getReturnType().isPrimitive()) {
 
 					o = "0";
@@ -65,8 +68,7 @@
 			return convert(method.getGenericReturnType(), o);
 		}
 
-		public Object convert(Type type, Object o)
-				throws Exception {
+		public Object convert(Type type, Object o) throws Exception {
 			if (type instanceof ParameterizedType) {
 				ParameterizedType pType = (ParameterizedType) type;
 				return convert(pType, o);
@@ -77,20 +79,20 @@
 				return convertArray(gType.getGenericComponentType(), o);
 			}
 
-			Class<?> resultType = (Class<?>) type;
+			Class< ? > resultType = (Class< ? >) type;
 
 			if (resultType.isArray()) {
 				return convertArray(resultType.getComponentType(), o);
 			}
 
-			Class<?> actualType = o.getClass();
+			Class< ? > actualType = o.getClass();
 			if (actualType.isAssignableFrom(resultType))
 				return o;
 
 			if (resultType == boolean.class || resultType == Boolean.class) {
-				if ( actualType == boolean.class || actualType == Boolean.class)
+				if (actualType == boolean.class || actualType == Boolean.class)
 					return o;
-				
+
 				if (Number.class.isAssignableFrom(actualType)) {
 					double b = ((Number) o).doubleValue();
 					if (b == 0)
@@ -99,7 +101,7 @@
 						return true;
 				}
 				return true;
-				
+
 			} else if (resultType == byte.class || resultType == Byte.class) {
 				if (Number.class.isAssignableFrom(actualType))
 					return ((Number) o).byteValue();
@@ -148,37 +150,41 @@
 			}
 
 			try {
-				Constructor<?> c = resultType.getConstructor(String.class);
+				Constructor< ? > c = resultType.getConstructor(String.class);
 				return c.newInstance(o.toString());
-			} catch (Throwable t) {
+			}
+			catch (Throwable t) {
 				// handled on next line
 			}
-			throw new IllegalArgumentException("No conversion to " + resultType + " from "
-					+ actualType + " value " + o);
+			throw new IllegalArgumentException("No conversion to " + resultType + " from " + actualType + " value " + o);
 		}
 
 		private Object convert(ParameterizedType pType, Object o) throws InstantiationException,
 				IllegalAccessException, Exception {
-			Class<?> resultType = (Class<?>) pType.getRawType();
+			Class< ? > resultType = (Class< ? >) pType.getRawType();
 			if (Collection.class.isAssignableFrom(resultType)) {
-				Collection<?> input = toCollection(o);
+				Collection< ? > input = toCollection(o);
 				if (resultType.isInterface()) {
 					if (resultType == Collection.class || resultType == List.class)
 						resultType = ArrayList.class;
 					else if (resultType == Set.class || resultType == SortedSet.class)
 						resultType = TreeSet.class;
-					else if (resultType == Queue.class /*|| resultType == Deque.class*/)
+					else if (resultType == Queue.class /*
+														 * || resultType ==
+														 * Deque.class
+														 */)
 						resultType = LinkedList.class;
-					else if (resultType == Queue.class /*|| resultType == Deque.class*/)
+					else if (resultType == Queue.class /*
+														 * || resultType ==
+														 * Deque.class
+														 */)
 						resultType = LinkedList.class;
 					else
 						throw new IllegalArgumentException(
-								"Unknown interface for a collection, no concrete class found: "
-										+ resultType);
+								"Unknown interface for a collection, no concrete class found: " + resultType);
 				}
-				
-				Collection<Object> result = (Collection<Object>) resultType
-						.newInstance();
+
+				Collection<Object> result = (Collection<Object>) resultType.newInstance();
 				Type componentType = pType.getActualTypeArguments()[0];
 
 				for (Object i : input) {
@@ -188,8 +194,8 @@
 			} else if (pType.getRawType() == Class.class) {
 				return loader.loadClass(o.toString());
 			}
-			if (Map.class.isAssignableFrom(resultType)){
-				Map<?,?> input = toMap(o);
+			if (Map.class.isAssignableFrom(resultType)) {
+				Map< ? , ? > input = toMap(o);
 				if (resultType.isInterface()) {
 					if (resultType == SortedMap.class)
 						resultType = TreeMap.class;
@@ -197,16 +203,14 @@
 						resultType = LinkedHashMap.class;
 					else
 						throw new IllegalArgumentException(
-								"Unknown interface for a collection, no concrete class found: "
-										+ resultType);
+								"Unknown interface for a collection, no concrete class found: " + resultType);
 				}
-				Map<Object,Object> result = (Map<Object,Object>) resultType
-						.newInstance();
+				Map<Object,Object> result = (Map<Object,Object>) resultType.newInstance();
 				Type keyType = pType.getActualTypeArguments()[0];
 				Type valueType = pType.getActualTypeArguments()[1];
 
-				for ( Map.Entry<?, ?> entry : input.entrySet()) {
-					result.put(convert(keyType,entry.getKey()), convert(valueType,entry.getValue()));
+				for (Map.Entry< ? , ? > entry : input.entrySet()) {
+					result.put(convert(keyType, entry.getKey()), convert(valueType, entry.getValue()));
 				}
 				return result;
 			}
@@ -214,10 +218,9 @@
 					+ " because it uses generics and is not a Collection or a map");
 		}
 
-
 		Object convertArray(Type componentType, Object o) throws Exception {
-			Collection<?> input = toCollection(o);
-			Class<?> componentClass = getRawClass(componentType);
+			Collection< ? > input = toCollection(o);
+			Class< ? > componentClass = getRawClass(componentType);
 			Object array = Array.newInstance(componentClass, input.size());
 
 			int i = 0;
@@ -227,67 +230,63 @@
 			return array;
 		}
 
-		private Class<?> getRawClass(Type type) {
+		private Class< ? > getRawClass(Type type) {
 			if (type instanceof Class)
-				return (Class<?>) type;
+				return (Class< ? >) type;
 
 			if (type instanceof ParameterizedType)
-				return (Class<?>) ((ParameterizedType) type).getRawType();
+				return (Class< ? >) ((ParameterizedType) type).getRawType();
 
-			throw new IllegalArgumentException(
-					"For the raw type, type must be ParamaterizedType or Class but is " + type);
+			throw new IllegalArgumentException("For the raw type, type must be ParamaterizedType or Class but is "
+					+ type);
 		}
 
-		private Collection<?> toCollection(Object o) {
+		private Collection< ? > toCollection(Object o) {
 			if (o instanceof Collection)
-				return (Collection<?>) o;
+				return (Collection< ? >) o;
 
 			if (o.getClass().isArray()) {
-				if ( o.getClass().getComponentType().isPrimitive()) {
+				if (o.getClass().getComponentType().isPrimitive()) {
 					int length = Array.getLength(o);
 					List<Object> result = new ArrayList<Object>(length);
-					for ( int i=0; i<length; i++) {
-						result.add( Array.get(o, i));
+					for (int i = 0; i < length; i++) {
+						result.add(Array.get(o, i));
 					}
 					return result;
 				} else
 					return Arrays.asList((Object[]) o);
 			}
 
-			if ( o instanceof String) {
-				String s = (String)o;
-				if (s.indexOf('|')>0)
-					return Arrays.asList(s.split("\\|"));					
+			if (o instanceof String) {
+				String s = (String) o;
+				if (s.indexOf('|') > 0)
+					return Arrays.asList(s.split("\\|"));
 			}
 			return Arrays.asList(o);
 		}
-		
-		private Map<?, ?> toMap(Object o) {
-			if ( o instanceof Map) 
-				return (Map<?, ?>) o;
-			
-			throw new IllegalArgumentException(
-					"Cannot convert " + o + " to a map as requested");
+
+		private Map< ? , ? > toMap(Object o) {
+			if (o instanceof Map)
+				return (Map< ? , ? >) o;
+
+			throw new IllegalArgumentException("Cannot convert " + o + " to a map as requested");
 		}
 
-
 	}
-	
-	
+
 	public static String mangleMethodName(String id) {
 		StringBuilder sb = new StringBuilder(id);
-		for ( int i =0; i<sb.length(); i++) {
-			char c  = sb.charAt(i);
-			boolean twice = i < sb.length()-1 && sb.charAt(i+1) ==c;
-			if ( c == '$' || c == '_') {
-				if ( twice )
-					sb.deleteCharAt(i+1);
-				else 
-					if ( c == '$')
-						sb.deleteCharAt(i--); // Remove dollars
-					else
-						sb.setCharAt(i, '.'); // Make _ into .
-			}				
+		for (int i = 0; i < sb.length(); i++) {
+			char c = sb.charAt(i);
+			boolean twice = i < sb.length() - 1 && sb.charAt(i + 1) == c;
+			if (c == '$' || c == '_') {
+				if (twice)
+					sb.deleteCharAt(i + 1);
+				else if (c == '$')
+					sb.deleteCharAt(i--); // Remove dollars
+				else
+					sb.setCharAt(i, '.'); // Make _ into .
+			}
 		}
 		return sb.toString();
 	}
diff --git a/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Meta.java b/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Meta.java
index a2686e5..d7b6745 100644
--- a/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Meta.java
+++ b/bundleplugin/src/main/java/aQute/bnd/annotation/metatype/Meta.java
@@ -13,16 +13,7 @@
 
 public interface Meta {
 	enum Type {
-		Boolean,
-		Byte,
-		Character,
-		Short,
-		Integer,
-		Long,
-		Float,
-		Double,
-		String,
-		Password
+		Boolean, Byte, Character, Short, Integer, Long, Float, Double, String, Password
 	}
 
 	/**
@@ -34,9 +25,10 @@
 	 * The OCD Annotation maps to the OCD element in the Metatype specification.
 	 * The only difference is that it is possible to create a Designate element
 	 * as well.
-	 * 
 	 */
-	@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @interface OCD {
+	@Target(ElementType.TYPE)
+	@Retention(RetentionPolicy.RUNTIME)
+	@interface OCD {
 		/**
 		 * The name for this component. The default name is a the short class
 		 * name that us un-camel cased to make it more readable.
@@ -48,7 +40,6 @@
 		/**
 		 * The id of the component. Default the name of the class in FQN
 		 * notation but with nested classes using the $ as separator (not .).
-		 * 
 		 * The Felix webconsole always uses this id as the PID and not the pid
 		 * in the Designate element. Reported as an error.
 		 * 
@@ -79,9 +70,10 @@
 
 	/**
 	 * The AD element in the Metatype specification.
-	 * 
 	 */
-	@Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) @interface AD {
+	@Target(ElementType.METHOD)
+	@Retention(RetentionPolicy.RUNTIME)
+	@interface AD {
 		/**
 		 * A description of the attribute. Default is empty.
 		 * 
@@ -119,10 +111,9 @@
 		/**
 		 * The cardinality of the attribute. If not explicitly set it will be
 		 * derived from the attributes return type. Collections return
-		 * Integer.MIN_VALUE and arrays use Integer.MAX_VALUE.
-		 * 
-		 * If a single string needs to be converted to a Collection or array
-		 * then the | will be used as a separator to split the line.
+		 * Integer.MIN_VALUE and arrays use Integer.MAX_VALUE. If a single
+		 * string needs to be converted to a Collection or array then the | will
+		 * be used as a separator to split the line.
 		 * 
 		 * @return the cardinality of the attribute
 		 */
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/CircularDependencyException.java b/bundleplugin/src/main/java/aQute/bnd/build/CircularDependencyException.java
index f08255b..c56a8eb 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/CircularDependencyException.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/CircularDependencyException.java
@@ -1,10 +1,10 @@
 package aQute.bnd.build;
 
 public class CircularDependencyException extends Exception {
-    public CircularDependencyException(String string) {
-        super(string);
-    }
+	public CircularDependencyException(String string) {
+		super(string);
+	}
 
-    private static final long serialVersionUID = 1L;
+	private static final long	serialVersionUID	= 1L;
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Container.java b/bundleplugin/src/main/java/aQute/bnd/build/Container.java
index 2fb38d9..e0aac8a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Container.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Container.java
@@ -18,12 +18,12 @@
 	final String				version;
 	final String				error;
 	final Project				project;
-	volatile Map<String, String>	attributes;
+	volatile Map<String,String>	attributes;
 	private long				manifestTime;
 	private Manifest			manifest;
 
 	Container(Project project, String bsn, String version, TYPE type, File source, String error,
-			Map<String, String> attributes) {
+			Map<String,String> attributes) {
 		this.bsn = bsn;
 		this.version = version;
 		this.type = type;
@@ -57,32 +57,32 @@
 	 */
 	public boolean contributeFiles(List<File> files, Processor reporter) throws Exception {
 		switch (type) {
-		case EXTERNAL:
-		case REPO:
-			files.add(file);
-			return true;
+			case EXTERNAL :
+			case REPO :
+				files.add(file);
+				return true;
 
-		case PROJECT:
-			File[] fs = project.build();
-			reporter.getInfo(project);
-			if (fs == null)
-				return false;
-
-			for (File f : fs)
-				files.add(f);
-			return true;
-
-		case LIBRARY:
-			List<Container> containers = getMembers();
-			for (Container container : containers) {
-				if (!container.contributeFiles(files, reporter))
+			case PROJECT :
+				File[] fs = project.build();
+				reporter.getInfo(project);
+				if (fs == null)
 					return false;
-			}
-			return true;
 
-		case ERROR:
-			reporter.error(error);
-			return false;
+				for (File f : fs)
+					files.add(f);
+				return true;
+
+			case LIBRARY :
+				List<Container> containers = getMembers();
+				for (Container container : containers) {
+					if (!container.contributeFiles(files, reporter))
+						return false;
+				}
+				return true;
+
+			case ERROR :
+				reporter.error(error);
+				return false;
 		}
 		return false;
 	}
@@ -130,13 +130,13 @@
 			return getFile().getAbsolutePath();
 	}
 
-	public Map<String, String> getAttributes() {
+	public Map<String,String> getAttributes() {
 		return attributes;
 	}
-	
+
 	public void putAttribute(String name, String value) {
-		if (attributes == Collections.<String,String>emptyMap())
-			attributes = new HashMap<String, String>(1);
+		if (attributes == Collections.<String, String> emptyMap())
+			attributes = new HashMap<String,String>(1);
 		attributes.put(name, value);
 	}
 
@@ -162,8 +162,7 @@
 			String line;
 			try {
 				in = new FileInputStream(file);
-				rd = new BufferedReader(new InputStreamReader(in,
-						Constants.DEFAULT_CHARSET));
+				rd = new BufferedReader(new InputStreamReader(in, Constants.DEFAULT_CHARSET));
 				while ((line = rd.readLine()) != null) {
 					line = line.trim();
 					if (!line.startsWith("#") && line.length() > 0) {
@@ -171,7 +170,8 @@
 						result.addAll(list);
 					}
 				}
-			} finally {
+			}
+			finally {
 				if (rd != null) {
 					rd.close();
 				}
@@ -201,7 +201,8 @@
 				manifest = jin.getManifest();
 				jin.close();
 				manifestTime = getFile().lastModified();
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 		}
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Project.java b/bundleplugin/src/main/java/aQute/bnd/build/Project.java
index 034a364..192be5d 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Project.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Project.java
@@ -5,7 +5,6 @@
 import java.net.*;
 import java.util.*;
 import java.util.Map.Entry;
-import java.util.concurrent.*;
 import java.util.concurrent.locks.*;
 import java.util.jar.*;
 
@@ -19,14 +18,12 @@
 import aQute.lib.osgi.eclipse.*;
 import aQute.libg.generics.*;
 import aQute.libg.header.*;
+import aQute.libg.reporter.*;
 import aQute.libg.sed.*;
 import aQute.libg.version.*;
 
 /**
  * This class is NOT threadsafe
- * 
- * @author aqute
- * 
  */
 
 public class Project extends Processor {
@@ -56,6 +53,7 @@
 	File						files[];
 	static List<Project>		trail					= new ArrayList<Project>();
 	boolean						delayRunDependencies	= false;
+	final ProjectMessages		msgs					= ReporterMessages.base(this, ProjectMessages.class);
 
 	public Project(Workspace workspace, File projectDir, File buildFile) throws Exception {
 		super(workspace);
@@ -76,7 +74,7 @@
 			File f = getFile("build.properties");
 			if (f.isFile()) {
 				Properties p = loadProperties(f);
-				for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
+				for (Enumeration< ? > e = p.propertyNames(); e.hasMoreElements();) {
 					String key = (String) e.nextElement();
 					String newkey = key;
 					if (key.indexOf('$') >= 0) {
@@ -85,7 +83,8 @@
 					setProperty(newkey, p.getProperty(key));
 				}
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
@@ -206,7 +205,7 @@
 						getWorkspace().changedFile(output);
 					}
 					if (!output.isDirectory())
-						error("Can not find output directory: " + output);
+						msgs.NoOutputDirectory_(output);
 					else {
 						Container c = new Container(this, output);
 						if (!buildpath.contains(c))
@@ -240,7 +239,7 @@
 					for (String p : requiredProjectNames) {
 						Project required = getWorkspace().getProject(p);
 						if (required == null)
-							error("No such project " + p + " on " + Constants.DEPENDSON);
+							msgs.MissingDependson_(p);
 						else {
 							dependencies.add(required);
 						}
@@ -279,11 +278,13 @@
 					}
 					if (isOk())
 						preparedPaths = true;
-				} finally {
+				}
+				finally {
 					inPrepare = false;
 				}
 			}
-		} finally {
+		}
+		finally {
 			trail.remove(this);
 		}
 	}
@@ -315,8 +316,8 @@
 	 * @param entries
 	 *            The input list of classpath entries
 	 */
-	private void doPath(Collection<Container> resultpath, Collection<Project> projects,
-			Collection<Container> entries, Collection<Container> bootclasspath) {
+	private void doPath(Collection<Container> resultpath, Collection<Project> projects, Collection<Container> entries,
+			Collection<Container> bootclasspath) {
 		for (Container cpe : entries) {
 			if (cpe.getError() != null)
 				error(cpe.getError());
@@ -324,8 +325,8 @@
 				if (cpe.getType() == Container.TYPE.PROJECT) {
 					projects.add(cpe.getProject());
 				}
-				if (bootclasspath != null && cpe.getBundleSymbolicName().startsWith("ee.")
-						|| cpe.getAttributes().containsKey("boot"))
+				if (bootclasspath != null
+						&& (cpe.getBundleSymbolicName().startsWith("ee.") || cpe.getAttributes().containsKey("boot")))
 					bootclasspath.add(cpe);
 				else
 					resultpath.add(cpe);
@@ -335,7 +336,6 @@
 
 	/**
 	 * Parse the list of bundles that are a prerequisite to this project.
-	 * 
 	 * Bundles are listed in repo specific names. So we just let our repo
 	 * plugins iterate over the list of bundles and we get the highest version
 	 * from them.
@@ -344,10 +344,8 @@
 	 */
 
 	private List<Container> parseBuildpath() throws Exception {
-		List<Container> bundles = getBundles(Strategy.LOWEST, getProperty(Constants.BUILDPATH),
-				Constants.BUILDPATH);
-		appendPackages(Strategy.LOWEST, getProperty(Constants.BUILDPACKAGES), bundles,
-				ResolverMode.build);
+		List<Container> bundles = getBundles(Strategy.LOWEST, getProperty(Constants.BUILDPATH), Constants.BUILDPATH);
+		appendPackages(Strategy.LOWEST, getProperty(Constants.BUILDPACKAGES), bundles, ResolverMode.build);
 		return bundles;
 	}
 
@@ -378,16 +376,15 @@
 	 * @return
 	 */
 
-	public List<Container> getBundles(Strategy strategyx, String spec, String source)
-			throws Exception {
+	public List<Container> getBundles(Strategy strategyx, String spec, String source) throws Exception {
 		List<Container> result = new ArrayList<Container>();
 		Parameters bundles = new Parameters(spec);
 
 		try {
-			for (Iterator<Entry<String, Attrs>> i = bundles.entrySet().iterator(); i.hasNext();) {
-				Entry<String, Attrs> entry = i.next();
-				String bsn = entry.getKey();
-				Map<String, String> attrs = entry.getValue();
+			for (Iterator<Entry<String,Attrs>> i = bundles.entrySet().iterator(); i.hasNext();) {
+				Entry<String,Attrs> entry = i.next();
+				String bsn = removeDuplicateMarker(entry.getKey());
+				Map<String,String> attrs = entry.getValue();
 
 				Container found = null;
 
@@ -399,16 +396,13 @@
 					}
 				}
 				if (found == null) {
-					if (versionRange != null
-							&& (versionRange.equals("project") || versionRange.equals("latest"))) {
+					if (versionRange != null && (versionRange.equals("project") || versionRange.equals("latest"))) {
 						Project project = getWorkspace().getProject(bsn);
 						if (project != null && project.exists()) {
 							File f = project.getOutput();
-							found = new Container(project, bsn, versionRange,
-									Container.TYPE.PROJECT, f, null, attrs);
+							found = new Container(project, bsn, versionRange, Container.TYPE.PROJECT, f, null, attrs);
 						} else {
-							error("Reference to project that does not exist in workspace\n"
-									+ "  Project       %s\n" + "  Specification %s", bsn, spec);
+							msgs.NoSuchProject(bsn, spec);
 							continue;
 						}
 					} else if (versionRange != null && versionRange.equals("file")) {
@@ -417,11 +411,9 @@
 						if (!f.exists())
 							error = "File does not exist: " + f.getAbsolutePath();
 						if (f.getName().endsWith(".lib")) {
-							found = new Container(this, bsn, "file", Container.TYPE.LIBRARY, f,
-									error, attrs);
+							found = new Container(this, bsn, "file", Container.TYPE.LIBRARY, f, error, attrs);
 						} else {
-							found = new Container(this, bsn, "file", Container.TYPE.EXTERNAL, f,
-									error, attrs);
+							found = new Container(this, bsn, "file", Container.TYPE.EXTERNAL, f, error, attrs);
 						}
 					} else {
 						found = getBundle(bsn, versionRange, strategyx, attrs);
@@ -432,26 +424,27 @@
 					List<Container> libs = found.getMembers();
 					for (Container cc : libs) {
 						if (result.contains(cc))
-							warning("Multiple bundles with the same final URL: " + cc);
-
-						result.add(cc);
+							warning("Multiple bundles with the same final URL: %s, dropped duplicate", cc);
+						else
+							result.add(cc);
 					}
 				} else {
 					// Oops, not a bundle in sight :-(
-					Container x = new Container(this, bsn, versionRange, Container.TYPE.ERROR,
-							null, bsn + ";version=" + versionRange + " not found", attrs);
+					Container x = new Container(this, bsn, versionRange, Container.TYPE.ERROR, null, bsn + ";version="
+							+ versionRange + " not found", attrs);
 					result.add(x);
 					warning("Can not find URL for bsn " + bsn);
 				}
 			}
-		} catch (CircularDependencyException e) {
+		}
+		catch (CircularDependencyException e) {
 			String message = e.getMessage();
 			if (source != null)
 				message = String.format("%s (from property: %s)", message, source);
-			error("Circular dependency detected from project %s: %s", e, getName(), message);
-		} catch (Exception e) {
-			error("Unexpected error while trying to get the bundles from " + spec, e);
-			e.printStackTrace();
+			msgs.CircularDependencyContext_Message_(getName(), message);
+		}
+		catch (Exception e) {
+			msgs.Unexpected_Error_(spec, e);
 		}
 		return result;
 	}
@@ -460,7 +453,6 @@
 	 * Just calls a new method with a default parm.
 	 * 
 	 * @throws Exception
-	 * 
 	 */
 	Collection<Container> getBundles(Strategy strategy, String spec) throws Exception {
 		return getBundles(strategy, spec, null);
@@ -476,18 +468,18 @@
 	 *            The value of the @{code -buildpackages} instruction.
 	 * @throws Exception
 	 */
-	public void appendPackages(Strategy strategyx, String spec, List<Container> resolvedBundles,
-			ResolverMode mode) throws Exception {
-		Map<File, Container> pkgResolvedBundles = new HashMap<File, Container>();
+	public void appendPackages(Strategy strategyx, String spec, List<Container> resolvedBundles, ResolverMode mode)
+			throws Exception {
+		Map<File,Container> pkgResolvedBundles = new HashMap<File,Container>();
 
-		List<Entry<String, Attrs>> queue = new LinkedList<Map.Entry<String, Attrs>>();
+		List<Entry<String,Attrs>> queue = new LinkedList<Map.Entry<String,Attrs>>();
 		queue.addAll(new Parameters(spec).entrySet());
 
 		while (!queue.isEmpty()) {
-			Entry<String, Attrs> entry = queue.remove(0);
+			Entry<String,Attrs> entry = queue.remove(0);
 
 			String pkgName = entry.getKey();
-			Map<String, String> attrs = entry.getValue();
+			Map<String,String> attrs = entry.getValue();
 
 			Container found = null;
 
@@ -520,8 +512,8 @@
 				}
 			} else {
 				// Unable to resolve
-				Container x = new Container(this, "X", versionRange, Container.TYPE.ERROR, null,
-						"package " + pkgName + ";version=" + versionRange + " not found", attrs);
+				Container x = new Container(this, "X", versionRange, Container.TYPE.ERROR, null, "package " + pkgName
+						+ ";version=" + versionRange + " not found", attrs);
 				resolvedBundles.add(x);
 				warning("Can not find URL for package " + pkgName);
 			}
@@ -576,14 +568,14 @@
 	 * @return
 	 * @throws Exception
 	 */
-	public Container getPackage(String packageName, String range, Strategy strategyx,
-			Map<String, String> attrs, ResolverMode mode) throws Exception {
+	public Container getPackage(String packageName, String range, Strategy strategyx, Map<String,String> attrs,
+			ResolverMode mode) throws Exception {
 		if ("snapshot".equals(range))
 			return new Container(this, "", range, Container.TYPE.ERROR, null,
 					"snapshot not supported for package lookups", null);
 
 		if (attrs == null)
-			attrs = new HashMap<String, String>(2);
+			attrs = new HashMap<String,String>(2);
 		attrs.put("package", packageName);
 		attrs.put("mode", mode.name());
 
@@ -595,23 +587,20 @@
 				File result = plugin.get(null, range, useStrategy, attrs);
 				if (result != null) {
 					if (result.getName().endsWith("lib"))
-						return new Container(this, result.getName(), range, Container.TYPE.LIBRARY,
-								result, null, attrs);
-					else
-						return new Container(this, result.getName(), range, Container.TYPE.REPO,
-								result, null, attrs);
+						return new Container(this, result.getName(), range, Container.TYPE.LIBRARY, result, null, attrs);
+					return new Container(this, result.getName(), range, Container.TYPE.REPO, result, null, attrs);
 				}
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				// Ignore... lots of repos will fail here
 			}
 		}
 
-		return new Container(this, "X", range, Container.TYPE.ERROR, null, "package " + packageName
-				+ ";version=" + range + " Not found in " + plugins, null);
+		return new Container(this, "X", range, Container.TYPE.ERROR, null, "package " + packageName + ";version="
+				+ range + " Not found in " + plugins, null);
 	}
 
-	private Strategy findStrategy(Map<String, String> attrs, Strategy defaultStrategy,
-			String versionRange) {
+	private Strategy findStrategy(Map<String,String> attrs, Strategy defaultStrategy, String versionRange) {
 		Strategy useStrategy = defaultStrategy;
 		String overrideStrategy = attrs.get("strategy");
 		if (overrideStrategy != null) {
@@ -640,11 +629,10 @@
 	 * @throws Exception
 	 *             anything goes wrong
 	 */
-	public void doMavenPom(Strategy strategyx, List<Container> result, String action)
-			throws Exception {
+	public void doMavenPom(Strategy strategyx, List<Container> result, String action) throws Exception {
 		File pomFile = getFile("pom.xml");
 		if (!pomFile.isFile())
-			error("Specified to use pom.xml but the project directory does not contain a pom.xml file");
+			msgs.MissingPom();
 		else {
 			ProjectPom pom = getWorkspace().getMaven().createProjectModel(pomFile);
 			if (action == null)
@@ -706,8 +694,7 @@
 		boolean result;
 		String runBuildsStr = getProperty(Constants.RUNBUILDS);
 		if (runBuildsStr == null)
-			result = !getPropertiesFile().getName().toLowerCase()
-					.endsWith(Constants.DEFAULT_BNDRUN_EXTENSION);
+			result = !getPropertiesFile().getName().toLowerCase().endsWith(Constants.DEFAULT_BNDRUN_EXTENSION);
 		else
 			result = Boolean.parseBoolean(runBuildsStr);
 		return result;
@@ -758,7 +745,7 @@
 		return list(args, toFiles(getDependson()));
 	}
 
-	private Collection<?> toFiles(Collection<Project> projects) {
+	private Collection< ? > toFiles(Collection<Project> projects) {
 		List<File> files = new ArrayList<File>();
 		for (Project p : projects) {
 			files.add(p.getBase());
@@ -792,11 +779,10 @@
 		return getOutput().getAbsolutePath();
 	}
 
-	private String list(String[] args, Collection<?> list) {
+	private String list(String[] args, Collection< ? > list) {
 		if (args.length > 3)
 			throw new IllegalArgumentException("${" + args[0]
-					+ "[;<separator>]} can only take a separator as argument, has "
-					+ Arrays.toString(args));
+					+ "[;<separator>]} can only take a separator as argument, has " + Arrays.toString(args));
 
 		String separator = ",";
 
@@ -808,7 +794,9 @@
 	}
 
 	protected Object[] getMacroDomains() {
-		return new Object[] { workspace };
+		return new Object[] {
+			workspace
+		};
 	}
 
 	public File release(Jar jar) throws Exception {
@@ -846,16 +834,17 @@
 			try {
 				File file = rp.put(jar);
 				trace("Released %s to file %s in repository %s", jar.getName(), file, rp);
-			} catch (Exception e) {
-				error("Deploying " + jar.getName() + " on " + rp.getName(), e);
-			} finally {
+			}
+			catch (Exception e) {
+				msgs.Release_Into_Exception_(jar, rp, e);
+			}
+			finally {
 				jar.close();
 			}
 		} else if (name == null)
-			error("There is no writable repository (no repo name specified)");
+			msgs.NoNameForReleaseRepository();
 		else
-			error("Cannot find a writeable repository with the name %s from the repositiories %s",
-					name, plugins);
+			msgs.ReleaseRepository_NotFoundIn_(name, plugins);
 
 		return null;
 
@@ -888,7 +877,8 @@
 			Jar j = new Jar(jar);
 			try {
 				release(name, j);
-			} finally {
+			}
+			finally {
 				j.close();
 			}
 		}
@@ -911,8 +901,7 @@
 	 *             when something goes wrong
 	 */
 
-	public Container getBundle(String bsn, String range, Strategy strategy,
-			Map<String, String> attrs) throws Exception {
+	public Container getBundle(String bsn, String range, Strategy strategy, Map<String,String> attrs) throws Exception {
 
 		if (range == null)
 			range = "0";
@@ -946,15 +935,14 @@
 					return toContainer(bsn, range, attrs, result);
 			}
 		} else {
-			VersionRange versionRange = "latest".equals(range) ? new VersionRange("0")
-					: new VersionRange(range);
+			VersionRange versionRange = "latest".equals(range) ? new VersionRange("0") : new VersionRange(range);
 
 			// We have a range search. Gather all the versions in all the repos
 			// and make a decision on that choice. If the same version is found
 			// in
 			// multiple repos we take the first
 
-			SortedMap<Version, RepositoryPlugin> versions = new TreeMap<Version, RepositoryPlugin>();
+			SortedMap<Version,RepositoryPlugin> versions = new TreeMap<Version,RepositoryPlugin>();
 			for (RepositoryPlugin plugin : plugins) {
 				try {
 					List<Version> vs = plugin.versions(bsn);
@@ -964,7 +952,8 @@
 								versions.put(v, plugin);
 						}
 					}
-				} catch (UnsupportedOperationException ose) {
+				}
+				catch (UnsupportedOperationException ose) {
 					// We have a plugin that cannot list versions, try
 					// if it has this specific version
 					// The main reaosn for this code was the Maven Remote
@@ -987,13 +976,13 @@
 				Version provider = null;
 
 				switch (useStrategy) {
-				case HIGHEST:
-					provider = versions.lastKey();
-					break;
+					case HIGHEST :
+						provider = versions.lastKey();
+						break;
 
-				case LOWEST:
-					provider = versions.firstKey();
-					break;
+					case LOWEST :
+						provider = versions.firstKey();
+						break;
 				}
 				if (provider != null) {
 					RepositoryPlugin repo = versions.get(provider);
@@ -1002,16 +991,15 @@
 					if (result != null)
 						return toContainer(bsn, version, attrs, result);
 				} else
-					error("Unexpected, found versions %s but then not provider for startegy %s?",
-							versions, useStrategy);
+					msgs.FoundVersions_ForStrategy_ButNoProvider(versions, useStrategy);
 			}
 		}
 
 		//
 		// If we get this far we ran into an error somewhere
 
-		return new Container(this, bsn, range, Container.TYPE.ERROR, null, bsn + ";version="
-				+ range + " Not found in " + plugins, null);
+		return new Container(this, bsn, range, Container.TYPE.ERROR, null, bsn + ";version=" + range + " Not found in "
+				+ plugins, null);
 
 	}
 
@@ -1020,7 +1008,7 @@
 	 * @param useStrategy
 	 * @return
 	 */
-	protected Strategy overrideStrategy(Map<String, String> attrs, Strategy useStrategy) {
+	protected Strategy overrideStrategy(Map<String,String> attrs, Strategy useStrategy) {
 		if (attrs != null) {
 			String overrideStrategy = attrs.get("strategy");
 
@@ -1043,10 +1031,10 @@
 	 * @param result
 	 * @return
 	 */
-	protected Container toContainer(String bsn, String range, Map<String, String> attrs, File result) {
+	protected Container toContainer(String bsn, String range, Map<String,String> attrs, File result) {
 		File f = result;
 		if (f == null) {
-			error("Result file for toContainer is unexpectedly null, not sure what to do");
+			msgs.ConfusedNoContainerFile();
 			f = new File("was null");
 		}
 		if (f.getName().endsWith("lib"))
@@ -1066,7 +1054,7 @@
 	 * @return
 	 * @throws Exception
 	 */
-	private Container getBundleFromProject(String bsn, Map<String, String> attrs) throws Exception {
+	private Container getBundleFromProject(String bsn, Map<String,String> attrs) throws Exception {
 		String pname = bsn;
 		while (true) {
 			Project p = getWorkspace().getProject(pname);
@@ -1112,9 +1100,11 @@
 			try {
 				rp.put(jar);
 				return;
-			} catch (Exception e) {
-				error("Deploying " + file + " on " + rp.getName(), e);
-			} finally {
+			}
+			catch (Exception e) {
+				msgs.DeployingFile_On_Exception_(file, rp.getName(), e);
+			}
+			finally {
 				jar.close();
 			}
 			return;
@@ -1154,27 +1144,29 @@
 					try {
 						if (d.deploy(this, jar))
 							trace("deployed %s successfully to %s", output, d);
-					} catch (Exception e) {
-						error("Error while deploying %s, %s", this, e);
-						e.printStackTrace();
+					}
+					catch (Exception e) {
+						msgs.Deploying(e);
 					}
 				}
-			} finally {
+			}
+			finally {
 				jar.close();
 			}
 		}
 	}
 
 	/**
-	 * Macro access to the repository
-	 * 
-	 * ${repo;<bsn>[;<version>[;<low|high>]]}
+	 * Macro access to the repository ${repo;<bsn>[;<version>[;<low|high>]]}
 	 */
 
+	static String	_repoHelp	= "${repo ';'<bsn> [ ; <version> [; ('HIGHEST'|'LOWEST')]}";
+
 	public String _repo(String args[]) throws Exception {
-		if (args.length < 2)
-			throw new IllegalArgumentException(
-					"Too few arguments for repo, syntax=: ${repo ';'<bsn> [ ; <version> [; ('HIGHEST'|'LOWEST')]}");
+		if (args.length < 2) {
+			msgs.RepoTooFewArguments(_repoHelp, args);
+			return null;
+		}
 
 		String bsns = args[1];
 		String version = null;
@@ -1190,8 +1182,7 @@
 				else if (args[3].equalsIgnoreCase("EXACT"))
 					strategy = Strategy.EXACT;
 				else
-					error("${repo;<bsn>;<version>;<'highest'|'lowest'|'exact'>} macro requires a strategy of 'highest' or 'lowest', and is "
-							+ args[3]);
+					msgs.InvalidStrategy(_repoHelp, args);
 			}
 		}
 
@@ -1215,8 +1206,8 @@
 			if (container.getError() == null)
 				paths.add(container.getFile().getAbsolutePath());
 			else {
-				paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-"
-						+ container.getVersion() + " : " + container.getError() + ">>");
+				paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : "
+						+ container.getError() + ">>");
 
 				if (isPedantic()) {
 					warning("Could not expand repo path request: %s ", container);
@@ -1266,13 +1257,24 @@
 
 	/**
 	 * Check if this project needs building. This is defined as:
-	 * 
 	 */
 	public boolean isStale() throws Exception {
+		Set<Project> visited = new HashSet<Project>();
+		return isStale(visited);
+	}
+
+	boolean isStale(Set<Project> visited) throws Exception {
 		// When we do not generate anything ...
 		if (isNoBundles())
 			return false;
 
+		if (visited.contains(this)) {
+			msgs.CircularDependencyContext_Message_(this.getName(), visited.toString());
+			return false;
+		}
+
+		visited.add(this);
+
 		long buildTime = 0;
 
 		files = getBuildFiles(false);
@@ -1288,6 +1290,9 @@
 		}
 
 		for (Project dependency : getDependson()) {
+			if (dependency == this)
+				continue;
+
 			if (dependency.isStale())
 				return true;
 
@@ -1305,11 +1310,8 @@
 
 	/**
 	 * This method must only be called when it is sure that the project has been
-	 * build before in the same session.
-	 * 
-	 * It is a bit yucky, but ant creates different class spaces which makes it
-	 * hard to detect we already build it.
-	 * 
+	 * build before in the same session. It is a bit yucky, but ant creates
+	 * different class spaces which makes it hard to detect we already build it.
 	 * This method remembers the files in the appropriate instance vars.
 	 * 
 	 * @return
@@ -1334,7 +1336,7 @@
 					if (!ff.isFile()) {
 						// Originally we warned the user
 						// but lets just rebuild. That way
-						// the error is not noticed but 
+						// the error is not noticed but
 						// it seems better to correct,
 						// See #154
 						rdr.close();
@@ -1344,7 +1346,8 @@
 						files.add(ff);
 				}
 				return this.files = files.toArray(new File[files.size()]);
-			} finally {
+			}
+			finally {
 				rdr.close();
 			}
 		}
@@ -1371,35 +1374,42 @@
 
 		files = null;
 		ProjectBuilder builder = getBuilder(null);
-		if (underTest)
-			builder.setProperty(Constants.UNDERTEST, "true");
-		Jar jars[] = builder.builds();
-		File[] files = new File[jars.length];
+		try {
+			if (underTest)
+				builder.setProperty(Constants.UNDERTEST, "true");
+			Jar jars[] = builder.builds();
+			File[] files = new File[jars.length];
 
-		for (int i = 0; i < jars.length; i++) {
-			Jar jar = jars[i];
-			files[i] = saveBuild(jar);
-		}
-		getInfo(builder);
-		builder.close();
-		if (isOk()) {
-			this.files = files;
+			getInfo(builder);
 
-			// Write out the filenames in the buildfiles file
-			// so we can get them later evenin another process
-			Writer fw = IO.writer(bfs);
-			try {
-				for (File f : files) {
-					fw.append(f.getAbsolutePath());
-					fw.append("\n");
+			if (isOk()) {
+				this.files = files;
+
+				for (int i = 0; i < jars.length; i++) {
+					Jar jar = jars[i];
+					files[i] = saveBuild(jar);
 				}
-			} finally {
-				fw.close();
-			}
-			getWorkspace().changedFile(bfs);
-			return files;
-		} else
-			return null;
+
+				// Write out the filenames in the buildfiles file
+				// so we can get them later evenin another process
+				Writer fw = IO.writer(bfs);
+				try {
+					for (File f : files) {
+						fw.append(f.getAbsolutePath());
+						fw.append("\n");
+					}
+				}
+				finally {
+					fw.close();
+				}
+				getWorkspace().changedFile(bfs);
+				return files;
+			} else
+				return null;
+		}
+		finally {
+			builder.close();
+		}
 	}
 
 	/**
@@ -1429,7 +1439,8 @@
 			}
 			trace(jar.getName() + " (" + f.getName() + ") " + jar.getResources().size() + " " + msg);
 			return f;
-		} finally {
+		}
+		finally {
 			jar.close();
 		}
 	}
@@ -1442,7 +1453,7 @@
 		if (isTrue(getProperty(Constants.REPORTNEWER))) {
 			StringBuilder sb = new StringBuilder();
 			String del = "Newer than " + new Date(lastModified);
-			for (Map.Entry<String, Resource> entry : jar.getResources().entrySet()) {
+			for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) {
 				if (entry.getValue().lastModified() > lastModified) {
 					sb.append(del);
 					del = ", \n     ";
@@ -1480,13 +1491,13 @@
 		return getBase().getName();
 	}
 
-	public Map<String, Action> getActions() {
-		Map<String, Action> all = newMap();
-		Map<String, Action> actions = newMap();
+	public Map<String,Action> getActions() {
+		Map<String,Action> all = newMap();
+		Map<String,Action> actions = newMap();
 		fillActions(all);
 		getWorkspace().fillActions(all);
 
-		for (Map.Entry<String, Action> action : all.entrySet()) {
+		for (Map.Entry<String,Action> action : all.entrySet()) {
 			String key = getReplacer().process(action.getKey());
 			if (key != null && key.trim().length() != 0)
 				actions.put(key, action.getValue());
@@ -1494,20 +1505,19 @@
 		return actions;
 	}
 
-	public void fillActions(Map<String, Action> all) {
+	public void fillActions(Map<String,Action> all) {
 		List<NamedAction> plugins = getPlugins(NamedAction.class);
 		for (NamedAction a : plugins)
 			all.put(a.getName(), a);
 
 		Parameters actions = new Parameters(getProperty("-actions", DEFAULT_ACTIONS));
-		for (Entry<String, Attrs> entry : actions.entrySet()) {
+		for (Entry<String,Attrs> entry : actions.entrySet()) {
 			String key = Processor.removeDuplicateMarker(entry.getKey());
 			Action action;
 
 			if (entry.getValue().get("script") != null) {
 				// TODO check for the type
-				action = new ScriptAction(entry.getValue().get("type"), entry.getValue().get(
-						"script"));
+				action = new ScriptAction(entry.getValue().get("type"), entry.getValue().get("script"));
 			} else {
 				action = new ReflectAction(key);
 			}
@@ -1593,7 +1603,8 @@
 		try {
 			Jar jar = new Jar(url.getFile().replace('/', '.'), in, System.currentTimeMillis());
 			return getValidJar(jar, url.toString());
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -1681,7 +1692,8 @@
 				bndfile += "\n# Added by by bump\nBundle-Version: 0.0.0\n";
 				IO.store(bndfile, getPropertiesFile());
 			}
-		} finally {
+		}
+		finally {
 			forceRefresh();
 		}
 	}
@@ -1697,7 +1709,7 @@
 	}
 
 	public void action(String command) throws Throwable {
-		Map<String, Action> actions = getActions();
+		Map<String,Action> actions = getActions();
 
 		Action a = actions.get(command);
 		if (a == null)
@@ -1706,7 +1718,8 @@
 		before(this, command);
 		try {
 			a.execute(this, command);
-		} catch (Throwable t) {
+		}
+		catch (Throwable t) {
 			after(this, command, t);
 			throw t;
 		}
@@ -1714,7 +1727,6 @@
 
 	/**
 	 * Run all before command plugins
-	 * 
 	 */
 	void before(Project p, String a) {
 		List<CommandPlugin> testPlugins = getPlugins(CommandPlugin.class);
@@ -1762,15 +1774,17 @@
 		refresh();
 	}
 
-	@SuppressWarnings("unchecked") public void script(String type, String script) throws Exception {
+	@SuppressWarnings("unchecked")
+	public void script(String type, String script) throws Exception {
 		// TODO check tyiping
 		List<Scripter> scripters = getPlugins(Scripter.class);
 		if (scripters.isEmpty()) {
-			error("Can not execute script because there are no scripters registered: %s", script);
+			msgs.NoScripters_(script);
 			return;
 		}
-		@SuppressWarnings("rawtypes") Map x = (Map) getProperties();
-		scripters.get(0).eval((Map<String, Object>) x, new StringReader(script));
+		@SuppressWarnings("rawtypes")
+		Map x = (Map) getProperties();
+		scripters.get(0).eval((Map<String,Object>) x, new StringReader(script));
 	}
 
 	public String _repos(String args[]) throws Exception {
@@ -1811,16 +1825,15 @@
 	 * Otherwise it contains all the sub bnd files.
 	 * 
 	 * @return A collection of containers
-	 * 
 	 * @throws Exception
 	 */
 	public Collection<Container> getDeliverables() throws Exception {
 		List<Container> result = new ArrayList<Container>();
-		Collection<? extends Builder> builders = getSubBuilders();
+		Collection< ? extends Builder> builders = getSubBuilders();
 
 		for (Builder builder : builders) {
-			Container c = new Container(this, builder.getBsn(), builder.getVersion(),
-					Container.TYPE.PROJECT, getOutputFile(builder.getBsn()), null, null);
+			Container c = new Container(this, builder.getBsn(), builder.getVersion(), Container.TYPE.PROJECT,
+					getOutputFile(builder.getBsn()), null, null);
 			result.add(c);
 		}
 		return result;
@@ -1847,7 +1860,7 @@
 		if (!bndFile.getAbsolutePath().startsWith(base.getAbsolutePath()))
 			return null;
 
-		Collection<? extends Builder> builders = getSubBuilders();
+		Collection< ? extends Builder> builders = getSubBuilders();
 		for (Builder sub : builders) {
 			File propertiesFile = sub.getPropertiesFile();
 			if (propertiesFile != null) {
@@ -1868,8 +1881,8 @@
 	 * @return null or the builder for a sub file.
 	 * @throws Exception
 	 */
-	public Container getDeliverable(String bsn, Map<String, String> attrs) throws Exception {
-		Collection<? extends Builder> builders = getSubBuilders();
+	public Container getDeliverable(String bsn, Map<String,String> attrs) throws Exception {
+		Collection< ? extends Builder> builders = getSubBuilders();
 		for (Builder sub : builders) {
 			if (sub.getBsn().equals(bsn))
 				return new Container(this, getOutputFile(bsn));
@@ -1886,7 +1899,7 @@
 	 * @return A list of builders.
 	 * @throws Exception
 	 */
-	public Collection<? extends Builder> getSubBuilders() throws Exception {
+	public Collection< ? extends Builder> getSubBuilders() throws Exception {
 		return getBuilder(null).getSubBuilders();
 	}
 
@@ -1910,7 +1923,7 @@
 		return hdr.keySet();
 	}
 
-	public Map<String, String> getRunProperties() {
+	public Map<String,String> getRunProperties() {
 		return OSGiHeader.parseProperties(getProperty(RUNPROPERTIES));
 	}
 
@@ -1921,17 +1934,16 @@
 	 * @throws Exception
 	 */
 	public ProjectLauncher getProjectLauncher() throws Exception {
-		return getHandler(ProjectLauncher.class, getRunpath(), LAUNCHER_PLUGIN,
-				"biz.aQute.launcher");
+		return getHandler(ProjectLauncher.class, getRunpath(), LAUNCHER_PLUGIN, "biz.aQute.launcher");
 	}
 
 	public ProjectTester getProjectTester() throws Exception {
 		return getHandler(ProjectTester.class, getTestpath(), TESTER_PLUGIN, "biz.aQute.junit");
 	}
 
-	private <T> T getHandler(Class<T> target, Collection<Container> containers, String header,
-			String defaultHandler) throws Exception {
-		Class<? extends T> handlerClass = target;
+	private <T> T getHandler(Class<T> target, Collection<Container> containers, String header, String defaultHandler)
+			throws Exception {
+		Class< ? extends T> handlerClass = target;
 
 		// Make sure we find at least one handler, but hope to find an earlier
 		// one
@@ -1946,15 +1958,13 @@
 			if (manifest != null) {
 				String launcher = manifest.getMainAttributes().getValue(header);
 				if (launcher != null) {
-					Class<?> clz = getClass(launcher, c.getFile());
+					Class< ? > clz = getClass(launcher, c.getFile());
 					if (clz != null) {
 						if (!target.isAssignableFrom(clz)) {
-							error("Found a %s class in %s but it is not compatible with: %s", clz,
-									c, target);
+							msgs.IncompatibleHandler_For_(launcher, defaultHandler);
 						} else {
 							handlerClass = clz.asSubclass(target);
-							Constructor<? extends T> constructor = handlerClass
-									.getConstructor(Project.class);
+							Constructor< ? extends T> constructor = handlerClass.getConstructor(Project.class);
 							return constructor.newInstance(this);
 						}
 					}
@@ -1962,34 +1972,13 @@
 			}
 		}
 
-		throw new IllegalArgumentException("Default handler for " + header + " not found in "
-				+ defaultHandler);
-	}
-
-	public synchronized boolean lock(String reason) throws InterruptedException {
-		if (!lock.tryLock(5, TimeUnit.SECONDS)) {
-			error("Could not acquire lock for %s, was locked by %s for %s", reason, lockingThread,
-					lockingReason);
-			System.err.printf("Could not acquire lock for %s, was locked by %s for %s%n", reason,
-					lockingThread, lockingReason);
-			System.err.flush();
-			return false;
-		}
-		this.lockingReason = reason;
-		this.lockingThread = Thread.currentThread();
-		return true;
-	}
-
-	public void unlock() {
-		lockingReason = null;
-		lock.unlock();
+		throw new IllegalArgumentException("Default handler for " + header + " not found in " + defaultHandler);
 	}
 
 	/**
-	 * Make this project delay the calculation of the run dependencies.
-	 * 
-	 * The run dependencies calculation can be done in prepare or until the
-	 * dependencies are actually needed.
+	 * Make this project delay the calculation of the run dependencies. The run
+	 * dependencies calculation can be done in prepare or until the dependencies
+	 * are actually needed.
 	 */
 	public void setDelayRunDependencies(boolean x) {
 		delayRunDependencies = x;
@@ -2006,8 +1995,9 @@
 	public void setPackageInfo(String packageName, Version version) {
 		try {
 			updatePackageInfoFile(packageName, version);
-		} catch (Exception e) {
-			error(e.getMessage(), e);
+		}
+		catch (Exception e) {
+			msgs.SettingPackageInfoException_(e);
 		}
 	}
 
@@ -2061,7 +2051,8 @@
 					return Version.parseVersion(line.substring(8));
 				}
 			}
-		} finally {
+		}
+		finally {
 			if (reader != null) {
 				IO.close(reader);
 			}
@@ -2073,19 +2064,19 @@
 	 * bnd maintains a class path that is set by the environment, i.e. bnd is
 	 * not in charge of it.
 	 */
-	
-	public void addClasspath( File f) {
-		if ( !f.isFile()) {
-			error("Adding non existent file to the classpath %s", f);
+
+	public void addClasspath(File f) {
+		if (!f.isFile() && !f.isDirectory()) {
+			msgs.AddingNonExistentFileToClassPath_(f);
 		}
 		Container container = new Container(f);
 		classpath.add(container);
 	}
-	
+
 	public void clearClasspath() {
 		classpath.clear();
 	}
-	
+
 	public Collection<Container> getClasspath() {
 		return classpath;
 	}
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
index d00b71b..4abb350 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectBuilder.java
@@ -6,72 +6,75 @@
 import aQute.lib.osgi.*;
 
 public class ProjectBuilder extends Builder {
-    Project project;
-    boolean initialized;
+	Project	project;
+	boolean	initialized;
 
-    public ProjectBuilder(Project project) {
-        super(project);
-        this.project = project;
-    }
+	public ProjectBuilder(Project project) {
+		super(project);
+		this.project = project;
+	}
 
-    public ProjectBuilder(ProjectBuilder builder) {
-        super(builder);
-        this.project = builder.project;
-    }
+	public ProjectBuilder(ProjectBuilder builder) {
+		super(builder);
+		this.project = builder.project;
+	}
 
-    @Override
-    public long lastModified() {
-        return Math.max(project.lastModified(), super.lastModified());
-    }
+	@Override
+	public long lastModified() {
+		return Math.max(project.lastModified(), super.lastModified());
+	}
 
-    /**
-     * We put our project and our workspace on the macro path.
-     */
-    protected Object[] getMacroDomains() {
-        return new Object[] { project, project.getWorkspace() };
-    }
+	/**
+	 * We put our project and our workspace on the macro path.
+	 */
+	protected Object[] getMacroDomains() {
+		return new Object[] {
+				project, project.getWorkspace()
+		};
+	}
 
-    public Builder getSubBuilder() throws Exception {
-        return project.getBuilder(this);
-    }
+	public Builder getSubBuilder() throws Exception {
+		return project.getBuilder(this);
+	}
 
-    public Project getProject() {
-        return project;
-    }
+	public Project getProject() {
+		return project;
+	}
 
-    public void init() {
-        try {
-            if (!initialized) {
-                initialized = true;
-                for (Container file : project.getClasspath()) {
-                    addClasspath(file.getFile());
-                }
-                
-                for (Container file : project.getBuildpath()) {
-                    addClasspath(file.getFile());
-                }
+	public void init() {
+		try {
+			if (!initialized) {
+				initialized = true;
+				for (Container file : project.getClasspath()) {
+					addClasspath(file.getFile());
+				}
 
-                for (Container file : project.getBootclasspath()) {
-                    addClasspath(file.getFile());
-                }
+				for (Container file : project.getBuildpath()) {
+					addClasspath(file.getFile());
+				}
 
-                for (File file : project.getAllsourcepath()) {
-                    addSourcepath(file);
-                }
+				for (Container file : project.getBootclasspath()) {
+					addClasspath(file.getFile());
+				}
 
-            }
-        } catch (Exception e) {
-            error("init project builder fails", e);
-        }
-    }
+				for (File file : project.getAllsourcepath()) {
+					addSourcepath(file);
+				}
 
-    public List<Jar> getClasspath() {
-        init();
-        return super.getClasspath();
-    }
+			}
+		}
+		catch (Exception e) {
+			msgs.Unexpected_Error_("ProjectBuilder init", e);
+		}
+	}
 
-    @Override
-    protected void changedFile(File f) {
-        project.getWorkspace().changedFile(f);
-    }
+	public List<Jar> getClasspath() {
+		init();
+		return super.getClasspath();
+	}
+
+	@Override
+	protected void changedFile(File f) {
+		project.getWorkspace().changedFile(f);
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectLauncher.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectLauncher.java
index 1b7bac0..6a97311 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ProjectLauncher.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectLauncher.java
@@ -19,42 +19,41 @@
  * class is instantiated and cast to a LauncherPlugin. This plug in is then
  * asked to provide a ProjectLauncher. This project launcher is then used by the
  * project to run the code. Launchers must extend this class.
- * 
  */
 public abstract class ProjectLauncher {
-	private final Project				project;
-	private long						timeout				= 0;
+	private final Project		project;
+	private long				timeout				= 0;
 	private final List<String>	classpath			= new ArrayList<String>();
-	private List<String>				runbundles			= Create.list();
-	private final List<String>			runvm				= new ArrayList<String>();
-	private Map<String, String>			runproperties;
-	private Command						java;
-	private Parameters					runsystempackages;
-	private final List<String>			activators			= Create.list();
-	private File						storageDir;
-	private final List<String>			warnings			= Create.list();
-	private final List<String>			errors				= Create.list();
+	private List<String>		runbundles			= Create.list();
+	private final List<String>	runvm				= new ArrayList<String>();
+	private Map<String,String>	runproperties;
+	private Command				java;
+	private Parameters			runsystempackages;
+	private final List<String>	activators			= Create.list();
+	private File				storageDir;
+	private final List<String>	warnings			= Create.list();
+	private final List<String>	errors				= Create.list();
 
-	private boolean						trace;
-	private boolean						keep;
-	private int							framework;
+	private boolean				trace;
+	private boolean				keep;
+	private int					framework;
 
-	public final static int				SERVICES			= 10111;
-	public final static int				NONE				= 20123;
+	public final static int		SERVICES			= 10111;
+	public final static int		NONE				= 20123;
 
 	// MUST BE ALIGNED WITH LAUNCHER
-	public final static int				OK					= 0;
-	public final static int				WARNING				= -1;
-	public final static int				ERROR				= -2;
-	public final static int				TIMEDOUT			= -3;
-	public final static int				UPDATE_NEEDED		= -4;
-	public final static int				CANCELED			= -5;
-	public final static int				DUPLICATE_BUNDLE	= -6;
-	public final static int				RESOLVE_ERROR		= -7;
-	public final static int				ACTIVATOR_ERROR		= -8;
-	public final static int				CUSTOM_LAUNCHER		= -128;
+	public final static int		OK					= 0;
+	public final static int		WARNING				= -1;
+	public final static int		ERROR				= -2;
+	public final static int		TIMEDOUT			= -3;
+	public final static int		UPDATE_NEEDED		= -4;
+	public final static int		CANCELED			= -5;
+	public final static int		DUPLICATE_BUNDLE	= -6;
+	public final static int		RESOLVE_ERROR		= -7;
+	public final static int		ACTIVATOR_ERROR		= -8;
+	public final static int		CUSTOM_LAUNCHER		= -128;
 
-	public final static String			EMBEDDED_ACTIVATOR	= "Embedded-Activator";
+	public final static String	EMBEDDED_ACTIVATOR	= "Embedded-Activator";
 
 	public ProjectLauncher(Project project) throws Exception {
 		this.project = project;
@@ -99,8 +98,7 @@
 		trace = Processor.isTrue(project.getProperty(Constants.RUNTRACE));
 
 		// For backward compatibility with bndtools launcher
-		List<Container> fws = project.getBundles(Strategy.HIGHEST, project.getProperty("-runfw"),
-				"-runfw");
+		List<Container> fws = project.getBundles(Strategy.HIGHEST, project.getProperty("-runfw"), "-runfw");
 		runpath.addAll(fws);
 
 		for (Container c : runpath) {
@@ -127,8 +125,7 @@
 
 	public void addClasspath(Container container) throws Exception {
 		if (container.getError() != null) {
-			project.error("Cannot launch because %s has reported %s", container.getProject(),
-					container.getError());
+			project.error("Cannot launch because %s has reported %s", container.getProject(), container.getError());
 		} else {
 			Collection<Container> members = container.getMembers();
 			for (Container m : members) {
@@ -139,9 +136,9 @@
 					Manifest manifest = m.getManifest();
 
 					if (manifest != null) {
-						Parameters exports = project.parseHeader(manifest.getMainAttributes()
-								.getValue(Constants.EXPORT_PACKAGE));
-						for (Entry<String, Attrs> e : exports.entrySet()) {
+						Parameters exports = project.parseHeader(manifest.getMainAttributes().getValue(
+								Constants.EXPORT_PACKAGE));
+						for (Entry<String,Attrs> e : exports.entrySet()) {
 							if (!runsystempackages.containsKey(e.getKey()))
 								runsystempackages.put(e.getKey(), e.getValue());
 						}
@@ -151,8 +148,7 @@
 						// the framework is completely initialized wit the
 						// system
 						// context.
-						String activator = manifest.getMainAttributes()
-								.getValue(EMBEDDED_ACTIVATOR);
+						String activator = manifest.getMainAttributes().getValue(EMBEDDED_ACTIVATOR);
 						if (activator != null)
 							activators.add(activator);
 					}
@@ -189,7 +185,7 @@
 		return Collections.emptySet();
 	}
 
-	public Map<String, String> getRunProperties() {
+	public Map<String,String> getRunProperties() {
 		return runproperties;
 	}
 
@@ -214,44 +210,45 @@
 			java.setTimeout(timeout + 1000, TimeUnit.MILLISECONDS);
 
 		try {
-			int result = java.execute((InputStream)null, System.err, System.err);
+			int result = java.execute((InputStream) null, System.err, System.err);
 			if (result == Integer.MIN_VALUE)
 				return TIMEDOUT;
 			reportResult(result);
 			return result;
-		} finally {
+		}
+		finally {
 			cleanup();
 		}
 	}
 
 	/**
-	 * Is called after the process exists. Can you be used to cleanup
-	 * the properties file.
+	 * Is called after the process exists. Can you be used to cleanup the
+	 * properties file.
 	 */
-	
+
 	public void cleanup() {
 		// do nothing by default
 	}
 
 	protected void reportResult(int result) {
 		switch (result) {
-		case OK:
-			project.trace("Command terminated normal %s", java);
-			break;
-		case TIMEDOUT:
-			project.error("Launch timedout: %s", java);
-			break;
+			case OK :
+				project.trace("Command terminated normal %s", java);
+				break;
+			case TIMEDOUT :
+				project.error("Launch timedout: %s", java);
+				break;
 
-		case ERROR:
-			project.error("Launch errored: %s", java);
-			break;
+			case ERROR :
+				project.error("Launch errored: %s", java);
+				break;
 
-		case WARNING:
-			project.warning("Launch had a warning %s", java);
-			break;
-		default:
-			project.error("Exit code remote process %d: %s", result, java);
-			break;
+			case WARNING :
+				project.warning("Launch had a warning %s", java);
+				break;
+			default :
+				project.error("Exit code remote process %d: %s", result, java);
+				break;
 		}
 	}
 
@@ -267,7 +264,7 @@
 		java.cancel();
 	}
 
-	public Map<String, ? extends Map<String, String>> getSystemPackages() {
+	public Map<String, ? extends Map<String,String>> getSystemPackages() {
 		return runsystempackages.asMapMap();
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectMessages.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectMessages.java
new file mode 100644
index 0000000..ac8d7fb
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectMessages.java
@@ -0,0 +1,50 @@
+package aQute.bnd.build;
+
+import java.io.*;
+import java.util.*;
+
+import aQute.bnd.service.*;
+import aQute.bnd.service.RepositoryPlugin.Strategy;
+import aQute.lib.osgi.*;
+import aQute.libg.reporter.*;
+import aQute.libg.version.*;
+
+public interface ProjectMessages extends Messages {
+
+	ERROR InvalidStrategy(String help, String[] args);
+
+	ERROR RepoTooFewArguments(String help, String[] args);
+
+	ERROR AddingNonExistentFileToClassPath_(File f);
+
+	ERROR Deploying(Exception e);
+
+	ERROR DeployingFile_On_Exception_(File file, String name, Exception e);
+
+	ERROR MissingPom();
+
+	ERROR FoundVersions_ForStrategy_ButNoProvider(SortedMap<Version,RepositoryPlugin> versions, Strategy useStrategy);
+
+	ERROR NoSuchProject(String bsn, String spec);
+
+	ERROR CircularDependencyContext_Message_(String name, String message);
+
+	ERROR IncompatibleHandler_For_(String launcher, String defaultHandler);
+
+	ERROR NoOutputDirectory_(File output);
+
+	ERROR MissingDependson_(String p);
+
+	ERROR NoNameForReleaseRepository();
+
+	ERROR ReleaseRepository_NotFoundIn_(String name, List<RepositoryPlugin> plugins);
+
+	ERROR Release_Into_Exception_(Jar jar, RepositoryPlugin rp, Exception e);
+
+	ERROR NoScripters_(String script);
+
+	ERROR SettingPackageInfoException_(Exception e);
+
+	ERROR ConfusedNoContainerFile();
+
+}
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java b/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
index 5060d2f..86ce2e3 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ProjectTester.java
@@ -10,7 +10,7 @@
 	final List<String>			tests		= new ArrayList<String>();
 	File						reportDir;
 	boolean						continuous	= true;
-	
+
 	public ProjectTester(Project project) throws Exception {
 		this.project = project;
 		launcher = project.getProjectLauncher();
@@ -18,8 +18,7 @@
 		for (Container c : testbundles) {
 			launcher.addClasspath(c);
 		}
-		reportDir = new File(project.getTarget(), project.getProperty("test-reports",
-				"test-reports"));
+		reportDir = new File(project.getTarget(), project.getProperty("test-reports", "test-reports"));
 	}
 
 	public ProjectLauncher getProjectLauncher() {
@@ -37,7 +36,7 @@
 	public Collection<File> getReports() {
 		List<File> reports = new ArrayList<File>();
 		for (File report : reportDir.listFiles()) {
-			if (report.isFile() )
+			if (report.isFile())
 				reports.add(report);
 		}
 		return reports;
@@ -65,7 +64,7 @@
 
 	public boolean prepare() throws Exception {
 		reportDir.mkdirs();
-		for ( File file : reportDir.listFiles() ) {
+		for (File file : reportDir.listFiles()) {
 			file.delete();
 		}
 		return true;
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java b/bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java
index 55c2861..3c3ee16 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ReflectAction.java
@@ -5,18 +5,18 @@
 import aQute.bnd.service.action.*;
 
 public class ReflectAction implements Action {
-    String  what;
-    
-    public ReflectAction(String what) {
-        this.what = what;
-    }
-    
-    public void execute(Project project, String action) throws Exception {
-        Method m = project.getClass().getMethod(what);
-        m.invoke(project);
-    }
+	String	what;
 
-    public String toString() {
-        return "ra:" + what;
-    }
+	public ReflectAction(String what) {
+		this.what = what;
+	}
+
+	public void execute(Project project, String action) throws Exception {
+		Method m = project.getClass().getMethod(what);
+		m.invoke(project);
+	}
+
+	public String toString() {
+		return "ra:" + what;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/ScriptAction.java b/bundleplugin/src/main/java/aQute/bnd/build/ScriptAction.java
index 8ca55fd..cba37e6 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/ScriptAction.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/ScriptAction.java
@@ -3,16 +3,16 @@
 import aQute.bnd.service.action.*;
 
 public class ScriptAction implements Action {
-    final String script;
-    final String type;
-    
-    public ScriptAction(String type, String script) {
-        this.script = script;
-        this.type = type;
-    }
+	final String	script;
+	final String	type;
 
-    public void execute(Project project, String action) throws Exception {
-        project.script(type, script);
-    }
+	public ScriptAction(String type, String script) {
+		this.script = script;
+		this.type = type;
+	}
+
+	public void execute(Project project, String action) throws Exception {
+		project.script(type, script);
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java b/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
index 44a24de..daee3d3 100644
--- a/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
+++ b/bundleplugin/src/main/java/aQute/bnd/build/Workspace.java
@@ -23,9 +23,9 @@
 	public static final String					BNDDIR		= "bnd";
 	public static final String					CACHEDIR	= "cache";
 
-	static Map<File, WeakReference<Workspace>>	cache		= newHashMap();
-	final Map<String, Project>					models		= newHashMap();
-	final Map<String, Action>					commands	= newMap();
+	static Map<File,WeakReference<Workspace>>	cache		= newHashMap();
+	final Map<String,Project>					models		= newHashMap();
+	final Map<String,Action>					commands	= newMap();
 	final File									buildDir;
 	final Maven									maven		= new Maven(Processor.getExecutor());
 
@@ -132,7 +132,8 @@
 		return false;
 	}
 
-	@Override public void propertiesChanged() {
+	@Override
+	public void propertiesChanged() {
 		super.propertiesChanged();
 		File extDir = new File(this.buildDir, "ext");
 		File[] extensions = extDir.listFiles();
@@ -143,7 +144,8 @@
 					extensionName = extensionName.substring(0, extensionName.length() - ".bnd".length());
 					try {
 						doIncludeFile(extension, false, getProperties(), "ext." + extensionName);
-					} catch (Exception e) {
+					}
+					catch (Exception e) {
 						error("PropertiesChanged: " + e.getMessage());
 					}
 				}
@@ -163,7 +165,7 @@
 		commands.remove(menu);
 	}
 
-	public void fillActions(Map<String, Action> all) {
+	public void fillActions(Map<String,Action> all) {
 		all.putAll(commands);
 	}
 
@@ -187,7 +189,8 @@
 		for (BndListener l : listeners)
 			try {
 				l.changed(f);
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				e.printStackTrace();
 			}
 	}
@@ -200,38 +203,42 @@
 					l.begin();
 				else
 					l.end();
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				// who cares?
 			}
 	}
 
-	
 	/**
-	 * Signal a BndListener plugin.
-	 * We ran an infinite bug loop :-( 
+	 * Signal a BndListener plugin. We ran an infinite bug loop :-(
 	 */
-	final ThreadLocal<Reporter> signalBusy = new ThreadLocal<Reporter>();
+	final ThreadLocal<Reporter>	signalBusy	= new ThreadLocal<Reporter>();
+
 	public void signal(Reporter reporter) {
-		if ( signalBusy.get() != null)
+		if (signalBusy.get() != null)
 			return;
-		
+
 		signalBusy.set(reporter);
 		try {
 			List<BndListener> listeners = getPlugins(BndListener.class);
 			for (BndListener l : listeners)
 				try {
 					l.signal(this);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					// who cares?
 				}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// Ignore
-		} finally {
+		}
+		finally {
 			signalBusy.set(null);
 		}
 	}
 
-	@Override public void signal() {
+	@Override
+	public void signal() {
 		signal(this);
 	}
 
@@ -251,15 +258,14 @@
 		CachedFileRepo() {
 			super("cache", getFile(buildDir, CACHEDIR), false);
 		}
-		
+
 		public String toString() {
 			return "bnd-cache";
 		}
 
 		protected void init() throws Exception {
 			if (lock.tryLock(50, TimeUnit.SECONDS) == false)
-				throw new TimeLimitExceededException(
-						"Cached File Repo is locked and can't acquire it");
+				throw new TimeLimitExceededException("Cached File Repo is locked and can't acquire it");
 			try {
 				if (!inited) {
 					inited = true;
@@ -275,7 +281,8 @@
 						error("Couldn't find embedded-repo.jar in bundle ");
 					}
 				}
-			} finally {
+			}
+			finally {
 				lock.unlock();
 			}
 		}
@@ -287,20 +294,21 @@
 				while (jentry != null) {
 					if (!jentry.isDirectory()) {
 						File dest = Processor.getFile(dir, jentry.getName());
-						if (!dest.isFile() || dest.lastModified() < jentry.getTime()
-								|| jentry.getTime() == 0) {
+						if (!dest.isFile() || dest.lastModified() < jentry.getTime() || jentry.getTime() == 0) {
 							dest.getParentFile().mkdirs();
 							FileOutputStream out = new FileOutputStream(dest);
 							try {
 								copy(jin, out);
-							} finally {
+							}
+							finally {
 								out.close();
 							}
 						}
 					}
 					jentry = jin.getNextJarEntry();
 				}
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 		}
@@ -345,7 +353,8 @@
 		return maven;
 	}
 
-	@Override protected void setTypeSpecificPlugins(Set<Object> list) {
+	@Override
+	protected void setTypeSpecificPlugins(Set<Object> list) {
 		super.setTypeSpecificPlugins(list);
 		list.add(maven);
 		list.add(new CachedFileRepo());
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java
index e187f3c..5118bf3 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericParameter.java
@@ -1,22 +1,24 @@
 package aQute.bnd.compatibility;
 
 public class GenericParameter {
-	String name;
-	GenericType bounds[];
-	
+	String		name;
+	GenericType	bounds[];
+
 	public GenericParameter(String name, GenericType[] bounds) {
 		this.name = name;
 		this.bounds = bounds;
 		if (bounds == null || bounds.length == 0)
-			this.bounds = new GenericType[] { new GenericType( Object.class) };
+			this.bounds = new GenericType[] {
+				new GenericType(Object.class)
+			};
 	}
 
 	public String toString() {
 		StringBuilder sb = new StringBuilder();
 		sb.append(name);
-		if ( bounds != null && bounds.length > 0) {
-			for ( GenericType gtype : bounds ) {
-				sb.append( ":");
+		if (bounds != null && bounds.length > 0) {
+			for (GenericType gtype : bounds) {
+				sb.append(":");
 				sb.append(gtype);
 			}
 		}
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericType.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericType.java
index 847a358..d16affe 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericType.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/GenericType.java
@@ -1,6 +1,5 @@
 package aQute.bnd.compatibility;
 
-
 public class GenericType {
 	public GenericType(Class<Object> class1) {
 		// TODO Auto-generated constructor stub
@@ -11,27 +10,25 @@
 	GenericType[]				a;
 	GenericType[]				b;
 	int							array;
-	
-	Scope	scope;
-	
-		static public class GenericWildcard extends GenericType{
+
+	Scope						scope;
+
+	static public class GenericWildcard extends GenericType {
 
 		public GenericWildcard(Class<Object> class1) {
 			super(class1);
 			// TODO Auto-generated constructor stub
 		}
-		
+
 	}
-	
+
 	static public class GenericArray extends GenericType {
 
 		public GenericArray(Class<Object> class1) {
 			super(class1);
 			// TODO Auto-generated constructor stub
 		}
-		
+
 	}
-	
-	
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java
index 1e84030..42626f1 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/Kind.java
@@ -2,7 +2,6 @@
 
 /**
  * The kind of thing we scope
- * 
  */
 public enum Kind {
 	ROOT, CLASS, FIELD, CONSTRUCTOR, METHOD, UNKNOWN;
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/ParseSignatureBuilder.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/ParseSignatureBuilder.java
index f1f91d1..133abb1 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/ParseSignatureBuilder.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/ParseSignatureBuilder.java
@@ -6,30 +6,32 @@
 import aQute.lib.osgi.Descriptors.TypeRef;
 
 public class ParseSignatureBuilder {
-	final Scope			root;
-	
+	final Scope	root;
+
 	public ParseSignatureBuilder(Scope root) {
 		this.root = root;
 	}
-	
-	public void add( Jar jar ) throws Exception {
-		for ( Resource r : jar.getResources().values()) {
+
+	public void add(Jar jar) throws Exception {
+		for (Resource r : jar.getResources().values()) {
 			InputStream in = r.openInputStream();
 			try {
 				parse(in);
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 		}
 	}
-	
-	public Scope getRoot() { return root; }
-	
-	
+
+	public Scope getRoot() {
+		return root;
+	}
+
 	public void parse(InputStream in) throws Exception {
 		Analyzer analyzer = new Analyzer();
 		Clazz clazz = new Clazz(analyzer, "", null);
-		
+
 		clazz.parseClassFile(in, new ClassDataCollector() {
 			Scope	s;
 			Scope	enclosing;
@@ -44,7 +46,7 @@
 
 			@Override
 			public void extendsClass(TypeRef name) {
-//				s.setBase(new GenericType(name));
+				// s.setBase(new GenericType(name));
 			}
 
 			@Override
@@ -55,7 +57,7 @@
 			GenericType[] convert(TypeRef names[]) {
 				GenericType tss[] = new GenericType[names.length];
 				for (int i = 0; i < names.length; i++) {
-//					tss[i] = new GenericType(names[i]);
+					// tss[i] = new GenericType(names[i]);
 				}
 				return tss;
 			}
@@ -92,9 +94,9 @@
 			@Override
 			public void classEnd() {
 				if (enclosing != null)
-					s.setEnclosing( enclosing );
+					s.setEnclosing(enclosing);
 				if (declaring != null)
-					s.setDeclaring( declaring );				
+					s.setDeclaring(declaring);
 			}
 
 			@Override
@@ -106,14 +108,11 @@
 			}
 
 			@Override
-			public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName,
-					int innerClassAccessFlags) {
+			public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags) {
 				if (outerClass != null && innerClass != null && innerClass.getBinary().equals(s.name))
 					declaring = root.getScope(outerClass.getBinary());
 			}
 		});
-		
-		
+
 	}
 }
-
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/RuntimeSignatureBuilder.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/RuntimeSignatureBuilder.java
index 32ae94f..9e6b090 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/RuntimeSignatureBuilder.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/RuntimeSignatureBuilder.java
@@ -9,16 +9,15 @@
 		this.root = root;
 	}
 
-	static public String identity(Class<?> c) {
+	static public String identity(Class< ? > c) {
 		return Scope.classIdentity(c.getName());
 	}
 
 	static public String identity(Method m) {
-		return Scope.methodIdentity(m.getName(), getDescriptor(m.getReturnType(), m
-				.getParameterTypes()));
+		return Scope.methodIdentity(m.getName(), getDescriptor(m.getReturnType(), m.getParameterTypes()));
 	}
 
-	static public String identity(Constructor<?> m) {
+	static public String identity(Constructor< ? > m) {
 		return Scope.constructorIdentity(getDescriptor(void.class, m.getParameterTypes()));
 	}
 
@@ -26,11 +25,11 @@
 		return Scope.fieldIdentity(m.getName(), getDescriptor(m.getType(), null));
 	}
 
-	static public String getDescriptor(Class<?> base, Class<?>[] parameters) {
+	static public String getDescriptor(Class< ? > base, Class< ? >[] parameters) {
 		StringBuilder sb = new StringBuilder();
 		if (parameters != null) {
 			sb.append("(");
-			for (Class<?> parameter : parameters) {
+			for (Class< ? > parameter : parameters) {
 				sb.append(getDescriptor(parameter));
 			}
 			sb.append(")");
@@ -39,9 +38,9 @@
 		return sb.toString();
 	}
 
-	public Scope add(Class<?> c) {
-		Scope local = add(root, getEnclosingScope(c), c.getModifiers(), c.getTypeParameters(),
-				Kind.CLASS, identity(c), c.getGenericSuperclass(), c.getGenericInterfaces(), null);
+	public Scope add(Class< ? > c) {
+		Scope local = add(root, getEnclosingScope(c), c.getModifiers(), c.getTypeParameters(), Kind.CLASS, identity(c),
+				c.getGenericSuperclass(), c.getGenericInterfaces(), null);
 
 		for (Field f : c.getDeclaredFields()) {
 			add(local, // declaring scope
@@ -56,7 +55,7 @@
 			);
 		}
 
-		for (Constructor<?> constr : c.getConstructors()) {
+		for (Constructor< ? > constr : c.getConstructors()) {
 			add(local, // class scope
 					local, // enclosing
 					constr.getModifiers(), // access modifiers
@@ -86,20 +85,20 @@
 		return local;
 	}
 
-	private Scope getEnclosingScope(Class<?> c) {
+	private Scope getEnclosingScope(Class< ? > c) {
 		Method m = c.getEnclosingMethod();
 		if (m != null) {
 			Scope s = getGlobalScope(m.getDeclaringClass());
 			return s.getScope(identity(m));
 		}
-// TODO
-//		Constructor cnstr = c.getEnclosingConstructor();
-//		if (m != null) {
-//			Scope s = getGlobalScope(cnstr.getDeclaringClass());
-//			return s.getScope(identity(cnstr));
-//
-//		}
-		Class<?> enclosingClass = c.getEnclosingClass();
+		// TODO
+		// Constructor cnstr = c.getEnclosingConstructor();
+		// if (m != null) {
+		// Scope s = getGlobalScope(cnstr.getDeclaringClass());
+		// return s.getScope(identity(cnstr));
+		//
+		// }
+		Class< ? > enclosingClass = c.getEnclosingClass();
 		if (enclosingClass != null) {
 			return getGlobalScope(enclosingClass);
 		}
@@ -107,23 +106,22 @@
 		return null;
 	}
 
-	private Scope getGlobalScope(Class<?> c) {
+	private Scope getGlobalScope(Class< ? > c) {
 		if (c == null)
 			return null;
 		String id = identity(c);
 		return root.getScope(id);
 	}
 
-	private Scope add(Scope declaring, Scope enclosing, int modifiers,
-			TypeVariable<?>[] typeVariables, Kind kind, String id, Type mainType,
-			Type[] parameterTypes, Type exceptionTypes[]) {
+	private Scope add(Scope declaring, Scope enclosing, int modifiers, TypeVariable< ? >[] typeVariables, Kind kind,
+			String id, Type mainType, Type[] parameterTypes, Type exceptionTypes[]) {
 
 		Scope scope = declaring.getScope(id);
 		assert scope.access == Access.UNKNOWN;
 		scope.setAccess(Access.modifier(modifiers));
 		scope.setKind(kind);
 		scope.setGenericParameter(convert(typeVariables));
-		scope.setBase(convert(scope,mainType));
+		scope.setBase(convert(scope, mainType));
 		scope.setParameterTypes(convert(parameterTypes));
 		scope.setExceptionTypes(convert(exceptionTypes));
 		scope.setDeclaring(declaring);
@@ -135,32 +133,32 @@
 		if (t instanceof ParameterizedType) {
 			// C<P..>
 			ParameterizedType pt = (ParameterizedType) t;
-			/*Scope reference =*/ root.getScope(identity((Class<?>)pt.getRawType()));			
+			/* Scope reference = */root.getScope(identity((Class< ? >) pt.getRawType()));
 			Type args[] = pt.getActualTypeArguments();
 			GenericType[] arguments = new GenericType[args.length];
 			int n = 0;
 			for (Type arg : args)
-				arguments[n++] = convert(source,arg);
-//			return new GenericType(reference,null,arguments);
-			
+				arguments[n++] = convert(source, arg);
+			// return new GenericType(reference,null,arguments);
+
 		} else if (t instanceof TypeVariable) {
-//			TypeVariable tv = (TypeVariable) t;
-//			return new GenericType(source,tv.getName(), null);
+			// TypeVariable tv = (TypeVariable) t;
+			// return new GenericType(source,tv.getName(), null);
 		} else if (t instanceof WildcardType) {
-//			WildcardType wc = (WildcardType) t;
-//			wc.
+			// WildcardType wc = (WildcardType) t;
+			// wc.
 		} else if (t instanceof GenericArrayType) {
 
 		}
-		if (t instanceof Class<?>) {
-//			raw = ((Class<?>) t).getName() + ";";
+		if (t instanceof Class< ? >) {
+			// raw = ((Class<?>) t).getName() + ";";
 		} else
 			throw new IllegalArgumentException(t.toString());
 
 		return null;
 	}
 
-	private GenericParameter[] convert(TypeVariable<?> vars[]) {
+	private GenericParameter[] convert(TypeVariable< ? > vars[]) {
 		if (vars == null)
 			return null;
 
@@ -178,12 +176,12 @@
 
 		GenericType tss[] = new GenericType[parameterTypes.length];
 		for (int i = 0; i < parameterTypes.length; i++) {
-			//tss[i] = new GenericType(parameterTypes[i]);
+			// tss[i] = new GenericType(parameterTypes[i]);
 		}
 		return tss;
 	}
 
-	private static String getDescriptor(Class<?> c) {
+	private static String getDescriptor(Class< ? > c) {
 		StringBuilder sb = new StringBuilder();
 		if (c.isPrimitive()) {
 			if (c == boolean.class)
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java
index 7f22f35..43dccbd 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/Scope.java
@@ -4,20 +4,20 @@
 import java.util.*;
 
 public class Scope {
-	final Map<String, Scope>	children	= new LinkedHashMap<String, Scope>();
+	final Map<String,Scope>	children	= new LinkedHashMap<String,Scope>();
 
 	// class: slashed name
 	// field: name ":" typed
 	// constructor: ":(" typed* ")" typed
 	// method: name ":(" typed* ")" typed
-	final String				name;
+	final String			name;
 
-	Access						access;
-	Kind						kind;
-	Scope						enclosing;
-	Scope						declaring;
-	GenericParameter						typeVars[];
-	Map<String, String[]>		name2bounds;
+	Access					access;
+	Kind					kind;
+	Scope					enclosing;
+	Scope					declaring;
+	GenericParameter		typeVars[];
+	Map<String,String[]>	name2bounds;
 
 	// class: super
 	// field: type
@@ -28,11 +28,11 @@
 	// class: interfaces
 	// constructor: args
 	// method: args
-	GenericType[]				parameters;
+	GenericType[]			parameters;
 
 	// constructor: exceptions
 	// method: exceptions
-	GenericType[]				exceptions;
+	GenericType[]			exceptions;
 
 	// class: super interfaces*
 	// field: type
@@ -70,10 +70,10 @@
 
 	public String toString() {
 		StringBuilder sb = new StringBuilder();
-		
-		if ( typeVars != null && typeVars.length !=0) {
+
+		if (typeVars != null && typeVars.length != 0) {
 			sb.append("<");
-			for ( GenericParameter v : typeVars) {
+			for (GenericParameter v : typeVars) {
 				sb.append(v);
 			}
 			sb.append(">");
@@ -81,8 +81,8 @@
 		sb.append(access.toString());
 		sb.append(" ");
 		sb.append(kind.toString());
-		sb.append( " ");
-		sb.append( name );
+		sb.append(" ");
+		sb.append(name);
 		return sb.toString();
 	}
 
@@ -124,7 +124,7 @@
 	}
 
 	static public String classIdentity(String name2) {
-		return name2.replace('.','/');
+		return name2.replace('.', '/');
 	}
 
 	static public String methodIdentity(String name, String descriptor) {
@@ -140,18 +140,18 @@
 	}
 
 	public void cleanRoot() {
-		Iterator<Map.Entry<String, Scope>> i = children.entrySet().iterator();
+		Iterator<Map.Entry<String,Scope>> i = children.entrySet().iterator();
 		while (i.hasNext()) {
-			Map.Entry<String, Scope> entry = i.next();
+			Map.Entry<String,Scope> entry = i.next();
 			if (!entry.getValue().isTop())
 				i.remove();
 		}
 	}
 
 	public void prune(EnumSet<Access> level) {
-		Iterator<Map.Entry<String, Scope>> i = children.entrySet().iterator();
+		Iterator<Map.Entry<String,Scope>> i = children.entrySet().iterator();
 		while (i.hasNext()) {
-			Map.Entry<String, Scope> entry = i.next();
+			Map.Entry<String,Scope> entry = i.next();
 			if (!level.contains(entry.getValue().access))
 				i.remove();
 			else
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/SignatureGenerator.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/SignatureGenerator.java
index 9b31f7f..6567ef8 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/SignatureGenerator.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/SignatureGenerator.java
@@ -1,125 +1,126 @@
 package aQute.bnd.compatibility;
 
-
 public class SignatureGenerator {
-//	enum ACCESS {
-////		PUBLIC("+"), PROTECTED("|"), PACKAGE_PRIVATE(""), PRIVATE("-");
-////		final String	repr;
-////
-////		ACCESS(String s) {
-////			repr = s;
-////		}
-////		
-////		public String toString() {
-////			return repr;
-////		}
-//	}
-//
-//	public static void main(String args[]) throws Exception {
-//		final PrintStream out = System.err;
-//
-//		Clazz c = new Clazz("x", new FileResource(new File(
-//				"src/aQute/bnd/compatibility/SignatureGenerator.class")));
-//		c.parseClassFileWithCollector(new ClassDataCollector() {
-//			public void classBegin(int access, String name) {
-//				out.print(name);
-//				out.println(access(access));
-//			}
-//
-//			private ACCESS access(int access) {
-//				if (Modifier.isPublic(access))
-//					return ACCESS.PUBLIC;
-//
-//				throw new IllegalArgumentException();
-//			}
-//
-//			public void extendsClass(String name) {
-//			}
-//
-//			public void implementsInterfaces(String name[]) {
-//			}
-//
-//			public void addReference(String token) {
-//			}
-//
-//			public void annotation(Annotation annotation) {
-//			}
-//
-//			public void parameter(int p) {
-//			}
-//
-//			public void method(Clazz.MethodDef defined) {
-//				if (defined.isConstructor())
-//					constructor(defined.access, defined.descriptor);
-//				else
-//					method(defined.access, defined.name, defined.descriptor);
-//			}
-//
-//			public void field(Clazz.FieldDef defined) {
-//				field(defined.access, defined.name, defined.descriptor);
-//			}
-//
-//			public void reference(Clazz.MethodDef referenced) {
-//			}
-//
-//			public void reference(Clazz.FieldDef referenced) {
-//			}
-//
-//			public void classEnd() {
-//			}
-//
-//			@Deprecated// Will really be removed!
-//			public void field(int access, String name, String descriptor) {
-//			}
-//
-//			@Deprecated// Will really be removed!
-//			public void constructor(int access, String descriptor) {
-//			}
-//
-//			@Deprecated// Will really be removed!
-//			public void method(int access, String name, String descriptor) {
-//			}
-//
-//			/**
-//			 * The EnclosingMethod attribute
-//			 * 
-//			 * @param cName
-//			 *            The name of the enclosing class, never null. Name is
-//			 *            with slashes.
-//			 * @param mName
-//			 *            The name of the enclosing method in the class with
-//			 *            cName or null
-//			 * @param mDescriptor
-//			 *            The descriptor of this type
-//			 */
-//			public void enclosingMethod(String cName, String mName, String mDescriptor) {
-//
-//			}
-//
-//			/**
-//			 * The InnerClass attribute
-//			 * 
-//			 * @param innerClass
-//			 *            The name of the inner class (with slashes). Can be
-//			 *            null.
-//			 * @param outerClass
-//			 *            The name of the outer class (with slashes) Can be
-//			 *            null.
-//			 * @param innerName
-//			 *            The name inside the outer class, can be null.
-//			 * @param modifiers
-//			 *            The access flags
-//			 */
-//			public void innerClass(String innerClass, String outerClass, String innerName,
-//					int innerClassAccessFlags) {
-//			}
-//
-//			public void signature(String signature) {
-//			}
-//
-//			public void constant(Object object) {
-//			}
-//
-//		});
-//	}
+	// enum ACCESS {
+	// // PUBLIC("+"), PROTECTED("|"), PACKAGE_PRIVATE(""), PRIVATE("-");
+	// // final String repr;
+	// //
+	// // ACCESS(String s) {
+	// // repr = s;
+	// // }
+	// //
+	// // public String toString() {
+	// // return repr;
+	// // }
+	// }
+	//
+	// public static void main(String args[]) throws Exception {
+	// final PrintStream out = System.err;
+	//
+	// Clazz c = new Clazz("x", new FileResource(new File(
+	// "src/aQute/bnd/compatibility/SignatureGenerator.class")));
+	// c.parseClassFileWithCollector(new ClassDataCollector() {
+	// public void classBegin(int access, String name) {
+	// out.print(name);
+	// out.println(access(access));
+	// }
+	//
+	// private ACCESS access(int access) {
+	// if (Modifier.isPublic(access))
+	// return ACCESS.PUBLIC;
+	//
+	// throw new IllegalArgumentException();
+	// }
+	//
+	// public void extendsClass(String name) {
+	// }
+	//
+	// public void implementsInterfaces(String name[]) {
+	// }
+	//
+	// public void addReference(String token) {
+	// }
+	//
+	// public void annotation(Annotation annotation) {
+	// }
+	//
+	// public void parameter(int p) {
+	// }
+	//
+	// public void method(Clazz.MethodDef defined) {
+	// if (defined.isConstructor())
+	// constructor(defined.access, defined.descriptor);
+	// else
+	// method(defined.access, defined.name, defined.descriptor);
+	// }
+	//
+	// public void field(Clazz.FieldDef defined) {
+	// field(defined.access, defined.name, defined.descriptor);
+	// }
+	//
+	// public void reference(Clazz.MethodDef referenced) {
+	// }
+	//
+	// public void reference(Clazz.FieldDef referenced) {
+	// }
+	//
+	// public void classEnd() {
+	// }
+	//
+	// @Deprecated// Will really be removed!
+	// public void field(int access, String name, String descriptor) {
+	// }
+	//
+	// @Deprecated// Will really be removed!
+	// public void constructor(int access, String descriptor) {
+	// }
+	//
+	// @Deprecated// Will really be removed!
+	// public void method(int access, String name, String descriptor) {
+	// }
+	//
+	// /**
+	// * The EnclosingMethod attribute
+	// *
+	// * @param cName
+	// * The name of the enclosing class, never null. Name is
+	// * with slashes.
+	// * @param mName
+	// * The name of the enclosing method in the class with
+	// * cName or null
+	// * @param mDescriptor
+	// * The descriptor of this type
+	// */
+	// public void enclosingMethod(String cName, String mName, String
+	// mDescriptor) {
+	//
+	// }
+	//
+	// /**
+	// * The InnerClass attribute
+	// *
+	// * @param innerClass
+	// * The name of the inner class (with slashes). Can be
+	// * null.
+	// * @param outerClass
+	// * The name of the outer class (with slashes) Can be
+	// * null.
+	// * @param innerName
+	// * The name inside the outer class, can be null.
+	// * @param modifiers
+	// * The access flags
+	// */
+	// public void innerClass(String innerClass, String outerClass, String
+	// innerName,
+	// int innerClassAccessFlags) {
+	// }
+	//
+	// public void signature(String signature) {
+	// }
+	//
+	// public void constant(Object object) {
+	// }
+	//
+	// });
+	// }
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/compatibility/Signatures.java b/bundleplugin/src/main/java/aQute/bnd/compatibility/Signatures.java
index 2b9ce53..18b89a9 100644
--- a/bundleplugin/src/main/java/aQute/bnd/compatibility/Signatures.java
+++ b/bundleplugin/src/main/java/aQute/bnd/compatibility/Signatures.java
@@ -29,26 +29,23 @@
  * @version $Id$
  */
 public class Signatures {
-	
-	
+
 	/**
-	 * Check if the environment has generics, i.e. later than 
-	 * Java 5 VM.
+	 * Check if the environment has generics, i.e. later than Java 5 VM.
 	 * 
 	 * @return true if generics are supported
 	 * @throws Exception
 	 */
 	public boolean hasGenerics() throws Exception {
 		try {
-			call( Signatures.class, "getGenericSuperClass");
+			call(Signatures.class, "getGenericSuperClass");
 			return true;
-		} catch( NoSuchMethodException mnfe ) {
+		}
+		catch (NoSuchMethodException mnfe) {
 			return false;
 		}
 	}
-	
-	
-	
+
 	/**
 	 * Helper class to track an index in a string.
 	 */
@@ -72,8 +69,7 @@
 		char take(char c) {
 			char x = s.charAt(i++);
 			if (c != x)
-				throw new IllegalStateException("get() expected " + c
-						+ " but got + " + x);
+				throw new IllegalStateException("get() expected " + c + " but got + " + x);
 			return x;
 		}
 
@@ -92,20 +88,21 @@
 
 	/**
 	 * Calculate the generic signature of a Class,Method,Field, or Constructor.
+	 * 
 	 * @param f
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	public String getSignature(Object c) throws Exception {
-		if( c instanceof Class<?>)
-			return getSignature((Class<?>)c);
-		if( c instanceof Constructor<?>)
-			return getSignature((Constructor<?>)c);
-		if( c instanceof Method)
-			return getSignature((Method)c);
-		if( c instanceof Field)
-			return getSignature((Field)c);
-		
+		if (c instanceof Class< ? >)
+			return getSignature((Class< ? >) c);
+		if (c instanceof Constructor< ? >)
+			return getSignature((Constructor< ? >) c);
+		if (c instanceof Method)
+			return getSignature((Method) c);
+		if (c instanceof Field)
+			return getSignature((Field) c);
+
 		throw new IllegalArgumentException(c.toString());
 	}
 
@@ -116,16 +113,15 @@
 	 * 	  class        ::= declaration? reference reference*
 	 * </pre>
 	 * 
-	 * 
 	 * @param f
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	public String getSignature(Class< ? > c) throws Exception {
 		StringBuilder sb = new StringBuilder();
 		declaration(sb, c);
 		reference(sb, call(c, "getGenericSuperclass"));
-		for (Object type : (Object[]) call(c,"getGenericInterfaces")) {
+		for (Object type : (Object[]) call(c, "getGenericInterfaces")) {
 			reference(sb, type);
 		}
 		return sb.toString();
@@ -140,17 +136,17 @@
 	 * 
 	 * @param c
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	public String getSignature(Method m) throws Exception {
 		StringBuilder sb = new StringBuilder();
 		declaration(sb, m);
 		sb.append('(');
-		for (Object type : (Object[]) call(m,"getGenericParameterTypes")) {
+		for (Object type : (Object[]) call(m, "getGenericParameterTypes")) {
 			reference(sb, type);
 		}
 		sb.append(')');
-		reference(sb, call(m,"getGenericReturnType"));
+		reference(sb, call(m, "getGenericReturnType"));
 		return sb.toString();
 	}
 
@@ -164,13 +160,13 @@
 	 * 
 	 * @param c
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	public String getSignature(Constructor< ? > c) throws Exception {
 		StringBuilder sb = new StringBuilder();
 		declaration(sb, c);
 		sb.append('(');
-		for (Object type : (Object[]) call(c,"getGenericParameterTypes")) {
+		for (Object type : (Object[]) call(c, "getGenericParameterTypes")) {
 			reference(sb, type);
 		}
 		sb.append(')');
@@ -187,11 +183,11 @@
 	 * 
 	 * @param c
 	 * @return
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	public String getSignature(Field f) throws Exception {
 		StringBuilder sb = new StringBuilder();
-		Object t = call(f,"getGenericType");
+		Object t = call(f, "getGenericType");
 		reference(sb, t);
 		return sb.toString();
 	}
@@ -215,13 +211,13 @@
  * @throws Exception 
 	 */
 	private void declaration(StringBuilder sb, Object gd) throws Exception {
-		Object[] typeParameters = (Object[]) call(gd,"getTypeParameters");
+		Object[] typeParameters = (Object[]) call(gd, "getTypeParameters");
 		if (typeParameters.length > 0) {
 			sb.append('<');
 			for (Object tv : typeParameters) {
-				sb.append( call(tv,"getName"));
+				sb.append(call(tv, "getName"));
 
-				Object[] bounds = (Object[]) call(tv,"getBounds");
+				Object[] bounds = (Object[]) call(tv, "getBounds");
 				if (bounds.length > 0 && isInterface(bounds[0])) {
 					sb.append(':');
 				}
@@ -237,22 +233,22 @@
 	/**
 	 * Verify that the type is an interface.
 	 * 
-	 * @param type the type to check.
+	 * @param type
+	 *            the type to check.
 	 * @return true if this is a class that is an interface or a Parameterized
 	 *         Type that is an interface
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	private boolean isInterface(Object type) throws Exception {
 		if (type instanceof Class)
 			return (((Class< ? >) type).isInterface());
 
-		if ( isInstance(type.getClass(), "java.lang.reflect.ParameterizedType"))
-			return isInterface(call(type,"getRawType"));
+		if (isInstance(type.getClass(), "java.lang.reflect.ParameterizedType"))
+			return isInterface(call(type, "getRawType"));
 
 		return false;
 	}
 
-
 /**
 	 * This is the heart of the signature builder. A reference is used
 	 * in a lot of places. It referes to another type.
@@ -271,80 +267,65 @@
 	 */
 	private void reference(StringBuilder sb, Object t) throws Exception {
 
-		if ( isInstance(t.getClass(),"java.lang.reflect.ParameterizedType")) {
+		if (isInstance(t.getClass(), "java.lang.reflect.ParameterizedType")) {
 			sb.append('L');
 			parameterizedType(sb, t);
 			sb.append(';');
 			return;
-		}
-		else
-			if ( isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) {
-				sb.append('[');
-				reference(sb, call(t,"getGenericComponentType"));
-			}
-			else
-				if ( isInstance(t.getClass(), "java.lang.reflect.WildcardType")) {
-					Object[] lowerBounds = (Object[]) call(t, "getLowerBounds");
-					Object[] upperBounds = (Object[]) call(t, "getUpperBounds");
+		} else if (isInstance(t.getClass(), "java.lang.reflect.GenericArrayType")) {
+			sb.append('[');
+			reference(sb, call(t, "getGenericComponentType"));
+		} else if (isInstance(t.getClass(), "java.lang.reflect.WildcardType")) {
+			Object[] lowerBounds = (Object[]) call(t, "getLowerBounds");
+			Object[] upperBounds = (Object[]) call(t, "getUpperBounds");
 
-					if (upperBounds.length == 1
-							&& upperBounds[0] == Object.class)
-						upperBounds = new Object[0];
+			if (upperBounds.length == 1 && upperBounds[0] == Object.class)
+				upperBounds = new Object[0];
 
-					if (upperBounds.length != 0) {
-						// extend
-						for (Object upper : upperBounds) {
-							sb.append('+');
-							reference(sb, upper);
-						}
-					}
-					else
-						if (lowerBounds.length != 0) {
-							// super, can only be one by the language
-							for (Object lower : lowerBounds) {
-								sb.append('-');
-								reference(sb, lower);
-							}
-						}
-						else
-							sb.append('*');
+			if (upperBounds.length != 0) {
+				// extend
+				for (Object upper : upperBounds) {
+					sb.append('+');
+					reference(sb, upper);
 				}
-				else
-					if ( isInstance(t.getClass(),"java.lang.reflect.TypeVariable")) {
-						sb.append('T');
-						sb.append( call(t,"getName"));
-						sb.append(';');
-					}
-					else
-						if (t instanceof Class< ? >) {
-							Class< ? > c = (Class< ? >) t;
-							if (c.isPrimitive()) {
-								sb.append(primitive(c));
-							}
-							else {
-								sb.append('L');
-								String name = c.getName().replace('.', '/');
-								sb.append(name);
-								sb.append(';');
-							}
-						}
+			} else if (lowerBounds.length != 0) {
+				// super, can only be one by the language
+				for (Object lower : lowerBounds) {
+					sb.append('-');
+					reference(sb, lower);
+				}
+			} else
+				sb.append('*');
+		} else if (isInstance(t.getClass(), "java.lang.reflect.TypeVariable")) {
+			sb.append('T');
+			sb.append(call(t, "getName"));
+			sb.append(';');
+		} else if (t instanceof Class< ? >) {
+			Class< ? > c = (Class< ? >) t;
+			if (c.isPrimitive()) {
+				sb.append(primitive(c));
+			} else {
+				sb.append('L');
+				String name = c.getName().replace('.', '/');
+				sb.append(name);
+				sb.append(';');
+			}
+		}
 	}
 
 	/**
-	 * Creates the signature for a Parameterized Type.
-	 * 
-	 * A Parameterized Type has a raw class and a set of type variables.
+	 * Creates the signature for a Parameterized Type. A Parameterized Type has
+	 * a raw class and a set of type variables.
 	 * 
 	 * @param sb
 	 * @param pt
-	 * @throws Exception 
+	 * @throws Exception
 	 */
 	private void parameterizedType(StringBuilder sb, Object pt) throws Exception {
-		Object owner = call(pt,"getOwnerType");
-		String name = ((Class< ? >) call(pt,"getRawType")).getName()
-				.replace('.', '/');
+		Object owner = call(pt, "getOwnerType");
+		String name = ((Class< ? >) call(pt, "getRawType")).getName().replace('.', '/');
 		if (owner != null) {
-			if ( isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType"))
+			if (isInstance(owner.getClass(), "java.lang.reflect.ParameterizedType"))
 				parameterizedType(sb, owner);
 			else
 				sb.append(((Class< ? >) owner).getName().replace('.', '/'));
@@ -355,7 +336,7 @@
 		sb.append(name);
 
 		sb.append('<');
-		for (Object parameterType : (Object[]) call(pt,"getActualTypeArguments")) {
+		for (Object parameterType : (Object[]) call(pt, "getActualTypeArguments")) {
 			reference(sb, parameterType);
 		}
 		sb.append('>');
@@ -365,40 +346,31 @@
 	/**
 	 * Handle primitives, these need to be translated to a single char.
 	 * 
-	 * @param type the primitive class
+	 * @param type
+	 *            the primitive class
 	 * @return the single char associated with the primitive
 	 */
 	private char primitive(Class< ? > type) {
 		if (type == byte.class)
 			return 'B';
+		else if (type == char.class)
+			return 'C';
+		else if (type == double.class)
+			return 'D';
+		else if (type == float.class)
+			return 'F';
+		else if (type == int.class)
+			return 'I';
+		else if (type == long.class)
+			return 'J';
+		else if (type == short.class)
+			return 'S';
+		else if (type == boolean.class)
+			return 'Z';
+		else if (type == void.class)
+			return 'V';
 		else
-			if (type == char.class)
-				return 'C';
-			else
-				if (type == double.class)
-					return 'D';
-				else
-					if (type == float.class)
-						return 'F';
-					else
-						if (type == int.class)
-							return 'I';
-						else
-							if (type == long.class)
-								return 'J';
-							else
-								if (type == short.class)
-									return 'S';
-								else
-									if (type == boolean.class)
-										return 'Z';
-									else
-										if (type == void.class)
-											return 'V';
-										else
-											throw new IllegalArgumentException(
-													"Unknown primitive type "
-															+ type);
+			throw new IllegalArgumentException("Unknown primitive type " + type);
 	}
 
 	/**
@@ -412,7 +384,7 @@
 
 	public String normalize(String signature) {
 		StringBuilder sb = new StringBuilder();
-		Map<String, String> map = new HashMap<String, String>();
+		Map<String,String> map = new HashMap<String,String>();
 		Rover rover = new Rover(signature);
 		declare(sb, map, rover);
 
@@ -424,8 +396,7 @@
 			}
 			sb.append(rover.take(')'));
 			reference(sb, map, rover, true); // return type
-		}
-		else {
+		} else {
 			// field or class
 			reference(sb, map, rover, true); // field type or super class
 			while (!rover.isEOF()) {
@@ -436,58 +407,51 @@
 	}
 
 	/**
-	 * The heart of the routine. Handle a reference to a type. Can be
-	 * an array, a class, a type variable, or a primitive.
+	 * The heart of the routine. Handle a reference to a type. Can be an array,
+	 * a class, a type variable, or a primitive.
 	 * 
 	 * @param sb
 	 * @param map
 	 * @param rover
 	 * @param primitivesAllowed
 	 */
-	private void reference(StringBuilder sb, Map<String, String> map,
-			Rover rover, boolean primitivesAllowed) {
+	private void reference(StringBuilder sb, Map<String,String> map, Rover rover, boolean primitivesAllowed) {
 
 		char type = rover.take();
 		sb.append(type);
 
 		if (type == '[') {
 			reference(sb, map, rover, true);
-		}
-		else
-			if (type == 'L') {
-				String fqnb = rover.upTo("<;.");
-				sb.append(fqnb);
+		} else if (type == 'L') {
+			String fqnb = rover.upTo("<;.");
+			sb.append(fqnb);
+			body(sb, map, rover);
+			while (rover.peek() == '.') {
+				sb.append(rover.take('.'));
+				sb.append(rover.upTo("<;."));
 				body(sb, map, rover);
-				while (rover.peek() == '.') {
-					sb.append(rover.take('.'));
-					sb.append(rover.upTo("<;."));
-					body(sb, map, rover);
-				}
-				sb.append(rover.take(';'));
 			}
-			else
-				if (type == 'T') {
-					String name = rover.upTo(";");
-					name = assign(map, name);
-					sb.append(name);
-					sb.append(rover.take(';'));
-				}
-				else {
-					if (!primitivesAllowed)
-						throw new IllegalStateException(
-								"Primitives are not allowed without an array");
-				}
+			sb.append(rover.take(';'));
+		} else if (type == 'T') {
+			String name = rover.upTo(";");
+			name = assign(map, name);
+			sb.append(name);
+			sb.append(rover.take(';'));
+		} else {
+			if (!primitivesAllowed)
+				throw new IllegalStateException("Primitives are not allowed without an array");
+		}
 	}
 
 	/**
-	 * Because classes can be nested the body handles the part that can 
-	 * be nested, the reference handles the enclosing L ... ;
+	 * Because classes can be nested the body handles the part that can be
+	 * nested, the reference handles the enclosing L ... ;
 	 * 
 	 * @param sb
 	 * @param map
 	 * @param rover
 	 */
-	private void body(StringBuilder sb, Map<String, String> map, Rover rover) {
+	private void body(StringBuilder sb, Map<String,String> map, Rover rover) {
 		if (rover.peek() == '<') {
 			sb.append(rover.take('<'));
 			while (rover.peek() != '>') {
@@ -528,7 +492,7 @@
 	 * @param map
 	 * @param rover
 	 */
-	private void declare(StringBuilder sb, Map<String, String> map, Rover rover) {
+	private void declare(StringBuilder sb, Map<String,String> map, Rover rover) {
 		char c = rover.peek();
 		if (c == '<') {
 			sb.append(rover.take('<'));
@@ -554,14 +518,16 @@
 	}
 
 	/**
-	 * Handles the assignment of type variables to index names so that
-	 * we have a normalized name for each type var.
+	 * Handles the assignment of type variables to index names so that we have a
+	 * normalized name for each type var.
 	 * 
-	 * @param map the map with variables.
-	 * @param name The name of the variable
+	 * @param map
+	 *            the map with variables.
+	 * @param name
+	 *            The name of the variable
 	 * @return the index name, like _1
 	 */
-	private String assign(Map<String, String> map, String name) {
+	private String assign(Map<String,String> map, String name) {
 		if (map.containsKey(name))
 			return map.get(name);
 		else {
@@ -571,23 +537,23 @@
 		}
 	}
 
-	private boolean isInstance(Class<?> type, String string) {
-		if ( type == null)
+	private boolean isInstance(Class< ? > type, String string) {
+		if (type == null)
 			return false;
-		
-		if ( type.getName().equals(string))
+
+		if (type.getName().equals(string))
 			return true;
-		
-		if ( isInstance( type.getSuperclass(), string))
+
+		if (isInstance(type.getSuperclass(), string))
 			return true;
-		
-		for ( Class<?> intf : type.getInterfaces()) {
-			if ( isInstance(intf,string))
+
+		for (Class< ? > intf : type.getInterfaces()) {
+			if (isInstance(intf, string))
 				return true;
 		}
 		return false;
 	}
-	
+
 	private Object call(Object gd, String string) throws Exception {
 		Method m = gd.getClass().getMethod(string);
 		return m.invoke(gd);
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java b/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
index 35cec3f..d0b915c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/AnnotationReader.java
@@ -47,7 +47,7 @@
 	MethodDef					method;
 	TypeRef						className;
 	Analyzer					analyzer;
-	MultiMap<String, String>	methods					= new MultiMap<String, String>();
+	MultiMap<String,String>		methods					= new MultiMap<String,String>();
 	TypeRef						extendsClass;
 	boolean						inherit;
 	boolean						baseclass				= true;
@@ -77,29 +77,26 @@
 
 				Clazz ec = analyzer.findClass(extendsClass);
 				if (ec == null) {
-					analyzer.error("Missing super class for DS annotations: " + extendsClass
-							+ " from " + clazz.getClassName());
+					analyzer.error("Missing super class for DS annotations: " + extendsClass + " from "
+							+ clazz.getClassName());
 				} else {
 					ec.parseClassFileWithCollector(this);
 				}
 			}
 		}
 		for (ReferenceDef rdef : component.references.values()) {
-			rdef.unbind = referredMethod(analyzer, rdef, rdef.unbind, "add(.*)", "remove$1",
-					"(.*)", "un$1");
-			rdef.updated = referredMethod(analyzer, rdef, rdef.updated, "(add|set|bind)(.*)",
-					"updated$2", "(.*)", "updated$1");
+			rdef.unbind = referredMethod(analyzer, rdef, rdef.unbind, "add(.*)", "remove$1", "(.*)", "un$1");
+			rdef.updated = referredMethod(analyzer, rdef, rdef.updated, "(add|set|bind)(.*)", "updated$2", "(.*)",
+					"updated$1");
 		}
 		return component;
 	}
 
 	/**
-	 * 
 	 * @param analyzer
 	 * @param rdef
 	 */
-	protected String referredMethod(Analyzer analyzer, ReferenceDef rdef, String value,
-			String... matches) {
+	protected String referredMethod(Analyzer analyzer, ReferenceDef rdef, String value, String... matches) {
 		if (value == null) {
 			String bind = rdef.bind;
 			for (int i = 0; i < matches.length; i += 2) {
@@ -117,8 +114,7 @@
 				Matcher matcher = BINDDESCRIPTOR.matcher(descriptor);
 				if (matcher.matches()) {
 					String type = matcher.group(2);
-					if (rdef.service.equals(Clazz.objectDescriptorToFQN(type))
-							|| type.equals("Ljava/util/Map;")
+					if (rdef.service.equals(Clazz.objectDescriptorToFQN(type)) || type.equals("Ljava/util/Map;")
 							|| type.equals("Lorg/osgi/framework/ServiceReference;")) {
 
 						return value;
@@ -145,7 +141,8 @@
 				doModified();
 			else if (a instanceof Reference)
 				doReference((Reference) a, annotation);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			e.printStackTrace();
 			analyzer.error("During generation of a component on class %s, exception %s", clazz, e);
 		}
@@ -187,7 +184,7 @@
 
 		if (def.name == null) {
 			Matcher m = BINDNAME.matcher(method.getName());
-			if ( m.matches() )
+			if (m.matches())
 				def.name = m.group(2);
 			else
 				analyzer.error("Invalid name for bind method %s", method.getName());
@@ -315,8 +312,7 @@
 					String value = m.group(4);
 					component.property.add(key, value);
 				} else
-					throw new IllegalArgumentException("Malformed property '" + p
-							+ "' on component: " + className);
+					throw new IllegalArgumentException("Malformed property '" + p + "' on component: " + className);
 			}
 		}
 	}
@@ -325,15 +321,18 @@
 	 * Are called during class parsing
 	 */
 
-	@Override public void classBegin(int access, TypeRef name) {
+	@Override
+	public void classBegin(int access, TypeRef name) {
 		className = name;
 	}
 
-	@Override public void implementsInterfaces(TypeRef[] interfaces) {
+	@Override
+	public void implementsInterfaces(TypeRef[] interfaces) {
 		this.interfaces = interfaces;
 	}
 
-	@Override public void method(Clazz.MethodDef method) {
+	@Override
+	public void method(Clazz.MethodDef method) {
 		int access = method.getAccess();
 
 		if (Modifier.isAbstract(access) || Modifier.isStatic(access))
@@ -346,7 +345,8 @@
 		methods.add(method.getName(), method.getDescriptor().toString());
 	}
 
-	@Override public void extendsClass(TypeRef name) {
+	@Override
+	public void extendsClass(TypeRef name) {
 		this.extendsClass = name;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/ComponentDef.java b/bundleplugin/src/main/java/aQute/bnd/component/ComponentDef.java
index 75b7b73..edcd909 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/ComponentDef.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/ComponentDef.java
@@ -21,8 +21,8 @@
 class ComponentDef {
 	final static String				NAMESPACE_STEM	= "http://www.osgi.org/xmlns/scr";
 	final List<String>				properties		= new ArrayList<String>();
-	final MultiMap<String, String>	property		= new MultiMap<String, String>();
-	final Map<String, ReferenceDef>	references		= new TreeMap<String, ReferenceDef>();
+	final MultiMap<String,String>	property		= new MultiMap<String,String>();
+	final Map<String,ReferenceDef>	references		= new TreeMap<String,ReferenceDef>();
 
 	Version							version			= AnnotationReader.V1_1;
 	String							name;
@@ -75,7 +75,7 @@
 		if (configurationPid != null)
 			version = ReferenceDef.max(version, AnnotationReader.V1_2);
 
-		for (Map.Entry<String, List<String>> kvs : property.entrySet()) {
+		for (Map.Entry<String,List<String>> kvs : property.entrySet()) {
 			Tag property = new Tag("property");
 			String name = kvs.getKey();
 			String type = null;
@@ -127,8 +127,7 @@
 			component.addAttribute("servicefactory", servicefactory);
 
 		if (configurationPolicy != null)
-			component.addAttribute("configuration-policy", configurationPolicy.toString()
-					.toLowerCase());
+			component.addAttribute("configuration-policy", configurationPolicy.toString().toLowerCase());
 
 		if (enabled != null)
 			component.addAttribute("enabled", enabled);
@@ -185,7 +184,7 @@
 			return v;
 
 		try {
-			Class<?> c = Class.forName("java.lang." + type);
+			Class< ? > c = Class.forName("java.lang." + type);
 			if (c == String.class)
 				return v;
 
@@ -194,13 +193,17 @@
 				c = Integer.class;
 			Method m = c.getMethod("valueOf", String.class);
 			m.invoke(null, v);
-		} catch (ClassNotFoundException e) {
+		}
+		catch (ClassNotFoundException e) {
 			analyzer.error("Invalid data type %s", type);
-		} catch (NoSuchMethodException e) {
+		}
+		catch (NoSuchMethodException e) {
 			analyzer.error("Cannot convert data %s to type %s", v, type);
-		} catch (NumberFormatException e) {
+		}
+		catch (NumberFormatException e) {
 			analyzer.error("Not a valid number %s for %s, %s", v, type, e.getMessage());
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			analyzer.error("Cannot convert data %s to type %s", v, type);
 		}
 		return v;
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java b/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
index 90a20af..0fd4011 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/DSAnnotations.java
@@ -8,23 +8,21 @@
 
 /**
  * Analyze the class space for any classes that have an OSGi annotation for DS.
- * 
  */
 public class DSAnnotations implements AnalyzerPlugin {
 
 	public boolean analyzeJar(Analyzer analyzer) throws Exception {
-		Parameters header = OSGiHeader.parseHeader(analyzer
-				.getProperty(Constants.DSANNOTATIONS));
-		if ( header.size()==0)
+		Parameters header = OSGiHeader.parseHeader(analyzer.getProperty(Constants.DSANNOTATIONS));
+		if (header.size() == 0)
 			return false;
-		
+
 		Instructions instructions = new Instructions(header);
 		Set<Clazz> list = new HashSet<Clazz>(analyzer.getClassspace().values());
 		String sc = analyzer.getProperty(Constants.SERVICE_COMPONENT);
 		List<String> names = new ArrayList<String>();
-		if ( sc != null && sc.trim().length() > 0)
+		if (sc != null && sc.trim().length() > 0)
 			names.add(sc);
-		
+
 		for (Iterator<Clazz> i = list.iterator(); i.hasNext();) {
 			for (Instruction instruction : instructions.keySet()) {
 				Clazz c = i.next();
@@ -38,8 +36,7 @@
 							definition.prepare(analyzer);
 							String name = "OSGI-INF/" + definition.name + ".xml";
 							names.add(name);
-							analyzer.getJar().putResource(name,
-									new TagResource(definition.getTag()));
+							analyzer.getJar().putResource(name, new TagResource(definition.getTag()));
 						}
 					}
 				}
diff --git a/bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java b/bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java
index 162bdb4..7dfc8b0 100644
--- a/bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java
+++ b/bundleplugin/src/main/java/aQute/bnd/component/ReferenceDef.java
@@ -11,7 +11,7 @@
  */
 
 class ReferenceDef {
-	Version					version = AnnotationReader.V1_1;
+	Version					version	= AnnotationReader.V1_1;
 	String					name;
 	String					service;
 	ReferenceCardinality	cardinality;
@@ -25,25 +25,26 @@
 	/**
 	 * Prepare the reference, will check for any errors.
 	 * 
-	 * @param analyzer the analyzer to report errors to.
-	 * @throws Exception 
+	 * @param analyzer
+	 *            the analyzer to report errors to.
+	 * @throws Exception
 	 */
 	public void prepare(Analyzer analyzer) throws Exception {
 		if (name == null)
 			analyzer.error("No name for a reference");
-		
-		if ((updated != null && !updated.equals("-")) || policyOption!= null)
+
+		if ((updated != null && !updated.equals("-")) || policyOption != null)
 			version = max(version, AnnotationReader.V1_2);
 
 		if (target != null) {
 			String error = Verifier.validateFilter(target);
-			if ( error != null)
+			if (error != null)
 				analyzer.error("Invalid target filter %s for %s", target, name);
 		}
 
-		if ( service == null)
+		if (service == null)
 			analyzer.error("No interface specified on %s", name);
-		
+
 	}
 
 	/**
@@ -71,12 +72,12 @@
 		if (unbind != null && !"-".equals(unbind))
 			ref.addAttribute("unbind", unbind);
 
-		if (updated != null && !"-".equals(updated)) 
+		if (updated != null && !"-".equals(updated))
 			ref.addAttribute("updated", updated);
 
-		if ( policyOption != null)
+		if (policyOption != null)
 			ref.addAttribute("policy-option", policyOption.toString());
-		
+
 		return ref;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/Baseline.java b/bundleplugin/src/main/java/aQute/bnd/differ/Baseline.java
index eee3e27..3228b7b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/differ/Baseline.java
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/Baseline.java
@@ -14,7 +14,6 @@
 
 /**
  * This class maintains
- * 
  */
 public class Baseline {
 
@@ -22,18 +21,19 @@
 		public String				packageName;
 		public Diff					packageDiff;
 		public Collection<String>	providers;
-		public Map<String, String>	attributes;
+		public Map<String,String>	attributes;
 		public Version				newerVersion;
 		public Version				olderVersion;
 		public Version				suggestedVersion;
 		public Version				suggestedIfProviders;
 		public boolean				mismatch;
-		public String				warning="";
+		public String				warning	= "";
 
 	}
 
 	final Differ	differ;
 	final Reporter	bnd;
+	Diff			diff;
 
 	public Baseline(Reporter bnd, Differ differ) throws IOException {
 		this.differ = differ;
@@ -51,25 +51,24 @@
 	 *         packages (also the ones that were ok).
 	 * @throws Exception
 	 */
-	public Set<Info> baseline(Jar newer, Jar older, Instructions packageFilters)
-			throws Exception {
+	public Set<Info> baseline(Jar newer, Jar older, Instructions packageFilters) throws Exception {
 		Tree n = differ.tree(newer);
 		Parameters nExports = getExports(newer);
 		Tree o = differ.tree(older);
 		Parameters oExports = getExports(older);
-		if ( packageFilters == null)
+		if (packageFilters == null)
 			packageFilters = new Instructions();
-		
+
 		return baseline(n, nExports, o, oExports, packageFilters);
 	}
 
-	public Set<Info> baseline(Tree n, Parameters nExports, Tree o,
-			Parameters oExports, Instructions packageFilters)
+	public Set<Info> baseline(Tree n, Parameters nExports, Tree o, Parameters oExports, Instructions packageFilters)
 			throws Exception {
-		Diff diff = n.diff(o).get("<api>");
+		diff = n.diff(o);
+		Diff apiDiff = diff.get("<api>");
 		Set<Info> infos = Create.set();
 
-		for (Diff pdiff : diff.getChildren()) {
+		for (Diff pdiff : apiDiff.getChildren()) {
 			if (pdiff.getType() != Type.PACKAGE) // Just packages
 				continue;
 
@@ -85,13 +84,13 @@
 			info.packageDiff = pdiff;
 			info.packageName = pdiff.getName();
 			info.attributes = nExports.get(info.packageName);
-			bnd.trace("attrs for %s %s", info.packageName,info.attributes);
+			bnd.trace("attrs for %s %s", info.packageName, info.attributes);
 
 			info.newerVersion = getVersion(info.attributes);
 			info.olderVersion = getVersion(oExports.get(info.packageName));
 			if (pdiff.getDelta() == Delta.UNCHANGED) {
 				info.suggestedVersion = info.olderVersion;
-				if( !info.newerVersion.equals(info.olderVersion)) {
+				if (!info.newerVersion.equals(info.olderVersion)) {
 					info.warning += "No difference but versions are equal";
 				}
 			} else if (pdiff.getDelta() == Delta.REMOVED) {
@@ -122,8 +121,7 @@
 						// by making them providers
 						Delta tryDelta = pdiff.getDelta(new Ignore() {
 							public boolean contains(Diff diff) {
-								if (diff.getType() == Type.INTERFACE
-										&& diff.getDelta() == Delta.MAJOR) {
+								if (diff.getType() == Type.INTERFACE && diff.getDelta() == Delta.MAJOR) {
 									info.providers.add(Descriptors.getShortName(diff.getName()));
 									return true;
 								}
@@ -141,22 +139,31 @@
 		return infos;
 	}
 
+	/**
+	 * Gets the generated diff
+	 * 
+	 * @return the diff
+	 */
+	public Diff getDiff() {
+		return diff;
+	}
+
 	private Version bump(Delta delta, Version last, int offset, int base) {
 		switch (delta) {
-		case UNCHANGED:
-			return last;
-		case MINOR:
-			return new Version(last.getMajor(), last.getMinor() + offset, base);
-		case MAJOR:
-			return new Version(last.getMajor() + 1, base, base);
-		case ADDED:
-			return last;
-		default:
-			return new Version(last.getMajor(), last.getMinor(), last.getMicro() + offset);
+			case UNCHANGED :
+				return last;
+			case MINOR :
+				return new Version(last.getMajor(), last.getMinor() + offset, base);
+			case MAJOR :
+				return new Version(last.getMajor() + 1, base, base);
+			case ADDED :
+				return last;
+			default :
+				return new Version(last.getMajor(), last.getMinor(), last.getMicro() + offset);
 		}
 	}
 
-	private Version getVersion(Map<String, String> map) {
+	private Version getVersion(Map<String,String> map) {
 		if (map == null)
 			return Version.LOWEST;
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java b/bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java
index 7b675c2..ea6cd50 100644
--- a/bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/DiffImpl.java
@@ -17,8 +17,8 @@
 
 public class DiffImpl implements Diff, Comparable<DiffImpl> {
 
-	final Element				older;
-	final Element				newer;
+	final Tree				older;
+	final Tree				newer;
 	final Collection<DiffImpl>	children;
 	final Delta					delta;
 
@@ -28,14 +28,30 @@
 	 * child delta for each child. This escalates deltas from below up.
 	 */
 	final static Delta[][]		TRANSITIONS	= {
-			{ IGNORED, UNCHANGED, CHANGED, MICRO, MINOR, MAJOR }, // IGNORED
-			{ IGNORED, UNCHANGED, CHANGED, MICRO, MINOR, MAJOR }, // UNCHANGED
-			{ IGNORED, CHANGED, CHANGED, MICRO, MINOR, MAJOR }, // CHANGED
-			{ IGNORED, MICRO, MICRO, MICRO, MINOR, MAJOR }, // MICRO
-			{ IGNORED, MINOR, MINOR, MINOR, MINOR, MAJOR }, // MINOR
-			{ IGNORED, MAJOR, MAJOR, MAJOR, MAJOR, MAJOR }, // MAJOR
-			{ IGNORED, MAJOR, MAJOR, MAJOR, MAJOR, MAJOR }, // REMOVED
-			{ IGNORED, MINOR, MINOR, MINOR, MINOR, MAJOR }, // ADDED
+			{
+			IGNORED, UNCHANGED, CHANGED, MICRO, MINOR, MAJOR
+			}, // IGNORED
+			{
+			IGNORED, UNCHANGED, CHANGED, MICRO, MINOR, MAJOR
+			}, // UNCHANGED
+			{
+			IGNORED, CHANGED, CHANGED, MICRO, MINOR, MAJOR
+			}, // CHANGED
+			{
+			IGNORED, MICRO, MICRO, MICRO, MINOR, MAJOR
+			}, // MICRO
+			{
+			IGNORED, MINOR, MINOR, MINOR, MINOR, MAJOR
+			}, // MINOR
+			{
+			IGNORED, MAJOR, MAJOR, MAJOR, MAJOR, MAJOR
+			}, // MAJOR
+			{
+			IGNORED, MAJOR, MAJOR, MAJOR, MAJOR, MAJOR
+			}, // REMOVED
+			{
+			IGNORED, MINOR, MINOR, MINOR, MINOR, MAJOR
+			}, // ADDED
 											};
 
 	/**
@@ -48,22 +64,22 @@
 	 *            The older Element
 	 * @param types
 	 */
-	DiffImpl(Element newer, Element older) {
+	public DiffImpl(Tree newer, Tree older) {
 		assert newer != null || older != null;
 		this.older = older;
 		this.newer = newer;
 
 		// Either newer or older can be null, indicating remove or add
 		// so we have to be very careful.
-		Element[] newerChildren = newer == null ? Element.EMPTY : newer.children;
-		Element[] olderChildren = older == null ? Element.EMPTY : older.children;
+		Tree[] newerChildren = newer == null ? Element.EMPTY : newer.getChildren();
+		Tree[] olderChildren = older == null ? Element.EMPTY : older.getChildren();
 
 		int o = 0;
 		int n = 0;
 		List<DiffImpl> children = new ArrayList<DiffImpl>();
 		while (true) {
-			Element nw = n < newerChildren.length ? newerChildren[n] : null;
-			Element ol = o < olderChildren.length ? olderChildren[o] : null;
+			Tree nw = n < newerChildren.length ? newerChildren[n] : null;
+			Tree ol = o < olderChildren.length ? olderChildren[o] : null;
 			DiffImpl diff;
 
 			if (nw == null && ol == null)
@@ -136,9 +152,9 @@
 			for (DiffImpl child : children) {
 				Delta sub = child.getDelta(ignore);
 				if (sub == REMOVED)
-					sub = child.older.remove;
+					sub = child.older.ifRemoved();
 				else if (sub == ADDED)
-					sub = child.newer.add;
+					sub = child.newer.ifAdded();
 
 				// The escalate method is used to calculate the default
 				// transition in the
@@ -160,7 +176,7 @@
 		return (newer == null ? older : newer).getName();
 	}
 
-	public Collection<? extends Diff> getChildren() {
+	public Collection< ? extends Diff> getChildren() {
 		return children;
 	}
 
@@ -171,8 +187,7 @@
 	public boolean equals(Object other) {
 		if (other instanceof DiffImpl) {
 			DiffImpl o = (DiffImpl) other;
-			return getDelta() == o.getDelta() && getType() == o.getType()
-					&& getName().equals(o.getName());
+			return getDelta() == o.getDelta() && getType() == o.getType() && getName().equals(o.getName());
 		}
 		return false;
 	}
@@ -207,4 +222,19 @@
 		return newer;
 	}
 
+	public Data serialize() {
+		Data data = new Data();
+		data.type = getType();
+		data.delta = delta;
+		data.name = getName();
+		data.children = new Data[children.size()];
+		
+		int i=0;		
+		for ( Diff d : children)
+			data.children[i++] = d.serialize();
+				
+		return data;
+	}
+
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/DiffPluginImpl.java b/bundleplugin/src/main/java/aQute/bnd/differ/DiffPluginImpl.java
index e3a1308..2fb366b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/differ/DiffPluginImpl.java
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/DiffPluginImpl.java
@@ -14,26 +14,23 @@
 import aQute.libg.cryptography.*;
 import aQute.libg.header.*;
 
-
 /**
  * This Diff Plugin Implementation will compare JARs for their API (based on the
  * Bundle Class Path and exported packages), the Manifest, and the resources.
  * The Differences are represented in a {@link Diff} tree.
  */
 public class DiffPluginImpl implements Differ {
-	
+
 	/**
 	 * Headers that are considered major enough to parse according to spec and
 	 * compare their constituents
 	 */
-	final static Set<String>				MAJOR_HEADERS	= new TreeSet<String>(
-																	String.CASE_INSENSITIVE_ORDER);
+	final static Set<String>	MAJOR_HEADERS	= new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
 
 	/**
 	 * Headers that are considered not major enough to be considered
 	 */
-	final static Set<String>				IGNORE_HEADERS	= new TreeSet<String>(
-																	String.CASE_INSENSITIVE_ORDER);
+	final static Set<String>	IGNORE_HEADERS	= new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
 
 	static {
 		MAJOR_HEADERS.add(Constants.EXPORT_PACKAGE);
@@ -52,7 +49,6 @@
 	}
 
 	/**
-	 * 
 	 * @see aQute.bnd.service.diff.Differ#diff(aQute.lib.resource.Jar,
 	 *      aQute.lib.resource.Jar)
 	 */
@@ -60,22 +56,23 @@
 		Jar jnewer = new Jar(newer);
 		try {
 			return tree(jnewer);
-		} finally {
+		}
+		finally {
 			jnewer.close();
 		}
 	}
 
 	/**
-	 * 
 	 * @see aQute.bnd.service.diff.Differ#diff(aQute.lib.resource.Jar,
 	 *      aQute.lib.resource.Jar)
 	 */
 	public Tree tree(Jar newer) throws Exception {
 		Analyzer anewer = new Analyzer();
 		try {
-				anewer.setJar(newer);
-				return tree(anewer);
-		} finally {
+			anewer.setJar(newer);
+			return tree(anewer);
+		}
+		finally {
 			anewer.setJar((Jar) null);
 			anewer.close();
 		}
@@ -88,7 +85,7 @@
 	/**
 	 * Create an element representing a bundle from the Jar.
 	 * 
-	 * @param infos 
+	 * @param infos
 	 * @param jar
 	 *            The Jar to be analyzed
 	 * @return the elements that should be compared
@@ -104,8 +101,7 @@
 			result.add(manifestElement(manifest));
 		}
 		result.add(resourcesElement(analyzer.getJar()));
-		return new Element(Type.BUNDLE, analyzer.getJar().getName(), result, CHANGED, CHANGED,
-				null);
+		return new Element(Type.BUNDLE, analyzer.getJar().getName(), result, CHANGED, CHANGED, null);
 	}
 
 	/**
@@ -117,25 +113,22 @@
 	 */
 	private Element resourcesElement(Jar jar) throws Exception {
 		List<Element> resources = new ArrayList<Element>();
-		for (Map.Entry<String, Resource> entry : jar.getResources().entrySet()) {
+		for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) {
 
 			InputStream in = entry.getValue().openInputStream();
 			try {
 				Digester<SHA1> digester = SHA1.getDigester();
 				IO.copy(in, digester);
 				String value = Hex.toHexString(digester.digest().digest());
-				resources
-						.add(new Element(Type.RESOURCE, entry.getKey()+"="+value, null, CHANGED, CHANGED, null));
-			} finally {
+				resources.add(new Element(Type.RESOURCE, entry.getKey() + "=" + value, null, CHANGED, CHANGED, null));
+			}
+			finally {
 				in.close();
 			}
 		}
 		return new Element(Type.RESOURCES, "<resources>", resources, CHANGED, CHANGED, null);
 	}
 
-
-
-
 	/**
 	 * Create an element for each manifest header. There are
 	 * {@link #IGNORE_HEADERS} and {@link #MAJOR_HEADERS} that will be treated
@@ -157,18 +150,17 @@
 			if (MAJOR_HEADERS.contains(header)) {
 				Parameters clauses = OSGiHeader.parseHeader(value);
 				Collection<Element> clausesDef = new ArrayList<Element>();
-				for (Map.Entry<String, Attrs> clause : clauses.entrySet()) {
+				for (Map.Entry<String,Attrs> clause : clauses.entrySet()) {
 					Collection<Element> parameterDef = new ArrayList<Element>();
-					for (Map.Entry<String, String> parameter : clause.getValue().entrySet()) {
-						parameterDef.add(new Element(Type.PARAMETER, parameter.getKey() + ":" + parameter
-								.getValue(), null, CHANGED, CHANGED, null));
+					for (Map.Entry<String,String> parameter : clause.getValue().entrySet()) {
+						parameterDef.add(new Element(Type.PARAMETER, parameter.getKey() + ":" + parameter.getValue(),
+								null, CHANGED, CHANGED, null));
 					}
-					clausesDef.add(new Element(Type.CLAUSE, clause.getKey(), parameterDef,
-							CHANGED, CHANGED, null));
+					clausesDef.add(new Element(Type.CLAUSE, clause.getKey(), parameterDef, CHANGED, CHANGED, null));
 				}
 				result.add(new Element(Type.HEADER, header, clausesDef, CHANGED, CHANGED, null));
 			} else {
-				result.add(new Element(Type.HEADER, header +":"+ value, null,CHANGED, CHANGED, null));
+				result.add(new Element(Type.HEADER, header + ":" + value, null, CHANGED, CHANGED, null));
 			}
 		}
 		return new Element(Type.MANIFEST, "<manifest>", result, CHANGED, CHANGED, null);
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/Element.java b/bundleplugin/src/main/java/aQute/bnd/differ/Element.java
index 602f95c..683c7a8 100644
--- a/bundleplugin/src/main/java/aQute/bnd/differ/Element.java
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/Element.java
@@ -20,7 +20,7 @@
  * unnecessary.
  */
 
-class Element implements Comparable<Element>, Tree {
+class Element implements Tree {
 	final static Element[]	EMPTY	= new Element[0];
 	final Type				type;
 	final String			name;
@@ -37,8 +37,7 @@
 		this(type, name, Arrays.asList(children), Delta.MINOR, Delta.MAJOR, null);
 	}
 
-	Element(Type type, String name, Collection<? extends Element> children, Delta add,
-			Delta remove, String comment) {
+	Element(Type type, String name, Collection< ? extends Element> children, Delta add, Delta remove, String comment) {
 		this.type = type;
 		this.name = name;
 		this.add = add;
@@ -66,6 +65,7 @@
 			Arrays.sort(this.children);
 		}
 	}
+
 	public Data serialize() {
 		Data data = new Data();
 		data.type = this.type;
@@ -94,11 +94,11 @@
 		return comment;
 	}
 
-	public int compareTo(Element other) {
-		if (type == other.type)
-			return name.compareTo(other.name);
+	public int compareTo(Tree other) {
+		if (type == other.getType())
+			return name.compareTo(other.getName());
 		else
-			return type.compareTo(other.type);
+			return type.compareTo(other.getType());
 	}
 
 	public boolean equals(Object other) {
@@ -135,10 +135,9 @@
 		}
 		return null;
 	}
-	
+
 	public String toString() {
 		return type + " " + name + " (" + add + "/" + remove + ")";
 	}
 
-
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/JavaElement.java b/bundleplugin/src/main/java/aQute/bnd/differ/JavaElement.java
index e9a77a5..c5bdb4b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/differ/JavaElement.java
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/JavaElement.java
@@ -47,32 +47,26 @@
  * <li>MAJOR - +final
  * <li>MAJOR - +protected
  * </ul>
- * 
  */
 
 class JavaElement {
-	final static EnumSet<Type>			INHERITED		= EnumSet.of(FIELD, METHOD, EXTENDS,
-																IMPLEMENTS);
-	private static final Element		PROTECTED		= new Element(ACCESS, "protected", null,
-																MAJOR, MINOR, null);
-	private static final Element		STATIC			= new Element(ACCESS, "static", null,
-																MAJOR, MAJOR, null);
-	private static final Element		ABSTRACT		= new Element(ACCESS, "abstract", null,
-																MAJOR, MINOR, null);
-	private static final Element		FINAL			= new Element(ACCESS, "final", null, MAJOR,
-																MINOR, null);
+	final static EnumSet<Type>			INHERITED		= EnumSet.of(FIELD, METHOD, EXTENDS, IMPLEMENTS);
+	private static final Element		PROTECTED		= new Element(ACCESS, "protected", null, MAJOR, MINOR, null);
+	private static final Element		STATIC			= new Element(ACCESS, "static", null, MAJOR, MAJOR, null);
+	private static final Element		ABSTRACT		= new Element(ACCESS, "abstract", null, MAJOR, MINOR, null);
+	private static final Element		FINAL			= new Element(ACCESS, "final", null, MAJOR, MINOR, null);
 	// private static final Element DEPRECATED = new Element(ACCESS,
 	// "deprecated", null,
 	// CHANGED, CHANGED, null);
 
 	final Analyzer						analyzer;
-	final Map<PackageRef, Instructions>	providerMatcher	= Create.map();
+	final Map<PackageRef,Instructions>	providerMatcher	= Create.map();
 	final Set<TypeRef>					notAccessible	= Create.set();
-	final Map<Object, Element>			cache			= Create.map();
+	final Map<Object,Element>			cache			= Create.map();
 	MultiMap<PackageRef, //
 	Element>							packages;
 	final MultiMap<TypeRef, //
-	Element>							covariant		= new MultiMap<TypeRef, Element>();
+	Element>							covariant		= new MultiMap<TypeRef,Element>();
 	final Set<JAVA>						javas			= Create.set();
 	final Packages						exports;
 
@@ -87,10 +81,9 @@
 		this.analyzer = analyzer;
 
 		Manifest manifest = analyzer.getJar().getManifest();
-		if (manifest != null
-				&& manifest.getMainAttributes().getValue(Constants.BUNDLE_MANIFESTVERSION) != null) {
+		if (manifest != null && manifest.getMainAttributes().getValue(Constants.BUNDLE_MANIFESTVERSION) != null) {
 			exports = new Packages();
-			for (Map.Entry<String, Attrs> entry : OSGiHeader.parseHeader(
+			for (Map.Entry<String,Attrs> entry : OSGiHeader.parseHeader(
 					manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE)).entrySet())
 				exports.put(analyzer.getPackageRef(entry.getKey()), entry.getValue());
 		} else
@@ -101,7 +94,7 @@
 		// out who the providers and consumers are
 		//
 
-		for (Entry<PackageRef, Attrs> entry : exports.entrySet()) {
+		for (Entry<PackageRef,Attrs> entry : exports.entrySet()) {
 			String value = entry.getValue().get(Constants.PROVIDER_TYPE_DIRECTIVE);
 			if (value != null) {
 				providerMatcher.put(entry.getKey(), new Instructions(value));
@@ -112,7 +105,7 @@
 		// creating the packages yet because we do not yet know
 		// which classes are accessible
 
-		packages = new MultiMap<PackageRef, Element>();
+		packages = new MultiMap<PackageRef,Element>();
 
 		for (Clazz c : analyzer.getClassspace().values()) {
 			if (c.isPublic() || c.isProtected()) {
@@ -136,27 +129,25 @@
 	private Element getLocalAPI() throws Exception {
 		List<Element> result = new ArrayList<Element>();
 
-		for (Map.Entry<PackageRef, List<Element>> entry : packages.entrySet()) {
+		for (Map.Entry<PackageRef,List<Element>> entry : packages.entrySet()) {
 			List<Element> set = entry.getValue();
 			for (Iterator<Element> i = set.iterator(); i.hasNext();) {
-				
-				if (notAccessible.contains( analyzer.getTypeRefFromFQN(i.next().getName())))
+
+				if (notAccessible.contains(analyzer.getTypeRefFromFQN(i.next().getName())))
 					i.remove();
-				
+
 			}
 			String version = exports.get(entry.getKey()).get(Constants.VERSION_ATTRIBUTE);
 			if (version != null) {
 				Version v = new Version(version);
-				set.add(new Element(Type.VERSION, v.getWithoutQualifier().toString(), null,
-						IGNORED, IGNORED, null));
+				set.add(new Element(Type.VERSION, v.getWithoutQualifier().toString(), null, IGNORED, IGNORED, null));
 			}
 			Element pd = new Element(Type.PACKAGE, entry.getKey().getFQN(), set, MINOR, MAJOR, null);
 			result.add(pd);
 		}
 
 		for (JAVA java : javas) {
-			result.add(new Element(CLASS_VERSION, java.toString(), null, Delta.CHANGED,
-					Delta.CHANGED, null));
+			result.add(new Element(CLASS_VERSION, java.toString(), null, Delta.CHANGED, Delta.CHANGED, null));
 		}
 
 		return new Element(Type.API, "<api>", result, CHANGED, CHANGED, null);
@@ -183,7 +174,7 @@
 		final Set<Element> members = new HashSet<Element>();
 		final Set<MethodDef> methods = Create.set();
 		final Set<Clazz.FieldDef> fields = Create.set();
-		final MultiMap<Clazz.Def, Element> annotations = new MultiMap<Clazz.Def, Element>();
+		final MultiMap<Clazz.Def,Element> annotations = new MultiMap<Clazz.Def,Element>();
 
 		final TypeRef name = clazz.getClassName();
 
@@ -209,11 +200,13 @@
 			boolean			memberEnd;
 			Clazz.FieldDef	last;
 
-			@Override public void version(int minor, int major) {
+			@Override
+			public void version(int minor, int major) {
 				javas.add(Clazz.JAVA.getJava(major, minor));
 			}
 
-			@Override public void method(MethodDef defined) {
+			@Override
+			public void method(MethodDef defined) {
 				if ((defined.isProtected() || defined.isPublic())) {
 					last = defined;
 					methods.add(defined);
@@ -222,14 +215,16 @@
 				}
 			}
 
-			@Override public void deprecated() {
+			@Override
+			public void deprecated() {
 				if (memberEnd)
 					clazz.setDeprecated(true);
 				else
 					last.setDeprecated(true);
 			}
 
-			@Override public void field(Clazz.FieldDef defined) {
+			@Override
+			public void field(Clazz.FieldDef defined) {
 				if (defined.isProtected() || defined.isPublic()) {
 					last = defined;
 					fields.add(defined);
@@ -237,25 +232,27 @@
 					last = null;
 			}
 
-			@Override public void constant(Object o) {
+			@Override
+			public void constant(Object o) {
 				if (last != null) {
 					// Must be accessible now
 					last.setConstant(o);
 				}
 			}
 
-			@Override public void extendsClass(TypeRef name) throws Exception {
+			@Override
+			public void extendsClass(TypeRef name) throws Exception {
 				String comment = null;
 				if (!clazz.isInterface())
 					comment = inherit(members, name);
 
 				Clazz c = analyzer.findClass(name);
 				if ((c == null || c.isPublic()) && !name.isObject())
-					members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR,
-							comment));
+					members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
 			}
 
-			@Override public void implementsInterfaces(TypeRef names[]) throws Exception {
+			@Override
+			public void implementsInterfaces(TypeRef names[]) throws Exception {
 				// TODO is interface reordering important for binary
 				// compatibility??
 
@@ -264,8 +261,7 @@
 					String comment = null;
 					if (clazz.isInterface() || clazz.isAbstract())
 						comment = inherit(members, name);
-					members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR,
-							comment));
+					members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment));
 				}
 			}
 
@@ -286,8 +282,7 @@
 							if (INHERITED.contains(child.type)) {
 								String n = child.getName();
 								if (child.type == METHOD) {
-									if (n.startsWith("<init>")
-											|| "getClass()".equals(child.getName())
+									if (n.startsWith("<init>") || "getClass()".equals(child.getName())
 											|| n.startsWith("wait(") || n.startsWith("notify(")
 											|| n.startsWith("notifyAll("))
 										continue;
@@ -314,7 +309,8 @@
 				return null;
 			}
 
-			@Override public void annotation(Annotation annotation) {
+			@Override
+			public void annotation(Annotation annotation) {
 				Collection<Element> properties = Create.set();
 				if (Deprecated.class.getName().equals(annotation.getName().getFQN())) {
 					if (memberEnd)
@@ -330,21 +326,20 @@
 					sb.append('=');
 					toString(sb, annotation.get(key));
 
-					properties.add(new Element(Type.PROPERTY, sb.toString(), null, CHANGED,
-							CHANGED, null));
+					properties.add(new Element(Type.PROPERTY, sb.toString(), null, CHANGED, CHANGED, null));
 				}
 
 				if (memberEnd) {
-					members.add(new Element(Type.ANNOTATED, annotation.getName().getFQN(),
-							properties, CHANGED, CHANGED, null));
+					members.add(new Element(Type.ANNOTATED, annotation.getName().getFQN(), properties, CHANGED,
+							CHANGED, null));
 					if (ProviderType.class.getName().equals(annotation.getName().getFQN())) {
 						provider.set(true);
 					} else if (ConsumerType.class.getName().equals(annotation.getName().getFQN())) {
 						provider.set(false);
 					}
 				} else if (last != null)
-					annotations.add(last, new Element(Type.ANNOTATED,
-							annotation.getName().getFQN(), properties, CHANGED, CHANGED, null));
+					annotations.add(last, new Element(Type.ANNOTATED, annotation.getName().getFQN(), properties,
+							CHANGED, CHANGED, null));
 			}
 
 			private void toString(StringBuilder sb, Object object) {
@@ -359,19 +354,20 @@
 					sb.append(object);
 			}
 
-			@Override public void innerClass(TypeRef innerClass, TypeRef outerClass,
-					String innerName, int innerClassAccessFlags) throws Exception {
+			@Override
+			public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
+					throws Exception {
 				Clazz clazz = analyzer.findClass(innerClass);
 				if (clazz != null)
 					clazz.setInnerAccess(innerClassAccessFlags);
 
-				if (Modifier.isProtected(innerClassAccessFlags)
-						|| Modifier.isPublic(innerClassAccessFlags))
+				if (Modifier.isProtected(innerClassAccessFlags) || Modifier.isPublic(innerClassAccessFlags))
 					return;
 				notAccessible.add(innerClass);
 			}
 
-			@Override public void memberEnd() {
+			@Override
+			public void memberEnd() {
 				memberEnd = true;
 			}
 		});
@@ -463,15 +459,14 @@
 
 			for (Iterator<MethodDef> i = synthetic.iterator(); i.hasNext();) {
 				MethodDef s = i.next();
-				if (s.getName().equals(m.getName())
-						&& Arrays.equals(s.getPrototype(), m.getPrototype())) {
+				if (s.getName().equals(m.getName()) && Arrays.equals(s.getPrototype(), m.getPrototype())) {
 					i.remove();
 					getCovariantReturns(children, s.getType());
 				}
 			}
 
-			Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()),
-					children, add, remove, null);
+			Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
+					null);
 
 			if (!members.add(member)) {
 				members.remove(member);
@@ -505,8 +500,8 @@
 
 			getCovariantReturns(children, m.getType());
 
-			Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()),
-					children, add, remove, "synthetic");
+			Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
+					"synthetic");
 
 			if (!members.add(member)) {
 				members.remove(member);
@@ -521,13 +516,12 @@
 
 			// Fields can have a constant value, this is a new element
 			if (f.getConstant() != null) {
-				children.add(new Element(Type.CONSTANT, f.getConstant().toString(), null, CHANGED,
-						CHANGED, null));
+				children.add(new Element(Type.CONSTANT, f.getConstant().toString(), null, CHANGED, CHANGED, null));
 			}
 
 			access(children, f.getAccess(), f.isDeprecated());
-			Element member = new Element(Type.FIELD, f.getType().getFQN() + " " + f.getName(),
-					children, MINOR, MAJOR, null);
+			Element member = new Element(Type.FIELD, f.getType().getFQN() + " " + f.getName(), children, MINOR, MAJOR,
+					null);
 
 			if (!members.add(member)) {
 				members.remove(member);
@@ -538,8 +532,7 @@
 		access(members, clazz.getAccess(), clazz.isDeprecated());
 
 		// And make the result
-		Element s = new Element(type, fqn, members, MINOR, MAJOR, comment.length() == 0 ? null
-				: comment.toString());
+		Element s = new Element(type, fqn, members, MINOR, MAJOR, comment.length() == 0 ? null : comment.toString());
 		cache.put(clazz, s);
 		return s;
 	}
@@ -577,33 +570,33 @@
 			String name = type.getBinary();
 			Element e;
 			switch (name.charAt(0)) {
-			case 'Z':
-				e = BOOLEAN_R;
-				break;
-			case 'S':
-				e = SHORT_R;
-				break;
-			case 'I':
-				e = INT_R;
-				break;
-			case 'B':
-				e = BYTE_R;
-				break;
-			case 'C':
-				e = CHAR_R;
-				break;
-			case 'J':
-				e = LONG_R;
-				break;
-			case 'F':
-				e = FLOAT_R;
-				break;
-			case 'D':
-				e = DOUBLE_R;
-				break;
+				case 'Z' :
+					e = BOOLEAN_R;
+					break;
+				case 'S' :
+					e = SHORT_R;
+					break;
+				case 'I' :
+					e = INT_R;
+					break;
+				case 'B' :
+					e = BYTE_R;
+					break;
+				case 'C' :
+					e = CHAR_R;
+					break;
+				case 'J' :
+					e = LONG_R;
+					break;
+				case 'F' :
+					e = FLOAT_R;
+					break;
+				case 'D' :
+					e = DOUBLE_R;
+					break;
 
-			default:
-				throw new IllegalArgumentException("Unknown primitive " + type);
+				default :
+					throw new IllegalArgumentException("Unknown primitive " + type);
 			}
 			elements.add(e);
 			return;
diff --git a/bundleplugin/src/main/java/aQute/bnd/differ/RepositoryElement.java b/bundleplugin/src/main/java/aQute/bnd/differ/RepositoryElement.java
new file mode 100644
index 0000000..23a5f20
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/bnd/differ/RepositoryElement.java
@@ -0,0 +1,23 @@
+package aQute.bnd.differ;
+
+import java.util.*;
+
+import aQute.bnd.service.*;
+import aQute.bnd.service.diff.*;
+import aQute.libg.version.*;
+
+public class RepositoryElement {
+
+	public static Element getTree(RepositoryPlugin repo) throws Exception {
+		List<Element> programs = new ArrayList<Element>();
+		for (String bsn : repo.list(null)) {
+			List<Element> versions = new ArrayList<Element>();
+			for (Version version : repo.versions(bsn)) {
+				versions.add(new Element(Type.VERSION, version.toString()));
+			}
+			programs.add(new Element(Type.PROGRAM, bsn, versions, Delta.MINOR, Delta.MAJOR, null));
+		}
+		return new Element(Type.REPO, repo.getName(), programs, Delta.MINOR, Delta.MAJOR, repo.getLocation());
+	}
+
+}
diff --git a/bundleplugin/src/main/java/aQute/bnd/help/Syntax.java b/bundleplugin/src/main/java/aQute/bnd/help/Syntax.java
index 20a7440..7c7b160 100644
--- a/bundleplugin/src/main/java/aQute/bnd/help/Syntax.java
+++ b/bundleplugin/src/main/java/aQute/bnd/help/Syntax.java
@@ -6,476 +6,376 @@
 import aQute.lib.osgi.*;
 
 public class Syntax implements Constants {
-    final String                            header;
-    final String                            lead;
-    final String                            example;
-    final Pattern                           pattern;
-    final String                            values;
-    final Syntax[]                          children;
+	final String							header;
+	final String							lead;
+	final String							example;
+	final Pattern							pattern;
+	final String							values;
+	final Syntax[]							children;
 
-    static Syntax                           version              = new Syntax(
-                                                                         VERSION_ATTRIBUTE,
-                                                                         "A version range to select the version of an export definition. The default value is 0.0.0 .",
-                                                                         "version=\"[1.2,3.0)\"",
-                                                                         null,
-                                                                         Verifier.VERSIONRANGE);
-    static Syntax                           bundle_symbolic_name = new Syntax(
-                                                                         BUNDLE_SYMBOLIC_NAME_ATTRIBUTE,
-                                                                         "The bundle symbolic name of the exporting bundle.",
-                                                                         "bundle-symbolic-name=com.acme.foo.daffy",
-                                                                         null,
-                                                                         Verifier.SYMBOLICNAME);
+	static Syntax							version					= new Syntax(
+																			VERSION_ATTRIBUTE,
+																			"A version range to select the version of an export definition. The default value is 0.0.0 .",
+																			"version=\"[1.2,3.0)\"", null,
+																			Verifier.VERSIONRANGE);
+	static Syntax							bundle_symbolic_name	= new Syntax(
+																			BUNDLE_SYMBOLIC_NAME_ATTRIBUTE,
+																			"The bundle symbolic name of the exporting bundle.",
+																			"bundle-symbolic-name=com.acme.foo.daffy",
+																			null, Verifier.SYMBOLICNAME);
 
-    static Syntax                           bundle_version       = new Syntax(
-                                                                         BUNDLE_VERSION_ATTRIBUTE,
-                                                                         "a version range to select the bundle version of the exporting bundle. The default value is 0.0.0.",
-                                                                         "bundle-version=1.3",
-                                                                         null,
-                                                                         Verifier.VERSIONRANGE);
+	static Syntax							bundle_version			= new Syntax(
+																			BUNDLE_VERSION_ATTRIBUTE,
+																			"a version range to select the bundle version of the exporting bundle. The default value is 0.0.0.",
+																			"bundle-version=1.3", null,
+																			Verifier.VERSIONRANGE);
 
-    static Syntax                           path_version         = new Syntax(
-                                                                         VERSION_ATTRIBUTE,
-                                                                         "Specifies the range in the repository, project, or file",
-                                                                         "version=project",
-                                                                         "project,type",
-                                                                         Pattern
-                                                                                 .compile("project|type|"
-                                                                                         + Verifier.VERSIONRANGE
-                                                                                                 .toString()));
+	static Syntax							path_version			= new Syntax(
+																			VERSION_ATTRIBUTE,
+																			"Specifies the range in the repository, project, or file",
+																			"version=project", "project,type", Pattern
+																					.compile("project|type|"
+																							+ Verifier.VERSIONRANGE
+																									.toString()));
 
-    @SuppressWarnings("deprecation")
-	static Syntax[]                         syntaxes             = new Syntax[] {
-            new Syntax(
-                    BUNDLE_ACTIVATIONPOLICY,
-                    "The Bundle-ActivationPolicy specifies how the framework should activate the bundle once started. ",
-                    "Bundle-ActivationPolicy: lazy", "lazy", Pattern
-                            .compile("lazy")),
+	@SuppressWarnings("deprecation")
+	static Syntax[]							syntaxes				= new Syntax[] {
+			new Syntax(
+					BUNDLE_ACTIVATIONPOLICY,
+					"The Bundle-ActivationPolicy specifies how the framework should activate the bundle once started. ",
+					"Bundle-ActivationPolicy: lazy", "lazy", Pattern.compile("lazy")),
 
-            new Syntax(
-                    BUNDLE_ACTIVATOR,
-                    "The Bundle-Activator header specifies the name of the class used to start and stop the bundle. ",
-                    "Bundle-Activator: com.acme.foo.Activator",
-                    "${classes;implementing;org.osgi.framework.BundleActivator}",
-                    Verifier.FQNPATTERN),
-            new Syntax(
-                    BUNDLE_CATEGORY,
-                    "The Bundle-Category header holds a comma-separated list of category names",
-                    "Bundle-Category: test",
-                    "osgi,test,game,util,eclipse,netbeans,jdk,specification",
-                    null),
-            new Syntax(
-                    BUNDLE_CLASSPATH,
-                    "The Bundle-ClassPath header defines a comma-separated list of JAR file path names or directories (inside the bundle) containing classes and resources. The period (’.’) specifies the root directory of the bundle’s JAR. The period is also the default.",
-                    "Bundle-Classpath: /lib/libnewgen.so, .", null,
-                    Verifier.PATHPATTERN),
-            new Syntax(
-                    BUNDLE_CONTACTADDRESS,
-                    "The Bundle-ContactAddress header provides the contact address of the vendor. ",
-                    "Bundle-ContactAddress: 2400 Oswego Road, Austin, TX 74563",
-                    null, null),
-            new Syntax(
-                    BUNDLE_COPYRIGHT,
-                    "The Bundle-Copyright header contains the copyright specification for this bundle. ",
-                    "Bundle-Copyright: OSGi (c) 2002", null, null),
-            new Syntax(
-                    BUNDLE_DESCRIPTION,
-                    "The Bundle-Description header defines a short description of this bundle.",
-                    "Bundle-Description: Ceci ce n'est pas une bundle", null,
-                    null),
+			new Syntax(BUNDLE_ACTIVATOR,
+					"The Bundle-Activator header specifies the name of the class used to start and stop the bundle. ",
+					"Bundle-Activator: com.acme.foo.Activator",
+					"${classes;implementing;org.osgi.framework.BundleActivator}", Verifier.FQNPATTERN),
+			new Syntax(BUNDLE_CATEGORY, "The Bundle-Category header holds a comma-separated list of category names",
+					"Bundle-Category: test", "osgi,test,game,util,eclipse,netbeans,jdk,specification", null),
+			new Syntax(
+					BUNDLE_CLASSPATH,
+					"The Bundle-ClassPath header defines a comma-separated list of JAR file path names or directories (inside the bundle) containing classes and resources. The period (’.’) specifies the root directory of the bundle’s JAR. The period is also the default.",
+					"Bundle-Classpath: /lib/libnewgen.so, .", null, Verifier.PATHPATTERN),
+			new Syntax(BUNDLE_CONTACTADDRESS,
+					"The Bundle-ContactAddress header provides the contact address of the vendor. ",
+					"Bundle-ContactAddress: 2400 Oswego Road, Austin, TX 74563", null, null),
+			new Syntax(BUNDLE_COPYRIGHT,
+					"The Bundle-Copyright header contains the copyright specification for this bundle. ",
+					"Bundle-Copyright: OSGi (c) 2002", null, null),
+			new Syntax(BUNDLE_DESCRIPTION, "The Bundle-Description header defines a short description of this bundle.",
+					"Bundle-Description: Ceci ce n'est pas une bundle", null, null),
 
-            new Syntax(
-                    BUNDLE_DOCURL,
-                    "The Bundle-DocURL headers must contain a URL pointing to documentation about this bundle.",
-                    "Bundle-DocURL: http://www.aQute.biz/Code/Bnd", null,
-                    Verifier.URLPATTERN),
+			new Syntax(BUNDLE_DOCURL,
+					"The Bundle-DocURL headers must contain a URL pointing to documentation about this bundle.",
+					"Bundle-DocURL: http://www.aQute.biz/Code/Bnd", null, Verifier.URLPATTERN),
 
-            new Syntax(
-                    BUNDLE_ICON,
-                    "The optional Bundle-Icon header provides a list of (relative) URLs to icons representing this bundle in different sizes. ",
-                    "Bundle-Icon: /icons/bnd.png;size=64", "/icons/bundle.png",
-                    Verifier.URLPATTERN, new Syntax("size",
-                            "Icons size in pixels, e.g. 64", "64",
-                            "16,32,48,64,128", Verifier.NUMBERPATTERN)),
+			new Syntax(
+					BUNDLE_ICON,
+					"The optional Bundle-Icon header provides a list of (relative) URLs to icons representing this bundle in different sizes. ",
+					"Bundle-Icon: /icons/bnd.png;size=64", "/icons/bundle.png", Verifier.URLPATTERN, new Syntax("size",
+							"Icons size in pixels, e.g. 64", "64", "16,32,48,64,128", Verifier.NUMBERPATTERN)),
 
-            new Syntax(
-                    BUNDLE_LICENSE,
-                    "The Bundle-License header provides an optional machine readable form of license information. The purpose of this header is to automate some of the license processing required by many organizations",
-                    "Bundle License: http://www.opensource.org/licenses/jabberpl.php",
-                    "http://www.apache.org/licenses/LICENSE-2.0,<<EXTERNAL>>",
-                    Pattern.compile("(" + Verifier.URLPATTERN
-                            + "|<<EXTERNAL>>)"), new Syntax(
-                            DESCRIPTION_ATTRIBUTE,
-                            "Human readable description of the license",
-                            "description=\"Described the license here\"", null,
-                            Verifier.ANYPATTERN), new Syntax(LINK_ATTRIBUTE,
-                            "", "", null, Verifier.URLPATTERN)),
-            new Syntax(
-                    BUNDLE_LOCALIZATION,
-                    "The Bundle-Localization header contains the location in the bundle where localization files can be found. The default value is OSGI-INF/l10n/bundle. Translations are by default therefore OSGI-INF/l10n/bundle_de.properties, OSGI-INF/l10n/bundle_nl.properties, etc.",
-                    "Bundle-Localization: OSGI-INF/l10n/bundle",
-                    "OSGI-INF/l10n/bundle", Verifier.URLPATTERN),
-            new Syntax(
-                    BUNDLE_MANIFESTVERSION,
-                    "This header is set by bnd automatically to 2. The Bundle-ManifestVersion header defines that the bundle follows the rules of this specification. The Bundle-ManifestVersion header determines whether the bundle follows the rules of this specification.",
-                    "# Bundle-ManifestVersion: 2", "2", Verifier.NUMBERPATTERN),
-            new Syntax(
-                    BUNDLE_NAME,
-                    "This header will be derived from the  Bundle-SymbolicName if not set. The Bundle-Name header defines a readable name for this bundle. This should be a short, human-readable name that can contain spaces.",
-                    "Bundle-Name: My Bundle", null, Verifier.ANYPATTERN),
-            new Syntax(
-                    BUNDLE_NATIVECODE,
-                    "The Bundle-NativeCode header contains a specification of native code libraries contained in this bundle. ",
-                    "Bundle-NativeCode: /lib/http.DLL; osname = QNX; osversion = 3.1",
-                    null,
-                    Verifier.PATHPATTERN,
-                    new Syntax(OSNAME_ATTRIBUTE,
-                            "The name of the operating system", "osname=MacOS",
-                            Processor.join(Verifier.OSNAMES, ","),
-                            Verifier.ANYPATTERN),
-                    new Syntax(OSVERSION_ATTRIBUTE, "Operating System Version",
-                            "osversion=3.1", null, Verifier.ANYPATTERN),
-                    new Syntax(LANGUAGE_ATTRIBUTE, "Language ISO 639 code",
-                            "language=nl", null, Verifier.ISO639),
-                    new Syntax(PROCESSOR_ATTRIBUTE, "Processor name",
-                            "processor=x86", Processor.join(
-                                    Verifier.PROCESSORNAMES, ","),
-                            Verifier.ANYPATTERN),
-                    new Syntax(
-                            SELECTION_FILTER_ATTRIBUTE,
-                            "The value of this attribute must be a filter expression that indicates if the native code clause should be selected or not.",
-                            "selection-filter=\"(com.acme.windowing=win32)\"",
-                            null, Verifier.FILTERPATTERN)),
-            new Syntax(
-                    BUNDLE_REQUIREDEXECUTIONENVIRONMENT,
-                    "The Bundle-RequiredExecutionEnvironment contains a comma-separated list of execution environments that must be present on the Service Platform.",
-                    "Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0",
-                    Processor.join(Verifier.EES, ","), Verifier.ANYPATTERN),
+			new Syntax(
+					BUNDLE_LICENSE,
+					"The Bundle-License header provides an optional machine readable form of license information. The purpose of this header is to automate some of the license processing required by many organizations",
+					"Bundle License: http://www.opensource.org/licenses/jabberpl.php",
+					"http://www.apache.org/licenses/LICENSE-2.0,<<EXTERNAL>>", Pattern.compile("("
+							+ Verifier.URLPATTERN + "|<<EXTERNAL>>)"), new Syntax(DESCRIPTION_ATTRIBUTE,
+							"Human readable description of the license", "description=\"Described the license here\"",
+							null, Verifier.ANYPATTERN), new Syntax(LINK_ATTRIBUTE, "", "", null, Verifier.URLPATTERN)),
+			new Syntax(
+					BUNDLE_LOCALIZATION,
+					"The Bundle-Localization header contains the location in the bundle where localization files can be found. The default value is OSGI-INF/l10n/bundle. Translations are by default therefore OSGI-INF/l10n/bundle_de.properties, OSGI-INF/l10n/bundle_nl.properties, etc.",
+					"Bundle-Localization: OSGI-INF/l10n/bundle", "OSGI-INF/l10n/bundle", Verifier.URLPATTERN),
+			new Syntax(
+					BUNDLE_MANIFESTVERSION,
+					"This header is set by bnd automatically to 2. The Bundle-ManifestVersion header defines that the bundle follows the rules of this specification. The Bundle-ManifestVersion header determines whether the bundle follows the rules of this specification.",
+					"# Bundle-ManifestVersion: 2", "2", Verifier.NUMBERPATTERN),
+			new Syntax(
+					BUNDLE_NAME,
+					"This header will be derived from the  Bundle-SymbolicName if not set. The Bundle-Name header defines a readable name for this bundle. This should be a short, human-readable name that can contain spaces.",
+					"Bundle-Name: My Bundle", null, Verifier.ANYPATTERN),
+			new Syntax(
+					BUNDLE_NATIVECODE,
+					"The Bundle-NativeCode header contains a specification of native code libraries contained in this bundle. ",
+					"Bundle-NativeCode: /lib/http.DLL; osname = QNX; osversion = 3.1",
+					null,
+					Verifier.PATHPATTERN,
+					new Syntax(OSNAME_ATTRIBUTE, "The name of the operating system", "osname=MacOS", Processor.join(
+							Verifier.OSNAMES, ","), Verifier.ANYPATTERN),
+					new Syntax(OSVERSION_ATTRIBUTE, "Operating System Version", "osversion=3.1", null,
+							Verifier.ANYPATTERN),
+					new Syntax(LANGUAGE_ATTRIBUTE, "Language ISO 639 code", "language=nl", null, Verifier.ISO639),
+					new Syntax(PROCESSOR_ATTRIBUTE, "Processor name", "processor=x86", Processor.join(
+							Verifier.PROCESSORNAMES, ","), Verifier.ANYPATTERN),
+					new Syntax(
+							SELECTION_FILTER_ATTRIBUTE,
+							"The value of this attribute must be a filter expression that indicates if the native code clause should be selected or not.",
+							"selection-filter=\"(com.acme.windowing=win32)\"", null, Verifier.FILTERPATTERN)),
+			new Syntax(
+					BUNDLE_REQUIREDEXECUTIONENVIRONMENT,
+					"The Bundle-RequiredExecutionEnvironment contains a comma-separated list of execution environments that must be present on the Service Platform.",
+					"Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0", Processor.join(Verifier.EES, ","),
+					Verifier.ANYPATTERN),
 
-            new Syntax(
-                    BUNDLE_SYMBOLICNAME,
-                    "The Bundle-SymbolicName header specifies a non-localizable name for this bundle. The bundle symbolic name together with a version must identify a  unique bundle. The bundle symbolic name should be based on the reverse  domain name convention",
-                    "Bundle-SymbolicName: com.acme.foo.daffy;singleton:=true",
-                    "${p}",
-                    Verifier.SYMBOLICNAME,
-                    new Syntax(
-                            SINGLETON_DIRECTIVE,
-                            " Indicates that the bundle can only have  a single version resolved.  A value of true indicates that the bundle is a singleton bundle. The default value is false. The Framework must resolve at most one  bundle when multiple versions of a singleton bundle with the same symbolic name are installed. Singleton bundles do not affect the resolution of non-singleton bundles with the same symbolic name.",
-                            "false", "true,false", Verifier.TRUEORFALSEPATTERN),
-                    new Syntax(
-                            FRAGMENT_ATTACHMENT_DIRECTIVE,
-                            "Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page73. The following values are valid for this directive:",
-                            "", "always|never|resolve-time", Pattern
-                                    .compile("always|never|resolve-time")),
-                    new Syntax(BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, "",
-                            "", "true,false", Verifier.TRUEORFALSEPATTERN),
-                    new Syntax(BLUEPRINT_TIMEOUT_ATTRIBUTE, "", "",
-                            "30000,60000,300000", Verifier.NUMBERPATTERN)),
+			new Syntax(
+					BUNDLE_SYMBOLICNAME,
+					"The Bundle-SymbolicName header specifies a non-localizable name for this bundle. The bundle symbolic name together with a version must identify a  unique bundle. The bundle symbolic name should be based on the reverse  domain name convention",
+					"Bundle-SymbolicName: com.acme.foo.daffy;singleton:=true",
+					"${p}",
+					Verifier.SYMBOLICNAME,
+					new Syntax(
+							SINGLETON_DIRECTIVE,
+							" Indicates that the bundle can only have  a single version resolved.  A value of true indicates that the bundle is a singleton bundle. The default value is false. The Framework must resolve at most one  bundle when multiple versions of a singleton bundle with the same symbolic name are installed. Singleton bundles do not affect the resolution of non-singleton bundles with the same symbolic name.",
+							"false", "true,false", Verifier.TRUEORFALSEPATTERN),
+					new Syntax(
+							FRAGMENT_ATTACHMENT_DIRECTIVE,
+							"Defines how fragments are allowed to be attached, see the fragments in Fragment Bundles on page73. The following values are valid for this directive:",
+							"", "always|never|resolve-time", Pattern.compile("always|never|resolve-time")), new Syntax(
+							BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE, "", "", "true,false",
+							Verifier.TRUEORFALSEPATTERN), new Syntax(BLUEPRINT_TIMEOUT_ATTRIBUTE, "", "",
+							"30000,60000,300000", Verifier.NUMBERPATTERN)),
 
-            new Syntax(
-                    BUNDLE_UPDATELOCATION,
-                    "The Bundle-UpdateLocation header specifies a URL where an update for this bundle should come from. If the bundle is updated, this location should be used, if present, to retrieve the updated JAR file.",
-                    "Bundle-UpdateLocation: http://www.acme.com/Firewall/bundle.jar",
-                    null, Verifier.URLPATTERN),
+			new Syntax(
+					BUNDLE_UPDATELOCATION,
+					"The Bundle-UpdateLocation header specifies a URL where an update for this bundle should come from. If the bundle is updated, this location should be used, if present, to retrieve the updated JAR file.",
+					"Bundle-UpdateLocation: http://www.acme.com/Firewall/bundle.jar", null, Verifier.URLPATTERN),
 
-            new Syntax(
-                    BUNDLE_VENDOR,
-                    "The Bundle-Vendor header contains a human-readable description of the bundle vendor. ",
-                    "Bundle-Vendor: OSGi Alliance ", null, null),
+			new Syntax(BUNDLE_VENDOR,
+					"The Bundle-Vendor header contains a human-readable description of the bundle vendor. ",
+					"Bundle-Vendor: OSGi Alliance ", null, null),
 
-            new Syntax(
-                    BUNDLE_VERSION,
-                    "The Bundle-Version header specifies the version of this bundle",
-                    "Bundle-Version: 1.23.4.build200903221000", null,
-                    Verifier.VERSION),
+			new Syntax(BUNDLE_VERSION, "The Bundle-Version header specifies the version of this bundle",
+					"Bundle-Version: 1.23.4.build200903221000", null, Verifier.VERSION),
 
-            new Syntax(
-                    DYNAMICIMPORT_PACKAGE,
-                    "The DynamicImport-Package header contains a comma-separated list of package names that should be dynamically imported when needed.",
-                    "DynamicImport-Package: com.acme.plugin.*", "",
-                    Verifier.WILDCARDNAMEPATTERN, version,
-                    bundle_symbolic_name, bundle_version),
+			new Syntax(
+					DYNAMICIMPORT_PACKAGE,
+					"The DynamicImport-Package header contains a comma-separated list of package names that should be dynamically imported when needed.",
+					"DynamicImport-Package: com.acme.plugin.*", "", Verifier.WILDCARDNAMEPATTERN, version,
+					bundle_symbolic_name, bundle_version),
 
-            new Syntax(
-                    EXPORT_PACKAGE,
-                    "The Export-Package header contains a declaration of exported packages.",
-                    "Export-Package: org.osgi.util.tracker;version=1.3",
-                    "${packages}",
-                    null,
-                    new Syntax(
-                            NO_IMPORT_DIRECTIVE,
-                            "By default, bnd makes all exports also imports. Adding a -noimport to an exported package will make it export only",
-                            "-noimport:=true", "true,false",
-                            Verifier.TRUEORFALSEPATTERN),
-                    new Syntax(
-                            USES_DIRECTIVE,
-                            "Calculated by bnd: It is a comma-separated list of package names that are used by the exported package",
-                            "Is calculated by bnd", null, null),
-                    new Syntax(
-                            MANDATORY_DIRECTIVE,
-                            "A comma-separated list of attribute names. Note that the use of a comma in the value requires it to be enclosed in double quotes. A bundle importing the package must specify the mandatory attributes, with a value that matches, to resolve to the exported package",
-                            "mandatory=\"bar,foo\"", null, null),
-                    new Syntax(
-                            INCLUDE_DIRECTIVE,
-                            "A comma-separated list of class names that must be visible to an importer",
-                            "include:=\"Qux*\"", null, null),
-                    new Syntax(
-                            EXCLUDE_DIRECTIVE,
-                            "A comma-separated list of class names that must not be visible to an importer",
-                            "exclude:=\"QuxImpl*,BarImpl\"", null,
-                            Verifier.WILDCARDNAMEPATTERN), new Syntax(
-                            IMPORT_DIRECTIVE, "Experimental", "", null, null)
+			new Syntax(
+					EXPORT_PACKAGE,
+					"The Export-Package header contains a declaration of exported packages.",
+					"Export-Package: org.osgi.util.tracker;version=1.3",
+					"${packages}",
+					null,
+					new Syntax(
+							NO_IMPORT_DIRECTIVE,
+							"By default, bnd makes all exports also imports. Adding a -noimport to an exported package will make it export only",
+							"-noimport:=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+					new Syntax(
+							USES_DIRECTIVE,
+							"Calculated by bnd: It is a comma-separated list of package names that are used by the exported package",
+							"Is calculated by bnd", null, null),
+					new Syntax(
+							MANDATORY_DIRECTIVE,
+							"A comma-separated list of attribute names. Note that the use of a comma in the value requires it to be enclosed in double quotes. A bundle importing the package must specify the mandatory attributes, with a value that matches, to resolve to the exported package",
+							"mandatory=\"bar,foo\"", null, null), new Syntax(INCLUDE_DIRECTIVE,
+							"A comma-separated list of class names that must be visible to an importer",
+							"include:=\"Qux*\"", null, null), new Syntax(EXCLUDE_DIRECTIVE,
+							"A comma-separated list of class names that must not be visible to an importer",
+							"exclude:=\"QuxImpl*,BarImpl\"", null, Verifier.WILDCARDNAMEPATTERN), new Syntax(
+							IMPORT_DIRECTIVE, "Experimental", "", null, null)
 
-            ),
-            new Syntax(EXPORT_SERVICE, "Deprecated",
-                    "Export-Service: org.osgi.service.log.LogService ",
-                    "${classes;implementing;*}", null),
-            new Syntax(
-                    FRAGMENT_HOST,
-                    "The Fragment-Host header defines the host bundle for this fragment.",
-                    "Fragment-Host: org.eclipse.swt; bundle-version=\"[3.0.0,4.0.0)\"",
-                    null,
-                    null,
-                    new Syntax(
-                            EXTENSION_DIRECTIVE,
-                            " Indicates this extension is a system or boot class path extension. It is only applicable when the Fragment-Host is the System Bundle",
-                            "extension:=framework", "framework,bootclasspath",
-                            Pattern.compile("framework|bootclasspath")),
-                    bundle_version),
-            new Syntax(
-                    IMPORT_PACKAGE,
-                    "This header is normally calculated by bnd, however, you can decorate packages or skip packages. The Import-Package header declares the imported packages for this bundle",
-                    "Import-Package: !com.exotic.*, com.acme.foo;vendor=ACME, *",
-                    "${exported_packages}",
-                    Verifier.WILDCARDNAMEPATTERN,
-                    new Syntax(
-                            REMOVE_ATTRIBUTE_DIRECTIVE,
-                            "Remove the given attributes from matching imported packages",
-                            "-remove-attribute:=foo.*", null,
-                            Verifier.WILDCARDNAMEPATTERN),
-                    new Syntax(
-                            RESOLUTION_DIRECTIVE,
-                            "Indicates that the packages must be resolved if the value is mandatory, which is the default. If mandatory packages cannot be resolved, then the bundle must fail to resolve. A value of optional indicates that the packages are optional",
-                            "resolution:=optional", "mandatory,optional",
-                            Pattern.compile("mandatory|optional")
+			),
+			new Syntax(EXPORT_SERVICE, "Deprecated", "Export-Service: org.osgi.service.log.LogService ",
+					"${classes;implementing;*}", null),
+			new Syntax(
+					FRAGMENT_HOST,
+					"The Fragment-Host header defines the host bundle for this fragment.",
+					"Fragment-Host: org.eclipse.swt; bundle-version=\"[3.0.0,4.0.0)\"",
+					null,
+					null,
+					new Syntax(
+							EXTENSION_DIRECTIVE,
+							" Indicates this extension is a system or boot class path extension. It is only applicable when the Fragment-Host is the System Bundle",
+							"extension:=framework", "framework,bootclasspath", Pattern
+									.compile("framework|bootclasspath")), bundle_version),
+			new Syntax(
+					IMPORT_PACKAGE,
+					"This header is normally calculated by bnd, however, you can decorate packages or skip packages. The Import-Package header declares the imported packages for this bundle",
+					"Import-Package: !com.exotic.*, com.acme.foo;vendor=ACME, *",
+					"${exported_packages}",
+					Verifier.WILDCARDNAMEPATTERN,
+					new Syntax(REMOVE_ATTRIBUTE_DIRECTIVE,
+							"Remove the given attributes from matching imported packages", "-remove-attribute:=foo.*",
+							null, Verifier.WILDCARDNAMEPATTERN),
+					new Syntax(
+							RESOLUTION_DIRECTIVE,
+							"Indicates that the packages must be resolved if the value is mandatory, which is the default. If mandatory packages cannot be resolved, then the bundle must fail to resolve. A value of optional indicates that the packages are optional",
+							"resolution:=optional", "mandatory,optional", Pattern.compile("mandatory|optional")
 
-                    ), version, bundle_symbolic_name, bundle_version),
+					), version, bundle_symbolic_name, bundle_version),
 
-            new Syntax(
-                    REQUIRE_BUNDLE,
-                    "The Require-Bundle header specifies the required exports from another bundle.",
-                    "Require-Bundle: com.acme.chess",
-                    null,
-                    Verifier.WILDCARDNAMEPATTERN,
+			new Syntax(
+					REQUIRE_BUNDLE,
+					"The Require-Bundle header specifies the required exports from another bundle.",
+					"Require-Bundle: com.acme.chess",
+					null,
+					Verifier.WILDCARDNAMEPATTERN,
 
-                    new Syntax(
-                            VISIBILITY_DIRECTIVE,
-                            " If the value is private (Default), then all visible packages from the required bundles are not re-exported. If the value is reexport then bundles that require this bundle will transitively have access to these required bundle’s exported packages.",
-                            "visibility:=private", "private,reexport", Pattern
-                                    .compile("private|reexport")),
+					new Syntax(
+							VISIBILITY_DIRECTIVE,
+							" If the value is private (Default), then all visible packages from the required bundles are not re-exported. If the value is reexport then bundles that require this bundle will transitively have access to these required bundle’s exported packages.",
+							"visibility:=private", "private,reexport", Pattern.compile("private|reexport")),
 
-                    new Syntax(
-                            RESOLUTION_DIRECTIVE,
-                            "If the value is mandatory (default) then the required bundle must exist for this bundle to resolve. If the value is optional, the bundle will resolve even if the required bundle does not exist.",
-                            "resolution:=optional", "mandatory,optional",
-                            Pattern.compile("mandatory|optional")),
+					new Syntax(
+							RESOLUTION_DIRECTIVE,
+							"If the value is mandatory (default) then the required bundle must exist for this bundle to resolve. If the value is optional, the bundle will resolve even if the required bundle does not exist.",
+							"resolution:=optional", "mandatory,optional", Pattern.compile("mandatory|optional")),
 
-                    new Syntax(
-                            SPLIT_PACKAGE_DIRECTIVE,
-                            "Indicates how an imported package should be merged when it is split between different exporters. The default is merge-first with warning",
-                            "-split-package:=merge-first",
-                            "merge-first,merge-last,error,first",
-                            Pattern
-                                    .compile("merge-first|merge-last|error|first")),
-                    bundle_version
+					new Syntax(
+							SPLIT_PACKAGE_DIRECTIVE,
+							"Indicates how an imported package should be merged when it is split between different exporters. The default is merge-first with warning",
+							"-split-package:=merge-first", "merge-first,merge-last,error,first", Pattern
+									.compile("merge-first|merge-last|error|first")), bundle_version
 
-            ),
-            new Syntax(
-                    BUILDPATH,
-                    "Provides the class path for building the jar. The entries are references to the repository",
-                    "-buildpath=osgi;version=4.1", "${repo;bsns}",
-                    Verifier.SYMBOLICNAME, path_version),
-            new Syntax(
-                    BUMPPOLICY,
-                    "Sets the version bump policy. This is a parameter to the ${version} macro.",
-                    "-bumppolicy==+0", "==+,=+0,+00", Pattern
-                            .compile("[=+-0][=+-0][=+-0]")),
+			),
+			new Syntax(BUILDPATH,
+					"Provides the class path for building the jar. The entries are references to the repository",
+					"-buildpath=osgi;version=4.1", "${repo;bsns}", Verifier.SYMBOLICNAME, path_version),
+			new Syntax(BUMPPOLICY, "Sets the version bump policy. This is a parameter to the ${version} macro.",
+					"-bumppolicy==+0", "==+,=+0,+00", Pattern.compile("[=+-0][=+-0][=+-0]")),
 
-            new Syntax(
-                    CONDUIT,
-                    "Allows a bnd file to point to files which will be returned when the bnd file is build",
-                    "-conduit= jar/osgi.jar", null, null),
+			new Syntax(CONDUIT,
+					"Allows a bnd file to point to files which will be returned when the bnd file is build",
+					"-conduit= jar/osgi.jar", null, null),
 
-            new Syntax(
-                    DEPENDSON,
-                    "List of project names that this project directly depends on. These projects are always build ahead of this project",
-                    "-dependson=org.acme.cm", "${projects}", null),
+			new Syntax(
+					DEPENDSON,
+					"List of project names that this project directly depends on. These projects are always build ahead of this project",
+					"-dependson=org.acme.cm", "${projects}", null),
 
-            new Syntax(DEPLOYREPO,
-                    "Specifies to which repo the project should be deployed.",
-                    "-deployrepo=cnf", "${repos}", null),
+			new Syntax(DEPLOYREPO, "Specifies to which repo the project should be deployed.", "-deployrepo=cnf",
+					"${repos}", null),
 
-            new Syntax(
-                    DONOTCOPY,
-                    "Regular expression for names of files and directories that should not be copied when discovered",
-                    "-donotcopy=(CVS|\\.svn)", null, null),
+			new Syntax(DONOTCOPY,
+					"Regular expression for names of files and directories that should not be copied when discovered",
+					"-donotcopy=(CVS|\\.svn)", null, null),
 
-            new Syntax(
-                    EXPORT_CONTENTS,
-                    "Build the JAR in the normal way but use this header for the Export-Package header manifest generation, same format",
-                    "-exportcontents=!*impl*,*;version=3.0", null, null),
+			new Syntax(
+					EXPORT_CONTENTS,
+					"Build the JAR in the normal way but use this header for the Export-Package header manifest generation, same format",
+					"-exportcontents=!*impl*,*;version=3.0", null, null),
 
-            new Syntax(
-                    FAIL_OK,
-                    "Return with an ok status (0) even if the build generates errors",
-                    "-failok=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+			new Syntax(FAIL_OK, "Return with an ok status (0) even if the build generates errors", "-failok=true",
+					"true,false", Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(
-                    INCLUDE,
-                    "Include files. If an entry starts with '-', it does not have to exist. If it starts with '~', it must not overwrite any existing properties",
-                    "-include: -${java.user}/.bnd", null, null),
+			new Syntax(
+					INCLUDE,
+					"Include files. If an entry starts with '-', it does not have to exist. If it starts with '~', it must not overwrite any existing properties",
+					"-include: -${java.user}/.bnd", null, null),
 
-            new Syntax(
-                    INCLUDERESOURCE,
-                    "Include resources from the file system. You can specify a directory, or file. All files are copied to the root, unless a destination directory is indicated",
-                    "-includeresource: lib=jar", null, null),
+			new Syntax(
+					INCLUDERESOURCE,
+					"Include resources from the file system. You can specify a directory, or file. All files are copied to the root, unless a destination directory is indicated",
+					"-includeresource: lib=jar", null, null),
 
-            new Syntax(
-                    MAKE,
-                    "Set patterns for make plugins. These patterns are used to find a plugin that can make a resource that can not be found.",
-                    "-make: (*).jar;type=bnd;  recipe=\"bnd/$1.bnd\"", null,
-                    null, new Syntax("type", "Type name for plugin",
-                            "type=bnd", "bnd", null), new Syntax("recipe",
-                            "Recipe for the plugin, can use back references",
-                            "recipe=\"bnd/$1.bnd\"", "bnd", null)),
+			new Syntax(
+					MAKE,
+					"Set patterns for make plugins. These patterns are used to find a plugin that can make a resource that can not be found.",
+					"-make: (*).jar;type=bnd;  recipe=\"bnd/$1.bnd\"", null, null, new Syntax("type",
+							"Type name for plugin", "type=bnd", "bnd", null), new Syntax("recipe",
+							"Recipe for the plugin, can use back references", "recipe=\"bnd/$1.bnd\"", "bnd", null)),
 
-            new Syntax(
-                    MANIFEST,
-                    "Directly include a manifest, do not use the calculated manifest",
-                    "-manifest = META-INF/MANIFEST.MF", null, null),
+			new Syntax(MANIFEST, "Directly include a manifest, do not use the calculated manifest",
+					"-manifest = META-INF/MANIFEST.MF", null, null),
 
-            new Syntax(NOEXTRAHEADERS, "Do not generate housekeeping headers",
-                    "-noextraheaders", "true,false",
-                    Verifier.TRUEORFALSEPATTERN),
+			new Syntax(NOEXTRAHEADERS, "Do not generate housekeeping headers", "-noextraheaders", "true,false",
+					Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(NOUSES,
-                    "Do not calculate the uses: directive on exports",
-                    "-nouses=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+			new Syntax(NOUSES, "Do not calculate the uses: directive on exports", "-nouses=true", "true,false",
+					Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(NOPE,
-                    "Deprecated, use -nobundles. ",
-                    "-nope=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+			new Syntax(NOPE, "Deprecated, use -nobundles. ", "-nope=true", "true,false", Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(
-                    PEDANTIC,
-                    "Warn about things that are not really wrong but still not right",
-                    "-nope=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+			new Syntax(PEDANTIC, "Warn about things that are not really wrong but still not right", "-nope=true",
+					"true,false", Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(
-                    PLUGIN,
-                    "Define the plugins",
-                    "-plugin=aQute.lib.spring.SpringComponent,aQute.lib.deployer.FileRepo;location=${repo}",
-                    null, null),
+			new Syntax(PLUGIN, "Define the plugins",
+					"-plugin=aQute.lib.spring.SpringComponent,aQute.lib.deployer.FileRepo;location=${repo}", null, null),
 
-            new Syntax(SERVICE_COMPONENT,
-                    "The header for Declarative Services",
-                    "Service-Component=com.acme.Foo?;activate='start'", null,
-                    null),
+			new Syntax(SERVICE_COMPONENT, "The header for Declarative Services",
+					"Service-Component=com.acme.Foo?;activate='start'", null, null),
 
-            new Syntax(POM, "Generate a maven pom", "-pom=true", "true,false",
-                    Verifier.TRUEORFALSEPATTERN),
+			new Syntax(POM, "Generate a maven pom", "-pom=true", "true,false", Verifier.TRUEORFALSEPATTERN),
 
-            new Syntax(RELEASEREPO,
-                    "Specifies to which repo the project should be released.",
-                    "-releaserepo=cnf", "${repos}", null),
+			new Syntax(RELEASEREPO, "Specifies to which repo the project should be released.", "-releaserepo=cnf",
+					"${repos}", null),
 
-            new Syntax(REMOVEHEADERS,
-                    "Remove all headers that match the regular expressions",
-                    "-removeheaders=FOO_.*,Proprietary", null, null),
-            new Syntax(
-                    RESOURCEONLY,
-                    "Normally bnd warns when the JAR does not contain any classes, this option suppresses this warning",
-                    "-resourceonly=true", "true,false",
-                    Verifier.TRUEORFALSEPATTERN),
-            new Syntax(SOURCES, "Include sources in the jar", "-sources=true",
-                    "true,false", Verifier.TRUEORFALSEPATTERN),
-            new Syntax(
-                    SOURCEPATH,
-                    "List of directory names that used to source sources for -sources",
-                    "-sourcepath:= src, test", null, null),
-            new Syntax(
-                    SUB,
-                    "Build a set of bnd files that use this bnd file as a basis. The list of bnd file can be specified with wildcards",
-                    "-sub=com.acme.*.bnd", null, null),
-            new Syntax(
-                    RUNPROPERTIES,
-                    "Properties that are set as system properties before the framework is started",
-                    "-runproperties= foo=3, bar=4", null, null),
-            new Syntax(RUNSYSTEMPACKAGES,
-                    "Add additional system packages to a framework run",
-                    "-runsystempackages=com.acme.foo,javax.management", null,
-                    null),
-            new Syntax(
-                    RUNBUNDLES,
-                    "Add additional bundles, specified with their bsn and version like in -buildpath, that are started before the project is run",
-                    "-runbundles=osgi;version=\"[4.1,4.2)\", junit.junit, com.acme.foo;version=project",
-                    null, Verifier.SYMBOLICNAME, path_version),
-            new Syntax(
-                    RUNPATH,
-                    "Additional JARs for the VM path, should include the framework",
-                    "-runpath=org.eclipse.osgi;version=3.5", null, null,
-                    path_version),
-            new Syntax(
-                    RUNVM,
-                    "Additional arguments for the VM invokation. Keys that start with a - are added as options, otherwise they are treated as -D properties for the VM",
-                    "-runvm=-Xmax=30", null, null),
-            new Syntax(
-                    VERSIONPOLICY,
-                    "Provides a version policy to imports that are calculated from exports",
-                    "-versionpolicy = \"[${version;==;${@}},${version;+;${@}})\"",
-                    null, null)
+			new Syntax(REMOVEHEADERS, "Remove all headers that match the regular expressions",
+					"-removeheaders=FOO_.*,Proprietary", null, null),
+			new Syntax(
+					RESOURCEONLY,
+					"Normally bnd warns when the JAR does not contain any classes, this option suppresses this warning",
+					"-resourceonly=true", "true,false", Verifier.TRUEORFALSEPATTERN),
+			new Syntax(SOURCES, "Include sources in the jar", "-sources=true", "true,false",
+					Verifier.TRUEORFALSEPATTERN),
+			new Syntax(SOURCEPATH, "List of directory names that used to source sources for -sources",
+					"-sourcepath:= src, test", null, null),
+			new Syntax(
+					SUB,
+					"Build a set of bnd files that use this bnd file as a basis. The list of bnd file can be specified with wildcards",
+					"-sub=com.acme.*.bnd", null, null),
+			new Syntax(RUNPROPERTIES, "Properties that are set as system properties before the framework is started",
+					"-runproperties= foo=3, bar=4", null, null),
+			new Syntax(RUNSYSTEMPACKAGES, "Add additional system packages to a framework run",
+					"-runsystempackages=com.acme.foo,javax.management", null, null),
+			new Syntax(
+					RUNBUNDLES,
+					"Add additional bundles, specified with their bsn and version like in -buildpath, that are started before the project is run",
+					"-runbundles=osgi;version=\"[4.1,4.2)\", junit.junit, com.acme.foo;version=project", null,
+					Verifier.SYMBOLICNAME, path_version),
+			new Syntax(RUNPATH, "Additional JARs for the VM path, should include the framework",
+					"-runpath=org.eclipse.osgi;version=3.5", null, null, path_version),
+			new Syntax(
+					RUNVM,
+					"Additional arguments for the VM invokation. Keys that start with a - are added as options, otherwise they are treated as -D properties for the VM",
+					"-runvm=-Xmax=30", null, null),
+			new Syntax(VERSIONPOLICY, "Provides a version policy to imports that are calculated from exports",
+					"-versionpolicy = \"[${version;==;${@}},${version;+;${@}})\"", null, null)
 
-                                                                 };
+																	};
 
-    public final static Map<String, Syntax> HELP                 = new HashMap<String, Syntax>();
+	public final static Map<String,Syntax>	HELP					= new HashMap<String,Syntax>();
 
-    static {
-        for (Syntax s : syntaxes) {
-            HELP.put(s.header, s);
-        }
-    }
+	static {
+		for (Syntax s : syntaxes) {
+			HELP.put(s.header, s);
+		}
+	}
 
-    public Syntax(String header, String lead, String example, String values,
-            Pattern pattern, Syntax... children) {
-        this.header = header;
-        this.children = children;
-        this.lead = lead;
-        this.example = example;
-        this.values = values;
-        this.pattern = pattern;
-    }
+	public Syntax(String header, String lead, String example, String values, Pattern pattern, Syntax... children) {
+		this.header = header;
+		this.children = children;
+		this.lead = lead;
+		this.example = example;
+		this.values = values;
+		this.pattern = pattern;
+	}
 
-    public String getLead() {
-        return lead;
-    }
+	public String getLead() {
+		return lead;
+	}
 
-    public String getExample() {
-        return example;
-    }
+	public String getExample() {
+		return example;
+	}
 
-    public String getValues() {
-        return values;
-    }
+	public String getValues() {
+		return values;
+	}
 
-    public String getPattern() {
-        return lead;
-    }
+	public String getPattern() {
+		return lead;
+	}
 
-    public Syntax[] getChildren() {
-        return children;
-    }
+	public Syntax[] getChildren() {
+		return children;
+	}
 
-    public String getHeader() {
-        return header;
-    }
+	public String getHeader() {
+		return header;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/Make.java b/bundleplugin/src/main/java/aQute/bnd/make/Make.java
index 2b0ce8a..a42b5e0 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/Make.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/Make.java
@@ -9,34 +9,34 @@
 import aQute.libg.header.*;
 
 public class Make {
-	Builder									builder;
-	Map<Instruction, Map<String, String>>	make;
+	Builder								builder;
+	Map<Instruction,Map<String,String>>	make;
 
 	public Make(Builder builder) {
 		this.builder = builder;
 	}
 
 	public Resource process(String source) {
-		Map<Instruction, Map<String, String>> make = getMakeHeader();
+		Map<Instruction,Map<String,String>> make = getMakeHeader();
 		builder.trace("make " + source);
 
-		for (Map.Entry<Instruction, Map<String, String>> entry : make.entrySet()) {
+		for (Map.Entry<Instruction,Map<String,String>> entry : make.entrySet()) {
 			Instruction instr = entry.getKey();
 			Matcher m = instr.getMatcher(source);
 			if (m.matches() || instr.isNegated()) {
-				Map<String, String> arguments = replace(m, entry.getValue());
+				Map<String,String> arguments = replace(m, entry.getValue());
 				List<MakePlugin> plugins = builder.getPlugins(MakePlugin.class);
 				for (MakePlugin plugin : plugins) {
 					try {
 						Resource resource = plugin.make(builder, source, arguments);
 						if (resource != null) {
-							builder.trace("Made " + source + " from args " + arguments + " with "
-									+ plugin);
+							builder.trace("Made " + source + " from args " + arguments + " with " + plugin);
 							return resource;
 						}
-					} catch (Exception e) {
-						builder.error("Plugin " + plugin + " generates error when use in making "
-								+ source + " with args " + arguments, e);
+					}
+					catch (Exception e) {
+						builder.error("Plugin " + plugin + " generates error when use in making " + source
+								+ " with args " + arguments, e);
 					}
 				}
 			}
@@ -44,9 +44,9 @@
 		return null;
 	}
 
-	private Map<String, String> replace(Matcher m, Map<String, String> value) {
-		Map<String, String> newArgs = Processor.newMap();
-		for (Map.Entry<String, String> entry : value.entrySet()) {
+	private Map<String,String> replace(Matcher m, Map<String,String> value) {
+		Map<String,String> newArgs = Processor.newMap();
+		for (Map.Entry<String,String> entry : value.entrySet()) {
 			String s = entry.getValue();
 			s = replace(m, s);
 			newArgs.put(entry.getKey(), s);
@@ -77,15 +77,15 @@
 		return sb.toString();
 	}
 
-	Map<Instruction, Map<String, String>> getMakeHeader() {
+	Map<Instruction,Map<String,String>> getMakeHeader() {
 		if (make != null)
 			return make;
 		make = Processor.newMap();
 
 		String s = builder.getProperty(Builder.MAKE);
 		Parameters make = builder.parseHeader(s);
-		
-		for (Entry<String, Attrs> entry : make.entrySet()) {
+
+		for (Entry<String,Attrs> entry : make.entrySet()) {
 			String pattern = Processor.removeDuplicateMarker(entry.getKey());
 
 			Instruction instr = new Instruction(pattern);
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/MakeBnd.java b/bundleplugin/src/main/java/aQute/bnd/make/MakeBnd.java
index 581deb7..29e5353 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/MakeBnd.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/MakeBnd.java
@@ -9,57 +9,55 @@
 import aQute.lib.osgi.*;
 
 public class MakeBnd implements MakePlugin, Constants {
-    final static Pattern JARFILE = Pattern.compile("(.+)\\.(jar|ipa)");
+	final static Pattern	JARFILE	= Pattern.compile("(.+)\\.(jar|ipa)");
 
-    public Resource make(Builder builder, String destination,
-            Map<String, String> argumentsOnMake) throws Exception {
-        String type = argumentsOnMake.get("type");
-        if (!"bnd".equals(type))
-            return null;
+	public Resource make(Builder builder, String destination, Map<String,String> argumentsOnMake) throws Exception {
+		String type = argumentsOnMake.get("type");
+		if (!"bnd".equals(type))
+			return null;
 
-        String recipe = argumentsOnMake.get("recipe");
-        if (recipe == null) {
-            builder.error("No recipe specified on a make instruction for "
-                    + destination);
-            return null;
-        }
-        File bndfile = builder.getFile(recipe);
-        if (bndfile.isFile()) {
-            // We do not use a parent because then we would
-            // build ourselves again. So we can not blindly
-            // inherit the properties.
-            Builder bchild = builder.getSubBuilder();
-            bchild.removeBundleSpecificHeaders();
-            
-            // We must make sure that we do not include ourselves again!
-            bchild.setProperty(Analyzer.INCLUDE_RESOURCE, "");
-            bchild.setProperty(Analyzer.INCLUDERESOURCE, "");
-            bchild.setProperties(bndfile, builder.getBase());
-            
-            Jar jar = bchild.build();
-            Jar dot = builder.getTarget();
+		String recipe = argumentsOnMake.get("recipe");
+		if (recipe == null) {
+			builder.error("No recipe specified on a make instruction for " + destination);
+			return null;
+		}
+		File bndfile = builder.getFile(recipe);
+		if (bndfile.isFile()) {
+			// We do not use a parent because then we would
+			// build ourselves again. So we can not blindly
+			// inherit the properties.
+			Builder bchild = builder.getSubBuilder();
+			bchild.removeBundleSpecificHeaders();
 
-            if (builder.hasSources()) {
-                for (String key : jar.getResources().keySet()) {
-                    if (key.startsWith("OSGI-OPT/src"))
-                        dot.putResource(key, jar.getResource(key));
-                }
-            }
-            builder.getInfo(bchild, bndfile.getName() +": ");
-            String debug = bchild.getProperty(DEBUG);
-            if (Processor.isTrue(debug)) {
-                if ( builder instanceof ProjectBuilder ) {
-                    ProjectBuilder pb = (ProjectBuilder) builder;
-                    File target = pb.getProject().getTarget();
-                    String bsn = bchild.getBsn();
-                    File output = new File(target, bsn+".jar");
-                    jar.write(output);
-                    pb.getProject().getWorkspace().changedFile(output);
-                }
-            }
-            return new JarResource(jar);
-        } else
-            return null;
-    }
+			// We must make sure that we do not include ourselves again!
+			bchild.setProperty(Analyzer.INCLUDE_RESOURCE, "");
+			bchild.setProperty(Analyzer.INCLUDERESOURCE, "");
+			bchild.setProperties(bndfile, builder.getBase());
+
+			Jar jar = bchild.build();
+			Jar dot = builder.getTarget();
+
+			if (builder.hasSources()) {
+				for (String key : jar.getResources().keySet()) {
+					if (key.startsWith("OSGI-OPT/src"))
+						dot.putResource(key, jar.getResource(key));
+				}
+			}
+			builder.getInfo(bchild, bndfile.getName() + ": ");
+			String debug = bchild.getProperty(DEBUG);
+			if (Processor.isTrue(debug)) {
+				if (builder instanceof ProjectBuilder) {
+					ProjectBuilder pb = (ProjectBuilder) builder;
+					File target = pb.getProject().getTarget();
+					String bsn = bchild.getBsn();
+					File output = new File(target, bsn + ".jar");
+					jar.write(output);
+					pb.getProject().getWorkspace().changedFile(output);
+				}
+			}
+			return new JarResource(jar);
+		} else
+			return null;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/MakeCopy.java b/bundleplugin/src/main/java/aQute/bnd/make/MakeCopy.java
index 3d5e4c8..74d2921 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/MakeCopy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/MakeCopy.java
@@ -9,37 +9,34 @@
 
 public class MakeCopy implements MakePlugin {
 
-    public Resource make(Builder builder, String destination,
-            Map<String, String> argumentsOnMake) throws Exception {
-        String type = argumentsOnMake.get("type");
-        if (!type.equals("copy"))
-            return null;
+	public Resource make(Builder builder, String destination, Map<String,String> argumentsOnMake) throws Exception {
+		String type = argumentsOnMake.get("type");
+		if (!type.equals("copy"))
+			return null;
 
-        String from = argumentsOnMake.get("from");
-        if (from == null) {
-            String content = argumentsOnMake.get("content");
-            if (content == null)
-                throw new IllegalArgumentException(
-                        "No 'from' or 'content' field in copy "
-                                + argumentsOnMake);
-            return new EmbeddedResource(content.getBytes("UTF-8"),0);
-        } else {
+		String from = argumentsOnMake.get("from");
+		if (from == null) {
+			String content = argumentsOnMake.get("content");
+			if (content == null)
+				throw new IllegalArgumentException("No 'from' or 'content' field in copy " + argumentsOnMake);
+			return new EmbeddedResource(content.getBytes("UTF-8"), 0);
+		} else {
 
-            File f = builder.getFile(from);
-            if (f.isFile())
-                return new FileResource(f);
-            else {
-                try {
-                    URL url = new URL(from);
-                    return new URLResource(url);
-                } catch(MalformedURLException mfue) {
-                    // We ignore this
-                }
-                throw new IllegalArgumentException(
-                        "Copy source does not exist " + from
-                                + " for destination " + destination);
-            }
-        }
-    }
+			File f = builder.getFile(from);
+			if (f.isFile())
+				return new FileResource(f);
+			else {
+				try {
+					URL url = new URL(from);
+					return new URLResource(url);
+				}
+				catch (MalformedURLException mfue) {
+					// We ignore this
+				}
+				throw new IllegalArgumentException("Copy source does not exist " + from + " for destination "
+						+ destination);
+			}
+		}
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java b/bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java
index e06cdc5f..a41e337 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/calltree/CalltreeResource.java
@@ -14,160 +14,160 @@
  *    calltree ::= &lt;using&gt; &lt;usedby&gt;
  *    using    ::= &lt;method&gt; *
  *    usedby   ::= &lt;method&gt; *
- *    method   ::= &lt;ref&gt; 
+ *    method   ::= &lt;ref&gt;
  * </pre>
  * 
  * The <code>using</code> element contains methods in the set of classes and
  * their references. The <code>usedby</code> element contains the used methods
  * and their references to the set of classes. The <code>ref</code> element
  * contains the class, the method name, the descriptor, and a pretty print
- * version of the method.
- * 
- * The XML does not contain an XML processor instruction to make it easier to
- * include in other XML. The encoding is always UTF-8.
- * 
- * This class can be used as a resource, just add it to a JAR and the data is
+ * version of the method. The XML does not contain an XML processor instruction
+ * to make it easier to include in other XML. The encoding is always UTF-8. This
+ * class can be used as a resource, just add it to a JAR and the data is
  * generated when the resource is written (saving time when the JAR is up to
  * date and does not have to be generated). However, the actual write method is
  * a static method and can be called as well:
  * {@link #writeCalltree(PrintWriter, Collection)}.
  */
 public class CalltreeResource extends WriteResource {
-    Collection<Clazz> classes;
+	Collection<Clazz>	classes;
 
-    /**
-     * Create a resource for inclusion that will print a call tree.
-     * 
-     * @param values the classes for which the call tree is generated.
-     */
-    public CalltreeResource(Collection<Clazz> values) {
-        this.classes = values;
-        System.err.println(values);
-    }
+	/**
+	 * Create a resource for inclusion that will print a call tree.
+	 * 
+	 * @param values
+	 *            the classes for which the call tree is generated.
+	 */
+	public CalltreeResource(Collection<Clazz> values) {
+		this.classes = values;
+		System.err.println(values);
+	}
 
-    /**
-     * We set the last modified to 0 so this resource does not force
-     * a new JAR if all other resources are up to date.
-     */
-    public long lastModified() {
-        return 0;
-    }
+	/**
+	 * We set the last modified to 0 so this resource does not force a new JAR
+	 * if all other resources are up to date.
+	 */
+	public long lastModified() {
+		return 0;
+	}
 
-    /**
-     * The write method is called to write the resource. We just call the static
-     * method.
-     */
-    public void write(OutputStream out) throws Exception {
-        OutputStreamWriter osw = new OutputStreamWriter(out, Constants.DEFAULT_CHARSET);
-        PrintWriter pw = new PrintWriter(osw);
-        try {
-            writeCalltree(pw, classes);
-        } finally {
-            pw.flush();
-        }
-    }
-
-    /**
-     * Print the call tree in XML.
-     * 
-     * @param out The output writer
-     * @param classes The set of classes
-     * @throws IOException Any errors
-     */
-    public static void writeCalltree(PrintWriter out, Collection<Clazz> classes)
-            throws Exception {
-
-        final Map<Clazz.MethodDef, Set<Clazz.MethodDef>> using = new TreeMap<Clazz.MethodDef, Set<Clazz.MethodDef>>(COMPARATOR);
-        final Map<Clazz.MethodDef, Set<Clazz.MethodDef>> usedby = new TreeMap<Clazz.MethodDef, Set<Clazz.MethodDef>>(COMPARATOR);
-
-        ClassDataCollector cd = new ClassDataCollector() {
-            Clazz.MethodDef source;
-
-            // Before a method is parsed
-            public void method(Clazz.MethodDef source) {
-                this.source = source;
-                xref(using, source, null);
-                xref(usedby, source, null);
-            }
-
-            // For any reference in the previous method.
-            public void reference(Clazz.MethodDef reference) {
-                xref(using, source, reference);
-                xref(usedby, reference, source);
-            }
-        };
-        for (Clazz clazz : classes) {
-            clazz.parseClassFileWithCollector(cd);
-        }
-
-        out.println("<calltree>");
-        xref(out, "using", using);
-        xref(out, "usedby", usedby);
-        out.println("</calltree>");
-    }
-
-    /*
-     * Add a new reference
-     */
-    static Comparator<Clazz.MethodDef> COMPARATOR = new Comparator<Clazz.MethodDef>() {
-		
-		public int compare(MethodDef a, MethodDef b) {
-			int r =a.getName().compareTo(b.getName()); 
-			return  r != 0 ? r : a.getDescriptor().toString().compareTo(b.getDescriptor().toString());
+	/**
+	 * The write method is called to write the resource. We just call the static
+	 * method.
+	 */
+	public void write(OutputStream out) throws Exception {
+		OutputStreamWriter osw = new OutputStreamWriter(out, Constants.DEFAULT_CHARSET);
+		PrintWriter pw = new PrintWriter(osw);
+		try {
+			writeCalltree(pw, classes);
 		}
-	};
-    private static void xref(
-            Map<Clazz.MethodDef, Set<Clazz.MethodDef>> references,
-            Clazz.MethodDef source, Clazz.MethodDef reference) {
-        Set<Clazz.MethodDef> set = references.get(source);
-        if (set == null)
-            references.put(source, set=new TreeSet<Clazz.MethodDef>(COMPARATOR));
-        if ( reference != null)
-            set.add(reference);
-    }
+		finally {
+			pw.flush();
+		}
+	}
 
-    /*
-     * Print out either using or usedby sets
-     */
-    private static void xref(PrintWriter out, String group,
-            Map<Clazz.MethodDef, Set<Clazz.MethodDef>> references) {
-        out.println("  <" + group + ">");
-        for (Map.Entry<Clazz.MethodDef, Set<Clazz.MethodDef>> entry : references
-                .entrySet()) {
-            Clazz.MethodDef source = entry.getKey();
-            Set<Clazz.MethodDef> refs = entry.getValue();
-            method(out, "method", source, ">");
-            for (Clazz.MethodDef ref : refs) {
-                method(out, "ref", ref, "/>");
-            }
-            out.println("      </method>");
-        }
-        out.println("  </" + group + ">");
-    }
+	/**
+	 * Print the call tree in XML.
+	 * 
+	 * @param out
+	 *            The output writer
+	 * @param classes
+	 *            The set of classes
+	 * @throws IOException
+	 *             Any errors
+	 */
+	public static void writeCalltree(PrintWriter out, Collection<Clazz> classes) throws Exception {
 
-    /*
-     * Print out a method.
-     */
-    private static void method(PrintWriter out, String element,
-            Clazz.MethodDef source, String closeElement) {
-        out.println("      <" + element + " class='" + source.getContainingClass().getFQN() + "'"
-                + getAccess(source.getAccess()) + 
-                ( source.isConstructor() ? "" :  " name='" + source.getName() + "'") + " descriptor='" + source.getDescriptor() + "' pretty='"
-                + source.toString() + "'" + closeElement);
-    }
+		final Map<Clazz.MethodDef,Set<Clazz.MethodDef>> using = new TreeMap<Clazz.MethodDef,Set<Clazz.MethodDef>>(
+				COMPARATOR);
+		final Map<Clazz.MethodDef,Set<Clazz.MethodDef>> usedby = new TreeMap<Clazz.MethodDef,Set<Clazz.MethodDef>>(
+				COMPARATOR);
 
-    private static String getAccess(int access) {
-        StringBuilder sb = new StringBuilder();
-        if ( Modifier.isPublic(access) )
-            sb.append(" public='true'");
-        if ( Modifier.isStatic(access) )
-            sb.append(" static='true'");
-        if ( Modifier.isProtected(access) )
-            sb.append(" protected='true'");
-        if ( Modifier.isInterface(access) )
-            sb.append(" interface='true'");
-        
-        return sb.toString();
-    }
+		ClassDataCollector cd = new ClassDataCollector() {
+			Clazz.MethodDef	source;
+
+			// Before a method is parsed
+			public void method(Clazz.MethodDef source) {
+				this.source = source;
+				xref(using, source, null);
+				xref(usedby, source, null);
+			}
+
+			// For any reference in the previous method.
+			public void reference(Clazz.MethodDef reference) {
+				xref(using, source, reference);
+				xref(usedby, reference, source);
+			}
+		};
+		for (Clazz clazz : classes) {
+			clazz.parseClassFileWithCollector(cd);
+		}
+
+		out.println("<calltree>");
+		xref(out, "using", using);
+		xref(out, "usedby", usedby);
+		out.println("</calltree>");
+	}
+
+	/*
+	 * Add a new reference
+	 */
+	static Comparator<Clazz.MethodDef>	COMPARATOR	= new Comparator<Clazz.MethodDef>() {
+
+														public int compare(MethodDef a, MethodDef b) {
+															int r = a.getName().compareTo(b.getName());
+															return r != 0 ? r : a.getDescriptor().toString()
+																	.compareTo(b.getDescriptor().toString());
+														}
+													};
+
+	private static void xref(Map<Clazz.MethodDef,Set<Clazz.MethodDef>> references, Clazz.MethodDef source,
+			Clazz.MethodDef reference) {
+		Set<Clazz.MethodDef> set = references.get(source);
+		if (set == null)
+			references.put(source, set = new TreeSet<Clazz.MethodDef>(COMPARATOR));
+		if (reference != null)
+			set.add(reference);
+	}
+
+	/*
+	 * Print out either using or usedby sets
+	 */
+	private static void xref(PrintWriter out, String group, Map<Clazz.MethodDef,Set<Clazz.MethodDef>> references) {
+		out.println("  <" + group + ">");
+		for (Map.Entry<Clazz.MethodDef,Set<Clazz.MethodDef>> entry : references.entrySet()) {
+			Clazz.MethodDef source = entry.getKey();
+			Set<Clazz.MethodDef> refs = entry.getValue();
+			method(out, "method", source, ">");
+			for (Clazz.MethodDef ref : refs) {
+				method(out, "ref", ref, "/>");
+			}
+			out.println("      </method>");
+		}
+		out.println("  </" + group + ">");
+	}
+
+	/*
+	 * Print out a method.
+	 */
+	private static void method(PrintWriter out, String element, Clazz.MethodDef source, String closeElement) {
+		out.println("      <" + element + " class='" + source.getContainingClass().getFQN() + "'"
+				+ getAccess(source.getAccess()) + (source.isConstructor() ? "" : " name='" + source.getName() + "'")
+				+ " descriptor='" + source.getDescriptor() + "' pretty='" + source.toString() + "'" + closeElement);
+	}
+
+	private static String getAccess(int access) {
+		StringBuilder sb = new StringBuilder();
+		if (Modifier.isPublic(access))
+			sb.append(" public='true'");
+		if (Modifier.isStatic(access))
+			sb.append(" static='true'");
+		if (Modifier.isProtected(access))
+			sb.append(" protected='true'");
+		if (Modifier.isInterface(access))
+			sb.append(" interface='true'");
+
+		return sb.toString();
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java b/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
index 1a586b4..7c776b3 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/component/ComponentAnnotationReader.java
@@ -22,18 +22,20 @@
 	static Pattern				ACTIVATEDESCRIPTOR		= Pattern
 																.compile("\\(((Lorg/osgi/service/component/ComponentContext;)|(Lorg/osgi/framework/BundleContext;)|(Ljava/util/Map;))*\\)V");
 	static Pattern				OLDACTIVATEDESCRIPTOR	= Pattern
-	.compile("\\(Lorg/osgi/service/component/ComponentContext;\\)V");
-	
-	
+																.compile("\\(Lorg/osgi/service/component/ComponentContext;\\)V");
+
 	static Pattern				OLDBINDDESCRIPTOR		= Pattern.compile("\\(L([^;]*);\\)V");
 	static Pattern				REFERENCEBINDDESCRIPTOR	= Pattern
 																.compile("\\(Lorg/osgi/framework/ServiceReference;\\)V");
 
 	static String[]				ACTIVATE_ARGUMENTS		= {
-		"org.osgi.service.component.ComponentContext", "org.osgi.framework.BundleContext",
-		Map.class.getName(), "org.osgi.framework.BundleContext" };
-	static String[]				OLD_ACTIVATE_ARGUMENTS	= { "org.osgi.service.component.ComponentContext" };
-	
+			"org.osgi.service.component.ComponentContext", "org.osgi.framework.BundleContext", Map.class.getName(),
+			"org.osgi.framework.BundleContext"
+														};
+	static String[]				OLD_ACTIVATE_ARGUMENTS	= {
+															"org.osgi.service.component.ComponentContext"
+														};
+
 	Reporter					reporter				= new Processor();
 	MethodDef					method;
 	TypeRef						className;
@@ -43,7 +45,7 @@
 	Set<String>					optional				= new HashSet<String>();
 	Set<String>					dynamic					= new HashSet<String>();
 
-	Map<String, String>			map						= new TreeMap<String, String>();
+	Map<String,String>			map						= new TreeMap<String,String>();
 	Set<String>					descriptors				= new HashSet<String>();
 	List<String>				properties				= new ArrayList<String>();
 	String						version					= null;
@@ -62,11 +64,11 @@
 		return this.reporter;
 	}
 
-	public static Map<String, String> getDefinition(Clazz c) throws Exception {
+	public static Map<String,String> getDefinition(Clazz c) throws Exception {
 		return getDefinition(c, new Processor());
 	}
 
-	public static Map<String, String> getDefinition(Clazz c, Reporter reporter) throws Exception {
+	public static Map<String,String> getDefinition(Clazz c, Reporter reporter) throws Exception {
 		ComponentAnnotationReader r = new ComponentAnnotationReader(c);
 		r.setReporter(reporter);
 		c.parseClassFileWithCollector(r);
@@ -76,7 +78,7 @@
 
 	public void annotation(Annotation annotation) {
 		String fqn = annotation.getName().getFQN();
-		
+
 		if (fqn.equals(Component.class.getName())) {
 			set(COMPONENT_NAME, annotation.get(Component.NAME), "<>");
 			set(COMPONENT_FACTORY, annotation.get(Component.FACTORY), false);
@@ -296,9 +298,8 @@
 	}
 
 	/**
-	 * Skip L and ; and replace / for . in an object descriptor.
-	 * 
-	 * A string like Lcom/acme/Foo; becomes com.acme.Foo
+	 * Skip L and ; and replace / for . in an object descriptor. A string like
+	 * Lcom/acme/Foo; becomes com.acme.Foo
 	 * 
 	 * @param string
 	 * @return
@@ -315,15 +316,18 @@
 		return sb.toString();
 	}
 
-	@Override public void classBegin(int access, TypeRef name) {
+	@Override
+	public void classBegin(int access, TypeRef name) {
 		className = name;
 	}
 
-	@Override public void implementsInterfaces(TypeRef[] interfaces) {
+	@Override
+	public void implementsInterfaces(TypeRef[] interfaces) {
 		this.interfaces = interfaces;
 	}
 
-	@Override public void method(Clazz.MethodDef method) {
+	@Override
+	public void method(Clazz.MethodDef method) {
 		this.method = method;
 		descriptors.add(method.getName());
 	}
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java b/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
index 1e5989f..653c48d 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/component/ServiceComponent.java
@@ -26,7 +26,7 @@
 
 		ComponentMaker m = new ComponentMaker(analyzer);
 
-		Map<String, Map<String, String>> l = m.doServiceComponent();
+		Map<String,Map<String,String>> l = m.doServiceComponent();
 
 		analyzer.setProperty(Constants.SERVICE_COMPONENT, Processor.printClauses(l));
 
@@ -50,21 +50,20 @@
 		 * <li>An XML file reference</li>
 		 * <li>A FQN/wildcard with a set of attributes</li>
 		 * </ol>
-		 * 
 		 * An XML reference is immediately expanded, an FQN/wildcard is more
 		 * complicated and is delegated to
 		 * {@link #componentEntry(Map, String, Map)}.
 		 * 
 		 * @throws Exception
 		 */
-		Map<String, Map<String, String>> doServiceComponent() throws Exception {
-			Map<String, Map<String, String>> serviceComponents = newMap();
+		Map<String,Map<String,String>> doServiceComponent() throws Exception {
+			Map<String,Map<String,String>> serviceComponents = newMap();
 			String header = getProperty(SERVICE_COMPONENT);
 			Parameters sc = parseHeader(header);
 
-			for (Entry<String, Attrs> entry : sc.entrySet()) {
+			for (Entry<String,Attrs> entry : sc.entrySet()) {
 				String name = entry.getKey();
-				Map<String, String> info = entry.getValue();
+				Map<String,String> info = entry.getValue();
 
 				try {
 					if (name.indexOf('/') >= 0 || name.endsWith(".xml")) {
@@ -73,7 +72,8 @@
 					} else {
 						componentEntry(serviceComponents, name, info);
 					}
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					e.printStackTrace();
 					error("Invalid Service-Component header: %s %s, throws %s", name, info, e);
 				}
@@ -89,17 +89,16 @@
 		 * <li>A wildcard expression for finding annotated components.</li>
 		 * </ol>
 		 * The problem is the distinction between an FQN and a wildcard because
-		 * an FQN can also be used as a wildcard.
-		 * 
-		 * If the info specifies {@link Constants#NOANNOTATIONS} then wildcards
-		 * are an error and the component must be fully described by the info.
-		 * Otherwise the FQN/wildcard is expanded into a list of classes with
-		 * annotations. If this list is empty, the FQN case is interpreted as a
-		 * complete component definition. For the wildcard case, it is checked
-		 * if any matching classes for the wildcard have been compiled for a
-		 * class file format that does not support annotations, this can be a
-		 * problem with JSR14 who silently ignores annotations. An error is
-		 * reported in such a case.
+		 * an FQN can also be used as a wildcard. If the info specifies
+		 * {@link Constants#NOANNOTATIONS} then wildcards are an error and the
+		 * component must be fully described by the info. Otherwise the
+		 * FQN/wildcard is expanded into a list of classes with annotations. If
+		 * this list is empty, the FQN case is interpreted as a complete
+		 * component definition. For the wildcard case, it is checked if any
+		 * matching classes for the wildcard have been compiled for a class file
+		 * format that does not support annotations, this can be a problem with
+		 * JSR14 who silently ignores annotations. An error is reported in such
+		 * a case.
 		 * 
 		 * @param serviceComponents
 		 * @param name
@@ -107,8 +106,8 @@
 		 * @throws Exception
 		 * @throws IOException
 		 */
-		private void componentEntry(Map<String, Map<String, String>> serviceComponents,
-				String name, Map<String, String> info) throws Exception, IOException {
+		private void componentEntry(Map<String,Map<String,String>> serviceComponents, String name,
+				Map<String,String> info) throws Exception, IOException {
 
 			boolean annotations = !Processor.isTrue(info.get(NOANNOTATIONS));
 			boolean fqn = Verifier.isFQN(name);
@@ -117,8 +116,8 @@
 
 				// Annotations possible!
 
-				Collection<Clazz> annotatedComponents = analyzer.getClasses("",
-						QUERY.ANNOTATED.toString(), Component.class.getName(), //
+				Collection<Clazz> annotatedComponents = analyzer.getClasses("", QUERY.ANNOTATED.toString(),
+						Component.class.getName(), //
 						QUERY.NAMED.toString(), name //
 						);
 
@@ -169,9 +168,9 @@
 		private Collection<Clazz> checkAnnotationsFeasible(String name) throws Exception {
 			Collection<Clazz> not = analyzer.getClasses("", QUERY.NAMED.toString(), name //
 					);
-			
+
 			if (not.isEmpty())
-				if ( "*".equals(name))
+				if ("*".equals(name))
 					return not;
 				else
 					error("Specified %s but could not find any class matching this pattern", name);
@@ -180,18 +179,17 @@
 				if (c.getFormat().hasAnnotations())
 					return not;
 			}
-			
+
 			warning("Wildcards are used (%s) requiring annotations to decide what is a component. Wildcard maps to classes that are compiled with java.target < 1.5. Annotations were introduced in Java 1.5",
 					name);
-			
+
 			return not;
 		}
 
-		void annotated(Map<String, Map<String, String>> components, Clazz c,
-				Map<String, String> info) throws Exception {
+		void annotated(Map<String,Map<String,String>> components, Clazz c, Map<String,String> info) throws Exception {
 			// Get the component definition
 			// from the annotations
-			Map<String, String> map = ComponentAnnotationReader.getDefinition(c, this);
+			Map<String,String> map = ComponentAnnotationReader.getDefinition(c, this);
 
 			// Pick the name, the annotation can override
 			// the name.
@@ -202,16 +200,15 @@
 			// Override the component info without manifest
 			// entries. We merge the properties though.
 
-			String merged = Processor.merge(info.remove(COMPONENT_PROPERTIES),
-					map.remove(COMPONENT_PROPERTIES));
+			String merged = Processor.merge(info.remove(COMPONENT_PROPERTIES), map.remove(COMPONENT_PROPERTIES));
 			if (merged != null && merged.length() > 0)
 				map.put(COMPONENT_PROPERTIES, merged);
 			map.putAll(info);
 			createComponentResource(components, localname, map);
 		}
 
-		private void createComponentResource(Map<String, Map<String, String>> components,
-				String name, Map<String, String> info) throws IOException {
+		private void createComponentResource(Map<String,Map<String,String>> components, String name,
+				Map<String,String> info) throws IOException {
 
 			// We can override the name in the parameters
 			if (info.containsKey(COMPONENT_NAME))
@@ -264,9 +261,7 @@
 
 					analyzer.getJar().putResource(rname, r);
 				} else {
-					analyzer.error(
-							"Cannot find designated configuration class %s for component %s", c,
-							name);
+					analyzer.error("Cannot find designated configuration class %s for component %s", c, name);
 				}
 			}
 			return true;
@@ -280,8 +275,7 @@
 		 * @param info
 		 * @throws UnsupportedEncodingException
 		 */
-		Resource createComponentResource(String name, String impl, Map<String, String> info)
-				throws IOException {
+		Resource createComponentResource(String name, String impl, Map<String,String> info) throws IOException {
 			String namespace = getNamespace(info);
 			ByteArrayOutputStream out = new ByteArrayOutputStream();
 			PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, Constants.DEFAULT_CHARSET));
@@ -295,8 +289,8 @@
 			doAttribute(pw, info.get(COMPONENT_FACTORY), "factory");
 			doAttribute(pw, info.get(COMPONENT_IMMEDIATE), "immediate", "false", "true");
 			doAttribute(pw, info.get(COMPONENT_ENABLED), "enabled", "true", "false");
-			doAttribute(pw, info.get(COMPONENT_CONFIGURATION_POLICY), "configuration-policy",
-					"optional", "require", "ignore");
+			doAttribute(pw, info.get(COMPONENT_CONFIGURATION_POLICY), "configuration-policy", "optional", "require",
+					"ignore");
 			doAttribute(pw, info.get(COMPONENT_ACTIVATE), "activate", JIDENTIFIER);
 			doAttribute(pw, info.get(COMPONENT_DEACTIVATE), "deactivate", JIDENTIFIER);
 			doAttribute(pw, info.get(COMPONENT_MODIFIED), "modified", JIDENTIFIER);
@@ -335,13 +329,12 @@
 				if (matches.length != 0) {
 					if (matches.length == 1 && matches[0].equals(JIDENTIFIER)) {
 						if (!Verifier.isIdentifier(value))
-							error("Component attribute %s has value %s but is not a Java identifier",
-									name, value);
+							error("Component attribute %s has value %s but is not a Java identifier", name, value);
 					} else {
 
 						if (!Verifier.isMember(value, matches))
-							error("Component attribute %s has value %s but is not a member of %s",
-									name, value, Arrays.toString(matches));
+							error("Component attribute %s has value %s but is not a member of %s", name, value,
+									Arrays.toString(matches));
 					}
 				}
 				pw.print(" ");
@@ -358,15 +351,15 @@
 		 * @param info
 		 * @return
 		 */
-		private String getNamespace(Map<String, String> info) {
+		private String getNamespace(Map<String,String> info) {
 			String version = info.get(COMPONENT_VERSION);
 			if (version != null) {
 				try {
 					Version v = new Version(version);
 					return NAMESPACE_STEM + "/v" + v;
-				} catch (Exception e) {
-					error("version: specified on component header but not a valid version: "
-							+ version);
+				}
+				catch (Exception e) {
+					error("version: specified on component header but not a valid version: " + version);
 					return null;
 				}
 			}
@@ -384,7 +377,7 @@
 		 * @param pw
 		 * @param info
 		 */
-		void properties(PrintWriter pw, Map<String, String> info) {
+		void properties(PrintWriter pw, Map<String,String> info) {
 			Collection<String> properties = split(info.get(COMPONENT_PROPERTIES));
 			for (Iterator<String> p = properties.iterator(); p.hasNext();) {
 				String clause = p.next();
@@ -468,21 +461,20 @@
 		 * @param pw
 		 */
 
-		void reference(Map<String, String> info, PrintWriter pw) {
+		void reference(Map<String,String> info, PrintWriter pw) {
 			Collection<String> dynamic = new ArrayList<String>(split(info.get(COMPONENT_DYNAMIC)));
 			Collection<String> optional = new ArrayList<String>(split(info.get(COMPONENT_OPTIONAL)));
 			Collection<String> multiple = new ArrayList<String>(split(info.get(COMPONENT_MULTIPLE)));
 
 			Collection<String> descriptors = split(info.get(COMPONENT_DESCRIPTORS));
 
-			for (Map.Entry<String, String> entry : info.entrySet()) {
+			for (Map.Entry<String,String> entry : info.entrySet()) {
 
 				// Skip directives
 				String referenceName = entry.getKey();
 				if (referenceName.endsWith(":")) {
 					if (!SET_COMPONENT_DIRECTIVES.contains(referenceName))
-						error("Unrecognized directive in Service-Component header: "
-								+ referenceName);
+						error("Unrecognized directive in Service-Component header: " + referenceName);
 					continue;
 				}
 
@@ -508,15 +500,14 @@
 					}
 				} else if (Character.isLowerCase(referenceName.charAt(0))) {
 					unbindCalculated = true;
-					bind = "set" + Character.toUpperCase(referenceName.charAt(0))
-							+ referenceName.substring(1);
+					bind = "set" + Character.toUpperCase(referenceName.charAt(0)) + referenceName.substring(1);
 					unbind = "un" + bind;
 				}
 
 				String interfaceName = entry.getValue();
 				if (interfaceName == null || interfaceName.length() == 0) {
-					error("Invalid Interface Name for references in Service Component: "
-							+ referenceName + "=" + interfaceName);
+					error("Invalid Interface Name for references in Service Component: " + referenceName + "="
+							+ interfaceName);
 					continue;
 				}
 
@@ -603,21 +594,21 @@
 		for (int i = 0; i < s.length(); i++) {
 			char c = s.charAt(i);
 			switch (c) {
-			case '<':
-				sb.append("&lt;");
-				break;
-			case '>':
-				sb.append("&gt;");
-				break;
-			case '&':
-				sb.append("&amp;");
-				break;
-			case '\'':
-				sb.append("&quot;");
-				break;
-			default:
-				sb.append(c);
-				break;
+				case '<' :
+					sb.append("&lt;");
+					break;
+				case '>' :
+					sb.append("&gt;");
+					break;
+				case '&' :
+					sb.append("&amp;");
+					break;
+				case '\'' :
+					sb.append("&quot;");
+					break;
+				default :
+					sb.append(c);
+					break;
 			}
 		}
 		return sb.toString();
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java b/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
index 020b85a..024b5fe 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/coverage/Coverage.java
@@ -11,89 +11,84 @@
  * This class can create a coverage table between two classspaces. The
  * destination class space is used to create a table of methods. All source
  * methods that refer to a specific dest are then filled into the table.
- * 
  */
 public class Coverage {
 
-    /**
-     * Create a cross reference table from source to dest.
-     * 
-     * @param source
-     *            The methods that refer to dest
-     * @param dest
-     *            The methods that are being referred to
-     * @return A mapping of source methods to destination methods.
-     * @throws IOException
-     */
-    public static Map<MethodDef, List<MethodDef>> getCrossRef(
-            Collection<Clazz> source, Collection<Clazz> dest)
-            throws Exception {
-        final Map<MethodDef, List<MethodDef>> catalog = buildCatalog(dest);
-        crossRef(source, catalog);
-        return catalog;
-    }
+	/**
+	 * Create a cross reference table from source to dest.
+	 * 
+	 * @param source
+	 *            The methods that refer to dest
+	 * @param dest
+	 *            The methods that are being referred to
+	 * @return A mapping of source methods to destination methods.
+	 * @throws IOException
+	 */
+	public static Map<MethodDef,List<MethodDef>> getCrossRef(Collection<Clazz> source, Collection<Clazz> dest)
+			throws Exception {
+		final Map<MethodDef,List<MethodDef>> catalog = buildCatalog(dest);
+		crossRef(source, catalog);
+		return catalog;
+	}
 
-    private static void crossRef(Collection<Clazz> source,
-            final Map<MethodDef, List<MethodDef>> catalog) throws Exception {
-        for (final Clazz clazz : source) {
-            clazz.parseClassFileWithCollector(new ClassDataCollector() {
-                MethodDef source;
+	private static void crossRef(Collection<Clazz> source, final Map<MethodDef,List<MethodDef>> catalog)
+			throws Exception {
+		for (final Clazz clazz : source) {
+			clazz.parseClassFileWithCollector(new ClassDataCollector() {
+				MethodDef	source;
 
-                public void implementsInterfaces(TypeRef names[]) {
-                    MethodDef def = clazz.getMethodDef(0,
-                            "<implements>", "()V");
-                    // TODO
-                    for (TypeRef interfaceName : names) {
-                        for (Map.Entry<MethodDef, List<MethodDef>> entry : catalog
-                                .entrySet()) {
-                            String catalogClass = entry.getKey().getContainingClass().getFQN();
-                            List<MethodDef> references = entry.getValue();
+				public void implementsInterfaces(TypeRef names[]) {
+					MethodDef def = clazz.getMethodDef(0, "<implements>", "()V");
+					// TODO
+					for (TypeRef interfaceName : names) {
+						for (Map.Entry<MethodDef,List<MethodDef>> entry : catalog.entrySet()) {
+							String catalogClass = entry.getKey().getContainingClass().getFQN();
+							List<MethodDef> references = entry.getValue();
 
-                            if (catalogClass.equals(interfaceName.getFQN())) {
-                                references.add(def);
-                            }
-                        }
-                    }
-                }
+							if (catalogClass.equals(interfaceName.getFQN())) {
+								references.add(def);
+							}
+						}
+					}
+				}
 
-                // Method definitions
-                public void method(MethodDef source) {
-                    this.source = source;
-                }
+				// Method definitions
+				public void method(MethodDef source) {
+					this.source = source;
+				}
 
-                public void reference(MethodDef reference) {
-                    List<MethodDef> references = catalog.get(reference);
-                    if (references != null) {
-                        references.add(source);
-                    }
-                }
-            });
-        }
-    }
+				public void reference(MethodDef reference) {
+					List<MethodDef> references = catalog.get(reference);
+					if (references != null) {
+						references.add(source);
+					}
+				}
+			});
+		}
+	}
 
-    private static Map<MethodDef, List<MethodDef>> buildCatalog(
-            Collection<Clazz> sources) throws Exception {
-        final Map<MethodDef, List<MethodDef>> catalog = new TreeMap<MethodDef, List<MethodDef>>(new Comparator<MethodDef>() {
-			public int compare(MethodDef a, MethodDef b) {
-				return a.getName().compareTo(b.getName());
-			}
-		});
-        for (final Clazz clazz : sources) {
-            clazz.parseClassFileWithCollector(new ClassDataCollector() {
+	private static Map<MethodDef,List<MethodDef>> buildCatalog(Collection<Clazz> sources) throws Exception {
+		final Map<MethodDef,List<MethodDef>> catalog = new TreeMap<MethodDef,List<MethodDef>>(
+				new Comparator<MethodDef>() {
+					public int compare(MethodDef a, MethodDef b) {
+						return a.getName().compareTo(b.getName());
+					}
+				});
+		for (final Clazz clazz : sources) {
+			clazz.parseClassFileWithCollector(new ClassDataCollector() {
 
-                public boolean classStart(int access, TypeRef name) {
-                    return clazz.isPublic();
-                }
+				public boolean classStart(int access, TypeRef name) {
+					return clazz.isPublic();
+				}
 
-                public void method(MethodDef source) {
-                    if (source.isPublic()
-                            || source.isProtected())
-                        catalog.put(source, new ArrayList<MethodDef>());
-                }
+				public void method(MethodDef source) {
+					if (source.isPublic() || source.isProtected())
+						catalog.put(source, new ArrayList<MethodDef>());
+				}
 
-            });
-        }
-        return catalog;
-    }
+			});
+		}
+		return catalog;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java b/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java
index d879e53..0a1b8ab 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/coverage/CoverageResource.java
@@ -12,80 +12,78 @@
 /**
  * Creates an XML Coverage report. This class can be used as a resource so the
  * report is created only when the JAR is written.
- * 
  */
 public class CoverageResource extends WriteResource {
-    Collection<Clazz> testsuite;
-    Collection<Clazz> service;
+	Collection<Clazz>	testsuite;
+	Collection<Clazz>	service;
 
-    public CoverageResource(Collection<Clazz> testsuite,
-            Collection<Clazz> service) {
-        this.testsuite = testsuite;
-        this.service = service;
-    }
+	public CoverageResource(Collection<Clazz> testsuite, Collection<Clazz> service) {
+		this.testsuite = testsuite;
+		this.service = service;
+	}
 
-    @Override
-    public long lastModified() {
-        return 0;
-    }
+	@Override
+	public long lastModified() {
+		return 0;
+	}
 
-    @Override
-    public void write(OutputStream out) throws IOException {
-        try {
-            Map<MethodDef, List<MethodDef>> table = getCrossRef(testsuite,
-                    service);
-            Tag coverage = toTag(table);
-            PrintWriter pw = new PrintWriter(new OutputStreamWriter(out,
-                    Constants.DEFAULT_CHARSET));
-            try {
-                coverage.print(0, pw);
-            } finally {
-                pw.flush();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
+	@Override
+	public void write(OutputStream out) throws IOException {
+		try {
+			Map<MethodDef,List<MethodDef>> table = getCrossRef(testsuite, service);
+			Tag coverage = toTag(table);
+			PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, Constants.DEFAULT_CHARSET));
+			try {
+				coverage.print(0, pw);
+			}
+			finally {
+				pw.flush();
+			}
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 
-    public static Tag toTag(Map<MethodDef, List<MethodDef>> catalog) {
-        Tag coverage = new Tag("coverage");
-        String currentClass = null;
-        Tag classTag = null;
+	public static Tag toTag(Map<MethodDef,List<MethodDef>> catalog) {
+		Tag coverage = new Tag("coverage");
+		String currentClass = null;
+		Tag classTag = null;
 
-        for (Map.Entry<MethodDef, List<MethodDef>> m : catalog.entrySet()) {
-            String className = m.getKey().getContainingClass().getFQN();
-            if (!className.equals(currentClass)) {
-                classTag = new Tag("class");
-                classTag.addAttribute("name", className);
-                classTag.addAttribute("package", Descriptors.getPackage(className));
-                classTag.addAttribute("short", Descriptors.getShortName(className));
-                coverage.addContent(classTag);
-                currentClass = className;
-            }
-            Tag method = doMethod(new Tag("method"), m.getKey());
-            classTag.addContent(method);
-            for (MethodDef r : m.getValue()) {
-                Tag ref = doMethod(new Tag("ref"), r);
-                method.addContent(ref);
-            }
-        }
-        return coverage;
-    }
+		for (Map.Entry<MethodDef,List<MethodDef>> m : catalog.entrySet()) {
+			String className = m.getKey().getContainingClass().getFQN();
+			if (!className.equals(currentClass)) {
+				classTag = new Tag("class");
+				classTag.addAttribute("name", className);
+				classTag.addAttribute("package", Descriptors.getPackage(className));
+				classTag.addAttribute("short", Descriptors.getShortName(className));
+				coverage.addContent(classTag);
+				currentClass = className;
+			}
+			Tag method = doMethod(new Tag("method"), m.getKey());
+			classTag.addContent(method);
+			for (MethodDef r : m.getValue()) {
+				Tag ref = doMethod(new Tag("ref"), r);
+				method.addContent(ref);
+			}
+		}
+		return coverage;
+	}
 
-    private static Tag doMethod(Tag tag, MethodDef method) {
-        tag.addAttribute("pretty", method.toString());
-        if (method.isPublic())
-            tag.addAttribute("public", true);
-        if (method.isStatic())
-            tag.addAttribute("static", true);
-        if (method.isProtected())
-            tag.addAttribute("protected", true);
-        if (method.isInterface())
-            tag.addAttribute("interface", true);
-        tag.addAttribute("constructor", method.isConstructor());
-        if (!method.isConstructor())
-            tag.addAttribute("name", method.getName());
-        tag.addAttribute("descriptor", method.getDescriptor());
-        return tag;
-    }
+	private static Tag doMethod(Tag tag, MethodDef method) {
+		tag.addAttribute("pretty", method.toString());
+		if (method.isPublic())
+			tag.addAttribute("public", true);
+		if (method.isStatic())
+			tag.addAttribute("static", true);
+		if (method.isProtected())
+			tag.addAttribute("protected", true);
+		if (method.isInterface())
+			tag.addAttribute("interface", true);
+		tag.addAttribute("constructor", method.isConstructor());
+		if (!method.isConstructor())
+			tag.addAttribute("name", method.getName());
+		tag.addAttribute("descriptor", method.getDescriptor());
+		return tag;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java b/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
index ae541d6..beb1a36 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetaTypeReader.java
@@ -12,33 +12,34 @@
 import aQute.libg.generics.*;
 
 public class MetaTypeReader extends WriteResource {
-	final Analyzer				reporter;
-	Clazz						clazz;
-	String						interfaces[];
-	Tag							metadata	= new Tag("metatype:MetaData", new String[] {
-			"xmlns:metatype", "http://www.osgi.org/xmlns/metatype/v1.1.0" });
-	Tag							ocd			= new Tag(metadata, "OCD");
-	Tag							designate	= new Tag(metadata, "Designate");
-	Tag							object		= new Tag(designate, "Object");
+	final Analyzer			reporter;
+	Clazz					clazz;
+	String					interfaces[];
+	Tag						metadata	= new Tag("metatype:MetaData", new String[] {
+			"xmlns:metatype", "http://www.osgi.org/xmlns/metatype/v1.1.0"
+										});
+	Tag						ocd			= new Tag(metadata, "OCD");
+	Tag						designate	= new Tag(metadata, "Designate");
+	Tag						object		= new Tag(designate, "Object");
 
 	// Resource
-	String						extra;
+	String					extra;
 
 	// One time init
-	boolean						finished;
+	boolean					finished;
 
 	// Designate
-	boolean						override;
-	String						designatePid;
-	boolean						factory;
+	boolean					override;
+	String					designatePid;
+	boolean					factory;
 
 	// AD
-	Map<MethodDef, Meta.AD>	methods		= new LinkedHashMap<MethodDef, Meta.AD>();
+	Map<MethodDef,Meta.AD>	methods		= new LinkedHashMap<MethodDef,Meta.AD>();
 
 	// OCD
-	Annotation					ocdAnnotation;
+	Annotation				ocdAnnotation;
 
-	MethodDef					method;
+	MethodDef				method;
 
 	public MetaTypeReader(Clazz clazz, Analyzer reporter) {
 		this.clazz = clazz;
@@ -58,13 +59,12 @@
 	 * @param optionValues
 	 */
 
-	static Pattern	COLLECTION	= Pattern
-										.compile("(.*(Collection|Set|List|Queue|Stack|Deque))<(L.+;)>");
+	static Pattern	COLLECTION	= Pattern.compile("(.*(Collection|Set|List|Queue|Stack|Deque))<(L.+;)>");
 
 	private void addMethod(MethodDef method, Meta.AD ad) throws Exception {
 
 		// Set all the defaults.
-		
+
 		String rtype = method.getGenericReturnType();
 		String id = Configurable.mangleMethodName(method.getName());
 		String name = Clazz.unCamel(id);
@@ -88,8 +88,8 @@
 		}
 
 		Meta.Type type = getType(rtype);
-		
-		boolean required = ad ==null || ad.required();
+
+		boolean required = ad == null || ad.required();
 		String deflt = null;
 		String max = null;
 		String min = null;
@@ -114,15 +114,15 @@
 				cardinality = ad.cardinality();
 			if (ad.type() != null)
 				type = ad.type();
-//			if (ad.required() || ad.deflt() == null)
-//				required = true;
+			// if (ad.required() || ad.deflt() == null)
+			// required = true;
 
 			if (ad.description() != null)
 				description = ad.description();
 
 			if (ad.optionLabels() != null)
 				optionLabels = ad.optionLabels();
-			if (ad.optionValues() != null )
+			if (ad.optionValues() != null)
 				optionValues = ad.optionValues();
 
 			if (ad.min() != null)
@@ -208,13 +208,15 @@
 	}
 
 	class Find extends ClassDataCollector {
-		
-		@Override public void method(MethodDef mdef) {
+
+		@Override
+		public void method(MethodDef mdef) {
 			method = mdef;
 			methods.put(mdef, null);
 		}
-		
-		@Override public void annotation(Annotation annotation) {
+
+		@Override
+		public void annotation(Annotation annotation) {
 			try {
 				Meta.OCD ocd = annotation.getAnnotation(Meta.OCD.class);
 				Meta.AD ad = annotation.getAnnotation(Meta.AD.class);
@@ -225,20 +227,20 @@
 					assert method != null;
 					methods.put(method, ad);
 				}
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				reporter.error("Error during annotation parsing %s : %s", clazz, e);
 				e.printStackTrace();
 			}
 		}
 
 	}
-	
-
 
 	public void write(OutputStream out) throws IOException {
 		try {
 			finish();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RuntimeException(e);
 		}
 		PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
@@ -255,8 +257,7 @@
 			if (this.ocdAnnotation != null)
 				ocd = this.ocdAnnotation.getAnnotation(Meta.OCD.class);
 			else
-				ocd = Configurable.createConfigurable(Meta.OCD.class,
-						new HashMap<String, Object>());
+				ocd = Configurable.createConfigurable(Meta.OCD.class, new HashMap<String,Object>());
 
 			// defaults
 			String id = clazz.getClassName().getFQN();
@@ -268,7 +269,6 @@
 			if (ocd.id() != null)
 				id = ocd.id();
 
-			
 			if (ocd.name() != null)
 				name = ocd.name();
 
@@ -295,7 +295,7 @@
 			this.ocd.addAttribute("localization", localization);
 
 			// do ADs
-			for (Map.Entry<MethodDef, Meta.AD> entry : methods.entrySet())
+			for (Map.Entry<MethodDef,Meta.AD> entry : methods.entrySet())
 				addMethod(entry.getKey(), entry.getValue());
 
 			this.designate.addAttribute("pid", pid);
@@ -313,7 +313,8 @@
 		this.designatePid = pid;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java b/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java
index ff43613..c6218a1 100644
--- a/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/make/metatype/MetatypePlugin.java
@@ -9,26 +9,23 @@
 import aQute.libg.header.*;
 
 /**
- * This class is responsible for meta type types. It is a plugin that can 
+ * This class is responsible for meta type types. It is a plugin that can
+ * 
  * @author aqute
- *
  */
 public class MetatypePlugin implements AnalyzerPlugin {
 
 	public boolean analyzeJar(Analyzer analyzer) throws Exception {
 
-		Parameters map = analyzer.parseHeader(analyzer
-				.getProperty(Constants.METATYPE));
+		Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));
 
 		Jar jar = analyzer.getJar();
 		for (String name : map.keySet()) {
-			Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(),
-					Meta.OCD.class.getName(), // 
+			Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
 					QUERY.NAMED.toString(), name //
 					);
 			for (Clazz c : metatypes) {
-				jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c,
-						analyzer));
+				jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
 			}
 		}
 		return false;
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java b/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java
index 6dc716c..85125ce 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/BsnToMavenPath.java
@@ -1,5 +1,5 @@
 package aQute.bnd.maven;
 
 public interface BsnToMavenPath {
-    String[] getGroupAndArtifact(String bsn);
+	String[] getGroupAndArtifact(String bsn);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
index e9cbfc3..edd212b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenCommand.java
@@ -22,8 +22,7 @@
 	final Settings	settings	= new Settings();
 	File			temp;
 
-	public MavenCommand() {
-	}
+	public MavenCommand() {}
 
 	public MavenCommand(Processor p) {
 		super(p);
@@ -167,14 +166,15 @@
 			else if (option.equals("-output"))
 				output = args[i++];
 			else if (option.equals("-nodelete"))
-				nodelete=true;
+				nodelete = true;
 			else if (option.startsWith("-properties")) {
 				InputStream in = null;
 				try {
 					in = new FileInputStream(args[i++]);
 					properties.load(in);
-				} catch (Exception e) {
-				} finally {
+				}
+				catch (Exception e) {}
+				finally {
 					if (in != null) {
 						in.close();
 					}
@@ -233,17 +233,16 @@
 		for (String d : developers)
 			pom.addDeveloper(d);
 
-		Set<String> exports = OSGiHeader.parseHeader(
-				manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE)).keySet();
+		Set<String> exports = OSGiHeader.parseHeader(manifest.getMainAttributes().getValue(Constants.EXPORT_PACKAGE))
+				.keySet();
 
 		Jar sourceJar;
 		if (source == null) {
 			trace("Splitting source code");
 			sourceJar = new Jar("source");
-			for (Map.Entry<String, Resource> entry : binaryJar.getResources().entrySet()) {
+			for (Map.Entry<String,Resource> entry : binaryJar.getResources().entrySet()) {
 				if (entry.getKey().startsWith("OSGI-OPT/src")) {
-					sourceJar.putResource(entry.getKey().substring("OSGI-OPT/src/".length()),
-							entry.getValue());
+					sourceJar.putResource(entry.getKey().substring("OSGI-OPT/src/".length()), entry.getValue());
 				}
 			}
 			copyInfo(binaryJar, sourceJar, "source");
@@ -251,7 +250,7 @@
 			sourceJar = getJarFromFileOrURL(source);
 		}
 		sourceJar.calcChecksums(null);
-		
+
 		Jar javadocJar;
 		if (javadoc == null) {
 			trace("creating javadoc because -javadoc not used");
@@ -266,7 +265,7 @@
 			javadocJar = getJarFromFileOrURL(javadoc);
 		}
 		javadocJar.calcChecksums(null);
-		
+
 		addClose(binaryJar);
 		addClose(sourceJar);
 		addClose(javadocJar);
@@ -280,8 +279,7 @@
 		File sourceFile = new File(bundle, prefix + "-sources.jar");
 		File javadocFile = new File(bundle, prefix + "-javadoc.jar");
 		File pomFile = new File(bundle, "pom.xml").getAbsoluteFile();
-		trace("creating output files %s, %s,%s, and %s", binaryFile, sourceFile, javadocFile,
-				pomFile);
+		trace("creating output files %s, %s,%s, and %s", binaryFile, sourceFile, javadocFile, pomFile);
 
 		IO.copy(pom.openInputStream(), pomFile);
 		trace("copied pom");
@@ -318,39 +316,39 @@
 	private void copyInfo(Jar source, Jar dest, String type) throws Exception {
 		source.ensureManifest();
 		dest.ensureManifest();
-		copyInfoResource( source, dest, "LICENSE");
-		copyInfoResource( source, dest, "LICENSE.html");
-		copyInfoResource( source, dest, "about.html");
-		
+		copyInfoResource(source, dest, "LICENSE");
+		copyInfoResource(source, dest, "LICENSE.html");
+		copyInfoResource(source, dest, "about.html");
+
 		Manifest sm = source.getManifest();
 		Manifest dm = dest.getManifest();
-		copyInfoHeader( sm, dm, "Bundle-Description","");
-		copyInfoHeader( sm, dm, "Bundle-Vendor","");
-		copyInfoHeader( sm, dm, "Bundle-Copyright","");
-		copyInfoHeader( sm, dm, "Bundle-DocURL","");
-		copyInfoHeader( sm, dm, "Bundle-License","");
-		copyInfoHeader( sm, dm, "Bundle-Name", " " + type);
-		copyInfoHeader( sm, dm, "Bundle-SymbolicName", "." + type);
-		copyInfoHeader( sm, dm, "Bundle-Version", "");
+		copyInfoHeader(sm, dm, "Bundle-Description", "");
+		copyInfoHeader(sm, dm, "Bundle-Vendor", "");
+		copyInfoHeader(sm, dm, "Bundle-Copyright", "");
+		copyInfoHeader(sm, dm, "Bundle-DocURL", "");
+		copyInfoHeader(sm, dm, "Bundle-License", "");
+		copyInfoHeader(sm, dm, "Bundle-Name", " " + type);
+		copyInfoHeader(sm, dm, "Bundle-SymbolicName", "." + type);
+		copyInfoHeader(sm, dm, "Bundle-Version", "");
 	}
 
 	private void copyInfoHeader(Manifest sm, Manifest dm, String key, String value) {
 		String v = sm.getMainAttributes().getValue(key);
-		if ( v == null) {
+		if (v == null) {
 			trace("no source for " + key);
 			return;
 		}
-		
-		if ( dm.getMainAttributes().getValue(key) != null) {
-			trace("already have " + key );
+
+		if (dm.getMainAttributes().getValue(key) != null) {
+			trace("already have " + key);
 			return;
 		}
-		
+
 		dm.getMainAttributes().putValue(key, v + value);
 	}
 
 	private void copyInfoResource(Jar source, Jar dest, String type) {
-		if ( source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
+		if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
 			dest.putResource(type, source.getResource(type));
 	}
 
@@ -369,7 +367,8 @@
 			InputStream in = url.openStream();
 			try {
 				jar = new Jar(url.getFile(), in);
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 		}
@@ -399,8 +398,7 @@
 		}
 	}
 
-	private Jar javadoc(File source, Set<String> exports, Manifest m, Properties p)
-			throws Exception {
+	private Jar javadoc(File source, Set<String> exports, Manifest m, Properties p) throws Exception {
 		File tmp = new File(temp, "javadoc");
 		tmp.mkdirs();
 
@@ -438,7 +436,7 @@
 		command.add("-tag");
 		command.add("noimplement:t:Consumers of this API must not implement this interface");
 
-		for (Enumeration<?> e = pp.propertyNames(); e.hasMoreElements();) {
+		for (Enumeration< ? > e = pp.propertyNames(); e.hasMoreElements();) {
 			String key = (String) e.nextElement();
 			String value = pp.getProperty(key);
 
@@ -460,8 +458,7 @@
 
 		int result = command.execute(out, err);
 		if (result != 0) {
-			warning("Error during execution of javadoc command: %s\n******************\n%s", out,
-					err);
+			warning("Error during execution of javadoc command: %s\n******************\n%s", out, err);
 		}
 		Jar jar = new Jar(tmp);
 		addClose(jar);
@@ -475,14 +472,13 @@
 	 * @return
 	 */
 	private String license(Attributes attr) {
-		Parameters map = Processor.parseHeader(
-				attr.getValue(Constants.BUNDLE_LICENSE), null);
+		Parameters map = Processor.parseHeader(attr.getValue(Constants.BUNDLE_LICENSE), null);
 		if (map.isEmpty())
 			return null;
 
 		StringBuilder sb = new StringBuilder();
 		String sep = "Licensed under ";
-		for (Entry<String, Attrs> entry : map.entrySet()) {
+		for (Entry<String,Attrs> entry : map.entrySet()) {
 			sb.append(sep);
 			String key = entry.getKey();
 			String link = entry.getValue().get("link");
@@ -541,78 +537,74 @@
 		pp.setProperty(key, defaultValue);
 	}
 
-	
 	/**
 	 * View - Show the dependency details of an artifact
 	 */
-	
 
-	static Executor executor = Executors.newCachedThreadPool();
-	static Pattern GROUP_ARTIFACT_VERSION = Pattern.compile("([^+]+)\\+([^+]+)\\+([^+]+)");
-	void view( String args[], int i) throws Exception {
+	static Executor	executor				= Executors.newCachedThreadPool();
+	static Pattern	GROUP_ARTIFACT_VERSION	= Pattern.compile("([^+]+)\\+([^+]+)\\+([^+]+)");
+
+	void view(String args[], int i) throws Exception {
 		Maven maven = new Maven(executor);
 		OutputStream out = System.err;
-		
-		List<URI>	urls = new ArrayList<URI>();
-		
-		while ( i < args.length && args[i].startsWith("-")) {
-			if( "-r".equals(args[i])) {
+
+		List<URI> urls = new ArrayList<URI>();
+
+		while (i < args.length && args[i].startsWith("-")) {
+			if ("-r".equals(args[i])) {
 				URI uri = new URI(args[++i]);
-				urls.add( uri );
+				urls.add(uri);
 				System.err.println("URI for repo " + uri);
-			}
-			else
-				if ( "-o".equals(args[i])) {
-					out = new FileOutputStream(args[++i]);
-				}
-				else
-					throw new IllegalArgumentException("Unknown option: " + args[i]);
-			
+			} else if ("-o".equals(args[i])) {
+				out = new FileOutputStream(args[++i]);
+			} else
+				throw new IllegalArgumentException("Unknown option: " + args[i]);
+
 			i++;
 		}
-		
+
 		URI[] urls2 = urls.toArray(new URI[urls.size()]);
 		PrintWriter pw = IO.writer(out);
-		
-		while ( i < args.length) {
+
+		while (i < args.length) {
 			String ref = args[i++];
 			pw.println("Ref " + ref);
-			
+
 			Matcher matcher = GROUP_ARTIFACT_VERSION.matcher(ref);
 			if (matcher.matches()) {
-				
+
 				String group = matcher.group(1);
 				String artifact = matcher.group(2);
 				String version = matcher.group(3);
 				CachedPom pom = maven.getPom(group, artifact, version, urls2);
-				
+
 				Builder a = new Builder();
 				a.setProperty("Private-Package", "*");
 				Set<Pom> dependencies = pom.getDependencies(Scope.compile, urls2);
-				for ( Pom dep : dependencies ) {
-					System.err.printf( "%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
+				for (Pom dep : dependencies) {
+					System.err.printf("%20s %-20s %10s%n", dep.getGroupId(), dep.getArtifactId(), dep.getVersion());
 					a.addClasspath(dep.getArtifact());
 				}
 				pw.println(a.getClasspath());
 				a.build();
 
-				TreeSet<PackageRef> sorted = new TreeSet<PackageRef>( a.getImports().keySet());
-				for ( PackageRef p :sorted) {
-					pw.printf("%-40s\n",p);
+				TreeSet<PackageRef> sorted = new TreeSet<PackageRef>(a.getImports().keySet());
+				for (PackageRef p : sorted) {
+					pw.printf("%-40s\n", p);
 				}
-//				for ( Map.Entry<String, Set<String>> entry : a.getUses().entrySet()) {
-//					String from = entry.getKey();
-//					for ( String uses : entry.getValue()) {
-//						System.err.printf("%40s %s\n", from, uses);
-//						from = "";
-//					}
-//				}
+				// for ( Map.Entry<String, Set<String>> entry :
+				// a.getUses().entrySet()) {
+				// String from = entry.getKey();
+				// for ( String uses : entry.getValue()) {
+				// System.err.printf("%40s %s\n", from, uses);
+				// from = "";
+				// }
+				// }
 				a.close();
 			} else
 				System.err.println("Wrong, must look like group+artifact+version, is " + ref);
-			
+
 		}
 	}
-	
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
index 52d2708..d34f2b2 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDependencyGraph.java
@@ -14,14 +14,13 @@
 	final List<Artifact>				dependencies	= new ArrayList<Artifact>();
 	final List<URL>						repositories	= new ArrayList<URL>();
 	final XPath							xpath			= xpathFactory.newXPath();
-	final Map<URL, Artifact>			cache			= new HashMap<URL, Artifact>();
-	Artifact						root;
+	final Map<URL,Artifact>				cache			= new HashMap<URL,Artifact>();
+	Artifact							root;
 
 	enum Scope {
 		COMPILE, RUNTIME, TEST, PROVIDED, SYSTEM, IMPORT,
 	}
 
-	
 	public class Artifact {
 
 		String			groupId;
@@ -49,33 +48,27 @@
 				if (scope != null && scope.length() > 0) {
 					this.scope = Scope.valueOf(scope.toUpperCase());
 				}
-				NodeList evaluate = (NodeList) xpath.evaluate("//dependencies/dependency", doc,
-						XPathConstants.NODESET);
+				NodeList evaluate = (NodeList) xpath.evaluate("//dependencies/dependency", doc, XPathConstants.NODESET);
 
 				for (int i = 0; i < evaluate.getLength(); i++) {
 					Node childNode = evaluate.item(i);
-					Artifact artifact = getArtifact(xpath.evaluate("groupId", childNode), xpath
-							.evaluate("artifactId", childNode), xpath.evaluate("version", childNode));
+					Artifact artifact = getArtifact(xpath.evaluate("groupId", childNode),
+							xpath.evaluate("artifactId", childNode), xpath.evaluate("version", childNode));
 					add(artifact);
 				}
 			}
 		}
-		
-		
 
 		public void add(Artifact artifact) {
 			dependencies.add(artifact);
 		}
 
-
-
 		public String toString() {
 			return groupId + "." + artifactId + "-" + version + "[" + scope + "," + optional + "]";
 		}
 
 		public String getPath() throws URISyntaxException {
-			return groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId
-					+ "-" + version;
+			return groupId.replace('.', '/') + "/" + artifactId + "/" + version + "/" + artifactId + "-" + version;
 		}
 
 	}
@@ -102,7 +95,8 @@
 				} else {
 					return new Artifact(url);
 				}
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				System.err.println("Failed to get " + artifactId + " from " + repository);
 			}
 		}
@@ -127,13 +121,10 @@
 		return null;
 	}
 
-	
-	
-	public void addArtifact( Artifact artifact ) throws Exception {
-		if ( root == null)
+	public void addArtifact(Artifact artifact) throws Exception {
+		if (root == null)
 			root = new Artifact(null);
 		root.add(artifact);
 	}
-	
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
index ce936e7..ec5e2b7 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeploy.java
@@ -21,7 +21,7 @@
 	String		passphrase;
 	Reporter	reporter;
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		repository = map.get("repository");
 		url = map.get("url");
 		passphrase = map.get("passphrase");
@@ -41,10 +41,9 @@
 	/**
 	 */
 	public boolean deploy(Project project, Jar original) throws Exception {
-		Parameters deploy = project.parseHeader(project
-				.getProperty(Constants.DEPLOY));
+		Parameters deploy = project.parseHeader(project.getProperty(Constants.DEPLOY));
 
-		Map<String, String> maven = deploy.get(repository);
+		Map<String,String> maven = deploy.get(repository);
 		if (maven == null)
 			return false; // we're not playing for this bundle
 
@@ -66,8 +65,8 @@
 			Jar src = new Jar("src");
 			try {
 				split(original, main, src);
-				Parameters exports = project.parseHeader(manifest
-						.getMainAttributes().getValue(Constants.EXPORT_PACKAGE));
+				Parameters exports = project.parseHeader(manifest.getMainAttributes()
+						.getValue(Constants.EXPORT_PACKAGE));
 				File jdoc = new File(tmp, "jdoc");
 				jdoc.mkdirs();
 				project.progress("Generating Javadoc for: " + exports.keySet());
@@ -86,7 +85,8 @@
 				project.progress("Deploying main javadoc file");
 				maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
 
-			} finally {
+			}
+			finally {
 				main.close();
 				src.close();
 			}
@@ -95,7 +95,7 @@
 	}
 
 	private void split(Jar original, Jar main, Jar src) {
-		for (Map.Entry<String, Resource> e : original.getResources().entrySet()) {
+		for (Map.Entry<String,Resource> e : original.getResources().entrySet()) {
 			String path = e.getKey();
 			if (path.startsWith("OSGI-OPT/src/")) {
 				src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue());
@@ -114,8 +114,7 @@
 	// -Dfile=/Ws/bnd/biz.aQute.bndlib/tmp/biz.aQute.bndlib.jar \
 	// -Dpassphrase=a1k3v3t5x3
 
-	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile)
-			throws Exception {
+	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile) throws Exception {
 		Command command = new Command();
 		command.setTrace();
 		command.add(b.getProperty("mvn", "mvn"));
@@ -134,8 +133,8 @@
 
 		int result = command.execute(stdout, stderr);
 		if (result != 0) {
-			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository,
-					file, "" + stdout + stderr);
+			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository, file, "" + stdout
+					+ stderr);
 		}
 	}
 
@@ -148,12 +147,12 @@
 
 	private Jar javadoc(File tmp, Project b, Set<String> exports) throws Exception {
 		Command command = new Command();
-		
+
 		command.add(b.getProperty("javadoc", "javadoc"));
 		command.add("-d");
 		command.add(tmp.getAbsolutePath());
 		command.add("-sourcepath");
-		command.add( Processor.join(b.getSourcePath(),File.pathSeparator));
+		command.add(Processor.join(b.getSourcePath(), File.pathSeparator));
 
 		for (String packageName : exports) {
 			command.add(packageName);
@@ -178,7 +177,8 @@
 		OutputStream out = new FileOutputStream(f);
 		try {
 			r.write(out);
-		} finally {
+		}
+		finally {
 			out.close();
 		}
 		return f;
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
index bbd233f..0209f5c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenDeployCmd.java
@@ -30,16 +30,16 @@
 	 */
 	void run(String args[], int i) throws Exception {
 		if (i >= args.length) {
+			System.err.println("Usage:%n");
 			System.err
-					.println("Usage:%n");
-			System.err.println("  deploy [-url repo] [-passphrase passphrase] [-homedir homedir] [-keyname keyname] bundle ...");
+					.println("  deploy [-url repo] [-passphrase passphrase] [-homedir homedir] [-keyname keyname] bundle ...");
 			System.err.println("  settings");
 			return;
 		}
 
 		/* skip first argument */
 		i++;
-		
+
 		while (i < args.length && args[i].startsWith("-")) {
 			String option = args[i];
 			if (option.equals("-url"))
@@ -54,10 +54,9 @@
 				error("Invalid command ");
 		}
 
-		
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		repository = map.get("repository");
 		url = map.get("url");
 		passphrase = map.get("passphrase");
@@ -77,10 +76,9 @@
 	/**
 	 */
 	public boolean deploy(Project project, Jar original) throws Exception {
-		Parameters deploy = project.parseHeader(project
-				.getProperty(Constants.DEPLOY));
+		Parameters deploy = project.parseHeader(project.getProperty(Constants.DEPLOY));
 
-		Map<String, String> maven = deploy.get(repository);
+		Map<String,String> maven = deploy.get(repository);
 		if (maven == null)
 			return false; // we're not playing for this bundle
 
@@ -102,8 +100,8 @@
 			Jar src = new Jar("src");
 			try {
 				split(original, main, src);
-				Parameters exports = project.parseHeader(manifest
-						.getMainAttributes().getValue(Constants.EXPORT_PACKAGE));
+				Parameters exports = project.parseHeader(manifest.getMainAttributes()
+						.getValue(Constants.EXPORT_PACKAGE));
 				File jdoc = new File(tmp, "jdoc");
 				jdoc.mkdirs();
 				project.progress("Generating Javadoc for: " + exports.keySet());
@@ -122,7 +120,8 @@
 				project.progress("Deploying main javadoc file");
 				maven_gpg_sign_and_deploy(project, javadocFile, "javadoc", null);
 
-			} finally {
+			}
+			finally {
 				main.close();
 				src.close();
 			}
@@ -131,7 +130,7 @@
 	}
 
 	private void split(Jar original, Jar main, Jar src) {
-		for (Map.Entry<String, Resource> e : original.getResources().entrySet()) {
+		for (Map.Entry<String,Resource> e : original.getResources().entrySet()) {
 			String path = e.getKey();
 			if (path.startsWith("OSGI-OPT/src/")) {
 				src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue());
@@ -150,8 +149,7 @@
 	// -Dfile=/Ws/bnd/biz.aQute.bndlib/tmp/biz.aQute.bndlib.jar \
 	// -Dpassphrase=a1k3v3t5x3
 
-	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile)
-			throws Exception {
+	private void maven_gpg_sign_and_deploy(Project b, File file, String classifier, File pomFile) throws Exception {
 		Command command = new Command();
 		command.setTrace();
 		command.add(b.getProperty("mvn", "mvn"));
@@ -170,8 +168,8 @@
 
 		int result = command.execute(stdout, stderr);
 		if (result != 0) {
-			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository,
-					file, "" + stdout + stderr);
+			b.error("Maven deploy to %s failed to sign and transfer %s because %s", repository, file, "" + stdout
+					+ stderr);
 		}
 	}
 
@@ -214,7 +212,8 @@
 		OutputStream out = new FileOutputStream(f);
 		try {
 			r.write(out);
-		} finally {
+		}
+		finally {
 			out.close();
 		}
 		return f;
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java
index 2d49be6..d74b6d6 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenGroup.java
@@ -6,22 +6,21 @@
 import aQute.libg.reporter.*;
 
 public class MavenGroup implements BsnToMavenPath, Plugin {
-    String    groupId = "";
+	String	groupId	= "";
 
-    public String[] getGroupAndArtifact(String bsn) {
-        String[] result = new String[2];
-        result[0] = groupId;
-        result[1] = bsn;
-        return result;
-    }
+	public String[] getGroupAndArtifact(String bsn) {
+		String[] result = new String[2];
+		result[0] = groupId;
+		result[1] = bsn;
+		return result;
+	}
 
-    public void setProperties(Map<String, String> map) {
-        if (map.containsKey("groupId")) {
-            groupId = map.get("groupId");
-        }
-    }
+	public void setProperties(Map<String,String> map) {
+		if (map.containsKey("groupId")) {
+			groupId = map.get("groupId");
+		}
+	}
 
-    public void setReporter(Reporter processor) {
-    }
+	public void setReporter(Reporter processor) {}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
index a5ad200..80a0a4e 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/MavenRepository.java
@@ -13,9 +13,9 @@
 
 	public final static String	NAME	= "name";
 
-	File					root;
-	Reporter				reporter;
-	String					name;
+	File						root;
+	Reporter					reporter;
+	String						name;
 
 	public String toString() {
 		return "maven:" + root;
@@ -31,9 +31,9 @@
 			range = new VersionRange(version);
 
 		List<BsnToMavenPath> plugins = ((Processor) reporter).getPlugins(BsnToMavenPath.class);
-		if ( plugins.isEmpty())
+		if (plugins.isEmpty())
 			plugins.add(this);
-		
+
 		for (BsnToMavenPath cvr : plugins) {
 			String[] paths = cvr.getGroupAndArtifact(bsn);
 			if (paths != null) {
@@ -62,18 +62,16 @@
 				if (Verifier.isVersion(vv)) {
 					Version vvv = new Version(vv);
 					if (range.includes(vvv)) {
-						File file = Processor.getFile(vsdir, v + "/" + artifactId + "-" + v
-								+ ".jar");
+						File file = Processor.getFile(vsdir, v + "/" + artifactId + "-" + v + ".jar");
 						if (file.isFile())
 							result.add(file);
 						else
 							reporter.warning("Expected maven entry was not a valid file %s ", file);
 					}
 				} else {
-					reporter
-							.warning(
-									"Expected a version directory in maven: dir=%s raw-version=%s cleaned-up-version=%s",
-									vsdir, vv, v);
+					reporter.warning(
+							"Expected a version directory in maven: dir=%s raw-version=%s cleaned-up-version=%s",
+							vsdir, vv, v);
 				}
 			}
 		} else
@@ -119,27 +117,27 @@
 	}
 
 	public List<Version> versions(String bsn) throws Exception {
-		
-		File files[] = get( bsn, null);
+
+		File files[] = get(bsn, null);
 		List<Version> versions = new ArrayList<Version>();
-		for ( File f : files ) {
+		for (File f : files) {
 			String version = f.getParentFile().getName();
 			version = Builder.cleanupVersion(version);
-			Version v = new Version( version );
+			Version v = new Version(version);
 			versions.add(v);
 		}
 		return versions;
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		File home = new File("");
 		String root = map.get("root");
 		if (root == null) {
-			home = new File( System.getProperty("user.home") );
-			this.root = Processor.getFile(home , ".m2/repository").getAbsoluteFile();
+			home = new File(System.getProperty("user.home"));
+			this.root = Processor.getFile(home, ".m2/repository").getAbsoluteFile();
 		} else
 			this.root = Processor.getFile(home, root).getAbsoluteFile();
-		
+
 		if (!this.root.isDirectory()) {
 			reporter.error("Maven repository did not get a proper URL to the repository %s", root);
 		}
@@ -155,21 +153,23 @@
 		String groupId;
 		String artifactId;
 		int n = bsn.indexOf('.');
-		
-		while ( n > 0 ) {
-			artifactId = bsn.substring(n+1);
-			groupId = bsn.substring(0,n);
-			
-			File gdir = new File(root, groupId.replace('.',File.separatorChar)).getAbsoluteFile();
-			File adir = new File( gdir, artifactId).getAbsoluteFile();
-			if ( adir.isDirectory() )
-				return new String[] {groupId, artifactId};
-			
-			n = bsn.indexOf('.',n+1);
+
+		while (n > 0) {
+			artifactId = bsn.substring(n + 1);
+			groupId = bsn.substring(0, n);
+
+			File gdir = new File(root, groupId.replace('.', File.separatorChar)).getAbsoluteFile();
+			File adir = new File(gdir, artifactId).getAbsoluteFile();
+			if (adir.isDirectory())
+				return new String[] {
+						groupId, artifactId
+				};
+
+			n = bsn.indexOf('.', n + 1);
 		}
 		return null;
 	}
-	
+
 	public String getName() {
 		if (name == null) {
 			return toString();
@@ -181,16 +181,16 @@
 		File[] files = get(bsn, range);
 		if (files.length >= 0) {
 			switch (strategy) {
-			case LOWEST:
-				return files[0];
-			case HIGHEST:
-				return files[files.length - 1];
+				case LOWEST :
+					return files[0];
+				case HIGHEST :
+					return files[files.length - 1];
 			}
 		}
 		return null;
 	}
 
-	public void setRoot( File f  ) {
+	public void setRoot(File f) {
 		root = f;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java b/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java
index 5b8c149..782c282 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/PomFromManifest.java
@@ -70,11 +70,13 @@
 		this.manifest = manifest;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 
-	@Override public void write(OutputStream out) throws IOException {
+	@Override
+	public void write(OutputStream out) throws IOException {
 		PrintWriter ps = IO.writer(out);
 
 		String name = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_NAME);
@@ -148,8 +150,7 @@
 				String xname = email;
 				String organization = null;
 
-				Matcher m = Pattern.compile("([^@]+)@([\\d\\w\\-_\\.]+)\\.([\\d\\w\\-_\\.]+)")
-						.matcher(email);
+				Matcher m = Pattern.compile("([^@]+)@([\\d\\w\\-_\\.]+)\\.([\\d\\w\\-_\\.]+)").matcher(email);
 				if (m.matches()) {
 					xname = m.group(1);
 					organization = m.group(2);
@@ -167,8 +168,7 @@
 			Tag ls = new Tag(project, "licenses");
 
 			Parameters map = Processor.parseHeader(licenses, null);
-			for (Iterator<Entry<String, Attrs>> e = map.entrySet().iterator(); e
-					.hasNext();) {
+			for (Iterator<Entry<String,Attrs>> e = map.entrySet().iterator(); e.hasNext();) {
 
 				// Bundle-License:
 				// http://www.opensource.org/licenses/apache2.0.php; \
@@ -182,9 +182,9 @@
 				//    <distribution>repo</distribution>
 				//    </license>
 
-				Entry<String, Attrs> entry = e.next();
+				Entry<String,Attrs> entry = e.next();
 				Tag l = new Tag(ls, "license");
-				Map<String, String> values = entry.getValue();
+				Map<String,String> values = entry.getValue();
 				String url = entry.getKey();
 
 				if (values.containsKey("description"))
@@ -209,8 +209,7 @@
 	 * @param tag
 	 * @param object
 	 */
-	private Tag tagFromMap(Tag parent, Map<String, String> values, String string, String tag,
-			String object) {
+	private Tag tagFromMap(Tag parent, Map<String,String> values, String string, String tag, String object) {
 		String value = values.get(string);
 		if (value == null)
 			value = object;
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java b/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java
index e529141..12c2edc 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/PomParser.java
@@ -12,22 +12,21 @@
 import aQute.lib.osgi.*;
 
 /**
- * Provides a way to parse a maven pom as properties.
- * 
- * This provides most of the maven elements as properties. It also
- * provides pom.scope.[compile|test|runtime|provided|system] properties
- * that can be appended to the build and run path. That is, they are
- * in the correct format for this.
+ * Provides a way to parse a maven pom as properties. This provides most of the
+ * maven elements as properties. It also provides
+ * pom.scope.[compile|test|runtime|provided|system] properties that can be
+ * appended to the build and run path. That is, they are in the correct format
+ * for this.
  */
 public class PomParser extends Processor {
 	static DocumentBuilderFactory	dbf			= DocumentBuilderFactory.newInstance();
 	static XPathFactory				xpathf		= XPathFactory.newInstance();
 	static Set<String>				multiple	= new HashSet<String>();
-	static Set<String>				skip	= new HashSet<String>();
+	static Set<String>				skip		= new HashSet<String>();
 
 	static {
 		dbf.setNamespaceAware(false);
-		
+
 		// Set all elements that need enumeration of their elements
 		// these will not use the name of the subelement but instead
 		// they use an index from 0..n
@@ -46,7 +45,7 @@
 		skip.add("dependencies");
 		skip.add("reporting");
 		skip.add("extensions");
-		
+
 	}
 
 	public Properties getProperties(File pom) throws Exception {
@@ -58,7 +57,7 @@
 
 		// Check if there is a parent pom
 		String relativePath = xpath.evaluate("project/parent/relativePath", doc);
-		if (relativePath != null && relativePath.length()!=0) {
+		if (relativePath != null && relativePath.length() != 0) {
 			File parentPom = IO.getFile(pom.getParentFile(), relativePath);
 			if (parentPom.isFile()) {
 				Properties parentProps = getProperties(parentPom);
@@ -71,15 +70,16 @@
 		Element e = doc.getDocumentElement();
 		traverse("pom", e, p);
 
-		String scopes[] = { "provided", "runtime", "test", "system" };
+		String scopes[] = {
+				"provided", "runtime", "test", "system"
+		};
 		NodeList set = (NodeList) xpath.evaluate("//dependency[not(scope) or scope='compile']", doc,
 				XPathConstants.NODESET);
 		if (set.getLength() != 0)
 			p.put("pom.scope.compile", toBsn(set));
 
 		for (String scope : scopes) {
-			set = (NodeList) xpath.evaluate("//dependency[scope='" + scope + "']", doc,
-					XPathConstants.NODESET);
+			set = (NodeList) xpath.evaluate("//dependency[scope='" + scope + "']", doc, XPathConstants.NODESET);
 			if (set.getLength() != 0)
 				p.put("pom.scope." + scope, toBsn(set));
 		}
@@ -98,9 +98,9 @@
 			sb.append(xpath.evaluate("groupId", child));
 			sb.append(".");
 			sb.append(xpath.evaluate("artifactId", child));
-			if (version != null && version.trim().length()!=0) {
+			if (version != null && version.trim().length() != 0) {
 				sb.append(";version=");
-				sb.append( Analyzer.cleanupVersion(version));
+				sb.append(Analyzer.cleanupVersion(version));
 			}
 			del = ", ";
 		}
@@ -108,15 +108,17 @@
 	}
 
 	/**
-	 * The maven POM is quite straightforward, it is basically a structured property file.
+	 * The maven POM is quite straightforward, it is basically a structured
+	 * property file.
+	 * 
 	 * @param name
 	 * @param parent
 	 * @param p
 	 */
 	static void traverse(String name, Node parent, Properties p) {
-		if ( skip.contains(parent.getNodeName()))
+		if (skip.contains(parent.getNodeName()))
 			return;
-		
+
 		NodeList children = parent.getChildNodes();
 		if (multiple.contains(parent.getNodeName())) {
 			int n = 0;
@@ -132,7 +134,7 @@
 				Node child = children.item(i);
 				if (child instanceof Text) {
 					String value = child.getNodeValue().trim();
-					if (value.length()!=0) {
+					if (value.length() != 0) {
 						p.put(name, value);
 					}
 				} else {
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java b/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java
index 416062d..b722d0f 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/PomResource.java
@@ -13,18 +13,20 @@
 
 public class PomResource extends WriteResource {
 	final Manifest				manifest;
-	private Map<String, String>	scm;
+	private Map<String,String>	scm;
 	final static Pattern		NAME_URL	= Pattern.compile("(.*)(http://.*)");
 
 	public PomResource(Manifest manifest) {
 		this.manifest = manifest;
 	}
 
-	@Override public long lastModified() {
+	@Override
+	public long lastModified() {
 		return 0;
 	}
 
-	@Override public void write(OutputStream out) throws IOException {
+	@Override
+	public void write(OutputStream out) throws IOException {
 		PrintWriter ps = IO.writer(out);
 
 		String name = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_NAME);
@@ -80,7 +82,7 @@
 
 		if (scm != null) {
 			Tag scm = new Tag(project, "scm");
-			for (Map.Entry<String, String> e : this.scm.entrySet()) {
+			for (Map.Entry<String,String> e : this.scm.entrySet()) {
 				new Tag(scm, e.getKey()).addContent(e.getValue());
 			}
 		}
@@ -103,8 +105,7 @@
 			Tag ls = new Tag(project, "licenses");
 
 			Parameters map = Processor.parseHeader(licenses, null);
-			for (Iterator<Entry<String, Attrs>> e = map.entrySet().iterator(); e
-					.hasNext();) {
+			for (Iterator<Entry<String,Attrs>> e = map.entrySet().iterator(); e.hasNext();) {
 
 				// Bundle-License:
 				// http://www.opensource.org/licenses/apache2.0.php; \
@@ -118,9 +119,9 @@
 				//    <distribution>repo</distribution>
 				//    </license>
 
-				Entry<String, Attrs> entry = e.next();
+				Entry<String,Attrs> entry = e.next();
 				Tag l = new Tag(ls, "license");
-				Map<String, String> values = entry.getValue();
+				Map<String,String> values = entry.getValue();
 				String url = entry.getKey();
 
 				if (values.containsKey("description"))
@@ -145,8 +146,7 @@
 	 * @param tag
 	 * @param object
 	 */
-	private Tag tagFromMap(Tag parent, Map<String, String> values, String string, String tag,
-			String object) {
+	private Tag tagFromMap(Tag parent, Map<String,String> values, String string, String tag, String object) {
 		String value = values.get(string);
 		if (value == null)
 			value = object;
@@ -156,7 +156,7 @@
 		return parent;
 	}
 
-	public void setProperties(Map<String, String> scm) {
+	public void setProperties(Map<String,String> scm) {
 		this.scm = scm;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
index 02449fa..5787e29 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/CachedPom.java
@@ -4,7 +4,7 @@
 import java.net.*;
 
 public class CachedPom extends Pom {
-	final MavenEntry				maven;
+	final MavenEntry	maven;
 
 	CachedPom(MavenEntry mavenEntry, URI repo) throws Exception {
 		super(mavenEntry.maven, mavenEntry.getPomFile(), repo);
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java
index 2124a05..416f255 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/Maven.java
@@ -12,25 +12,27 @@
  */
 public class Maven {
 	final File						userHome	= new File(System.getProperty("user.home"));
-	final Map<String, MavenEntry>	entries		= new ConcurrentHashMap<String, MavenEntry>();
-	final static String[]			ALGORITHMS	= { "md5", "sha1" };
+	final Map<String,MavenEntry>	entries		= new ConcurrentHashMap<String,MavenEntry>();
+	final static String[]			ALGORITHMS	= {
+			"md5", "sha1"
+												};
 	boolean							usecache	= false;
 	final Executor					executor;
 	File							m2			= new File(userHome, ".m2");
 	File							repository	= new File(m2, "repository");
 
 	public Maven(Executor executor) {
-		if ( executor == null)
+		if (executor == null)
 			this.executor = Executors.newCachedThreadPool();
 		else
 			this.executor = executor;
 	}
-	
-	//http://repo1.maven.org/maven2/junit/junit/maven-metadata.xml
-	
-	static Pattern MAVEN_RANGE = Pattern.compile("(\\[|\\()(.+)(,(.+))(\\]|\\))");
-	public CachedPom getPom(String groupId, String artifactId, String version, URI... extra)
-			throws Exception {		
+
+	// http://repo1.maven.org/maven2/junit/junit/maven-metadata.xml
+
+	static Pattern	MAVEN_RANGE	= Pattern.compile("(\\[|\\()(.+)(,(.+))(\\]|\\))");
+
+	public CachedPom getPom(String groupId, String artifactId, String version, URI... extra) throws Exception {
 		MavenEntry entry = getEntry(groupId, artifactId, version);
 		return entry.getPom(extra);
 	}
@@ -59,8 +61,7 @@
 	}
 
 	private String path(String groupId, String artifactId, String version) {
-		return groupId.replace('.', '/') + '/' + artifactId + '/' + version + "/" + artifactId
-				+ "-" + version;
+		return groupId.replace('.', '/') + '/' + artifactId + '/' + version + "/" + artifactId + "-" + version;
 	}
 
 	public void schedule(Runnable runnable) {
@@ -82,7 +83,7 @@
 
 	public void setM2(File dir) {
 		this.m2 = dir;
-		this.repository = new File(dir,"repository");
+		this.repository = new File(dir, "repository");
 	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
index 60ebb63..fd4459a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenEntry.java
@@ -13,7 +13,6 @@
 /**
  * An entry (a group/artifact) in the maven cache in the .m2/repository
  * directory. It provides methods to get the pom and the artifact.
- * 
  */
 public class MavenEntry implements Closeable {
 	final Maven					maven;
@@ -21,7 +20,7 @@
 	final File					dir;
 	final String				path;
 	final DirectoryLock			lock;
-	final Map<URI, CachedPom>	poms	= new HashMap<URI, CachedPom>();
+	final Map<URI,CachedPom>	poms	= new HashMap<URI,CachedPom>();
 	final File					pomFile;
 	final File					artifactFile;
 	final String				pomPath;
@@ -57,7 +56,6 @@
 	 * @param urls
 	 *            The allowed URLs
 	 * @return a CachedPom for this maven entry
-	 * 
 	 * @throws Exception
 	 *             If something goes haywire
 	 */
@@ -124,7 +122,8 @@
 				}
 			}
 			return null;
-		} finally {
+		}
+		finally {
 			saveProperties();
 			// lock.release();
 		}
@@ -143,12 +142,13 @@
 	private boolean download(URI repo, String path) throws MalformedURLException {
 		try {
 			URL url = toURL(repo, path);
-			System.err.println("Downloading "  + repo + " path " + path + " url " + url);
+			System.err.println("Downloading " + repo + " path " + path + " url " + url);
 			File file = new File(root, path);
 			IO.copy(url.openStream(), file);
-			System.err.println("Downloaded "  + url);
+			System.err.println("Downloaded " + url);
 			return true;
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			System.err.println("debug: " + e);
 			return false;
 		}
@@ -162,7 +162,6 @@
 	 * @param path
 	 *            The path in the directory + url
 	 * @return a URL that points to the file in the repo
-	 * 
 	 * @throws MalformedURLException
 	 */
 	URL toURL(URI base, String path) throws MalformedURLException {
@@ -181,8 +180,7 @@
 	 * @return true if valid
 	 */
 	private boolean isValid() {
-		return pomFile.isFile() && pomFile.length() > 100 && artifactFile.isFile()
-				&& artifactFile.length() > 100;
+		return pomFile.isFile() && pomFile.length() > 100 && artifactFile.isFile() && artifactFile.length() > 100;
 	}
 
 	/**
@@ -211,9 +209,11 @@
 				try {
 					in = new FileInputStream(props);
 					properties.load(in);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					// we ignore for now, will handle it on safe
-				} finally {
+				}
+				finally {
 					IO.close(in);
 				}
 			}
@@ -238,7 +238,8 @@
 			FileOutputStream fout = new FileOutputStream(propertiesFile);
 			try {
 				properties.store(fout, "");
-			} finally {
+			}
+			finally {
 				properties = null;
 				propertiesChanged = false;
 				fout.close();
@@ -298,11 +299,13 @@
 			File digestFile = new File(root, digestPath);
 			final MessageDigest md = MessageDigest.getInstance(algorithm);
 			IO.copy(actualFile, new OutputStream() {
-				@Override public void write(int c) throws IOException {
+				@Override
+				public void write(int c) throws IOException {
 					md.update((byte) c);
 				}
 
-				@Override public void write(byte[] buffer, int offset, int length) {
+				@Override
+				public void write(byte[] buffer, int offset, int length) {
 					md.update(buffer, offset, length);
 				}
 			});
@@ -319,7 +322,7 @@
 	}
 
 	public File getArtifact() throws Exception {
-		if (artifact == null )
+		if (artifact == null)
 			return artifactFile;
 		return artifact.get();
 	}
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
index a9f0ba2..d1c0472 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/MavenRemoteRepository.java
@@ -21,23 +21,24 @@
 		if (f == null)
 			return null;
 
-		return new File[] { f };
+		return new File[] {
+			f
+		};
 	}
 
-	public File get(String bsn, String version, Strategy strategy, Map<String, String> properties)
-			throws Exception {
+	public File get(String bsn, String version, Strategy strategy, Map<String,String> properties) throws Exception {
 		String groupId = null;
-		
+
 		if (properties != null)
 			groupId = properties.get("groupId");
-		
+
 		if (groupId == null) {
 			int n = bsn.indexOf('+');
-			if ( n < 0)
+			if (n < 0)
 				return null;
-			
-			groupId = bsn.substring(0,n);
-			bsn = bsn.substring(n+1);
+
+			groupId = bsn.substring(0, n);
+			bsn = bsn.substring(n + 1);
 		}
 
 		String artifactId = bsn;
@@ -59,15 +60,16 @@
 		try {
 			action = Pom.Scope.valueOf(value);
 			return pom.getLibrary(action, repositories);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			return pom.getArtifact();
 		}
 	}
 
 	public Maven getMaven() {
-		if ( maven != null)
+		if (maven != null)
 			return maven;
-		
+
 		maven = registry.getPlugin(Maven.class);
 		return maven;
 	}
@@ -96,7 +98,7 @@
 		repositories = urls;
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		String repoString = map.get("repositories");
 		if (repoString != null) {
 			String[] repos = repoString.split("\\s*,\\s*");
@@ -105,10 +107,11 @@
 			for (String repo : repos) {
 				try {
 					URI uri = new URI(repo);
-					if ( !uri.isAbsolute())
-						uri = IO.getFile( new File(""),repo).toURI();
+					if (!uri.isAbsolute())
+						uri = IO.getFile(new File(""), repo).toURI();
 					repositories[n++] = uri;
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					if (reporter != null)
 						reporter.error("Invalid repository %s for maven plugin, %s", repo, e);
 				}
@@ -129,9 +132,9 @@
 	}
 
 	public String getLocation() {
-		if ( repositories == null || repositories.length==0)
+		if (repositories == null || repositories.length == 0)
 			return "maven central";
-		
-		return Arrays.toString(repositories); 
+
+		return Arrays.toString(repositories);
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java
index 30a3378..0055d19 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/Pom.java
@@ -18,19 +18,19 @@
 	static {
 		dbf.setNamespaceAware(false);
 	}
-	
+
 	public enum Scope {
 		compile, runtime, system, import_, provided, test, ;
-		
-//		private boolean includes(Scope other) {
-//			if (other == this) return true;
-//			switch (this) {
-//			case compile:
-//				return other == provided || other == test;
-//			default:
-//				return false;
-//			}
-//		}
+
+		// private boolean includes(Scope other) {
+		// if (other == this) return true;
+		// switch (this) {
+		// case compile:
+		// return other == provided || other == test;
+		// default:
+		// return false;
+		// }
+		// }
 	}
 
 	final Maven			maven;
@@ -41,7 +41,7 @@
 	String				version;
 	List<Dependency>	dependencies	= new ArrayList<Dependency>();
 	File				pomFile;
-	String				description="";
+	String				description		= "";
 	String				name;
 
 	public String getDescription() {
@@ -88,6 +88,7 @@
 		public Pom getPom() throws Exception {
 			return maven.getPom(groupId, artifactId, version);
 		}
+
 		@Override
 		public String toString() {
 			StringBuilder builder = new StringBuilder();
@@ -129,16 +130,15 @@
 		this.artifactId = replace(xp.evaluate("project/artifactId", doc).trim(), this.artifactId);
 		this.groupId = replace(xp.evaluate("project/groupId", doc).trim(), this.groupId);
 		this.version = replace(xp.evaluate("project/version", doc).trim(), this.version);
-		
+
 		String nextDescription = xp.evaluate("project/description", doc).trim();
-		if ( this.description.length() != 0 && nextDescription.length() != 0)
+		if (this.description.length() != 0 && nextDescription.length() != 0)
 			this.description += "\n";
 		this.description += replace(nextDescription);
-		
+
 		this.name = replace(xp.evaluate("project/name", doc).trim(), this.name);
 
-		NodeList list = (NodeList) xp.evaluate("project/dependencies/dependency", doc,
-				XPathConstants.NODESET);
+		NodeList list = (NodeList) xp.evaluate("project/dependencies/dependency", doc, XPathConstants.NODESET);
 		for (int i = 0; i < list.getLength(); i++) {
 			Node node = list.item(i);
 			Dependency dep = new Dependency();
@@ -157,8 +157,7 @@
 			dep.version = replace(xp.evaluate("version", node).trim());
 			dependencies.add(dep);
 
-			NodeList exclusions = (NodeList) xp
-					.evaluate("exclusions", node, XPathConstants.NODESET);
+			NodeList exclusions = (NodeList) xp.evaluate("exclusions", node, XPathConstants.NODESET);
 			for (int e = 0; e < exclusions.getLength(); e++) {
 				Node exc = exclusions.item(e);
 				String exclGroupId = xp.evaluate("groupId", exc).trim();
@@ -170,9 +169,9 @@
 	}
 
 	private String replace(String key, String dflt) {
-		if ( key == null || key.length() == 0)
+		if (key == null || key.length() == 0)
 			return dflt;
-		
+
 		return replace(key);
 	}
 
@@ -185,7 +184,7 @@
 	}
 
 	public String getVersion() throws Exception {
-		if ( version == null)
+		if (version == null)
 			return "<not set>";
 		return replace(version);
 	}
@@ -205,8 +204,7 @@
 		final Dependency	dependency;
 
 		public boolean excludes(String name) {
-			return dependency.exclusions.contains(name) && previous != null
-					&& previous.excludes(name);
+			return dependency.exclusions.contains(name) && previous != null && previous.excludes(name);
 		}
 	}
 
@@ -229,7 +227,7 @@
 
 			if (rover.excludes(name) || dep.optional)
 				continue;
-			
+
 			if (dep.scope == scope && !dep.optional) {
 				try {
 					Pom sub = maven.getPom(groupId, artifactId, version, urls);
@@ -240,35 +238,35 @@
 								queue.add(new Rover(rover, subd));
 							}
 						}
-					} else
-						if (rover.previous != null)
-							System.err.println("Cannot find " + dep + " from "
-									+ rover.previous.dependency);
-						else
-							System.err.println("Cannot find " + dep + " from top");
-				} catch (Exception e) {
+					} else if (rover.previous != null)
+						System.err.println("Cannot find " + dep + " from " + rover.previous.dependency);
+					else
+						System.err.println("Cannot find " + dep + " from top");
+				}
+				catch (Exception e) {
 					if (rover.previous != null)
-						System.err.println("Cannot find " + dep + " from "
-								+ rover.previous.dependency);
+						System.err.println("Cannot find " + dep + " from " + rover.previous.dependency);
 					else
 						System.err.println("Cannot find " + dep + " from top");
 
-//			boolean include = false;
-//			if (dep.scope == Scope.compile) {
-//				include = true;
-//			} else if (dep.scope == Scope.test) {
-//				include = rover.previous == null && (action == Action.compile || action == Action.test);
-//			} else if (dep.scope == Scope.runtime) {
-//				include = action == Action.run;
-//			}
-//			if (include) {
-//				Pom sub = maven.getPom(groupId, artifactId, version, urls);
-//				if (!result.contains(sub)) {
-//					result.add(sub);
-//					for (Dependency subd : sub.dependencies) {
-//						queue.add(new Rover(rover, subd));
-//					}
-					
+					// boolean include = false;
+					// if (dep.scope == Scope.compile) {
+					// include = true;
+					// } else if (dep.scope == Scope.test) {
+					// include = rover.previous == null && (action ==
+					// Action.compile || action == Action.test);
+					// } else if (dep.scope == Scope.runtime) {
+					// include = action == Action.run;
+					// }
+					// if (include) {
+					// Pom sub = maven.getPom(groupId, artifactId, version,
+					// urls);
+					// if (!result.contains(sub)) {
+					// result.add(sub);
+					// for (Dependency subd : sub.dependencies) {
+					// queue.add(new Rover(rover, subd));
+					// }
+
 				}
 			}
 		}
@@ -281,8 +279,7 @@
 			return "null";
 
 		in = in.trim();
-		if ("${pom.version}".equals(in) || "${version}".equals(in)
-				|| "${project.version}".equals(in))
+		if ("${pom.version}".equals(in) || "${version}".equals(in) || "${project.version}".equals(in))
 			return version;
 
 		if ("${basedir}".equals(in))
@@ -318,7 +315,8 @@
 			for (Pom dep : getDependencies(action, repositories)) {
 				doEntry(writer, dep);
 			}
-		} finally {
+		}
+		finally {
 			writer.close();
 		}
 		return file;
diff --git a/bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java b/bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java
index 069acb9..6a8130c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java
+++ b/bundleplugin/src/main/java/aQute/bnd/maven/support/ProjectPom.java
@@ -13,20 +13,21 @@
 
 public class ProjectPom extends Pom {
 
-	final List<URI>	repositories	= new ArrayList<URI>();
+	final List<URI>		repositories	= new ArrayList<URI>();
 	final Properties	properties		= new Properties();
-	String 		packaging;
-	String 		url;
-	
+	String				packaging;
+	String				url;
+
 	ProjectPom(Maven maven, File pomFile) throws Exception {
 		super(maven, pomFile, pomFile.toURI());
 	}
 
-	@Override protected void parse(Document doc, XPath xp) throws Exception {
+	@Override
+	protected void parse(Document doc, XPath xp) throws Exception {
 
 		packaging = xp.evaluate("project/packaging", doc);
 		url = xp.evaluate("project/url", doc);
-		
+
 		Node parent = (Node) xp.evaluate("project/parent", doc, XPathConstants.NODE);
 		if (parent != null && parent.hasChildNodes()) {
 			File parentFile = IO.getFile(getPomFile().getParentFile(), "../pom.xml");
@@ -35,20 +36,20 @@
 			String parentArtifactId = xp.evaluate("artifactId", parent).trim();
 			String parentVersion = xp.evaluate("version", parent).trim();
 			String parentPath = xp.evaluate("relativePath", parent).trim();
-			if (parentPath != null && parentPath.length()!=0) {
+			if (parentPath != null && parentPath.length() != 0) {
 				parentFile = IO.getFile(getPomFile().getParentFile(), parentPath);
 			}
 			if (parentFile.isFile()) {
 				ProjectPom parentPom = new ProjectPom(maven, parentFile);
 				parentPom.parse();
 				dependencies.addAll(parentPom.dependencies);
-				for ( Enumeration<?> e = parentPom.properties.propertyNames(); e.hasMoreElements(); ) {
+				for (Enumeration< ? > e = parentPom.properties.propertyNames(); e.hasMoreElements();) {
 					String key = (String) e.nextElement();
-					if ( ! properties.contains(key))
+					if (!properties.contains(key))
 						properties.put(key, parentPom.properties.get(key));
 				}
 				repositories.addAll(parentPom.repositories);
-				
+
 				setNames(parentPom);
 			} else {
 				// This seems to be a bit bizarre, extending an external pom?
@@ -58,42 +59,40 @@
 			}
 		}
 
-		NodeList propNodes = (NodeList) xp.evaluate("project/properties/*", doc,
-				XPathConstants.NODESET);
+		NodeList propNodes = (NodeList) xp.evaluate("project/properties/*", doc, XPathConstants.NODESET);
 		for (int i = 0; i < propNodes.getLength(); i++) {
 			Node node = propNodes.item(i);
 			String key = node.getNodeName();
 			String value = node.getTextContent();
-			if ( key == null || key.length()==0)
+			if (key == null || key.length() == 0)
 				throw new IllegalArgumentException("Pom has an empty or null key");
-			if ( value == null || value.length()==0)
+			if (value == null || value.length() == 0)
 				throw new IllegalArgumentException("Pom has an empty or null value for property " + key);
 			properties.setProperty(key, value.trim());
 		}
 
-		NodeList repos = (NodeList) xp.evaluate("project/repositories/repository/url", doc,
-				XPathConstants.NODESET);
+		NodeList repos = (NodeList) xp.evaluate("project/repositories/repository/url", doc, XPathConstants.NODESET);
 		for (int i = 0; i < repos.getLength(); i++) {
 			Node node = repos.item(i);
 			String URIString = node.getTextContent().trim();
 			URI uri = new URI(URIString);
-			if ( uri.getScheme() ==null )
-				uri = IO.getFile(pomFile.getParentFile(),URIString).toURI();
+			if (uri.getScheme() == null)
+				uri = IO.getFile(pomFile.getParentFile(), URIString).toURI();
 			repositories.add(uri);
 		}
 
 		super.parse(doc, xp);
 	}
 
-//	private void print(Node node, String indent) {
-//		System.err.print(indent);
-//		System.err.println(node.getNodeName());
-//		Node rover = node.getFirstChild();
-//		while ( rover != null) {
-//			print( rover, indent+" ");
-//			rover = rover.getNextSibling();
-//		}
-//	}
+	// private void print(Node node, String indent) {
+	// System.err.print(indent);
+	// System.err.println(node.getNodeName());
+	// Node rover = node.getFirstChild();
+	// while ( rover != null) {
+	// print( rover, indent+" ");
+	// rover = rover.getNextSibling();
+	// }
+	// }
 
 	/**
 	 * @param parentArtifactId
@@ -102,17 +101,17 @@
 	 * @throws Exception
 	 */
 	private void setNames(Pom pom) throws Exception {
-		if (artifactId == null || artifactId.length()==0)
+		if (artifactId == null || artifactId.length() == 0)
 			artifactId = pom.getArtifactId();
-		if (groupId == null || groupId.length()==0)
+		if (groupId == null || groupId.length() == 0)
 			groupId = pom.getGroupId();
-		if (version == null || version.length()==0)
+		if (version == null || version.length() == 0)
 			version = pom.getVersion();
-		if ( description == null )
+		if (description == null)
 			description = pom.getDescription();
 		else
 			description = pom.getDescription() + "\n" + description;
-	
+
 	}
 
 	static class Rover {
@@ -126,8 +125,7 @@
 		final Dependency	dependency;
 
 		public boolean excludes(String name) {
-			return dependency.exclusions.contains(name) && previous != null
-					&& previous.excludes(name);
+			return dependency.exclusions.contains(name) && previous != null && previous.excludes(name);
 		}
 	}
 
@@ -140,7 +138,7 @@
 
 	protected String replace(String in) {
 		System.err.println("Replce: " + in);
-		if ( in == null) {
+		if (in == null) {
 			System.err.println("null??");
 		}
 		Matcher matcher = MACRO.matcher(in);
@@ -148,18 +146,18 @@
 		StringBuilder sb = new StringBuilder();
 		while (matcher.find()) {
 			int n = matcher.start();
-			sb.append( in, last, n);
+			sb.append(in, last, n);
 			String replacement = get(matcher.group(2));
-			if ( replacement == null )
-				sb.append( matcher.group(1));
+			if (replacement == null)
+				sb.append(matcher.group(1));
 			else
-				sb.append( replacement );
+				sb.append(replacement);
 			last = matcher.end();
 		}
-		if ( last == 0)
+		if (last == 0)
 			return in;
-		
-		sb.append( in, last, in.length());
+
+		sb.append(in, last, in.length());
 		return sb.toString();
 	}
 
@@ -170,14 +168,14 @@
 			return groupId;
 		if (key.equals("pom.version"))
 			return version;
-		
+
 		if (key.equals("pom.name"))
 			return name;
-		
+
 		String prop = properties.getProperty(key);
-		if ( prop != null )
+		if (prop != null)
 			return prop;
-		
+
 		return System.getProperty(key);
 	}
 
@@ -198,7 +196,8 @@
 		return replace(s);
 	}
 
-	@Override public File getArtifact() throws Exception {
+	@Override
+	public File getArtifact() throws Exception {
 		return null;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java b/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
index 312825e..a54fc7e 100644
--- a/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
+++ b/bundleplugin/src/main/java/aQute/bnd/repo/eclipse/EclipseRepo.java
@@ -14,186 +14,181 @@
 import aQute.libg.version.*;
 
 public class EclipseRepo implements Plugin, RepositoryPlugin {
-    File                             root;
-    Reporter                         reporter;
-    String                           name;
-    Parameters index;
+	File						root;
+	Reporter					reporter;
+	String						name;
+	Parameters					index;
 
-    public final static String             LOCATION = "location";
-    public final static String             NAME     = "name";
+	public final static String	LOCATION	= "location";
+	public final static String	NAME		= "name";
 
-    public void setProperties(Map<String, String> map) {
-        String location = map.get(LOCATION);
-        if (location == null)
-            throw new IllegalArgumentException(
-                    "Location muse be set on a EclipseRepo plugin");
+	public void setProperties(Map<String,String> map) {
+		String location = map.get(LOCATION);
+		if (location == null)
+			throw new IllegalArgumentException("Location muse be set on a EclipseRepo plugin");
 
-        root = new File(location);
-        if (!root.isDirectory())
-            throw new IllegalArgumentException(
-                    "Repository is not a valid directory " + root);
+		root = new File(location);
+		if (!root.isDirectory())
+			throw new IllegalArgumentException("Repository is not a valid directory " + root);
 
-        if (!new File(root, "plugins").isDirectory())
-            throw new IllegalArgumentException(
-                    "Repository is not a valid directory (no plugins directory)"
-                            + root);
+		if (!new File(root, "plugins").isDirectory())
+			throw new IllegalArgumentException("Repository is not a valid directory (no plugins directory)" + root);
 
-        name = map.get(NAME);
+		name = map.get(NAME);
 
-        try {
-            index = buildIndex();
-        } catch (Exception e) {
-            throw new RuntimeException(
-                    "Could not build index for eclipse repo: " + root);
-        }
-    }
+		try {
+			index = buildIndex();
+		}
+		catch (Exception e) {
+			throw new RuntimeException("Could not build index for eclipse repo: " + root);
+		}
+	}
 
-    Parameters buildIndex() throws Exception {
-        File index = new File(root, "bnd.index").getAbsoluteFile();
-        File[] plugins = new File(root, "plugins").listFiles();
+	Parameters buildIndex() throws Exception {
+		File index = new File(root, "bnd.index").getAbsoluteFile();
+		File[] plugins = new File(root, "plugins").listFiles();
 
-        for (File f : plugins) {
-            f = f.getAbsoluteFile();
-            if (f.isFile()) {
-                if (f.lastModified() > index.lastModified()) {
+		for (File f : plugins) {
+			f = f.getAbsoluteFile();
+			if (f.isFile()) {
+				if (f.lastModified() > index.lastModified()) {
 
-                    Parameters map = buildIndex(plugins);
-                    write(index, map);
-                    return map;
-                }
-            }
-        }
+					Parameters map = buildIndex(plugins);
+					write(index, map);
+					return map;
+				}
+			}
+		}
 
-        String s = read(index);
-        return Processor.parseHeader(s, null);
-    }
+		String s = read(index);
+		return Processor.parseHeader(s, null);
+	}
 
-    private String read(File index) throws Exception {
-        if (index.isFile()) {
-            BufferedReader fr = IO.reader(index);
-            StringBuilder sb = new StringBuilder();
+	private String read(File index) throws Exception {
+		if (index.isFile()) {
+			BufferedReader fr = IO.reader(index);
+			StringBuilder sb = new StringBuilder();
 
-            try {
-                String s = fr.readLine();
-                while (s != null) {
-                    sb.append(s);
-                    s = fr.readLine();
-                }
-            } finally {
-                fr.close();
-            }
-        }
-        return null;
-    }
+			try {
+				String s = fr.readLine();
+				while (s != null) {
+					sb.append(s);
+					s = fr.readLine();
+				}
+			}
+			finally {
+				fr.close();
+			}
+		}
+		return null;
+	}
 
-    private void write(File index, Map<String, ? extends Map<String, String>> map)
-            throws Exception {
-        String s = Processor.printClauses(map);
-        index.getParentFile().mkdirs();
-        PrintWriter fw = IO.writer(index);
-        try {
-            fw.write(s);
-        } finally {
-            fw.close();
-        }
-    }
+	private void write(File index, Map<String, ? extends Map<String,String>> map) throws Exception {
+		String s = Processor.printClauses(map);
+		index.getParentFile().mkdirs();
+		PrintWriter fw = IO.writer(index);
+		try {
+			fw.write(s);
+		}
+		finally {
+			fw.close();
+		}
+	}
 
-    private Parameters buildIndex(File[] plugins) {
-        Parameters map = new Parameters();
-        for (File plugin : plugins) {
-            try {
-                Jar jar = new Jar(plugin);
-                Manifest manifest = jar.getManifest();
-                String bsn = manifest.getMainAttributes().getValue(
-                        Constants.BUNDLE_SYMBOLICNAME);
-                String version = manifest.getMainAttributes().getValue(
-                        Constants.BUNDLE_VERSION);
+	private Parameters buildIndex(File[] plugins) {
+		Parameters map = new Parameters();
+		for (File plugin : plugins) {
+			try {
+				Jar jar = new Jar(plugin);
+				Manifest manifest = jar.getManifest();
+				String bsn = manifest.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
+				String version = manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
 
-                if (bsn != null) {
-                    if (version == null)
-                        version = "0";
+				if (bsn != null) {
+					if (version == null)
+						version = "0";
 
-                    Map<String, String> instance = map.get(bsn);
-                    if (instance == null) {
-                        instance = Create.map();
-                    }
-                    instance.put(version, plugin.getAbsolutePath());
-                }
-            } catch (Exception e) {
-                // Ignore exceptions in the plugins dir.
-            }
-        }
-        return map;
-    }
+					Map<String,String> instance = map.get(bsn);
+					if (instance == null) {
+						instance = Create.map();
+					}
+					instance.put(version, plugin.getAbsolutePath());
+				}
+			}
+			catch (Exception e) {
+				// Ignore exceptions in the plugins dir.
+			}
+		}
+		return map;
+	}
 
-    public void setReporter(Reporter reporter) {
-        this.reporter = reporter;
-    }
+	public void setReporter(Reporter reporter) {
+		this.reporter = reporter;
+	}
 
-    public boolean canWrite() {
-        return false;
-    }
+	public boolean canWrite() {
+		return false;
+	}
 
-    public File[] get(String bsn, String range) throws Exception {
-        VersionRange r = new VersionRange(range);
-        Map<String, String> instances = index.get(bsn);
-        if (instances == null)
-            return null;
+	public File[] get(String bsn, String range) throws Exception {
+		VersionRange r = new VersionRange(range);
+		Map<String,String> instances = index.get(bsn);
+		if (instances == null)
+			return null;
 
-        List<File> result = Create.list();
+		List<File> result = Create.list();
 
-        for (Entry<String, String> entry : instances.entrySet()) {
-            if (r.includes(new Version(entry.getKey()))) {
-                File f = new File(entry.getValue());
-                if (f.isFile()) {
-                    result.add(f);
-                }
-            }
-        }
-        return result.toArray(new File[result.size()]);
-    }
+		for (Entry<String,String> entry : instances.entrySet()) {
+			if (r.includes(new Version(entry.getKey()))) {
+				File f = new File(entry.getValue());
+				if (f.isFile()) {
+					result.add(f);
+				}
+			}
+		}
+		return result.toArray(new File[result.size()]);
+	}
 
-    public String getName() {
-        return name;
-    }
+	public String getName() {
+		return name;
+	}
 
-    public List<String> list(String regex) {
-        Instruction pattern = null;
-        if (regex != null)
-            pattern = new Instruction(regex);
+	public List<String> list(String regex) {
+		Instruction pattern = null;
+		if (regex != null)
+			pattern = new Instruction(regex);
 
-        List<String> result = new ArrayList<String>();
-        for (String f : index.keySet()) {
-            if (pattern == null || pattern.matches(f))
-                result.add(f);
-        }
-        return result;
-    }
+		List<String> result = new ArrayList<String>();
+		for (String f : index.keySet()) {
+			if (pattern == null || pattern.matches(f))
+				result.add(f);
+		}
+		return result;
+	}
 
-    public File put(Jar jar) throws Exception {
-        return null;
-    }
+	public File put(Jar jar) throws Exception {
+		return null;
+	}
 
-    public List<Version> versions(String bsn) {
-        Map<String, String> instances = index.get(bsn);
-        if (instances == null)
-            return null;
+	public List<Version> versions(String bsn) {
+		Map<String,String> instances = index.get(bsn);
+		if (instances == null)
+			return null;
 
-        List<Version> versions = Create.list();
-        for (String v : instances.keySet())
-            versions.add(new Version(v));
-        return versions;
-    }
-
+		List<Version> versions = Create.list();
+		for (String v : instances.keySet())
+			versions.add(new Version(v));
+		return versions;
+	}
 
 	public File get(String bsn, String range, Strategy strategy, Map<String,String> properties) throws Exception {
 		File[] files = get(bsn, range);
 		if (files.length >= 0) {
 			switch (strategy) {
-			case LOWEST:
-				return files[0];
-			case HIGHEST:
-				return files[files.length - 1];
+				case LOWEST :
+					return files[0];
+				case HIGHEST :
+					return files[files.length - 1];
 			}
 		}
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/AnalyzerPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/AnalyzerPlugin.java
index 3efe8ee..1a5b19a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/AnalyzerPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/AnalyzerPlugin.java
@@ -4,17 +4,17 @@
 
 public interface AnalyzerPlugin {
 
-    /**
-     * This plugin is called after analysis. The plugin is free to modify the
-     * jar and/or change the classpath information (see referred, contained).
-     * This plugin is called after analysis of the JAR but before manifest
-     * generation.
-     * 
-     * @param analyzer
-     * @return true if the classpace has been modified so that the bundle
-     *         classpath must be reanalyzed
-     * @throws Exception
-     */
+	/**
+	 * This plugin is called after analysis. The plugin is free to modify the
+	 * jar and/or change the classpath information (see referred, contained).
+	 * This plugin is called after analysis of the JAR but before manifest
+	 * generation.
+	 * 
+	 * @param analyzer
+	 * @return true if the classpace has been modified so that the bundle
+	 *         classpath must be reanalyzed
+	 * @throws Exception
+	 */
 
-    boolean analyzeJar(Analyzer analyzer) throws Exception;
+	boolean analyzeJar(Analyzer analyzer) throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/BndListener.java b/bundleplugin/src/main/java/aQute/bnd/service/BndListener.java
index e937110..6335697 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/BndListener.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/BndListener.java
@@ -6,18 +6,23 @@
 import aQute.libg.reporter.*;
 
 public class BndListener {
-	final AtomicInteger inside = new AtomicInteger();
-	
-    public void changed(File file) {
-    }
-    public void begin() { inside.incrementAndGet();}
-    public void end() { inside.decrementAndGet(); }
-    
-    public boolean isInside() {
-    	return inside.get()!=0;
-    }
-    
-    public void signal(Reporter reporter) {
-    	
-    }
+	final AtomicInteger	inside	= new AtomicInteger();
+
+	public void changed(File file) {}
+
+	public void begin() {
+		inside.incrementAndGet();
+	}
+
+	public void end() {
+		inside.decrementAndGet();
+	}
+
+	public boolean isInside() {
+		return inside.get() != 0;
+	}
+
+	public void signal(Reporter reporter) {
+
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/CommandPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/CommandPlugin.java
index 34c72c2..9511637 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/CommandPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/CommandPlugin.java
@@ -3,28 +3,30 @@
 import aQute.bnd.build.*;
 
 /**
- * A plugin that makes it possible to 
+ * A plugin that makes it possible to
+ * 
  * @author aqute
- *
  */
 public interface CommandPlugin {
-    /**
-     * Is run before a command is executed. These plugins are called
-     * in the order of declaration.
-     * 
-     * @param project The project for which the command runs
-     * 
-     * @param command the command name
-     */
-    void before(Project project, String command);
-    
-    /**
-     * Is run after a command is executed. These plugins are
-     * called in the reverse order of declaration.
-     * 
-     * @param project The project for which the command runs
-     *
-     * @param command the command name
-     */
-    void after(Project project, String command, Throwable outcome);
+	/**
+	 * Is run before a command is executed. These plugins are called in the
+	 * order of declaration.
+	 * 
+	 * @param project
+	 *            The project for which the command runs
+	 * @param command
+	 *            the command name
+	 */
+	void before(Project project, String command);
+
+	/**
+	 * Is run after a command is executed. These plugins are called in the
+	 * reverse order of declaration.
+	 * 
+	 * @param project
+	 *            The project for which the command runs
+	 * @param command
+	 *            the command name
+	 */
+	void after(Project project, String command, Throwable outcome);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Compiler.java b/bundleplugin/src/main/java/aQute/bnd/service/Compiler.java
index 626b68c..a57fa5f 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Compiler.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Compiler.java
@@ -6,6 +6,6 @@
 import aQute.bnd.build.*;
 
 public interface Compiler {
-	boolean compile(Project project, Collection<File> sources, Collection<Container> buildpath,
-			File bin) throws Exception;
+	boolean compile(Project project, Collection<File> sources, Collection<Container> buildpath, File bin)
+			throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/DependencyContributor.java b/bundleplugin/src/main/java/aQute/bnd/service/DependencyContributor.java
index e6a88ff..1fb073b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/DependencyContributor.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/DependencyContributor.java
@@ -5,5 +5,5 @@
 import aQute.bnd.build.*;
 
 public interface DependencyContributor {
-    void addDependencies(Project project, Set<String> dependencies);
+	void addDependencies(Project project, Set<String> dependencies);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java b/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
index e1d92e1..c2f2b61 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Deploy.java
@@ -5,8 +5,7 @@
 
 /**
  * Deploy this artifact to maven.
- * 
  */
-public interface Deploy {	
+public interface Deploy {
 	boolean deploy(Project project, Jar jar) throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/EclipseJUnitTester.java b/bundleplugin/src/main/java/aQute/bnd/service/EclipseJUnitTester.java
index a2af9b0..f5e4174 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/EclipseJUnitTester.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/EclipseJUnitTester.java
@@ -2,5 +2,6 @@
 
 public interface EclipseJUnitTester {
 	void setPort(int port);
-	void setHost( String host);
+
+	void setHost(String host);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/IndexProvider.java b/bundleplugin/src/main/java/aQute/bnd/service/IndexProvider.java
index 5454c2d..9805f8b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/IndexProvider.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/IndexProvider.java
@@ -1,12 +1,11 @@
 package aQute.bnd.service;
 
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
+import java.net.*;
+import java.util.*;
 
 public interface IndexProvider {
 
-	List<URL> getIndexLocations() throws Exception;
+	List<URI> getIndexLocations() throws Exception;
 
 	Set<ResolutionPhase> getSupportedPhases();
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/MakePlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/MakePlugin.java
index 20a1849..2e564e5 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/MakePlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/MakePlugin.java
@@ -6,16 +6,19 @@
 
 public interface MakePlugin {
 
-    /**
-     * This plugin is called when Include-Resource detects a reference to a resource
-     * that it can not find in the file system.
-     * 
-     * @param builder   The current builder
-     * @param source    The source string (i.e. the place where bnd looked)
-     * @param arguments Any arguments on the clause in Include-Resource
-     * @return          A resource or null if no resource could be made
-     * @throws Exception
-     */
-    Resource make(Builder builder, String source, Map<String,String> arguments) throws Exception;
+	/**
+	 * This plugin is called when Include-Resource detects a reference to a
+	 * resource that it can not find in the file system.
+	 * 
+	 * @param builder
+	 *            The current builder
+	 * @param source
+	 *            The source string (i.e. the place where bnd looked)
+	 * @param arguments
+	 *            Any arguments on the clause in Include-Resource
+	 * @return A resource or null if no resource could be made
+	 * @throws Exception
+	 */
+	Resource make(Builder builder, String source, Map<String,String> arguments) throws Exception;
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Plugin.java b/bundleplugin/src/main/java/aQute/bnd/service/Plugin.java
index 065fac8..6b5bfcf 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Plugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Plugin.java
@@ -8,24 +8,23 @@
  * An optional interface for plugins. If a plugin implements this interface then
  * it can receive the reminaing attributes and directives given in its clause as
  * well as the reporter to use.
- * 
  */
 public interface Plugin {
-    /**
-     * Give the plugin the remaining properties.
-     * 
-     * When a plugin is declared, the clause can contain extra properties.
-     * All the properties and directives are given to the plugin to use.
-     * 
-     * @param map attributes and directives for this plugin's clause
-     */
-    void setProperties(Map<String,String> map);
-    
-    /**
-     * Set the current reporter. This is called at init time. This plugin
-     * should report all errors and warnings to this reporter.
-     * 
-     * @param processor
-     */
-    void setReporter(Reporter processor);
+	/**
+	 * Give the plugin the remaining properties. When a plugin is declared, the
+	 * clause can contain extra properties. All the properties and directives
+	 * are given to the plugin to use.
+	 * 
+	 * @param map
+	 *            attributes and directives for this plugin's clause
+	 */
+	void setProperties(Map<String,String> map);
+
+	/**
+	 * Set the current reporter. This is called at init time. This plugin should
+	 * report all errors and warnings to this reporter.
+	 * 
+	 * @param processor
+	 */
+	void setReporter(Reporter processor);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Refreshable.java b/bundleplugin/src/main/java/aQute/bnd/service/Refreshable.java
index e5e62e9..aeac258 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Refreshable.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Refreshable.java
@@ -3,6 +3,7 @@
 import java.io.*;
 
 public interface Refreshable {
-    boolean refresh();
-    File getRoot();
+	boolean refresh();
+
+	File getRoot();
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Registry.java b/bundleplugin/src/main/java/aQute/bnd/service/Registry.java
index 90fca36..a55c927 100755
--- a/bundleplugin/src/main/java/aQute/bnd/service/Registry.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Registry.java
@@ -7,5 +7,6 @@
  */
 public interface Registry {
 	<T> List<T> getPlugins(Class<T> c);
+
 	<T> T getPlugin(Class<T> c);
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/RegistryPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/RegistryPlugin.java
index 7a46849..8a80660 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/RegistryPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/RegistryPlugin.java
@@ -1,6 +1,5 @@
 package aQute.bnd.service;
 
-
 /**
  * A plugin that wants a registry
  */
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/RemoteRepositoryPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/RemoteRepositoryPlugin.java
index e441a4c..8110fab 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/RemoteRepositoryPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/RemoteRepositoryPlugin.java
@@ -5,8 +5,11 @@
 
 public interface RemoteRepositoryPlugin extends RepositoryPlugin {
 	/**
-	 * Retrieve a resource handle from the repository. For all implementations of this interface, calling {@code getFile(bsn, range, strategy, props)}
-	 * should always return the same result as {@code getResource(bsn, range, strategy, props).request()}.
+	 * Retrieve a resource handle from the repository. For all implementations
+	 * of this interface, calling {@code getFile(bsn, range, strategy, props)}
+	 * should always return the same result as
+	 * {@code getResource(bsn, range, strategy, props).request()}.
+	 * 
 	 * @param bsn
 	 * @param range
 	 * @param strategy
@@ -14,7 +17,8 @@
 	 * @return
 	 * @throws Exception
 	 */
-	ResourceHandle getHandle(String bsn, String range, Strategy strategy, Map<String,String> properties) throws Exception;
-	
+	ResourceHandle getHandle(String bsn, String range, Strategy strategy, Map<String,String> properties)
+			throws Exception;
+
 	File getCacheDirectory();
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryListenerPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryListenerPlugin.java
index 13899f7..92238ab 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryListenerPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryListenerPlugin.java
@@ -5,9 +5,10 @@
 import aQute.lib.osgi.*;
 
 public interface RepositoryListenerPlugin {
-	
+
 	/**
 	 * Called when a bundle is added to a repository.
+	 * 
 	 * @param repository
 	 * @param jar
 	 * @param file
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
index 91b0a7e..c190847 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/RepositoryPlugin.java
@@ -24,7 +24,8 @@
 	 * @throws Exception
 	 *             when anything goes wrong
 	 */
-	@Deprecated File[] get(String bsn, String range) throws Exception;
+	@Deprecated
+	File[] get(String bsn, String range) throws Exception;
 
 	/**
 	 * Return a URL to a matching version of the given bundle.
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/ResourceHandle.java b/bundleplugin/src/main/java/aQute/bnd/service/ResourceHandle.java
index be7f79b..42abd9b 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/ResourceHandle.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/ResourceHandle.java
@@ -3,10 +3,14 @@
 import java.io.*;
 
 public interface ResourceHandle {
-	
-	public enum Location { local, remote_cached, remote }
-	
+
+	public enum Location {
+		local, remote_cached, remote
+	}
+
 	String getName();
+
 	Location getLocation();
+
 	File request() throws IOException;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/Scripter.java b/bundleplugin/src/main/java/aQute/bnd/service/Scripter.java
index 2e4e1d3..069590c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/Scripter.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/Scripter.java
@@ -5,6 +5,6 @@
 
 public interface Scripter {
 
-	void eval(Map<String, Object> x, StringReader stringReader);
+	void eval(Map<String,Object> x, StringReader stringReader);
 
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/SignerPlugin.java b/bundleplugin/src/main/java/aQute/bnd/service/SignerPlugin.java
index aaef646..b503652 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/SignerPlugin.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/SignerPlugin.java
@@ -3,13 +3,15 @@
 import aQute.lib.osgi.*;
 
 public interface SignerPlugin {
-    /**
-     * Sign the current jar. The alias is the given certificate 
-     * keystore.
-     * 
-     * @param builder   The current builder that contains the jar to sign
-     * @param alias     The keystore certificate alias
-     * @throws Exception When anything goes wrong
-     */
-    void sign(Builder builder, String alias) throws Exception;
+	/**
+	 * Sign the current jar. The alias is the given certificate keystore.
+	 * 
+	 * @param builder
+	 *            The current builder that contains the jar to sign
+	 * @param alias
+	 *            The keystore certificate alias
+	 * @throws Exception
+	 *             When anything goes wrong
+	 */
+	void sign(Builder builder, String alias) throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/action/Action.java b/bundleplugin/src/main/java/aQute/bnd/service/action/Action.java
index 5167827..c74903d 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/action/Action.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/action/Action.java
@@ -3,5 +3,5 @@
 import aQute.bnd.build.*;
 
 public interface Action {
-    void execute( Project project, String action) throws Exception;
+	void execute(Project project, String action) throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/action/NamedAction.java b/bundleplugin/src/main/java/aQute/bnd/service/action/NamedAction.java
index 5a1c697..7b0c29a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/action/NamedAction.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/action/NamedAction.java
@@ -1,6 +1,5 @@
 package aQute.bnd.service.action;
 
-
 public interface NamedAction extends Action {
-    String getName();
+	String getName();
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/diff/Delta.java b/bundleplugin/src/main/java/aQute/bnd/service/diff/Delta.java
index eec4781..5d3aa12 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/diff/Delta.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/diff/Delta.java
@@ -3,7 +3,6 @@
 /**
  * The Delta provides information about the {@link Diff} object. It tells the
  * relation between the newer and older compared elements.
- * 
  */
 public enum Delta {
 
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/diff/Diff.java b/bundleplugin/src/main/java/aQute/bnd/service/diff/Diff.java
index 43bf4e5..bf23eee 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/diff/Diff.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/diff/Diff.java
@@ -6,18 +6,32 @@
 	interface Ignore {
 		boolean contains(Diff diff);
 	}
-	
+
+	class Data {
+
+		public Type		type;
+		public Delta	delta;
+		public String	name;
+		public Data[]	children;
+		public String	comment;
+	}
+
+	Data serialize();
+
 	Delta getDelta();
+
 	Delta getDelta(Ignore ignore);
 
 	Type getType();
+
 	String getName();
+
 	Tree getOlder();
+
 	Tree getNewer();
 
-	Collection<? extends Diff> getChildren();
-	
+	Collection< ? extends Diff> getChildren();
+
 	Diff get(String name);
-	
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/diff/Differ.java b/bundleplugin/src/main/java/aQute/bnd/service/diff/Differ.java
index 869a237..6d60c82 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/diff/Differ.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/diff/Differ.java
@@ -6,7 +6,8 @@
  * Compare two Jars and report the differences.
  */
 public interface Differ {
-	Tree tree(Analyzer source ) throws Exception;
+	Tree tree(Analyzer source) throws Exception;
+
 	Tree tree(Jar source) throws Exception;
 
 	Tree deserialize(Tree.Data data) throws Exception;
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/diff/Tree.java b/bundleplugin/src/main/java/aQute/bnd/service/diff/Tree.java
index 7072ac1..0b61f86 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/diff/Tree.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/diff/Tree.java
@@ -1,6 +1,6 @@
 package aQute.bnd.service.diff;
 
-public interface Tree {
+public interface Tree extends Comparable<Tree>{
 
 	public class Data {
 		public String	name;
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/diff/Type.java b/bundleplugin/src/main/java/aQute/bnd/service/diff/Type.java
index d71b9f4..ec4c1b2 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/diff/Type.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/diff/Type.java
@@ -1,10 +1,10 @@
 package aQute.bnd.service.diff;
 
 public enum Type {
-	ACCESS, BUNDLE, API, MANIFEST, PACKAGE, CLASS, INTERFACE, ANNOTATION, ENUM, EXTENDS, IMPLEMENTS, FIELD, METHOD, ANNOTATED, PROPERTY, RESOURCE, CUSTOM, CLAUSE, HEADER, PARAMETER, CLASS_VERSION, RESOURCES, CONSTANT, RETURN, VERSION, DEPRECATED;
+	ACCESS, BUNDLE, API, MANIFEST, PACKAGE, CLASS, INTERFACE, ANNOTATION, ENUM, EXTENDS, IMPLEMENTS, FIELD, METHOD, ANNOTATED, PROPERTY, RESOURCE, CUSTOM, CLAUSE, HEADER, PARAMETER, CLASS_VERSION, RESOURCES, CONSTANT, RETURN, VERSION, DEPRECATED, REPO, PROGRAM, REVISION;
 
 	public boolean isInherited() {
 		// TODO Auto-generated method stub
 		return false;
-	} 
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/packageinfo b/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
index 0ff7674..084a0d4 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
+++ b/bundleplugin/src/main/java/aQute/bnd/service/packageinfo
@@ -1 +1 @@
-version 1.45.0
+version 2.0.0
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/url/TaggedData.java b/bundleplugin/src/main/java/aQute/bnd/service/url/TaggedData.java
index 53332f4..fe81de8 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/url/TaggedData.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/url/TaggedData.java
@@ -1,18 +1,17 @@
 package aQute.bnd.service.url;
 
-import java.io.InputStream;
+import java.io.*;
 
 /**
  * Represents a data stream that has a tag associated with it; the primary
  * use-case is an HTTP response stream with an ETag header.
  * 
  * @author Neil Bartlett
- * 
  */
 public class TaggedData {
 
-	private final String tag;
-	private final InputStream inputStream;
+	private final String		tag;
+	private final InputStream	inputStream;
 
 	public TaggedData(String tag, InputStream inputStream) {
 		this.tag = tag;
diff --git a/bundleplugin/src/main/java/aQute/bnd/service/url/URLConnector.java b/bundleplugin/src/main/java/aQute/bnd/service/url/URLConnector.java
index e853509..5781288 100644
--- a/bundleplugin/src/main/java/aQute/bnd/service/url/URLConnector.java
+++ b/bundleplugin/src/main/java/aQute/bnd/service/url/URLConnector.java
@@ -1,8 +1,7 @@
 package aQute.bnd.service.url;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
+import java.io.*;
+import java.net.*;
 
 public interface URLConnector {
 
@@ -24,7 +23,6 @@
 	 *         {@link TaggedData#getTag()} method <strong>may</strong> return
 	 *         {@code null} if the resource has no tag.
 	 * @throws IOException
-	 * 
 	 * @since 1.1
 	 */
 	TaggedData connectTagged(URL url) throws IOException;
@@ -41,7 +39,6 @@
 	 * @return An instance of {@link TaggedData}, or {@code null} if the
 	 *         resource has not modified (i.e., if it has the same tag value).
 	 * @throws IOException
-	 * 
 	 * @since 1.1
 	 */
 	TaggedData connectTagged(URL url, String tag) throws IOException;
diff --git a/bundleplugin/src/main/java/aQute/bnd/settings/Settings.java b/bundleplugin/src/main/java/aQute/bnd/settings/Settings.java
index 78ed213..6b7ff90 100644
--- a/bundleplugin/src/main/java/aQute/bnd/settings/Settings.java
+++ b/bundleplugin/src/main/java/aQute/bnd/settings/Settings.java
@@ -37,7 +37,7 @@
 	}
 
 	private void generate() throws NoSuchAlgorithmException {
-		Pair<? extends PrivateKey, ? extends RSAPublicKey> pair = RSA.generate();
+		Pair< ? extends PrivateKey, ? extends RSAPublicKey> pair = RSA.generate();
 		prefs.put(KEY_PRIVATE, Crypto.toString(pair.a));
 		prefs.put(KEY_PUBLIC, Crypto.toString(pair.b));
 		prefs.putBoolean(KEY_SET, true);
diff --git a/bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java b/bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java
index d0073b5..b96bd41 100644
--- a/bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java
+++ b/bundleplugin/src/main/java/aQute/bnd/signing/JartoolSigner.java
@@ -11,134 +11,131 @@
 import aQute.libg.reporter.*;
 
 /**
- * Sign the jar file.
- * 
- * -sign : <alias> [ ';' 'password:=' <password> ] [ ';' 'keystore:=' <keystore> ] [
- * ';' 'sign-password:=' <pw> ] ( ',' ... )*
+ * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';'
+ * 'keystore:=' <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )*
  * 
  * @author aqute
- * 
  */
 public class JartoolSigner implements Plugin, SignerPlugin {
-    String keystore;
-    String storetype;
-    String path = "jarsigner";
-    String storepass;
-    String keypass;
-    String sigFile;
-    String digestalg;
+	String	keystore;
+	String	storetype;
+	String	path	= "jarsigner";
+	String	storepass;
+	String	keypass;
+	String	sigFile;
+	String	digestalg;
 
-    public void setProperties(Map<String, String> map) {
-        if (map.containsKey("keystore"))
-            this.keystore = map.get("keystore");
-        if (map.containsKey("storetype"))
-            this.storetype = map.get("storetype");
-        if (map.containsKey("storepass"))
-            this.storepass = map.get("storepass");
-        if (map.containsKey("keypass"))
-            this.keypass = map.get("keypass");
-        if (map.containsKey("path"))
-            this.path = map.get("path");
-        if (map.containsKey("sigFile"))
-            this.sigFile = map.get("sigFile");
-        if (map.containsKey("digestalg"))
-            this.digestalg = map.get("digestalg");
-    }
+	public void setProperties(Map<String,String> map) {
+		if (map.containsKey("keystore"))
+			this.keystore = map.get("keystore");
+		if (map.containsKey("storetype"))
+			this.storetype = map.get("storetype");
+		if (map.containsKey("storepass"))
+			this.storepass = map.get("storepass");
+		if (map.containsKey("keypass"))
+			this.keypass = map.get("keypass");
+		if (map.containsKey("path"))
+			this.path = map.get("path");
+		if (map.containsKey("sigFile"))
+			this.sigFile = map.get("sigFile");
+		if (map.containsKey("digestalg"))
+			this.digestalg = map.get("digestalg");
+	}
 
-    public void setReporter(Reporter processor) {
-    }
+	public void setReporter(Reporter processor) {}
 
-    public void sign(Builder builder, String alias) throws Exception {    	    	
-    	File f = builder.getFile(keystore);
-    	if ( !f.isFile()) {
-    		builder.error("Invalid keystore %s", f.getAbsolutePath() );
-    		return;
-    	}
-    	
-        Jar jar = builder.getJar();
-        File tmp = File.createTempFile("signdjar", ".jar");
-        tmp.deleteOnExit();
+	public void sign(Builder builder, String alias) throws Exception {
+		File f = builder.getFile(keystore);
+		if (!f.isFile()) {
+			builder.error("Invalid keystore %s", f.getAbsolutePath());
+			return;
+		}
 
-        jar.write(tmp);
+		Jar jar = builder.getJar();
+		File tmp = File.createTempFile("signdjar", ".jar");
+		tmp.deleteOnExit();
 
-        Command command = new Command();
-        command.add(path);
-        if (keystore != null) {
-            command.add("-keystore");
-            command.add(f.getAbsolutePath());
-        }
+		jar.write(tmp);
 
-        if (storetype != null) {
-        	command.add("-storetype");
-        	command.add(storetype);
-        }
+		Command command = new Command();
+		command.add(path);
+		if (keystore != null) {
+			command.add("-keystore");
+			command.add(f.getAbsolutePath());
+		}
 
-        if (keypass != null) {
-        	command.add("-keypass");
-        	command.add(keypass);
-        }
+		if (storetype != null) {
+			command.add("-storetype");
+			command.add(storetype);
+		}
 
-        if (storepass != null) {
-        	command.add("-storepass");
-        	command.add(storepass);
-        }
+		if (keypass != null) {
+			command.add("-keypass");
+			command.add(keypass);
+		}
 
-        if (sigFile != null) {
-        	command.add("-sigFile");
-        	command.add(sigFile);
-        }
+		if (storepass != null) {
+			command.add("-storepass");
+			command.add(storepass);
+		}
 
-        if (digestalg != null) {
-        	command.add("-digestalg");
-        	command.add(digestalg);
-	    }
+		if (sigFile != null) {
+			command.add("-sigFile");
+			command.add(sigFile);
+		}
 
-        command.add(tmp.getAbsolutePath());
-        command.add(alias);
-        builder.trace("Jarsigner command: %s", command);
-        command.setTimeout(20, TimeUnit.SECONDS);
-        StringBuilder out = new StringBuilder();
-        StringBuilder err = new StringBuilder();
-        int exitValue = command.execute(System.in, out, err);
-        if (exitValue != 0) {
-            builder.error("Signing Jar out: %s\nerr: %s", out, err);
-        } else {
-            builder.trace("Signing Jar out: %s \nerr: %s", out, err);
-        }
+		if (digestalg != null) {
+			command.add("-digestalg");
+			command.add(digestalg);
+		}
 
-        Jar signed = new Jar(tmp);
-        builder.addClose(signed);
+		command.add(tmp.getAbsolutePath());
+		command.add(alias);
+		builder.trace("Jarsigner command: %s", command);
+		command.setTimeout(20, TimeUnit.SECONDS);
+		StringBuilder out = new StringBuilder();
+		StringBuilder err = new StringBuilder();
+		int exitValue = command.execute(out, err);
+		if (exitValue != 0) {
+			builder.error("Signing Jar out: %s\nerr: %s", out, err);
+		} else {
+			builder.trace("Signing Jar out: %s \nerr: %s", out, err);
+		}
 
-        Map<String, Resource> dir = signed.getDirectories().get("META-INF");
-        for (Entry<String, Resource> entry : dir.entrySet()) {
-            String path = entry.getKey();
-            if (path.matches(".*\\.(DSA|RSA|SF|MF)$")) {
-                jar.putResource(path, entry.getValue());
-            }
-        }
-        jar.setDoNotTouchManifest();
-    }
+		Jar signed = new Jar(tmp);
+		builder.addClose(signed);
 
-    StringBuilder collect(final InputStream in) throws Exception {
-        final StringBuilder sb = new StringBuilder();
-        
-        Thread tin = new Thread() {
-            public void run() {
-                try {
-                    BufferedReader rdr = new BufferedReader(new InputStreamReader(in, Constants.DEFAULT_CHARSET));
-                    String line = rdr.readLine();
-                    while (line != null) {
-                        sb.append(line);
-                        line = rdr.readLine();
-                    }
-                    rdr.close();
-                    in.close();
-                } catch (Exception e) {
-                    // Ignore any exceptions
-                }
-            }
-        };
-        tin.start();
-        return sb;
-    }
+		Map<String,Resource> dir = signed.getDirectories().get("META-INF");
+		for (Entry<String,Resource> entry : dir.entrySet()) {
+			String path = entry.getKey();
+			if (path.matches(".*\\.(DSA|RSA|SF|MF)$")) {
+				jar.putResource(path, entry.getValue());
+			}
+		}
+		jar.setDoNotTouchManifest();
+	}
+
+	StringBuilder collect(final InputStream in) throws Exception {
+		final StringBuilder sb = new StringBuilder();
+
+		Thread tin = new Thread() {
+			public void run() {
+				try {
+					BufferedReader rdr = new BufferedReader(new InputStreamReader(in, Constants.DEFAULT_CHARSET));
+					String line = rdr.readLine();
+					while (line != null) {
+						sb.append(line);
+						line = rdr.readLine();
+					}
+					rdr.close();
+					in.close();
+				}
+				catch (Exception e) {
+					// Ignore any exceptions
+				}
+			}
+		};
+		tin.start();
+		return sb;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/bnd/signing/Signer.java b/bundleplugin/src/main/java/aQute/bnd/signing/Signer.java
index 1827cd6..7914df3 100644
--- a/bundleplugin/src/main/java/aQute/bnd/signing/Signer.java
+++ b/bundleplugin/src/main/java/aQute/bnd/signing/Signer.java
@@ -13,184 +13,176 @@
 
 /**
  * This class is used with the aQute.lib.osgi package, it signs jars with DSA
- * signature.
- * 
- * -sign: md5, sha1
+ * signature. -sign: md5, sha1
  */
 public class Signer extends Processor {
-    static Pattern  METAINFDIR   = Pattern.compile("META-INF/[^/]*");
-    String         digestNames[]    = new String[] { "MD5" };
-    File           keystoreFile  = new File("keystore");
-    String         password;
-    String         alias;
+	static Pattern	METAINFDIR		= Pattern.compile("META-INF/[^/]*");
+	String			digestNames[]	= new String[] {
+										"MD5"
+									};
+	File			keystoreFile	= new File("keystore");
+	String			password;
+	String			alias;
 
-    public void signJar(Jar jar) {
-        if (digestNames == null || digestNames.length == 0)
-            error("Need at least one digest algorithm name, none are specified");
+	public void signJar(Jar jar) {
+		if (digestNames == null || digestNames.length == 0)
+			error("Need at least one digest algorithm name, none are specified");
 
-        if (keystoreFile == null || !keystoreFile.getAbsoluteFile().exists()) {
-            error("No such keystore file: " + keystoreFile);
-            return;
-        }
+		if (keystoreFile == null || !keystoreFile.getAbsoluteFile().exists()) {
+			error("No such keystore file: " + keystoreFile);
+			return;
+		}
 
-        if (alias == null) {
-            error("Private key alias not set for signing");
-            return;
-        }
+		if (alias == null) {
+			error("Private key alias not set for signing");
+			return;
+		}
 
-        MessageDigest digestAlgorithms[] = new MessageDigest[digestNames.length];
+		MessageDigest digestAlgorithms[] = new MessageDigest[digestNames.length];
 
-        getAlgorithms(digestNames, digestAlgorithms);
+		getAlgorithms(digestNames, digestAlgorithms);
 
-        try {
-            Manifest manifest = jar.getManifest();
-            manifest.getMainAttributes().putValue("Signed-By", "Bnd");
+		try {
+			Manifest manifest = jar.getManifest();
+			manifest.getMainAttributes().putValue("Signed-By", "Bnd");
 
-            // Create a new manifest that contains the
-            // Name parts with the specified digests
+			// Create a new manifest that contains the
+			// Name parts with the specified digests
 
-            ByteArrayOutputStream o = new ByteArrayOutputStream();
-            manifest.write(o);
-            doManifest(jar, digestNames, digestAlgorithms, o);
-            o.flush();
-            byte newManifestBytes[] = o.toByteArray();
-            jar.putResource("META-INF/MANIFEST.MF", new EmbeddedResource(
-                    newManifestBytes, 0));
+			ByteArrayOutputStream o = new ByteArrayOutputStream();
+			manifest.write(o);
+			doManifest(jar, digestNames, digestAlgorithms, o);
+			o.flush();
+			byte newManifestBytes[] = o.toByteArray();
+			jar.putResource("META-INF/MANIFEST.MF", new EmbeddedResource(newManifestBytes, 0));
 
-            // Use the bytes from the new manifest to create
-            // a signature file
+			// Use the bytes from the new manifest to create
+			// a signature file
 
-            byte[] signatureFileBytes = doSignatureFile(digestNames,
-                    digestAlgorithms, newManifestBytes);
-            jar.putResource("META-INF/BND.SF", new EmbeddedResource(
-                    signatureFileBytes, 0));
+			byte[] signatureFileBytes = doSignatureFile(digestNames, digestAlgorithms, newManifestBytes);
+			jar.putResource("META-INF/BND.SF", new EmbeddedResource(signatureFileBytes, 0));
 
-            // Now we must create an RSA signature
-            // this requires the private key from the keystore
+			// Now we must create an RSA signature
+			// this requires the private key from the keystore
 
-            KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
+			KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
 
-            KeyStore.PrivateKeyEntry privateKeyEntry = null;
+			KeyStore.PrivateKeyEntry privateKeyEntry = null;
 
-            java.io.FileInputStream keystoreInputStream = null;
-            try {
-            	keystoreInputStream = new java.io.FileInputStream(
-                        keystoreFile);
-                char[] pw = password == null ? new char[0]
-                        : password.toCharArray();
-                
-                keystore.load(keystoreInputStream, pw);
-                keystoreInputStream.close();
-                privateKeyEntry =  (PrivateKeyEntry) keystore.getEntry(
-                        alias, new KeyStore.PasswordProtection(pw));
-            } catch (Exception e) {
-                error("No able to load the private key from the give keystore("+keystoreFile.getAbsolutePath()+") with alias "+alias+" : "
-                        + e);
-                return;
-            } finally {
-            	IO.close(keystoreInputStream);
-            }
-            PrivateKey privateKey = privateKeyEntry.getPrivateKey();
+			java.io.FileInputStream keystoreInputStream = null;
+			try {
+				keystoreInputStream = new java.io.FileInputStream(keystoreFile);
+				char[] pw = password == null ? new char[0] : password.toCharArray();
 
-            Signature signature = Signature.getInstance("MD5withRSA");
-            signature.initSign(privateKey);
+				keystore.load(keystoreInputStream, pw);
+				keystoreInputStream.close();
+				privateKeyEntry = (PrivateKeyEntry) keystore.getEntry(alias, new KeyStore.PasswordProtection(pw));
+			}
+			catch (Exception e) {
+				error("No able to load the private key from the give keystore(" + keystoreFile.getAbsolutePath()
+						+ ") with alias " + alias + " : " + e);
+				return;
+			}
+			finally {
+				IO.close(keystoreInputStream);
+			}
+			PrivateKey privateKey = privateKeyEntry.getPrivateKey();
 
-            signature.update(signatureFileBytes);
+			Signature signature = Signature.getInstance("MD5withRSA");
+			signature.initSign(privateKey);
 
-            signature.sign();
+			signature.update(signatureFileBytes);
 
-            // TODO, place the SF in a PCKS#7 structure ...
-            // no standard class for this? The following
-            // is an idea but we will to have do ASN.1 BER
-            // encoding ...
+			signature.sign();
 
-         
-            
-            ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
-            jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream
-                    .toByteArray(), 0));
-        } catch (Exception e) {
-            error("During signing: " + e);
-        }
-    }
+			// TODO, place the SF in a PCKS#7 structure ...
+			// no standard class for this? The following
+			// is an idea but we will to have do ASN.1 BER
+			// encoding ...
 
-    private byte[] doSignatureFile(String[] digestNames,
-            MessageDigest[] algorithms, byte[] manbytes) throws IOException {
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        PrintWriter ps = IO.writer(out);
-        ps.print("Signature-Version: 1.0\r\n");
+			ByteArrayOutputStream tmpStream = new ByteArrayOutputStream();
+			jar.putResource("META-INF/BND.RSA", new EmbeddedResource(tmpStream.toByteArray(), 0));
+		}
+		catch (Exception e) {
+			error("During signing: " + e);
+		}
+	}
 
-        for (int a = 0; a < algorithms.length; a++) {
-            if (algorithms[a] != null) {
-                byte[] digest = algorithms[a].digest(manbytes);
-                ps.print(digestNames[a] + "-Digest-Manifest: ");
-                ps.print(new Base64(digest));
-                ps.print("\r\n");
-            }
-        }
-        return out.toByteArray();
-    }
+	private byte[] doSignatureFile(String[] digestNames, MessageDigest[] algorithms, byte[] manbytes)
+			throws IOException {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		PrintWriter ps = IO.writer(out);
+		ps.print("Signature-Version: 1.0\r\n");
 
-    private void doManifest(Jar jar, String[] digestNames,
-            MessageDigest[] algorithms, OutputStream out) throws Exception {
+		for (int a = 0; a < algorithms.length; a++) {
+			if (algorithms[a] != null) {
+				byte[] digest = algorithms[a].digest(manbytes);
+				ps.print(digestNames[a] + "-Digest-Manifest: ");
+				ps.print(new Base64(digest));
+				ps.print("\r\n");
+			}
+		}
+		return out.toByteArray();
+	}
 
-        for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) {
-            String name = entry.getKey();
-            if (!METAINFDIR.matcher(name).matches()) {
-                out.write("\r\n".getBytes());
-                out.write("Name: ".getBytes());
-                out.write(name.getBytes("UTF-8"));
-                out.write("\r\n".getBytes());
+	private void doManifest(Jar jar, String[] digestNames, MessageDigest[] algorithms, OutputStream out)
+			throws Exception {
 
-                digest(algorithms, entry.getValue());
-                for (int a = 0; a < algorithms.length; a++) {
-                    if (algorithms[a] != null) {
-                        byte[] digest = algorithms[a].digest();
-                        String header = digestNames[a] + "-Digest: "
-                                + new Base64(digest) + "\r\n";
-                        out.write(header.getBytes());
-                    }
-                }
-            }
-        }
-    }
+		for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) {
+			String name = entry.getKey();
+			if (!METAINFDIR.matcher(name).matches()) {
+				out.write("\r\n".getBytes());
+				out.write("Name: ".getBytes());
+				out.write(name.getBytes("UTF-8"));
+				out.write("\r\n".getBytes());
 
-    private void digest(MessageDigest[] algorithms, Resource r)
-            throws Exception {
-        InputStream in = r.openInputStream();
-        byte[] data = new byte[1024];
-        int size = in.read(data);
-        while (size > 0) {
-            for (int a = 0; a < algorithms.length; a++) {
-                if (algorithms[a] != null) {
-                    algorithms[a].update(data, 0, size);
-                }
-            }
-            size = in.read(data);
-        }
-    }
+				digest(algorithms, entry.getValue());
+				for (int a = 0; a < algorithms.length; a++) {
+					if (algorithms[a] != null) {
+						byte[] digest = algorithms[a].digest();
+						String header = digestNames[a] + "-Digest: " + new Base64(digest) + "\r\n";
+						out.write(header.getBytes());
+					}
+				}
+			}
+		}
+	}
 
-    private void getAlgorithms(String[] digestNames, MessageDigest[] algorithms) {
-        for (int i = 0; i < algorithms.length; i++) {
-            String name = digestNames[i];
-            try {
-                algorithms[i] = MessageDigest.getInstance(name);
-            } catch (NoSuchAlgorithmException e) {
-                error("Specified digest algorithm " + digestNames[i]
-                        + ", but not such algorithm was found: " + e);
-            }
-        }
-    }
+	private void digest(MessageDigest[] algorithms, Resource r) throws Exception {
+		InputStream in = r.openInputStream();
+		byte[] data = new byte[1024];
+		int size = in.read(data);
+		while (size > 0) {
+			for (int a = 0; a < algorithms.length; a++) {
+				if (algorithms[a] != null) {
+					algorithms[a].update(data, 0, size);
+				}
+			}
+			size = in.read(data);
+		}
+	}
 
-    public void setPassword(String string) {
-        password = string;
-    }
+	private void getAlgorithms(String[] digestNames, MessageDigest[] algorithms) {
+		for (int i = 0; i < algorithms.length; i++) {
+			String name = digestNames[i];
+			try {
+				algorithms[i] = MessageDigest.getInstance(name);
+			}
+			catch (NoSuchAlgorithmException e) {
+				error("Specified digest algorithm " + digestNames[i] + ", but not such algorithm was found: " + e);
+			}
+		}
+	}
 
-    public void setKeystore(File keystore) {
-        this.keystoreFile = keystore;
-    }
+	public void setPassword(String string) {
+		password = string;
+	}
 
-    public void setAlias(String string) {
-        this.alias = string;
-    }
+	public void setKeystore(File keystore) {
+		this.keystoreFile = keystore;
+	}
+
+	public void setAlias(String string) {
+		this.alias = string;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/configurable/Config.java b/bundleplugin/src/main/java/aQute/configurable/Config.java
index bc2aebe..e652ad7 100644
--- a/bundleplugin/src/main/java/aQute/configurable/Config.java
+++ b/bundleplugin/src/main/java/aQute/configurable/Config.java
@@ -2,12 +2,16 @@
 
 import java.lang.annotation.*;
 
-@Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) 
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
 public @interface Config {
-	String NULL = "<<NULL>>";
-	
+	String	NULL	= "<<NULL>>";
+
 	boolean required() default false;
+
 	String description() default "";
+
 	String deflt() default NULL;
+
 	String id() default NULL;
 }
diff --git a/bundleplugin/src/main/java/aQute/configurable/Configurable.java b/bundleplugin/src/main/java/aQute/configurable/Configurable.java
index 79af122..1c461e6 100644
--- a/bundleplugin/src/main/java/aQute/configurable/Configurable.java
+++ b/bundleplugin/src/main/java/aQute/configurable/Configurable.java
@@ -10,15 +10,14 @@
 public class Configurable<T> {
 
 	public static <T> T createConfigurable(Class<T> c, Map< ? , ? > properties) {
-		Object o = Proxy.newProxyInstance(c.getClassLoader(),
-				new Class< ? >[] {c},
-				new ConfigurableHandler(properties, c.getClassLoader()));
+		Object o = Proxy.newProxyInstance(c.getClassLoader(), new Class< ? >[] {
+			c
+		}, new ConfigurableHandler(properties, c.getClassLoader()));
 		return c.cast(o);
 	}
 
-	public static <T> T createConfigurable(Class<T> c,
-			Dictionary< ? , ? > properties) {
-		Map<Object, Object> alt = new HashMap<Object, Object>();
+	public static <T> T createConfigurable(Class<T> c, Dictionary< ? , ? > properties) {
+		Map<Object,Object> alt = new HashMap<Object,Object>();
 		for (Enumeration< ? > e = properties.keys(); e.hasMoreElements();) {
 			Object key = e.nextElement();
 			alt.put(key, properties.get(key));
@@ -35,8 +34,7 @@
 			this.loader = loader;
 		}
 
-		public Object invoke(Object proxy, Method method, Object[] args)
-				throws Throwable {
+		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
 			Config ad = method.getAnnotation(Config.class);
 			String id = Configurable.mangleMethodName(method.getName());
 
@@ -50,9 +48,7 @@
 			if (o == null) {
 				if (ad != null) {
 					if (ad.required())
-						throw new IllegalStateException(
-								"Attribute is required but not set "
-										+ method.getName());
+						throw new IllegalStateException("Attribute is required but not set " + method.getName());
 
 					o = ad.deflt();
 					if (o.equals(Config.NULL))
@@ -63,13 +59,10 @@
 				Class< ? > rt = method.getReturnType();
 				if (rt == boolean.class || rt == Boolean.class)
 					return false;
-				if (method.getReturnType().isPrimitive()
-						|| Number.class
-								.isAssignableFrom(method.getReturnType())) {
+				if (method.getReturnType().isPrimitive() || Number.class.isAssignableFrom(method.getReturnType())) {
 
 					o = "0";
-				}
-				else
+				} else
 					return null;
 			}
 
@@ -77,25 +70,20 @@
 				String s = (String) convert(String.class, o);
 
 				// Allow a base to be specified for File and URL
-				if (method.getReturnType() == File.class
-						&& args[0].getClass() == File.class) {
+				if (method.getReturnType() == File.class && args[0].getClass() == File.class) {
 					return new File((File) args[0], s);
+				} else if (method.getReturnType() == URL.class && args[0].getClass() == File.class) {
+					return new URL(((File) args[0]).toURI().toURL(), s);
+				} else if (method.getReturnType() == URL.class && args[0].getClass() == URL.class) {
+					return new URL((URL) args[0], s);
 				}
-				else
-					if (method.getReturnType() == URL.class
-							&& args[0].getClass() == File.class) {
-						return new URL(((File) args[0]).toURI().toURL(), s);
-					}
-					else
-						if (method.getReturnType() == URL.class
-								&& args[0].getClass() == URL.class) {
-							return new URL((URL) args[0], s);
-						}
 			}
 			return convert(method.getGenericReturnType(), o);
 		}
 
-		@SuppressWarnings({"unchecked", "rawtypes"})
+		@SuppressWarnings({
+				"unchecked", "rawtypes"
+		})
 		public Object convert(Type type, Object o) throws Exception {
 
 			// TODO type variables
@@ -133,74 +121,52 @@
 				}
 				return true;
 
+			} else if (resultType == byte.class || resultType == Byte.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).byteValue();
+				resultType = Byte.class;
+			} else if (resultType == char.class) {
+				resultType = Character.class;
+			} else if (resultType == short.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).shortValue();
+				resultType = Short.class;
+			} else if (resultType == int.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).intValue();
+				resultType = Integer.class;
+			} else if (resultType == long.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).longValue();
+				resultType = Long.class;
+			} else if (resultType == float.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).floatValue();
+				resultType = Float.class;
+			} else if (resultType == double.class) {
+				if (Number.class.isAssignableFrom(actualType))
+					return ((Number) o).doubleValue();
+				resultType = Double.class;
 			}
-			else
-				if (resultType == byte.class || resultType == Byte.class) {
-					if (Number.class.isAssignableFrom(actualType))
-						return ((Number) o).byteValue();
-					resultType = Byte.class;
-				}
-				else
-					if (resultType == char.class) {
-						resultType = Character.class;
-					}
-					else
-						if (resultType == short.class) {
-							if (Number.class.isAssignableFrom(actualType))
-								return ((Number) o).shortValue();
-							resultType = Short.class;
-						}
-						else
-							if (resultType == int.class) {
-								if (Number.class.isAssignableFrom(actualType))
-									return ((Number) o).intValue();
-								resultType = Integer.class;
-							}
-							else
-								if (resultType == long.class) {
-									if (Number.class
-											.isAssignableFrom(actualType))
-										return ((Number) o).longValue();
-									resultType = Long.class;
-								}
-								else
-									if (resultType == float.class) {
-										if (Number.class
-												.isAssignableFrom(actualType))
-											return ((Number) o).floatValue();
-										resultType = Float.class;
-									}
-									else
-										if (resultType == double.class) {
-											if (Number.class
-													.isAssignableFrom(actualType))
-												return ((Number) o)
-														.doubleValue();
-											resultType = Double.class;
-										}
 
 			if (resultType.isPrimitive())
-				throw new IllegalArgumentException("Unknown primitive: "
-						+ resultType);
+				throw new IllegalArgumentException("Unknown primitive: " + resultType);
 
-			if (Number.class.isAssignableFrom(resultType)
-					&& actualType == Boolean.class) {
+			if (Number.class.isAssignableFrom(resultType) && actualType == Boolean.class) {
 				Boolean b = (Boolean) o;
 				o = b ? "1" : "0";
-			}
-			else
-				if (actualType == String.class) {
-					String input = (String) o;
-					if (Enum.class.isAssignableFrom(resultType)) {
-						return Enum.valueOf((Class<Enum>) resultType, input);
-					}
-					if (resultType == Class.class && loader != null) {
-						return loader.loadClass(input);
-					}
-					if (resultType == Pattern.class) {
-						return Pattern.compile(input);
-					}
+			} else if (actualType == String.class) {
+				String input = (String) o;
+				if (Enum.class.isAssignableFrom(resultType)) {
+					return Enum.valueOf((Class<Enum>) resultType, input);
 				}
+				if (resultType == Class.class && loader != null) {
+					return loader.loadClass(input);
+				}
+				if (resultType == Pattern.class) {
+					return Pattern.compile(input);
+				}
+			}
 
 			try {
 				Constructor< ? > c = resultType.getConstructor(String.class);
@@ -209,85 +175,68 @@
 			catch (Throwable t) {
 				// handled on next line
 			}
-			throw new IllegalArgumentException("No conversion to " + resultType
-					+ " from " + actualType + " value " + o);
+			throw new IllegalArgumentException("No conversion to " + resultType + " from " + actualType + " value " + o);
 		}
 
-		private Object convert(ParameterizedType pType, Object o)
-				throws InstantiationException, IllegalAccessException,
-				Exception {
+		private Object convert(ParameterizedType pType, Object o) throws InstantiationException,
+				IllegalAccessException, Exception {
 			Class< ? > resultType = (Class< ? >) pType.getRawType();
 			if (Collection.class.isAssignableFrom(resultType)) {
 				Collection< ? > input = toCollection(o);
 				if (resultType.isInterface()) {
-					if (resultType == Collection.class
-							|| resultType == List.class)
+					if (resultType == Collection.class || resultType == List.class)
 						resultType = ArrayList.class;
-					else
-						if (resultType == Set.class
-								|| resultType == SortedSet.class)
-							resultType = TreeSet.class;
-						else
-							if (resultType == Queue.class /*
+					else if (resultType == Set.class || resultType == SortedSet.class)
+						resultType = TreeSet.class;
+					else if (resultType == Queue.class /*
 														 * || resultType ==
 														 * Deque.class
 														 */)
-								resultType = LinkedList.class;
-							else
-								if (resultType == Queue.class /*
-															 * || resultType ==
-															 * Deque.class
-															 */)
-									resultType = LinkedList.class;
-								else
-									throw new IllegalArgumentException(
-											"Unknown interface for a collection, no concrete class found: "
-													+ resultType);
+						resultType = LinkedList.class;
+					else if (resultType == Queue.class /*
+														 * || resultType ==
+														 * Deque.class
+														 */)
+						resultType = LinkedList.class;
+					else
+						throw new IllegalArgumentException(
+								"Unknown interface for a collection, no concrete class found: " + resultType);
 				}
 
 				@SuppressWarnings("unchecked")
-				Collection<Object> result = (Collection<Object>) resultType
-						.newInstance();
+				Collection<Object> result = (Collection<Object>) resultType.newInstance();
 				Type componentType = pType.getActualTypeArguments()[0];
 
 				for (Object i : input) {
 					result.add(convert(componentType, i));
 				}
 				return result;
+			} else if (pType.getRawType() == Class.class) {
+				return loader.loadClass(o.toString());
 			}
-			else
-				if (pType.getRawType() == Class.class) {
-					return loader.loadClass(o.toString());
-				}
 			if (Map.class.isAssignableFrom(resultType)) {
 				Map< ? , ? > input = toMap(o);
 				if (resultType.isInterface()) {
 					if (resultType == SortedMap.class)
 						resultType = TreeMap.class;
+					else if (resultType == Map.class)
+						resultType = LinkedHashMap.class;
 					else
-						if (resultType == Map.class)
-							resultType = LinkedHashMap.class;
-						else
-							throw new IllegalArgumentException(
-									"Unknown interface for a collection, no concrete class found: "
-											+ resultType);
+						throw new IllegalArgumentException(
+								"Unknown interface for a collection, no concrete class found: " + resultType);
 				}
 				@SuppressWarnings("unchecked")
-				Map<Object, Object> result = (Map<Object, Object>) resultType
-						.newInstance();
+				Map<Object,Object> result = (Map<Object,Object>) resultType.newInstance();
 				Type keyType = pType.getActualTypeArguments()[0];
 				Type valueType = pType.getActualTypeArguments()[1];
 
 				for (Map.Entry< ? , ? > entry : input.entrySet()) {
-					result.put(convert(keyType, entry.getKey()),
-							convert(valueType, entry.getValue()));
+					result.put(convert(keyType, entry.getKey()), convert(valueType, entry.getValue()));
 				}
 				return result;
 			}
-			throw new IllegalArgumentException(
-					"cannot convert to "
-							+ pType
-							+ " because it uses generics and is not a Collection or a map");
+			throw new IllegalArgumentException("cannot convert to " + pType
+					+ " because it uses generics and is not a Collection or a map");
 		}
 
 		Object convertArray(Type componentType, Object o) throws Exception {
@@ -309,9 +258,8 @@
 			if (type instanceof ParameterizedType)
 				return (Class< ? >) ((ParameterizedType) type).getRawType();
 
-			throw new IllegalArgumentException(
-					"For the raw type, type must be ParamaterizedType or Class but is "
-							+ type);
+			throw new IllegalArgumentException("For the raw type, type must be ParamaterizedType or Class but is "
+					+ type);
 		}
 
 		private Collection< ? > toCollection(Object o) {
@@ -342,8 +290,7 @@
 			if (o instanceof Map)
 				return (Map< ? , ? >) o;
 
-			throw new IllegalArgumentException("Cannot convert " + o
-					+ " to a map as requested");
+			throw new IllegalArgumentException("Cannot convert " + o + " to a map as requested");
 		}
 
 	}
@@ -356,11 +303,10 @@
 			if (c == '$' || c == '_') {
 				if (twice)
 					sb.deleteCharAt(i + 1);
+				else if (c == '$')
+					sb.deleteCharAt(i--); // Remove dollars
 				else
-					if (c == '$')
-						sb.deleteCharAt(i--); // Remove dollars
-					else
-						sb.setCharAt(i, '.'); // Make _ into .
+					sb.setCharAt(i, '.'); // Make _ into .
 			}
 		}
 		return sb.toString();
diff --git a/bundleplugin/src/main/java/aQute/lib/base64/Base64.java b/bundleplugin/src/main/java/aQute/lib/base64/Base64.java
index 151adc4..777ac91 100755
--- a/bundleplugin/src/main/java/aQute/lib/base64/Base64.java
+++ b/bundleplugin/src/main/java/aQute/lib/base64/Base64.java
@@ -28,19 +28,18 @@
 		this.data = data;
 	}
 
-	
-	
 	public final static byte[] decodeBase64(String string) {
-		ByteArrayOutputStream bout= new ByteArrayOutputStream(string.length()*2/3);
+		ByteArrayOutputStream bout = new ByteArrayOutputStream(string.length() * 2 / 3);
 		StringReader rdr = new StringReader(string.trim());
 		try {
-			decode(rdr,bout);
-		} catch (Exception e) {
+			decode(rdr, bout);
+		}
+		catch (Exception e) {
 			// cannot happen
 		}
 		return bout.toByteArray();
 	}
-	
+
 	public final static void decode(Reader rdr, OutputStream out) throws Exception {
 		int register = 0;
 		int i = 0;
@@ -48,22 +47,19 @@
 
 		byte test[] = new byte[3];
 		int c;
-		while ((c=rdr.read()) >= 0) {
+		while ((c = rdr.read()) >= 0) {
 
 			if (c > 0x7F)
-				throw new IllegalArgumentException(
-						"Invalid base64 character in " + rdr
-								+ ", character value > 128 ");
-			
+				throw new IllegalArgumentException("Invalid base64 character in " + rdr + ", character value > 128 ");
+
 			int v = 0;
-			if ( c == '=' ) {
+			if (c == '=') {
 				pads++;
 			} else {
 				v = values[c];
-				if ( v < 0 )
-					throw new IllegalArgumentException(
-							"Invalid base64 character in " + rdr + ", " + c );
-			}					
+				if (v < 0)
+					throw new IllegalArgumentException("Invalid base64 character in " + rdr + ", " + c);
+			}
 			register <<= 6;
 			register |= v;
 			test[2] = (byte) (register & 0xFF);
@@ -82,19 +78,19 @@
 
 	static private void flush(OutputStream out, int register, int pads) throws IOException {
 		switch (pads) {
-		case 0:
-			out.write(0xFF & (register >> 16));
-			out.write(0xFF & (register >> 8));
-			out.write(0xFF & (register >> 0));
-			break;
-			
-		case 1:
-			out.write(0xFF & (register >> 16));
-			out.write(0xFF & (register >> 8));
-			break;
-			
-		case 2:
-			out.write(0xFF & (register >> 16));
+			case 0 :
+				out.write(0xFF & (register >> 16));
+				out.write(0xFF & (register >> 8));
+				out.write(0xFF & (register >> 0));
+				break;
+
+			case 1 :
+				out.write(0xFF & (register >> 16));
+				out.write(0xFF & (register >> 8));
+				break;
+
+			case 2 :
+				out.write(0xFF & (register >> 16));
 		}
 	}
 
@@ -110,24 +106,24 @@
 		StringWriter sw = new StringWriter();
 		ByteArrayInputStream bin = new ByteArrayInputStream(data);
 		try {
-			encode(bin,sw);
-		} catch (IOException e) {
+			encode(bin, sw);
+		}
+		catch (IOException e) {
 			// can't happen
 		}
 		return sw.toString();
 	}
-	
 
 	public Object toData() {
 		return data;
 	}
 
 	public static void encode(InputStream in, Appendable sb) throws IOException {
-		//StringBuilder sb = new StringBuilder();
+		// StringBuilder sb = new StringBuilder();
 		int buf = 0;
 		int bits = 0;
 		int out = 0;
-		
+
 		while (true) {
 			if (bits >= 6) {
 				bits -= 6;
diff --git a/bundleplugin/src/main/java/aQute/lib/codec/Codec.java b/bundleplugin/src/main/java/aQute/lib/codec/Codec.java
index 6de09cf..6072ebd 100644
--- a/bundleplugin/src/main/java/aQute/lib/codec/Codec.java
+++ b/bundleplugin/src/main/java/aQute/lib/codec/Codec.java
@@ -4,6 +4,7 @@
 import java.lang.reflect.*;
 
 public interface Codec {
-	Object decode(Reader in, Type type) throws Exception;	
+	Object decode(Reader in, Type type) throws Exception;
+
 	void encode(Type t, Object o, Appendable out) throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/codec/HCodec.java b/bundleplugin/src/main/java/aQute/lib/codec/HCodec.java
index f97e695..c174e52 100644
--- a/bundleplugin/src/main/java/aQute/lib/codec/HCodec.java
+++ b/bundleplugin/src/main/java/aQute/lib/codec/HCodec.java
@@ -15,7 +15,7 @@
 	}
 
 	public <T> T decode(InputStream in, Class<T> t) throws Exception {
-		return t.cast(decode(in, (Type)t));
+		return t.cast(decode(in, (Type) t));
 	}
 
 	public <T> T decode(Reader in, Class<T> t) throws Exception {
@@ -35,7 +35,8 @@
 		OutputStreamWriter wr = new OutputStreamWriter(out, "UTF-8");
 		try {
 			codec.encode(t, o, wr);
-		} finally {
+		}
+		finally {
 			wr.flush();
 		}
 	}
@@ -46,10 +47,12 @@
 			InputStreamReader rdr = new InputStreamReader(fin, "UTF-8");
 			try {
 				return t.cast(decode(rdr, t));
-			} finally {
+			}
+			finally {
 				rdr.close();
 			}
-		} finally {
+		}
+		finally {
 			fin.close();
 		}
 
@@ -61,10 +64,12 @@
 			Writer wr = new OutputStreamWriter(oout, "UTF-8");
 			try {
 				codec.encode(t, o, wr);
-			} finally {
+			}
+			finally {
 				wr.close();
 			}
-		} finally {
+		}
+		finally {
 			oout.close();
 		}
 	}
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);
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/converter/Converter.java b/bundleplugin/src/main/java/aQute/lib/converter/Converter.java
index 6b5af19..f22f840 100644
--- a/bundleplugin/src/main/java/aQute/lib/converter/Converter.java
+++ b/bundleplugin/src/main/java/aQute/lib/converter/Converter.java
@@ -12,16 +12,17 @@
  * conversion
  * 
  * @author aqute
- * 
  */
-@SuppressWarnings({"unchecked", "rawtypes"})
+@SuppressWarnings({
+		"unchecked", "rawtypes"
+})
 public class Converter {
 	public interface Hook {
 		Object convert(Type dest, Object o) throws Exception;
 	}
 
 	boolean			fatal	= true;
-	Map<Type, Hook>	hooks = new HashMap<Type, Converter.Hook>();
+	Map<Type,Hook>	hooks	= new HashMap<Type,Converter.Hook>();
 
 	public <T> T convert(Class<T> type, Object o) throws Exception {
 		// Is it a compatible type?
@@ -30,18 +31,22 @@
 		return (T) convert((Type) type, o);
 	}
 
+	public <T> T convert(TypeReference<T> type, Object o) throws Exception {
+		return (T) convert( type.getType(), o);
+	}
+	
 	public Object convert(Type type, Object o) throws Exception {
 		if (o == null)
 			return null; // compatible with any
 
 		
 		Hook hook = hooks.get(type);
-		if ( hook != null ) {
+		if (hook != null) {
 			Object value = hook.convert(type, o);
-			if ( value != null)
+			if (value != null)
 				return value;
 		}
-		
+
 		Class resultType = getRawClass(type);
 		Class< ? > actualType = o.getClass();
 
@@ -116,61 +121,47 @@
 				return n.longValue() == 0 ? false : true;
 
 			resultType = Boolean.class;
+		} else if (resultType == byte.class || resultType == Byte.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.byteValue();
+			resultType = Byte.class;
+		} else if (resultType == char.class || resultType == Character.class) {
+			Number n = number(o);
+			if (n != null)
+				return (char) n.shortValue();
+			resultType = Character.class;
+		} else if (resultType == short.class || resultType == Short.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.shortValue();
+
+			resultType = Short.class;
+		} else if (resultType == int.class || resultType == Integer.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.intValue();
+
+			resultType = Integer.class;
+		} else if (resultType == long.class || resultType == Long.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.longValue();
+
+			resultType = Long.class;
+		} else if (resultType == float.class || resultType == Float.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.floatValue();
+
+			resultType = Float.class;
+		} else if (resultType == double.class || resultType == Double.class) {
+			Number n = number(o);
+			if (n != null)
+				return n.doubleValue();
+
+			resultType = Double.class;
 		}
-		else
-			if (resultType == byte.class || resultType == Byte.class) {
-				Number n = number(o);
-				if (n != null)
-					return n.byteValue();
-				resultType = Byte.class;
-			}
-			else
-				if (resultType == char.class || resultType == Character.class) {
-					Number n = number(o);
-					if (n != null)
-						return (char) n.shortValue();
-					resultType = Character.class;
-				}
-				else
-					if (resultType == short.class || resultType == Short.class) {
-						Number n = number(o);
-						if (n != null)
-							return n.shortValue();
-
-						resultType = Short.class;
-					}
-					else
-						if (resultType == int.class || resultType == Integer.class) {
-							Number n = number(o);
-							if (n != null)
-								return n.intValue();
-
-							resultType = Integer.class;
-						}
-						else
-							if (resultType == long.class || resultType == Long.class) {
-								Number n = number(o);
-								if (n != null)
-									return n.longValue();
-
-								resultType = Long.class;
-							}
-							else
-								if (resultType == float.class || resultType == Float.class) {
-									Number n = number(o);
-									if (n != null)
-										return n.floatValue();
-
-									resultType = Float.class;
-								}
-								else
-									if (resultType == double.class || resultType == Double.class) {
-										Number n = number(o);
-										if (n != null)
-											return n.doubleValue();
-
-										resultType = Double.class;
-									}
 
 		assert !resultType.isPrimitive();
 
@@ -193,15 +184,13 @@
 				Constructor< ? > c = resultType.getConstructor(String.class);
 				return c.newInstance(o.toString());
 			}
-			catch (Throwable t) {
-			}
+			catch (Throwable t) {}
 			try {
 				Method m = resultType.getMethod("valueOf", String.class);
 				if (Modifier.isStatic(m.getModifiers()))
 					return m.invoke(null, o.toString());
 			}
-			catch (Throwable t) {
-			}
+			catch (Throwable t) {}
 
 			if (resultType == Character.class && input.length() == 1)
 				return input.charAt(0);
@@ -236,7 +225,7 @@
 
 		if (o instanceof Map) {
 			try {
-				Map<Object, Object> map = (Map) o;
+				Map<Object,Object> map = (Map) o;
 				Object instance = resultType.newInstance();
 				for (Map.Entry e : map.entrySet()) {
 					String key = (String) e.getKey();
@@ -276,35 +265,27 @@
 		return null;
 	}
 
-	private Collection collection(Type collectionType, Class< ? extends Collection> rawClass,
-			Object o) throws Exception {
+	private Collection collection(Type collectionType, Class< ? extends Collection> rawClass, Object o)
+			throws Exception {
 		Collection collection;
 		if (rawClass.isInterface() || Modifier.isAbstract(rawClass.getModifiers())) {
 			if (rawClass.isAssignableFrom(ArrayList.class))
 				collection = new ArrayList();
+			else if (rawClass.isAssignableFrom(HashSet.class))
+				collection = new HashSet();
+			else if (rawClass.isAssignableFrom(TreeSet.class))
+				collection = new TreeSet();
+			else if (rawClass.isAssignableFrom(LinkedList.class))
+				collection = new LinkedList();
+			else if (rawClass.isAssignableFrom(Vector.class))
+				collection = new Vector();
+			else if (rawClass.isAssignableFrom(Stack.class))
+				collection = new Stack();
+			else if (rawClass.isAssignableFrom(ConcurrentLinkedQueue.class))
+				collection = new ConcurrentLinkedQueue();
 			else
-				if (rawClass.isAssignableFrom(HashSet.class))
-					collection = new HashSet();
-				else
-					if (rawClass.isAssignableFrom(TreeSet.class))
-						collection = new TreeSet();
-					else
-						if (rawClass.isAssignableFrom(LinkedList.class))
-							collection = new LinkedList();
-						else
-							if (rawClass.isAssignableFrom(Vector.class))
-								collection = new Vector();
-							else
-								if (rawClass.isAssignableFrom(Stack.class))
-									collection = new Stack();
-								else
-									if (rawClass.isAssignableFrom(ConcurrentLinkedQueue.class))
-										collection = new ConcurrentLinkedQueue();
-									else
-										return (Collection) error("Cannot find a suitable collection for the collection interface "
-												+ rawClass);
-		}
-		else
+				return (Collection) error("Cannot find a suitable collection for the collection interface " + rawClass);
+		} else
 			collection = rawClass.newInstance();
 
 		Type subType = Object.class;
@@ -321,22 +302,18 @@
 		return collection;
 	}
 
-	private Map map(Type mapType, Class< ? extends Map< ? , ? >> rawClass, Object o)
-			throws Exception {
+	private Map map(Type mapType, Class< ? extends Map< ? , ? >> rawClass, Object o) throws Exception {
 		Map result;
 		if (rawClass.isInterface() || Modifier.isAbstract(rawClass.getModifiers())) {
 			if (rawClass.isAssignableFrom(HashMap.class))
 				result = new HashMap();
+			else if (rawClass.isAssignableFrom(TreeMap.class))
+				result = new TreeMap();
+			else if (rawClass.isAssignableFrom(ConcurrentHashMap.class))
+				result = new ConcurrentHashMap();
 			else
-				if (rawClass.isAssignableFrom(TreeMap.class))
-					result = new TreeMap();
-				else
-					if (rawClass.isAssignableFrom(ConcurrentHashMap.class))
-						result = new ConcurrentHashMap();
-					else
-						return (Map) error("Cannot find suitable map for map interface " + rawClass);
-		}
-		else
+				return (Map) error("Cannot find suitable map for map interface " + rawClass);
+		} else
 			result = rawClass.newInstance();
 
 		Map< ? , ? > input = toMap(o);
@@ -439,8 +416,7 @@
 	public void setFatalIsException(boolean b) {
 		fatal = b;
 	}
-	
-	
+
 	public Converter hook(Type type, Hook hook) {
 		this.hooks.put(type, hook);
 		return this;
diff --git a/bundleplugin/src/main/java/aQute/lib/converter/TypeReference.java b/bundleplugin/src/main/java/aQute/lib/converter/TypeReference.java
new file mode 100644
index 0000000..2b52308
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/converter/TypeReference.java
@@ -0,0 +1,10 @@
+package aQute.lib.converter;
+
+import java.lang.reflect.*;
+
+public class TypeReference<T> implements Type {
+
+	public Type getType() {
+		return ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/data/AllowNull.java b/bundleplugin/src/main/java/aQute/lib/data/AllowNull.java
index 2bbf253..0b25300 100644
--- a/bundleplugin/src/main/java/aQute/lib/data/AllowNull.java
+++ b/bundleplugin/src/main/java/aQute/lib/data/AllowNull.java
@@ -3,7 +3,9 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.FIELD})
+@Target(value = {
+	ElementType.FIELD
+})
 public @interface AllowNull {
 	String reason() default "";
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/data/Data.java b/bundleplugin/src/main/java/aQute/lib/data/Data.java
index d790d2e..f44d1a7 100644
--- a/bundleplugin/src/main/java/aQute/lib/data/Data.java
+++ b/bundleplugin/src/main/java/aQute/lib/data/Data.java
@@ -20,7 +20,6 @@
 				if (allowNull == null)
 					formatter.format("Value for %s must not be null\n", f.getName());
 			} else {
-				
 
 				if (patternValidator != null) {
 					Pattern p = Pattern.compile(patternValidator.value());
@@ -28,8 +27,8 @@
 					if (!m.matches()) {
 						String reason = patternValidator.reason();
 						if (reason.length() == 0)
-							formatter.format("Value for %s=%s does not match pattern %s\n",
-									f.getName(), value, patternValidator.value());
+							formatter.format("Value for %s=%s does not match pattern %s\n", f.getName(), value,
+									patternValidator.value());
 						else
 							formatter.format("Value for %s=%s %s\n", f.getName(), value, reason);
 					}
@@ -39,29 +38,31 @@
 					if (o instanceof String) {
 						try {
 							o = Double.parseDouble((String) o);
-						} catch (Exception e) {
+						}
+						catch (Exception e) {
 							formatter.format("Value for %s=%s %s\n", f.getName(), value, "Not a number");
 						}
 					}
-					
+
 					try {
 						Number n = (Number) o;
 						long number = n.longValue();
 						if (number >= numericValidator.min() && number < numericValidator.max()) {
-							formatter.format("Value for %s=%s not in valid range (%s,%s]\n",
-									f.getName(), value, numericValidator.min(), numericValidator.max());
+							formatter.format("Value for %s=%s not in valid range (%s,%s]\n", f.getName(), value,
+									numericValidator.min(), numericValidator.max());
 						}
-					} catch (ClassCastException e) {
+					}
+					catch (ClassCastException e) {
 						formatter.format("Value for %s=%s [%s,%s) is not a number\n", f.getName(), value,
 								numericValidator.min(), numericValidator.max());
 					}
 				}
 			}
 		}
-		if ( sb.length() == 0)
+		if (sb.length() == 0)
 			return null;
-		
-		if ( sb.length() > 0)
+
+		if (sb.length() > 0)
 			sb.delete(sb.length() - 1, sb.length());
 		return sb.toString();
 	}
@@ -69,8 +70,8 @@
 	public static void details(Object data, Appendable out) throws Exception {
 		Field fields[] = data.getClass().getFields();
 		Formatter formatter = new Formatter(out);
-		
-		for ( Field f : fields ) {
+
+		for (Field f : fields) {
 			String name = f.getName();
 			name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
 			formatter.format("%-40s %s\n", name, f.get(data));
diff --git a/bundleplugin/src/main/java/aQute/lib/data/Numeric.java b/bundleplugin/src/main/java/aQute/lib/data/Numeric.java
index 19d60cf..eb1534e 100644
--- a/bundleplugin/src/main/java/aQute/lib/data/Numeric.java
+++ b/bundleplugin/src/main/java/aQute/lib/data/Numeric.java
@@ -3,9 +3,13 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.FIELD})
+@Target(value = {
+	ElementType.FIELD
+})
 public @interface Numeric {
 	long min() default Long.MIN_VALUE;
+
 	long max() default Long.MAX_VALUE;
+
 	String reason() default "";
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/data/Validator.java b/bundleplugin/src/main/java/aQute/lib/data/Validator.java
index e8a8d4f..48324e8 100644
--- a/bundleplugin/src/main/java/aQute/lib/data/Validator.java
+++ b/bundleplugin/src/main/java/aQute/lib/data/Validator.java
@@ -3,8 +3,11 @@
 import java.lang.annotation.*;
 
 @Retention(RetentionPolicy.RUNTIME)
-@Target(value={ElementType.FIELD})
+@Target(value = {
+	ElementType.FIELD
+})
 public @interface Validator {
 	String value();
+
 	String reason() default "";
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java b/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
index 780c32f..cd98036 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
@@ -13,138 +13,137 @@
 
 public class FileInstallRepo extends FileRepo {
 
-	String group;
-	boolean dirty;
-	Reporter reporter;
-	Pattern              REPO_FILE   = Pattern
-    .compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+)\\.(jar|lib)");
-	
-    public void setProperties(Map<String, String> map) {
-    	super.setProperties(map);
-    	group = map.get("group");
-    }
-    public void setReporter(Reporter reporter) {
-    	super.setReporter(reporter);
-        this.reporter = reporter;
-    }
+	String		group;
+	boolean		dirty;
+	Reporter	reporter;
+	Pattern		REPO_FILE	= Pattern.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+)\\.(jar|lib)");
 
-    public File put(Jar jar) throws Exception {
-        dirty = true;
-        Manifest manifest = jar.getManifest();
-        if (manifest == null)
-            throw new IllegalArgumentException("No manifest in JAR: " + jar);
+	public void setProperties(Map<String,String> map) {
+		super.setProperties(map);
+		group = map.get("group");
+	}
 
-        String bsn = manifest.getMainAttributes().getValue(
-                Analyzer.BUNDLE_SYMBOLICNAME);
-        if (bsn == null)
-            throw new IllegalArgumentException("No Bundle SymbolicName set");
+	public void setReporter(Reporter reporter) {
+		super.setReporter(reporter);
+		this.reporter = reporter;
+	}
 
-        Parameters b = Processor.parseHeader(bsn, null);
-        if (b.size() != 1)
-            throw new IllegalArgumentException("Multiple bsn's specified " + b);
+	public File put(Jar jar) throws Exception {
+		dirty = true;
+		Manifest manifest = jar.getManifest();
+		if (manifest == null)
+			throw new IllegalArgumentException("No manifest in JAR: " + jar);
 
-        for (String key : b.keySet()) {
-            bsn = key;
-            if (!Verifier.SYMBOLICNAME.matcher(bsn).matches())
-                throw new IllegalArgumentException(
-                        "Bundle SymbolicName has wrong format: " + bsn);
-        }
+		String bsn = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_SYMBOLICNAME);
+		if (bsn == null)
+			throw new IllegalArgumentException("No Bundle SymbolicName set");
 
-        String versionString = manifest.getMainAttributes().getValue(
-                Analyzer.BUNDLE_VERSION);
-        Version version;
-        if (versionString == null)
-            version = new Version();
-        else
-            version = new Version(versionString);
+		Parameters b = Processor.parseHeader(bsn, null);
+		if (b.size() != 1)
+			throw new IllegalArgumentException("Multiple bsn's specified " + b);
 
-        File dir;
-        if (group == null) {
-        	dir = getRoot();
-        } else {
-        	dir= new File(getRoot(), group);
-        	dir.mkdirs();
-        }
-        String fName = bsn + "-" + version.getMajor() + "."
-                + version.getMinor() + "." + version.getMicro() + ".jar";
-        File file = new File(dir, fName);
+		for (String key : b.keySet()) {
+			bsn = key;
+			if (!Verifier.SYMBOLICNAME.matcher(bsn).matches())
+				throw new IllegalArgumentException("Bundle SymbolicName has wrong format: " + bsn);
+		}
 
-        jar.write(file);
-        fireBundleAdded(jar, file);
+		String versionString = manifest.getMainAttributes().getValue(Analyzer.BUNDLE_VERSION);
+		Version version;
+		if (versionString == null)
+			version = new Version();
+		else
+			version = new Version(versionString);
 
-        file = new File(dir, bsn + "-latest.jar");
-        if (file.isFile() && file.lastModified() < jar.lastModified()) {
-            jar.write(file);
-        }
-        return file;
-    }
-    public boolean refresh() {
-        if ( dirty ) {
-            dirty = false;
-            return true;
-        } else 
-            return false;
-    }
+		File dir;
+		if (group == null) {
+			dir = getRoot();
+		} else {
+			dir = new File(getRoot(), group);
+			dir.mkdirs();
+		}
+		String fName = bsn + "-" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro() + ".jar";
+		File file = new File(dir, fName);
+
+		jar.write(file);
+		fireBundleAdded(jar, file);
+
+		file = new File(dir, bsn + "-latest.jar");
+		if (file.isFile() && file.lastModified() < jar.lastModified()) {
+			jar.write(file);
+		}
+		return file;
+	}
+
+	public boolean refresh() {
+		if (dirty) {
+			dirty = false;
+			return true;
+		} else
+			return false;
+	}
+
 	@Override
 	public List<String> list(String regex) {
-	       Instruction pattern = null;
-	        if (regex != null)
-	            pattern = new Instruction(regex);
+		Instruction pattern = null;
+		if (regex != null)
+			pattern = new Instruction(regex);
 
-	        String list[] = getRoot().list();
-	        List<String> result = new ArrayList<String>();
-	        for (String f : list) {
-                Matcher m = REPO_FILE.matcher(f);
-                if (!m.matches()) {
-                	continue;
-                }
-                String s = m.group(1);
-	            if (pattern == null || pattern.matches(s))
-	                result.add(s);
-	        }
-	        return result;
+		String list[] = getRoot().list();
+		List<String> result = new ArrayList<String>();
+		for (String f : list) {
+			Matcher m = REPO_FILE.matcher(f);
+			if (!m.matches()) {
+				continue;
+			}
+			String s = m.group(1);
+			if (pattern == null || pattern.matches(s))
+				result.add(s);
+		}
+		return result;
 	}
+
 	@Override
 	public File[] get(String bsn, String versionRange) throws MalformedURLException {
-	       // If the version is set to project, we assume it is not
-        // for us. A project repo will then get it.
-        if (versionRange != null && versionRange.equals("project"))
-            return null;
+		// If the version is set to project, we assume it is not
+		// for us. A project repo will then get it.
+		if (versionRange != null && versionRange.equals("project"))
+			return null;
 
-        //
-        // The version range we are looking for can
-        // be null (for all) or a version range.
-        //
-        VersionRange range;
-        if (versionRange == null || versionRange.equals("latest")) {
-            range = new VersionRange("0");
-        } else
-            range = new VersionRange(versionRange);
+		//
+		// The version range we are looking for can
+		// be null (for all) or a version range.
+		//
+		VersionRange range;
+		if (versionRange == null || versionRange.equals("latest")) {
+			range = new VersionRange("0");
+		} else
+			range = new VersionRange(versionRange);
 
-        //
-        // Iterator over all the versions for this BSN.
-        // Create a sorted map over the version as key
-        // and the file as URL as value. Only versions
-        // that match the desired range are included in
-        // this list.
-        //
-        File instances[] = getRoot().listFiles();
-        SortedMap<Version, File> versions = new TreeMap<Version, File>();
-        for (int i = 0; i < instances.length; i++) {
-            Matcher m = REPO_FILE.matcher(instances[i].getName());
-            if (m.matches() && m.group(1).equals(bsn)) {
-                String versionString = m.group(2);
-                Version version;
-                if (versionString.equals("latest"))
-                    version = new Version(Integer.MAX_VALUE);
-                else
-                    version = new Version(versionString);
+		//
+		// Iterator over all the versions for this BSN.
+		// Create a sorted map over the version as key
+		// and the file as URL as value. Only versions
+		// that match the desired range are included in
+		// this list.
+		//
+		File instances[] = getRoot().listFiles();
+		SortedMap<Version,File> versions = new TreeMap<Version,File>();
+		for (int i = 0; i < instances.length; i++) {
+			Matcher m = REPO_FILE.matcher(instances[i].getName());
+			if (m.matches() && m.group(1).equals(bsn)) {
+				String versionString = m.group(2);
+				Version version;
+				if (versionString.equals("latest"))
+					version = new Version(Integer.MAX_VALUE);
+				else
+					version = new Version(versionString);
 
-                if (range.includes(version))
-                    versions.put(version, instances[i]);
-            }
-        }
-        return versions.values().toArray(new File[versions.size()]);
+				if (range.includes(version))
+					versions.put(version, instances[i]);
+			}
+		}
+		return versions.values().toArray(new File[versions.size()]);
 	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
index 8cd39f1..3e79730 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
@@ -17,18 +17,16 @@
 	public final static String	READONLY	= "readonly";
 	public final static String	NAME		= "name";
 
-	File[]					EMPTY_FILES	= new File[0];
-	protected File			root;
-	Registry				registry;
-	boolean					canWrite	= true;
-	Pattern					REPO_FILE	= Pattern
-												.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+|latest)\\.(jar|lib)");
-	Reporter				reporter;
-	boolean					dirty;
-	String					name;
+	File[]						EMPTY_FILES	= new File[0];
+	protected File				root;
+	Registry					registry;
+	boolean						canWrite	= true;
+	Pattern						REPO_FILE	= Pattern.compile("([-a-zA-z0-9_\\.]+)-([0-9\\.]+|latest)\\.(jar|lib)");
+	Reporter					reporter;
+	boolean						dirty;
+	String						name;
 
-	public FileRepo() {
-	}
+	public FileRepo() {}
 
 	public FileRepo(String name, File location, boolean canWrite) {
 		this.name = name;
@@ -40,7 +38,7 @@
 		// for extensions
 	}
 
-	public void setProperties(Map<String, String> map) {
+	public void setProperties(Map<String,String> map) {
 		String location = map.get(LOCATION);
 		if (location == null)
 			throw new IllegalArgumentException("Location must be set on a FileRepo plugin");
@@ -93,7 +91,7 @@
 		// this list.
 		//
 		File instances[] = f.listFiles();
-		SortedMap<Version, File> versions = new TreeMap<Version, File>();
+		SortedMap<Version,File> versions = new TreeMap<Version,File>();
 		for (int i = 0; i < instances.length; i++) {
 			Matcher m = REPO_FILE.matcher(instances[i].getName());
 			if (m.matches() && m.group(1).equals(bsn)) {
@@ -111,7 +109,9 @@
 
 		File[] files = versions.values().toArray(EMPTY_FILES);
 		if ("latest".equals(versionRange) && files.length > 0) {
-			return new File[] { files[files.length - 1] };
+			return new File[] {
+				files[files.length - 1]
+			};
 		}
 		return files;
 	}
@@ -149,8 +149,8 @@
 		else
 			version = new Version(versionString);
 
-		reporter.trace("bsn=%s version=%s",bsn,version);
-		
+		reporter.trace("bsn=%s version=%s", bsn, version);
+
 		File dir = new File(root, bsn);
 		dir.mkdirs();
 		String fName = bsn + "-" + version.getWithoutQualifier() + ".jar";
@@ -178,12 +178,12 @@
 	protected void fireBundleAdded(Jar jar, File file) {
 		if (registry == null)
 			return;
-		List<RepositoryListenerPlugin> listeners = registry
-				.getPlugins(RepositoryListenerPlugin.class);
+		List<RepositoryListenerPlugin> listeners = registry.getPlugins(RepositoryListenerPlugin.class);
 		for (RepositoryListenerPlugin listener : listeners) {
 			try {
 				listener.bundleAdded(this, jar, file);
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				if (reporter != null)
 					reporter.warning("Repository listener threw an unexpected exception: %s", e);
 			}
@@ -275,16 +275,14 @@
 	public Jar get(String bsn, Version v) throws Exception {
 		init();
 		File bsns = new File(root, bsn);
-		File version = new File(bsns, bsn + "-" + v.getMajor() + "." + v.getMinor() + "."
-				+ v.getMicro() + ".jar");
-		if ( version.exists())
+		File version = new File(bsns, bsn + "-" + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + ".jar");
+		if (version.exists())
 			return new Jar(version);
 		else
 			return null;
 	}
 
-	public File get(String bsn, String version, Strategy strategy, Map<String, String> properties)
-			throws Exception {
+	public File get(String bsn, String version, Strategy strategy, Map<String,String> properties) throws Exception {
 		if (version == null)
 			version = "0.0.0";
 
@@ -313,10 +311,10 @@
 
 		if (files.length >= 0) {
 			switch (strategy) {
-			case LOWEST:
-				return files[0];
-			case HIGHEST:
-				return files[files.length - 1];
+				case LOWEST :
+					return files[0];
+				case HIGHEST :
+					return files[files.length - 1];
 			}
 		}
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/lib/filter/Filter.java b/bundleplugin/src/main/java/aQute/lib/filter/Filter.java
index ab75db9..2a7792c 100755
--- a/bundleplugin/src/main/java/aQute/lib/filter/Filter.java
+++ b/bundleplugin/src/main/java/aQute/lib/filter/Filter.java
@@ -51,18 +51,18 @@
 			boolean val;
 
 			switch (tail.charAt(0)) {
-			case '&':
-				val = doAnd();
-				break;
-			case '|':
-				val = doOr();
-				break;
-			case '!':
-				val = doNot();
-				break;
-			default:
-				val = doSimple();
-				break;
+				case '&' :
+					val = doAnd();
+					break;
+				case '|' :
+					val = doOr();
+					break;
+				case '!' :
+					val = doNot();
+					break;
+				default :
+					val = doSimple();
+					break;
 			}
 
 			if (!prefix(")"))
@@ -131,15 +131,15 @@
 			int ix = 0;
 			label: for (; ix < len; ix++) {
 				switch (tail.charAt(ix)) {
-				case '(':
-				case ')':
-				case '<':
-				case '>':
-				case '=':
-				case '~':
-				case '*':
-				case '\\':
-					break label;
+					case '(' :
+					case ')' :
+					case '<' :
+					case '>' :
+					case '=' :
+					case '~' :
+					case '*' :
+					case '\\' :
+						break label;
 				}
 			}
 			String attr = tail.substring(0, ix).toLowerCase();
@@ -156,20 +156,20 @@
 			label: for (; ix < len; ix++) {
 				char c = tail.charAt(ix);
 				switch (c) {
-				case '(':
-				case ')':
-					break label;
-				case '*':
-					sb.append(WILDCARD);
-					break;
-				case '\\':
-					if (ix == len - 1)
+					case '(' :
+					case ')' :
 						break label;
-					sb.append(tail.charAt(++ix));
-					break;
-				default:
-					sb.append(c);
-					break;
+					case '*' :
+						sb.append(WILDCARD);
+						break;
+					case '\\' :
+						if (ix == len - 1)
+							break label;
+						sb.append(tail.charAt(++ix));
+						break;
+					default :
+						sb.append(c);
+						break;
 				}
 			}
 			tail = tail.substring(ix);
@@ -184,7 +184,7 @@
 			if (obj == null)
 				return false;
 			try {
-				Class<?> numClass = obj.getClass();
+				Class< ? > numClass = obj.getClass();
 				if (numClass == String.class) {
 					return compareString((String) obj, op, s);
 				} else if (numClass == Character.class) {
@@ -211,8 +211,8 @@
 					return compareSign(op, new BigInteger(s).compareTo((BigInteger) obj));
 				} else if (numClass == BigDecimal.class) {
 					return compareSign(op, new BigDecimal(s).compareTo((BigDecimal) obj));
-				} else if (obj instanceof Collection<?>) {
-					for (Object x : (Collection<?>) obj)
+				} else if (obj instanceof Collection< ? >) {
+					for (Object x : (Collection< ? >) obj)
 						if (compare(x, op, s))
 							return true;
 				} else if (numClass.isArray()) {
@@ -221,16 +221,16 @@
 						if (compare(Array.get(obj, i), op, s))
 							return true;
 				}
-			} catch (Exception e) {
 			}
+			catch (Exception e) {}
 			return false;
 		}
 	}
 
 	class DictQuery extends Query {
-		private Dictionary<?, ?>	dict;
+		private Dictionary< ? , ? >	dict;
 
-		DictQuery(Dictionary<?, ?> dict) {
+		DictQuery(Dictionary< ? , ? > dict) {
 			this.dict = dict;
 		}
 
@@ -246,18 +246,20 @@
 			throw new IllegalArgumentException("Null query");
 	}
 
-	public boolean match(Dictionary<?, ?> dict) {
+	public boolean match(Dictionary< ? , ? > dict) {
 		try {
 			return new DictQuery(dict).match();
-		} catch (IllegalArgumentException e) {
+		}
+		catch (IllegalArgumentException e) {
 			return false;
 		}
 	}
 
 	public String verify() {
 		try {
-			new DictQuery(new Hashtable<Object, Object>()).match();
-		} catch (IllegalArgumentException e) {
+			new DictQuery(new Hashtable<Object,Object>()).match();
+		}
+		catch (IllegalArgumentException e) {
 			return e.getMessage();
 		}
 		return null;
@@ -277,25 +279,25 @@
 
 	boolean compareString(String s1, int op, String s2) {
 		switch (op) {
-		case EQ:
-			return patSubstr(s1, s2);
-		case APPROX:
-			return fixupString(s2).equals(fixupString(s1));
-		default:
-			return compareSign(op, s2.compareTo(s1));
+			case EQ :
+				return patSubstr(s1, s2);
+			case APPROX :
+				return fixupString(s2).equals(fixupString(s1));
+			default :
+				return compareSign(op, s2.compareTo(s1));
 		}
 	}
 
 	boolean compareSign(int op, int cmp) {
 		switch (op) {
-		case LE:
-			return cmp >= 0;
-		case GE:
-			return cmp <= 0;
-		case EQ:
-			return cmp == 0;
-		default: /* APPROX */
-			return cmp == 0;
+			case LE :
+				return cmp >= 0;
+			case GE :
+				return cmp <= 0;
+			case EQ :
+				return cmp == 0;
+			default : /* APPROX */
+				return cmp == 0;
 		}
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
index f95b6c4..a5185e4 100644
--- a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
+++ b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
@@ -17,16 +17,18 @@
  * parameter of Options type. Usually this is an interface that extends Options.
  * The methods on this interface are options or flags (when they return
  * boolean).
- * 
  */
-@SuppressWarnings("unchecked") public class CommandLine {
-	static int		LINELENGTH	= 60;
-	static Pattern	ASSIGNMENT	= Pattern.compile("(\\w[\\w\\d]*+)\\s*=\\s*([^\\s]+)\\s*");
-	Reporter		reporter;
-	Justif			justif = new Justif(60);
-	
+@SuppressWarnings("unchecked")
+public class CommandLine {
+	static int			LINELENGTH	= 60;
+	static Pattern		ASSIGNMENT	= Pattern.compile("(\\w[\\w\\d]*+)\\s*=\\s*([^\\s]+)\\s*");
+	Reporter			reporter;
+	Justif				justif		= new Justif(60);
+	CommandLineMessages	msg;
+
 	public CommandLine(Reporter reporter) {
 		this.reporter = reporter;
+		msg = ReporterMessages.base(reporter, CommandLineMessages.class);
 	}
 
 	/**
@@ -56,11 +58,11 @@
 		//
 
 		List<String> arguments = new ArrayList<String>(input);
-		Map<String, Method> commands = getCommands(target);
+		Map<String,Method> commands = getCommands(target);
 
 		Method m = commands.get(cmd);
 		if (m == null) {
-			reporter.error("No such command %s\n", cmd);
+			msg.NoSuchCommand_(cmd);
 			return help(target, null, null);
 		}
 
@@ -68,7 +70,7 @@
 		// Parse the options
 		//
 
-		Class<? extends Options> optionClass = (Class<? extends Options>) m.getParameterTypes()[0];
+		Class< ? extends Options> optionClass = (Class< ? extends Options>) m.getParameterTypes()[0];
 		Options options = getOptions(optionClass, arguments);
 		if (options == null) {
 			// had some error, already reported
@@ -85,7 +87,7 @@
 			// Check for commands without any arguments
 
 			if (patterns.length == 0 && arguments.size() > 0) {
-				reporter.error("This command takes no arguments but found %s\n", arguments);
+				msg.TooManyArguments_(arguments);
 				return help(target, cmd, null);
 			}
 
@@ -108,7 +110,7 @@
 
 				if (i > arguments.size()) {
 					if (!optional)
-						reporter.error("Missing argument %s\n", patterns[i]);
+						msg.MissingArgument_(patterns[i]);
 					return help(target, cmd, optionClass);
 				}
 			}
@@ -116,8 +118,7 @@
 			// Check if we have unconsumed arguments left
 
 			if (i < arguments.size()) {
-				reporter.error("Too many arguments specified %s, expecting %s\n", arguments,
-						Arrays.asList(patterns));
+				msg.TooManyArguments_(arguments);
 				return help(target, cmd, optionClass);
 			}
 		}
@@ -129,7 +130,7 @@
 		return help(target, cmd, optionClass);
 	}
 
-	private String help(Object target, String cmd, Class<? extends Options> type) throws Exception {
+	private String help(Object target, String cmd, Class< ? extends Options> type) throws Exception {
 		StringBuilder sb = new StringBuilder();
 		Formatter f = new Formatter(sb);
 		if (cmd == null)
@@ -148,13 +149,11 @@
 	 * Parse the options in a command line and return an interface that provides
 	 * the options from this command line. This will parse up to (and including)
 	 * -- or an argument that does not start with -
-	 * 
 	 */
-	public <T extends Options> T getOptions(Class<T> specification, List<String> arguments)
-			throws Exception {
-		Map<String, String> properties = Create.map();
-		Map<String, Object> values = new HashMap<String, Object>();
-		Map<String, Method> options = getOptions(specification);
+	public <T extends Options> T getOptions(Class<T> specification, List<String> arguments) throws Exception {
+		Map<String,String> properties = Create.map();
+		Map<String,Object> values = new HashMap<String,Object>();
+		Map<String,Method> options = getOptions(specification);
 
 		argloop: while (arguments.size() > 0) {
 
@@ -173,7 +172,7 @@
 					String name = option.substring(2);
 					Method m = options.get(name);
 					if (m == null)
-						reporter.error("Unrecognized option %s\n", name);
+						msg.UnrecognizedOption_(name);
 					else
 						assignOptionValue(values, m, arguments, true);
 
@@ -185,15 +184,14 @@
 
 						char optionChar = option.charAt(j);
 
-						for (Entry<String, Method> entry : options.entrySet()) {
+						for (Entry<String,Method> entry : options.entrySet()) {
 							if (entry.getKey().charAt(0) == optionChar) {
 								boolean last = (j + 1) >= option.length();
-								assignOptionValue(values, entry.getValue(),
-										arguments, last);
+								assignOptionValue(values, entry.getValue(), arguments, last);
 								continue charloop;
 							}
 						}
-						reporter.error("No such option -%s\n", optionChar);
+						msg.UnrecognizedOption_(optionChar + "");
 					}
 				}
 			} else {
@@ -207,11 +205,11 @@
 
 		// check if all required elements are set
 
-		for (Entry<String, Method> entry : options.entrySet()) {
+		for (Entry<String,Method> entry : options.entrySet()) {
 			Method m = entry.getValue();
 			String name = entry.getKey();
 			if (!values.containsKey(name) && isMandatory(m))
-				reporter.error("Required option --%s not set", name);
+				msg.OptionNotSet_(name);
 		}
 
 		values.put(".", arguments);
@@ -223,8 +221,8 @@
 	/**
 	 * Answer a list of the options specified in an options interface
 	 */
-	private Map<String, Method> getOptions(Class<? extends Options> interf) {
-		Map<String, Method> map = new TreeMap<String, Method>();
+	private Map<String,Method> getOptions(Class< ? extends Options> interf) {
+		Map<String,Method> map = new TreeMap<String,Method>();
 
 		for (Method m : interf.getMethods()) {
 			if (m.getName().startsWith("_"))
@@ -259,8 +257,7 @@
 	 *            if this is the last in a multi single character option
 	 * @return
 	 */
-	public void assignOptionValue(Map<String, Object> options, Method m, List<String> args,
-			boolean last) {
+	public void assignOptionValue(Map<String,Object> options, Method m, List<String> args, boolean last) {
 		String name = m.getName();
 		Type type = m.getGenericReturnType();
 
@@ -274,15 +271,12 @@
 			// The option is followed by an argument
 
 			if (!last) {
-				reporter.error(
-						"Option --%s not last in a set of 1-letter options (%s) but it requires an argument of type ",
-						name, name.charAt(0), getTypeDescriptor(type));
+				msg.Option__WithArgumentNotLastInAvvreviation_(name, name.charAt(0), getTypeDescriptor(type));
 				return;
 			}
 
 			if (args.isEmpty()) {
-				reporter.error("Missing argument %s for option --%s, -%s ",
-						getTypeDescriptor(type), name, name.charAt(0));
+				msg.MissingArgument__(name, name.charAt(0));
 				return;
 			}
 
@@ -301,7 +295,7 @@
 			} else {
 
 				if (options.containsKey(name)) {
-					reporter.error("The option %s can only occur once", name);
+					msg.OptionCanOnlyOccurOnce_(name);
 					return;
 				}
 
@@ -314,10 +308,10 @@
 	 * Provide a help text.
 	 */
 
-	public void help(Formatter f, Object target, String cmd, Class<? extends Options> specification) {
+	public void help(Formatter f, Object target, String cmd, Class< ? extends Options> specification) {
 		Description descr = specification.getAnnotation(Description.class);
 		Arguments patterns = specification.getAnnotation(Arguments.class);
-		Map<String, Method> options = getOptions(specification);
+		Map<String,Method> options = getOptions(specification);
 
 		String description = descr == null ? "" : descr.value();
 
@@ -339,7 +333,7 @@
 		}
 
 		f.format("OPTIONS\n");
-		for (Entry<String, Method> entry : options.entrySet()) {
+		for (Entry<String,Method> entry : options.entrySet()) {
 			String optionName = entry.getKey();
 			Method m = entry.getValue();
 
@@ -347,8 +341,7 @@
 			Description d = m.getAnnotation(Description.class);
 			boolean required = isMandatory(m);
 
-			String methodDescription = cfg != null ? cfg.description() : (d == null ? "" : d
-					.value());
+			String methodDescription = cfg != null ? cfg.description() : (d == null ? "" : d.value());
 
 			f.format("   %s -%s, --%s %s%s - %s\n", required ? " " : "[", //
 					optionName.charAt(0), //
@@ -398,7 +391,7 @@
 		if (m == null)
 			f.format("No such command: %s\n", cmd);
 		else {
-			Class<? extends Options> options = (Class<? extends Options>) m.getParameterTypes()[0];
+			Class< ? extends Options> options = (Class< ? extends Options>) m.getParameterTypes()[0];
 			help(f, target, cmd, options);
 		}
 	}
@@ -409,13 +402,13 @@
 	 * @param target
 	 * @return
 	 */
-	public Map<String, Method> getCommands(Object target) {
-		Map<String, Method> map = new TreeMap<String, Method>();
+	public Map<String,Method> getCommands(Object target) {
+		Map<String,Method> map = new TreeMap<String,Method>();
 
 		for (Method m : target.getClass().getMethods()) {
 
 			if (m.getParameterTypes().length == 1 && m.getName().startsWith("_")) {
-				Class<?> clazz = m.getParameterTypes()[0];
+				Class< ? > clazz = m.getParameterTypes()[0];
 				if (Options.class.isAssignableFrom(clazz)) {
 					String name = m.getName().substring(1);
 					map.put(name, m);
@@ -453,7 +446,7 @@
 			ParameterizedType pt = (ParameterizedType) type;
 			Type c = pt.getRawType();
 			if (c instanceof Class) {
-				if (Collection.class.isAssignableFrom((Class<?>) c)) {
+				if (Collection.class.isAssignableFrom((Class< ? >) c)) {
 					return getTypeDescriptor(pt.getActualTypeArguments()[0]) + "*";
 				}
 			}
@@ -461,7 +454,7 @@
 		if (!(type instanceof Class))
 			return "<>";
 
-		Class<?> clazz = (Class<?>) type;
+		Class< ? > clazz = (Class< ? >) type;
 
 		if (clazz == Boolean.class || clazz == boolean.class)
 			return ""; // Is a flag
diff --git a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLineMessages.java b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLineMessages.java
new file mode 100644
index 0000000..afeb0b9
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLineMessages.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package aQute.lib.getopt;
+
+import java.util.*;
+
+import aQute.libg.reporter.*;
+
+public interface CommandLineMessages extends Messages {
+
+	ERROR Option__WithArgumentNotLastInAvvreviation_(String name, char charAt, String typeDescriptor);
+
+	ERROR MissingArgument__(String name, char charAt);
+
+	ERROR OptionCanOnlyOccurOnce_(String name);
+
+	ERROR NoSuchCommand_(String cmd);
+
+	ERROR TooManyArguments_(List<String> arguments);
+
+	ERROR MissingArgument_(String string);
+
+	ERROR UnrecognizedOption_(String name);
+
+	ERROR OptionNotSet_(String name);
+
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/getopt/Options.java b/bundleplugin/src/main/java/aQute/lib/getopt/Options.java
index aab2b7f..ff2b168 100644
--- a/bundleplugin/src/main/java/aQute/lib/getopt/Options.java
+++ b/bundleplugin/src/main/java/aQute/lib/getopt/Options.java
@@ -4,8 +4,12 @@
 
 public interface Options {
 	List<String> _();
+
 	CommandLine _command();
+
 	Map<String,String> _properties();
+
 	boolean _ok();
+
 	boolean _help();
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/hex/Hex.java b/bundleplugin/src/main/java/aQute/lib/hex/Hex.java
index 3c7fa4a..ffceded 100755
--- a/bundleplugin/src/main/java/aQute/lib/hex/Hex.java
+++ b/bundleplugin/src/main/java/aQute/lib/hex/Hex.java
@@ -2,59 +2,61 @@
 
 import java.io.*;
 
-
 /*
  * Hex converter.
  * 
  * TODO Implement string to byte[]
  */
 public class Hex {
-	final static char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+	final static char[]	HEX	= {
+			'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
+							};
+
 	public final static byte[] toByteArray(String string) {
 		string = string.trim();
-		if ( (string.length() & 1) != 0)
+		if ((string.length() & 1) != 0)
 			throw new IllegalArgumentException("a hex string must have an even length");
 
-		byte[]out = new byte[ string.length()/2];
-		for ( int i=0; i < out.length; i++) {
-			int high = nibble(string.charAt(i*2))<<4;
-			int low = nibble(string.charAt(i*2+1));
+		byte[] out = new byte[string.length() / 2];
+		for (int i = 0; i < out.length; i++) {
+			int high = nibble(string.charAt(i * 2)) << 4;
+			int low = nibble(string.charAt(i * 2 + 1));
 			out[i] = (byte) (high + low);
 		}
 		return out;
 	}
 
-	
-	public final static int nibble( char c) {
+	public final static int nibble(char c) {
 		if (c >= '0' && c <= '9')
 			return c - '0';
-		
-		if ( c>='A' && c<='F')
+
+		if (c >= 'A' && c <= 'F')
 			return c - 'A' + 10;
-		if ( c>='a' && c<='f')
+		if (c >= 'a' && c <= 'f')
 			return c - 'a' + 10;
-		
+
 		throw new IllegalArgumentException("Not a hex digit: " + c);
 	}
-	
+
 	public final static String toHexString(byte data[]) {
 		StringBuilder sb = new StringBuilder();
 		try {
-			append(sb,data);
-		} catch (IOException e) {
+			append(sb, data);
+		}
+		catch (IOException e) {
 			// cannot happen with sb
 		}
 		return sb.toString();
 	}
-	
-	public final static void append( Appendable sb, byte [] data ) throws IOException {
-		for ( int i =0; i<data.length; i++) {
-			sb.append( nibble( data[i] >> 4));
-			sb.append( nibble( data[i]));
+
+	public final static void append(Appendable sb, byte[] data) throws IOException {
+		for (int i = 0; i < data.length; i++) {
+			sb.append(nibble(data[i] >> 4));
+			sb.append(nibble(data[i]));
 		}
 	}
 
-	private final static char nibble(int i) {	
+	private final static char nibble(int i) {
 		return HEX[i & 0xF];
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/index/Index.java b/bundleplugin/src/main/java/aQute/lib/index/Index.java
index 4414f9d..da19f68 100644
--- a/bundleplugin/src/main/java/aQute/lib/index/Index.java
+++ b/bundleplugin/src/main/java/aQute/lib/index/Index.java
@@ -12,8 +12,6 @@
  *   123 -> 123, 244   -> 2
  *   245 -> 245, ...
  * </pre>
- * 
- * 
  */
 public class Index implements Iterable<byte[]> {
 	final static int					LEAF		= 0;
@@ -29,7 +27,7 @@
 	final int							valueSize	= 8;
 	final int							capacity;
 	public Page							root;
-	final LinkedHashMap<Integer, Page>	cache		= new LinkedHashMap<Integer, Index.Page>();
+	final LinkedHashMap<Integer,Page>	cache		= new LinkedHashMap<Integer,Index.Page>();
 	final MappedByteBuffer				settings;
 
 	private int							nextPage;
@@ -81,7 +79,8 @@
 							i = getPage(c).iterator();
 						}
 						return i.hasNext();
-					} catch (IOException e) {
+					}
+					catch (IOException e) {
 						throw new RuntimeException(e);
 					}
 
@@ -246,7 +245,8 @@
 			StringBuilder sb = new StringBuilder();
 			try {
 				toString(sb, "");
-			} catch (IOException e) {
+			}
+			catch (IOException e) {
 				e.printStackTrace();
 			}
 			return sb.toString();
@@ -254,8 +254,8 @@
 
 		public void toString(StringBuilder sb, String indent) throws IOException {
 			for (int i = 0; i < n; i++) {
-				sb.append(String.format("%s %02d:%02d %20s %s %d\n", indent, number, i,
-						hex(k(i), 0, 4), leaf ? "==" : "->", c(i)));
+				sb.append(String.format("%s %02d:%02d %20s %s %d\n", indent, number, i, hex(k(i), 0, 4), leaf ? "=="
+						: "->", c(i)));
 				if (!leaf) {
 					long c = c(i);
 					Page sub = getPage((int) c);
@@ -303,8 +303,8 @@
 
 			this.keySize = settings.getInt(KEYSIZE);
 			if (keySize != 0 && this.keySize != keySize)
-				throw new IllegalStateException("Invalid key size for Index file. The file is "
-						+ this.keySize + " and was expected to be " + this.keySize);
+				throw new IllegalStateException("Invalid key size for Index file. The file is " + this.keySize
+						+ " and was expected to be " + this.keySize);
 
 			root = getPage(1);
 			nextPage = (int) (this.file.size() / pageSize);
diff --git a/bundleplugin/src/main/java/aQute/lib/io/IO.java b/bundleplugin/src/main/java/aQute/lib/io/IO.java
index 3d4458e..183d92a 100644
--- a/bundleplugin/src/main/java/aQute/lib/io/IO.java
+++ b/bundleplugin/src/main/java/aQute/lib/io/IO.java
@@ -16,7 +16,8 @@
 				w.write(buffer, 0, size);
 				size = r.read(buffer);
 			}
-		} finally {
+		}
+		finally {
 			r.close();
 			w.flush();
 		}
@@ -26,19 +27,20 @@
 		copy(r, w, "UTF-8");
 	}
 
-	public static void copy(byte []r, Writer w) throws IOException {
-		copy( new ByteArrayInputStream(r), w, "UTF-8");
+	public static void copy(byte[] r, Writer w) throws IOException {
+		copy(new ByteArrayInputStream(r), w, "UTF-8");
 	}
 
-	public static void copy(byte []r, OutputStream w) throws IOException {
-		copy( new ByteArrayInputStream(r), w);
+	public static void copy(byte[] r, OutputStream w) throws IOException {
+		copy(new ByteArrayInputStream(r), w);
 	}
 
 	public static void copy(InputStream r, Writer w, String charset) throws IOException {
 		try {
 			InputStreamReader isr = new InputStreamReader(r, charset);
 			copy(isr, w);
-		} finally {
+		}
+		finally {
 			r.close();
 		}
 	}
@@ -51,7 +53,8 @@
 		try {
 			OutputStreamWriter osw = new OutputStreamWriter(o, charset);
 			copy(r, osw);
-		} finally {
+		}
+		finally {
 			r.close();
 		}
 	}
@@ -70,7 +73,8 @@
 				out.write(buffer, 0, size);
 				size = in.read(buffer);
 			}
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -83,7 +87,8 @@
 				bb.put(buffer, 0, size);
 				size = in.read(buffer);
 			}
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -100,7 +105,6 @@
 		copy(in.getInputStream(), md);
 	}
 
-
 	public static void copy(InputStream in, MessageDigest md) throws IOException {
 		byte[] buffer = new byte[10000];
 		try {
@@ -109,7 +113,8 @@
 				md.update(buffer, 0, size);
 				size = in.read(buffer);
 			}
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -142,14 +147,14 @@
 			FileOutputStream out = new FileOutputStream(b);
 			try {
 				copy(new FileInputStream(a), out);
-			} finally {
+			}
+			finally {
 				out.close();
 			}
 		} else if (a.isDirectory()) {
 			b.mkdirs();
 			if (!b.isDirectory())
-				throw new IllegalArgumentException(
-						"target directory for a directory must be a directory: " + b);
+				throw new IllegalArgumentException("target directory for a directory must be a directory: " + b);
 			File subs[] = a.listFiles();
 			for (File sub : subs) {
 				copy(sub, new File(b, sub.getName()));
@@ -162,7 +167,8 @@
 		FileOutputStream out = new FileOutputStream(b);
 		try {
 			copy(a, out);
-		} finally {
+		}
+		finally {
 			out.close();
 		}
 	}
@@ -216,6 +222,10 @@
 		return sw.toString();
 	}
 
+	public static File getFile(String filename) {
+		return new File(filename.replace("/", File.separator));
+	}
+	
 	public static File getFile(File base, String file) {
 		File f = new File(file);
 		if (f.isAbsolute())
@@ -236,20 +246,63 @@
 		return new File(f, file).getAbsoluteFile();
 	}
 
+	/** Deletes the specified file.
+	 * Folders are recursively deleted.<br>
+	 * If file(s) cannot be deleted, no feedback is provided (fail silently).
+	 * @param f file to be deleted
+	 */
 	public static void delete(File f) {
+		try {
+			deleteWithException(f);
+		} catch (IOException e) {
+			// Ignore a failed delete
+		}
+	}
+	
+	/** Deletes the specified file.
+	 * Folders are recursively deleted.<br>
+	 * Throws exception if any of the files could not be deleted.
+	 * @param f file to be deleted
+	 * @throws IOException if the file (or contents of a folder) could not be deleted
+	 */
+	public static void deleteWithException(File f) throws IOException {
 		f = f.getAbsoluteFile();
+		if (!f.exists()) return;
 		if (f.getParentFile() == null)
 			throw new IllegalArgumentException("Cannot recursively delete root for safety reasons");
 
+		boolean wasDeleted = true;
 		if (f.isDirectory()) {
 			File[] subs = f.listFiles();
-			for (File sub : subs)
-				delete(sub);
+			for (File sub : subs) {
+				try {
+					deleteWithException(sub);
+				} catch (IOException e) {
+					wasDeleted = false;
+				}
+			}
 		}
 
-		f.delete();
+		boolean fDeleted = f.delete();
+		if (!fDeleted || !wasDeleted) {
+			throw new IOException("Failed to delete " + f.getAbsoluteFile());
+		}
 	}
 
+    /** Deletes <code>to</code> file if it exists, and renames <code>from</code> file to <code>to</code>.<br>
+     * Throws exception the rename operation fails.
+     * @param from source file
+     * @param to destination file
+     * @throws IOException if the rename operation fails
+     */
+    public static void rename(File from, File to) throws IOException {
+    	IO.deleteWithException(to);
+    	
+    	boolean renamed = from.renameTo(to);
+    	if (!renamed) throw new IOException("Could not rename " + from.getAbsoluteFile() + " to " + to.getAbsoluteFile());
+    }
+
+
 	public static long drain(InputStream in) throws IOException {
 		long result = 0;
 		byte[] buffer = new byte[10000];
@@ -259,14 +312,15 @@
 				result += size;
 				size = in.read(buffer);
 			}
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 		return result;
 	}
 
-	public void copy(Collection<?> c, OutputStream out) throws IOException {
-		Writer w = new OutputStreamWriter(out,"UTF-8");
+	public void copy(Collection< ? > c, OutputStream out) throws IOException {
+		Writer w = new OutputStreamWriter(out, "UTF-8");
 		PrintWriter ps = new PrintWriter(w);
 		for (Object o : c) {
 			ps.println(o);
@@ -276,13 +330,14 @@
 	}
 
 	public static Throwable close(Closeable in) {
-		if ( in == null)
+		if (in == null)
 			return null;
-		
+
 		try {
 			in.close();
 			return null;
-		} catch (Throwable e) {
+		}
+		catch (Throwable e) {
 			return e;
 		}
 	}
@@ -304,18 +359,18 @@
 		FileOutputStream fout = new FileOutputStream(out);
 		try {
 			store(o, fout, encoding);
-		} finally {
+		}
+		finally {
 			fout.close();
 		}
 	}
 
-	public static void store(Object o, OutputStream fout) throws UnsupportedEncodingException,
-			IOException {
+	public static void store(Object o, OutputStream fout) throws UnsupportedEncodingException, IOException {
 		store(o, fout, "UTF-8");
 	}
 
-	public static void store(Object o, OutputStream fout, String encoding)
-			throws UnsupportedEncodingException, IOException {
+	public static void store(Object o, OutputStream fout, String encoding) throws UnsupportedEncodingException,
+			IOException {
 		String s;
 
 		if (o == null)
@@ -325,7 +380,8 @@
 
 		try {
 			fout.write(s.getBytes(encoding));
-		} finally {
+		}
+		finally {
 			fout.close();
 		}
 	}
@@ -333,7 +389,8 @@
 	public static InputStream stream(String s) {
 		try {
 			return new ByteArrayInputStream(s.getBytes("UTF-8"));
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// Ignore
 			return null;
 		}
@@ -355,33 +412,34 @@
 		return new StringReader(s);
 	}
 
-
 	public static BufferedReader reader(File f, String encoding) throws IOException {
-		return reader( new FileInputStream(f), encoding);
+		return reader(new FileInputStream(f), encoding);
 	}
-	
+
 	public static BufferedReader reader(File f) throws IOException {
-		return reader(f,"UTF-8");
+		return reader(f, "UTF-8");
 	}
-	
+
 	public static PrintWriter writer(File f, String encoding) throws IOException {
-		return writer( new FileOutputStream(f),encoding);
+		return writer(new FileOutputStream(f), encoding);
 	}
-	
+
 	public static PrintWriter writer(File f) throws IOException {
 		return writer(f, "UTF-8");
 	}
-	
+
 	public static PrintWriter writer(OutputStream out, String encoding) throws IOException {
-		return new PrintWriter( new OutputStreamWriter( out,encoding));
+		return new PrintWriter(new OutputStreamWriter(out, encoding));
 	}
+
 	public static BufferedReader reader(InputStream in, String encoding) throws IOException {
-		return new BufferedReader( new InputStreamReader(in, encoding));
+		return new BufferedReader(new InputStreamReader(in, encoding));
 	}
-	
+
 	public static BufferedReader reader(InputStream in) throws IOException {
 		return reader(in, "UTF-8");
 	}
+
 	public static PrintWriter writer(OutputStream out) throws IOException {
 		return writer(out, "UTF-8");
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/io/LimitedInputStream.java b/bundleplugin/src/main/java/aQute/lib/io/LimitedInputStream.java
index bf9a21f..b48ce5e 100644
--- a/bundleplugin/src/main/java/aQute/lib/io/LimitedInputStream.java
+++ b/bundleplugin/src/main/java/aQute/lib/io/LimitedInputStream.java
@@ -14,7 +14,8 @@
 		this.size = size;
 	}
 
-	@Override public int read() throws IOException {
+	@Override
+	public int read() throws IOException {
 		if (left <= 0) {
 			eof();
 			return -1;
@@ -24,27 +25,31 @@
 		return in.read();
 	}
 
-	@Override public int available() throws IOException {		
+	@Override
+	public int available() throws IOException {
 		return Math.min(left, in.available());
 	}
 
-	@Override public void close() throws IOException {
+	@Override
+	public void close() throws IOException {
 		eof();
 		in.close();
 	}
 
-	protected void eof() {
-	}
+	protected void eof() {}
 
-	@Override public synchronized void mark(int readlimit) {
+	@Override
+	public synchronized void mark(int readlimit) {
 		throw new UnsupportedOperationException();
 	}
 
-	@Override public boolean markSupported() {
+	@Override
+	public boolean markSupported() {
 		return false;
 	}
 
-	@Override public int read(byte[] b, int off, int len) throws IOException {
+	@Override
+	public int read(byte[] b, int off, int len) throws IOException {
 		int min = Math.min(len, left);
 		if (min == 0)
 			return 0;
@@ -55,23 +60,26 @@
 		return read;
 	}
 
-	@Override public int read(byte[] b) throws IOException {
-		return read(b,0,b.length);
+	@Override
+	public int read(byte[] b) throws IOException {
+		return read(b, 0, b.length);
 	}
 
-	@Override public synchronized void reset() throws IOException {
+	@Override
+	public synchronized void reset() throws IOException {
 		throw new UnsupportedOperationException();
 	}
 
-	@Override public long skip(long n) throws IOException {
+	@Override
+	public long skip(long n) throws IOException {
 		long count = 0;
 		byte buffer[] = new byte[1024];
-		while ( n > 0 && read() >= 0) {
+		while (n > 0 && read() >= 0) {
 			int size = read(buffer);
-			if ( size <= 0)
+			if (size <= 0)
 				return count;
-			count+=size;
-			n-=size;
+			count += size;
+			n -= size;
 		}
 		return count;
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java b/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
index 62af4a7..1eb83ac 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
@@ -12,8 +12,7 @@
 	}
 
 	@Override
-	void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		app.append("[");
 		String del = "";
 		int l = Array.getLength(object);
@@ -29,8 +28,7 @@
 	Object decodeArray(Decoder r) throws Exception {
 		ArrayList<Object> list = new ArrayList<Object>();
 		r.codec.parseArray(list, componentType, r);
-		Object array = Array.newInstance(r.codec.getRawClass(componentType),
-				list.size());
+		Object array = Array.newInstance(r.codec.getRawClass(componentType), list.size());
 		int n = 0;
 		for (Object o : list)
 			Array.set(array, n++, o);
diff --git a/bundleplugin/src/main/java/aQute/lib/json/BooleanHandler.java b/bundleplugin/src/main/java/aQute/lib/json/BooleanHandler.java
index d3b56ea..5dd4990 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/BooleanHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/BooleanHandler.java
@@ -6,24 +6,28 @@
 
 public class BooleanHandler extends Handler {
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
-		app.append( object.toString());
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
+		app.append(object.toString());
 	}
-	
-	@Override Object decode(boolean s) {
+
+	@Override
+	Object decode(boolean s) {
 		return s;
 	}
 
-	@Override Object decode(String s) {
+	@Override
+	Object decode(String s) {
 		return Boolean.parseBoolean(s);
 	}
 
-	@Override Object decode(Number s) {
+	@Override
+	Object decode(Number s) {
 		return s.intValue() != 0;
 	}
 
-	@Override Object decode() {
+	@Override
+	Object decode() {
 		return false;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/ByteArrayHandler.java b/bundleplugin/src/main/java/aQute/lib/json/ByteArrayHandler.java
index 65f5f74..d956a6c 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/ByteArrayHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/ByteArrayHandler.java
@@ -8,12 +8,13 @@
 
 public class ByteArrayHandler extends Handler {
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		StringHandler.string(app, Base64.encodeBase64((byte[]) object));
 	}
 
-	@Override Object decodeArray(Decoder r) throws Exception {
+	@Override
+	Object decodeArray(Decoder r) throws Exception {
 		ByteArrayOutputStream out = new ByteArrayOutputStream();
 
 		ArrayList<Object> list = new ArrayList<Object>();
@@ -24,7 +25,8 @@
 		return out.toByteArray();
 	}
 
-	@Override Object decode(String s) throws Exception {
+	@Override
+	Object decode(String s) throws Exception {
 		return Base64.decodeBase64(s);
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java b/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
index 7009e0c..3d00cdc 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
@@ -5,26 +5,30 @@
 
 public class CharacterHandler extends Handler {
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws Exception {	
-		Character c  = (Character) object;
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws Exception {
+		Character c = (Character) object;
 		int v = (int) c.charValue();
-		app.append( v+"" );
+		app.append(v + "");
 	}
-	
-	@Override Object decode(boolean s) {
+
+	@Override
+	Object decode(boolean s) {
 		return s ? 't' : 'f';
 	}
 
-	@Override Object decode(String s) {
+	@Override
+	Object decode(String s) {
 		return (char) Integer.parseInt(s);
 	}
 
-	@Override Object decode(Number s) {
+	@Override
+	Object decode(Number s) {
 		return (char) s.shortValue();
 	}
 
-	@Override Object decode() {
+	@Override
+	Object decode() {
 		return 0;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java b/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
index 89492c1..0ebfc62 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
@@ -6,10 +6,10 @@
 import java.util.concurrent.*;
 
 public class CollectionHandler extends Handler {
-	Class<?>	rawClass;
+	Class< ? >	rawClass;
 	Type		componentType;
-	
-	CollectionHandler(Class<?> rawClass, Type componentType) {
+
+	CollectionHandler(Class< ? > rawClass, Type componentType) {
 		this.componentType = componentType;
 		if (rawClass.isInterface()) {
 			if (rawClass.isAssignableFrom(ArrayList.class))
@@ -29,15 +29,14 @@
 			else if (rawClass.isAssignableFrom(CopyOnWriteArraySet.class))
 				rawClass = CopyOnWriteArraySet.class;
 			else
-				throw new IllegalArgumentException("Unknown interface type for collection: "
-						+ rawClass);
+				throw new IllegalArgumentException("Unknown interface type for collection: " + rawClass);
 		}
 		this.rawClass = rawClass;
 	}
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
-		Iterable<?> collection = (Iterable<?>) object;
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
+		Iterable< ? > collection = (Iterable< ? >) object;
 
 		app.append("[");
 		String del = "";
@@ -49,7 +48,9 @@
 		app.append("]");
 	}
 
-	@SuppressWarnings("unchecked") @Override Object decodeArray(Decoder r) throws Exception {
+	@SuppressWarnings("unchecked")
+	@Override
+	Object decodeArray(Decoder r) throws Exception {
 		Collection<Object> c = (Collection<Object>) rawClass.newInstance();
 		r.codec.parseArray(c, componentType, r);
 		return c;
diff --git a/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java b/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java
index d4f262e..784fcbe 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/DateHandler.java
@@ -8,8 +8,8 @@
 public class DateHandler extends Handler {
 	final static SimpleDateFormat	sdf	= new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		String s;
 		synchronized (sdf) {
 			s = sdf.format((Date) object);
@@ -17,13 +17,15 @@
 		StringHandler.string(app, s);
 	}
 
-	@Override Object decode(String s) throws Exception {
+	@Override
+	Object decode(String s) throws Exception {
 		synchronized (sdf) {
 			return sdf.parse(s);
 		}
 	}
 
-	@Override Object decode(Number s) throws Exception {
+	@Override
+	Object decode(Number s) throws Exception {
 		return new Date(s.longValue());
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
index 3cbed4b..703331d 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
@@ -5,15 +5,17 @@
 import java.security.*;
 import java.util.*;
 
+import aQute.lib.converter.*;
+
 public class Decoder implements Closeable {
 	final JSONCodec		codec;
 	Reader				reader;
 	int					current;
 	MessageDigest		digest;
-	Map<String, Object>	extra;
-	String encoding = "UTF-8";
-	
-	boolean strict;
+	Map<String,Object>	extra;
+	String				encoding	= "UTF-8";
+
+	boolean				strict;
 
 	Decoder(JSONCodec codec) {
 		this.codec = codec;
@@ -26,12 +28,12 @@
 	public Decoder from(InputStream in) throws Exception {
 		return from(new InputStreamReader(in, encoding));
 	}
-	
+
 	public Decoder charset(String encoding) {
 		this.encoding = encoding;
 		return this;
 	}
-	
+
 	public Decoder strict() {
 		this.strict = true;
 		return this;
@@ -65,7 +67,8 @@
 		return digest.digest();
 	}
 
-	@SuppressWarnings("unchecked") public <T> T get(Class<T> clazz) throws Exception {
+	@SuppressWarnings("unchecked")
+	public <T> T get(Class<T> clazz) throws Exception {
 		return (T) codec.decode(clazz, this);
 	}
 
@@ -77,6 +80,11 @@
 		return codec.decode(null, this);
 	}
 
+	@SuppressWarnings("unchecked")
+	public <T> T get(TypeReference<T> ref) throws Exception {
+		return (T) codec.decode(ref.getType(), this);
+	}
+
 	int read() throws Exception {
 		current = reader.read();
 		if (digest != null) {
@@ -129,9 +137,9 @@
 		reader.close();
 	}
 
-	public Map<String, Object> getExtra() {
+	public Map<String,Object> getExtra() {
 		if (extra == null)
-			extra = new HashMap<String, Object>();
+			extra = new HashMap<String,Object>();
 		return extra;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Encoder.java b/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
index 09990ed..b6112e7 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Encoder.java
@@ -20,7 +20,7 @@
 		if (app == null)
 			to();
 
-		codec.encode(this, object, null, new IdentityHashMap<Object, Type>());
+		codec.encode(this, object, null, new IdentityHashMap<Object,Type>());
 		return this;
 	}
 
@@ -95,7 +95,7 @@
 			((Closeable) app).close();
 	}
 
-	void encode(Object object, Type type, Map<Object, Type> visited) throws Exception {
+	void encode(Object object, Type type, Map<Object,Type> visited) throws Exception {
 		codec.encode(this, object, type, visited);
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/EnumHandler.java b/bundleplugin/src/main/java/aQute/lib/json/EnumHandler.java
index dbdb492..85aad12 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/EnumHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/EnumHandler.java
@@ -6,18 +6,19 @@
 
 public class EnumHandler extends Handler {
 	@SuppressWarnings("rawtypes")
-	final Class				type;
+	final Class	type;
 
-	public EnumHandler(Class<?> type) {
+	public EnumHandler(Class< ? > type) {
 		this.type = type;
 	}
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		StringHandler.string(app, object.toString());
 	}
 
-	@SuppressWarnings("unchecked") Object decode(String s) throws Exception {
+	@SuppressWarnings("unchecked")
+	Object decode(String s) throws Exception {
 		return Enum.valueOf(type, s);
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/FileHandler.java b/bundleplugin/src/main/java/aQute/lib/json/FileHandler.java
index 2f0eea5..c024090 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/FileHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/FileHandler.java
@@ -8,18 +8,19 @@
 
 public class FileHandler extends Handler {
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		File f = (File) object;
-		if ( !f.isFile())
-			throw new RuntimeException("Encoding a file requires the file to exist and to be a normal file " + f );
-		
+		if (!f.isFile())
+			throw new RuntimeException("Encoding a file requires the file to exist and to be a normal file " + f);
+
 		FileInputStream in = new FileInputStream(f);
 		try {
 			app.append('"');
 			Base64.encode(in, app);
 			app.append('"');
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -29,7 +30,8 @@
 		FileOutputStream fout = new FileOutputStream(tmp);
 		try {
 			Base64.decode(new StringReader(s), fout);
-		} finally {
+		}
+		finally {
 			fout.close();
 		}
 		return tmp;
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Handler.java b/bundleplugin/src/main/java/aQute/lib/json/Handler.java
index 18957e8..f002f50 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Handler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Handler.java
@@ -5,8 +5,7 @@
 import java.util.*;
 
 abstract class Handler {
-	abstract void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception;
+	abstract void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception;
 
 	Object decodeObject(Decoder isr) throws Exception {
 		throw new UnsupportedOperationException("Cannot be mapped to object " + this);
diff --git a/bundleplugin/src/main/java/aQute/lib/json/JSONCodec.java b/bundleplugin/src/main/java/aQute/lib/json/JSONCodec.java
index fa5c751..032f08f 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/JSONCodec.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/JSONCodec.java
@@ -39,22 +39,18 @@
 	final static String								START_CHARACTERS	= "[{\"-0123456789tfn";
 
 	// Handlers
-	private final static WeakHashMap<Type, Handler>	handlers			= new WeakHashMap<Type, Handler>();
+	private final static WeakHashMap<Type,Handler>	handlers			= new WeakHashMap<Type,Handler>();
 	private static StringHandler					sh					= new StringHandler();
 	private static BooleanHandler					bh					= new BooleanHandler();
 	private static CharacterHandler					ch					= new CharacterHandler();
-	private static CollectionHandler				dch					= new CollectionHandler(
-																				ArrayList.class,
+	private static CollectionHandler				dch					= new CollectionHandler(ArrayList.class,
 																				Object.class);
-	private static SpecialHandler					sph					= new SpecialHandler(
-																				Pattern.class,
-																				null, null);
+	private static SpecialHandler					sph					= new SpecialHandler(Pattern.class, null, null);
 	private static DateHandler						sdh					= new DateHandler();
 	private static FileHandler						fh					= new FileHandler();
 	private static ByteArrayHandler					byteh				= new ByteArrayHandler();
 
-	boolean ignorenull;
-	
+	boolean											ignorenull;
 
 	/**
 	 * Create a new Encoder with the state and appropriate API.
@@ -77,7 +73,7 @@
 	/*
 	 * Work horse encode methods, all encoding ends up here.
 	 */
-	void encode(Encoder app, Object object, Type type, Map<Object, Type> visited) throws Exception {
+	void encode(Encoder app, Object object, Type type, Map<Object,Type> visited) throws Exception {
 
 		// Get the null out of the way
 
@@ -104,11 +100,8 @@
 	 * stuff. It returns a handler for each type. If no appropriate handler
 	 * exists, it will create one for the given type. There are actually quite a
 	 * lot of handlers since Java is not very object oriented.
-	 * 
 	 * @param type
-	 * 
 	 * @return
-	 * 
 	 * @throws Exception
 	 */
 	Handler getHandler(Type type) throws Exception {
@@ -146,7 +139,7 @@
 
 		if (type instanceof Class) {
 
-			Class<?> clazz = (Class<?>) type;
+			Class< ? > clazz = (Class< ? >) type;
 
 			if (Enum.class.isAssignableFrom(clazz))
 				h = new EnumHandler(clazz);
@@ -162,16 +155,18 @@
 				h = new NumberHandler(clazz);
 			else {
 				Method valueOf = null;
-				Constructor<?> constructor = null;
+				Constructor< ? > constructor = null;
 
 				try {
 					constructor = clazz.getConstructor(String.class);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					// Ignore
 				}
 				try {
 					valueOf = clazz.getMethod("valueOf", String.class);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					// Ignore
 				}
 				if (constructor != null || valueOf != null)
@@ -190,22 +185,19 @@
 				ParameterizedType pt = (ParameterizedType) type;
 				Type rawType = pt.getRawType();
 				if (rawType instanceof Class) {
-					Class<?> rawClass = (Class<?>) rawType;
+					Class< ? > rawClass = (Class< ? >) rawType;
 					if (Iterable.class.isAssignableFrom(rawClass))
 						h = new CollectionHandler(rawClass, pt.getActualTypeArguments()[0]);
 					else if (Map.class.isAssignableFrom(rawClass))
-						h = new MapHandler(rawClass, pt.getActualTypeArguments()[0],
-								pt.getActualTypeArguments()[1]);
+						h = new MapHandler(rawClass, pt.getActualTypeArguments()[0], pt.getActualTypeArguments()[1]);
 					else
-						throw new IllegalArgumentException(
-								"Found a parameterized type that is not a map or collection");
+						throw new IllegalArgumentException("Found a parameterized type that is not a map or collection");
 				}
 			} else if (type instanceof GenericArrayType) {
 				GenericArrayType gat = (GenericArrayType) type;
 				h = new ArrayHandler(getRawClass(type), gat.getGenericComponentType());
 			} else
-				throw new IllegalArgumentException(
-						"Found a parameterized type that is not a map or collection");
+				throw new IllegalArgumentException("Found a parameterized type that is not a map or collection");
 		}
 		synchronized (handlers) {
 			// We might actually have duplicates
@@ -225,87 +217,86 @@
 			// type information
 
 			switch (c) {
-			case '{':
-				type = LinkedHashMap.class;
-				break;
+				case '{' :
+					type = LinkedHashMap.class;
+					break;
 
-			case '[':
-				type = ArrayList.class;
-				break;
+				case '[' :
+					type = ArrayList.class;
+					break;
 
-			case '"':
-				return parseString(isr);
+				case '"' :
+					return parseString(isr);
 
-			case 'n':
-				isr.expect("ull");
-				return null;
+				case 'n' :
+					isr.expect("ull");
+					return null;
 
-			case 't':
-				isr.expect("rue");
-				return true;
+				case 't' :
+					isr.expect("rue");
+					return true;
 
-			case 'f':
-				isr.expect("alse");
-				return false;
+				case 'f' :
+					isr.expect("alse");
+					return false;
 
-			case '0':
-			case '1':
-			case '2':
-			case '3':
-			case '4':
-			case '5':
-			case '6':
-			case '7':
-			case '8':
-			case '9':
-			case '-':
-				return parseNumber(isr);
+				case '0' :
+				case '1' :
+				case '2' :
+				case '3' :
+				case '4' :
+				case '5' :
+				case '6' :
+				case '7' :
+				case '8' :
+				case '9' :
+				case '-' :
+					return parseNumber(isr);
 
-			default:
-				throw new IllegalArgumentException("Invalid character at begin of token: "
-						+ (char) c);
+				default :
+					throw new IllegalArgumentException("Invalid character at begin of token: " + (char) c);
 			}
 		}
 
 		h = getHandler(type);
 
 		switch (c) {
-		case '{':
-			return h.decodeObject(isr);
+			case '{' :
+				return h.decodeObject(isr);
 
-		case '[':
-			return h.decodeArray(isr);
+			case '[' :
+				return h.decodeArray(isr);
 
-		case '"':
-			return h.decode(parseString(isr));
+			case '"' :
+				return h.decode(parseString(isr));
 
-		case 'n':
-			isr.expect("ull");
-			return h.decode();
+			case 'n' :
+				isr.expect("ull");
+				return h.decode();
 
-		case 't':
-			isr.expect("rue");
-			return h.decode(Boolean.TRUE);
+			case 't' :
+				isr.expect("rue");
+				return h.decode(Boolean.TRUE);
 
-		case 'f':
-			isr.expect("alse");
-			return h.decode(Boolean.FALSE);
+			case 'f' :
+				isr.expect("alse");
+				return h.decode(Boolean.FALSE);
 
-		case '0':
-		case '1':
-		case '2':
-		case '3':
-		case '4':
-		case '5':
-		case '6':
-		case '7':
-		case '8':
-		case '9':
-		case '-':
-			return h.decode(parseNumber(isr));
+			case '0' :
+			case '1' :
+			case '2' :
+			case '3' :
+			case '4' :
+			case '5' :
+			case '6' :
+			case '7' :
+			case '8' :
+			case '9' :
+			case '-' :
+				return h.decode(parseNumber(isr));
 
-		default:
-			throw new IllegalArgumentException("Unexpected character in input stream: " + (char) c);
+			default :
+				throw new IllegalArgumentException("Unexpected character in input stream: " + (char) c);
 		}
 	}
 
@@ -317,47 +308,45 @@
 		StringBuilder sb = new StringBuilder();
 		while (c != '"') {
 			if (c < 0 || Character.isISOControl(c))
-				throw new IllegalArgumentException(
-						"JSON strings may not contain control characters: " + r.current());
+				throw new IllegalArgumentException("JSON strings may not contain control characters: " + r.current());
 
 			if (c == '\\') {
 				c = r.read();
 				switch (c) {
-				case '"':
-				case '\\':
-				case '/':
-					sb.append((char)c);
-					break;
+					case '"' :
+					case '\\' :
+					case '/' :
+						sb.append((char) c);
+						break;
 
-				case 'b':
-					sb.append('\b');
-					break;
+					case 'b' :
+						sb.append('\b');
+						break;
 
-				case 'f':
-					sb.append('\f');
-					break;
-				case 'n':
-					sb.append('\n');
-					break;
-				case 'r':
-					sb.append('\r');
-					break;
-				case 't':
-					sb.append('\t');
-					break;
-				case 'u':
-					int a3 = hexDigit(r.read()) << 12;
-					int a2 = hexDigit(r.read()) << 8;
-					int a1 = hexDigit(r.read()) << 4;
-					int a0 = hexDigit(r.read()) << 0;
-					c = a3 + a2 + a1 + a0;
-					sb.append((char) c);
-					break;
+					case 'f' :
+						sb.append('\f');
+						break;
+					case 'n' :
+						sb.append('\n');
+						break;
+					case 'r' :
+						sb.append('\r');
+						break;
+					case 't' :
+						sb.append('\t');
+						break;
+					case 'u' :
+						int a3 = hexDigit(r.read()) << 12;
+						int a2 = hexDigit(r.read()) << 8;
+						int a1 = hexDigit(r.read()) << 4;
+						int a0 = hexDigit(r.read()) << 0;
+						c = a3 + a2 + a1 + a0;
+						sb.append((char) c);
+						break;
 
-				default:
-					throw new IllegalArgumentException(
-							"The only characters after a backslash are \", \\, b, f, n, r, t, and u but got "
-									+ c);
+					default :
+						throw new IllegalArgumentException(
+								"The only characters after a backslash are \", \\, b, f, n, r, t, and u but got " + c);
 				}
 			} else
 				sb.append((char) c);
@@ -455,15 +444,15 @@
 				continue;
 			}
 
-			throw new IllegalArgumentException(
-					"Invalid character in parsing list, expected ] or , but found " + (char) c);
+			throw new IllegalArgumentException("Invalid character in parsing list, expected ] or , but found "
+					+ (char) c);
 		}
 		assert r.current() == ']';
 		r.read(); // skip closing
 	}
 
 	@SuppressWarnings("rawtypes")
-	Class<?> getRawClass(Type type) {
+	Class< ? > getRawClass(Type type) {
 		if (type instanceof Class)
 			return (Class) type;
 
@@ -477,12 +466,12 @@
 		}
 
 		throw new IllegalArgumentException(
-				"Does not support generics beyond Parameterized Type  and GenericArrayType, got "
-						+ type);
+				"Does not support generics beyond Parameterized Type  and GenericArrayType, got " + type);
 	}
 
 	/**
 	 * Ignore null values in output and input
+	 * 
 	 * @param ignorenull
 	 * @return
 	 */
diff --git a/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java b/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
index 9299878..4a12c02 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
@@ -5,11 +5,11 @@
 import java.util.*;
 
 public class MapHandler extends Handler {
-	final Class<?>	rawClass;
-	final Type		keyType;
-	final Type		valueType;
+	final Class< ? >	rawClass;
+	final Type			keyType;
+	final Type			valueType;
 
-	MapHandler(Class<?> rawClass, Type keyType, Type valueType) {
+	MapHandler(Class< ? > rawClass, Type keyType, Type valueType) {
 		this.keyType = keyType;
 		this.valueType = valueType;
 		if (rawClass.isInterface()) {
@@ -27,13 +27,13 @@
 		this.rawClass = rawClass;
 	}
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
-		Map<?, ?> map = (Map<?, ?>) object;
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
+		Map< ? , ? > map = (Map< ? , ? >) object;
 
 		app.append("{");
 		String del = "";
-		for (Map.Entry<?, ?> e : map.entrySet()) {
+		for (Map.Entry< ? , ? > e : map.entrySet()) {
 			app.append(del);
 			String key;
 			if (e.getKey() != null && (keyType == String.class || keyType == Object.class))
@@ -49,31 +49,33 @@
 		app.append("}");
 	}
 
-	@SuppressWarnings("unchecked") @Override Object decodeObject(Decoder r) throws Exception {
+	@SuppressWarnings("unchecked")
+	@Override
+	Object decodeObject(Decoder r) throws Exception {
 		assert r.current() == '{';
-		
-		Map<Object, Object> map = (Map<Object, Object>) rawClass.newInstance();
-		
+
+		Map<Object,Object> map = (Map<Object,Object>) rawClass.newInstance();
+
 		int c = r.next();
 		while (JSONCodec.START_CHARACTERS.indexOf(c) >= 0) {
 			Object key = r.codec.parseString(r);
-			if ( !(keyType == null || keyType == Object.class)) {
+			if (!(keyType == null || keyType == Object.class)) {
 				Handler h = r.codec.getHandler(keyType);
-				key = h.decode((String)key);
+				key = h.decode((String) key);
 			}
-			
+
 			c = r.skipWs();
-			if ( c != ':')
+			if (c != ':')
 				throw new IllegalArgumentException("Expected ':' but got " + (char) c);
 
 			c = r.next();
 			Object value = r.codec.decode(valueType, r);
-			if ( value != null || !r.codec.ignorenull)
+			if (value != null || !r.codec.ignorenull)
 				map.put(key, value);
 
 			c = r.skipWs();
-			
-			if (c == '}') 
+
+			if (c == '}')
 				break;
 
 			if (c == ',') {
@@ -81,8 +83,8 @@
 				continue;
 			}
 
-			throw new IllegalArgumentException(
-					"Invalid character in parsing list, expected } or , but found " + (char) c);
+			throw new IllegalArgumentException("Invalid character in parsing list, expected } or , but found "
+					+ (char) c);
 		}
 		assert r.current() == '}';
 		r.read(); // skip closing
diff --git a/bundleplugin/src/main/java/aQute/lib/json/NumberHandler.java b/bundleplugin/src/main/java/aQute/lib/json/NumberHandler.java
index 644d49a..310ca3e 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/NumberHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/NumberHandler.java
@@ -5,42 +5,45 @@
 import java.util.*;
 
 public class NumberHandler extends Handler {
-	final Class<?>	type;
+	final Class< ? >	type;
 
-	NumberHandler(Class<?> clazz) {
+	NumberHandler(Class< ? > clazz) {
 		this.type = clazz;
 	}
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws Exception {
 		String s = object.toString();
-		if ( s.endsWith(".0"))
-			s  = s.substring(0,s.length()-2);
-		
+		if (s.endsWith(".0"))
+			s = s.substring(0, s.length() - 2);
+
 		app.append(s);
 	}
 
-	@Override Object decode(boolean s) {
+	@Override
+	Object decode(boolean s) {
 		return decode(s ? 1d : 0d);
 	}
 
-	@Override Object decode(String s) {
+	@Override
+	Object decode(String s) {
 		double d = Double.parseDouble(s);
 		return decode(d);
 	}
 
-	@Override Object decode() {
+	@Override
+	Object decode() {
 		return decode(0d);
 	}
 
-	@Override Object decode(Number s) {
+	@Override
+	Object decode(Number s) {
 		double dd = s.doubleValue();
-		
+
 		if (type == double.class || type == Double.class)
 			return s.doubleValue();
 
-		if ((type == int.class || type == Integer.class)
-				&& within(dd, Integer.MIN_VALUE, Integer.MAX_VALUE))
+		if ((type == int.class || type == Integer.class) && within(dd, Integer.MIN_VALUE, Integer.MAX_VALUE))
 			return s.intValue();
 
 		if ((type == long.class || type == Long.class) && within(dd, Long.MIN_VALUE, Long.MAX_VALUE))
@@ -49,8 +52,7 @@
 		if ((type == byte.class || type == Byte.class) && within(dd, Byte.MIN_VALUE, Byte.MAX_VALUE))
 			return s.byteValue();
 
-		if ((type == short.class || type == Short.class)
-				&& within(dd, Short.MIN_VALUE, Short.MAX_VALUE))
+		if ((type == short.class || type == Short.class) && within(dd, Short.MIN_VALUE, Short.MAX_VALUE))
 			return s.shortValue();
 
 		if (type == float.class || type == Float.class)
diff --git a/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java b/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java
index 2a876a4..50aaac0 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java
@@ -11,7 +11,7 @@
 	final Object	defaults[];
 	final Field		extra;
 
-	ObjectHandler(JSONCodec codec, Class<?> c) throws Exception {
+	ObjectHandler(JSONCodec codec, Class< ? > c) throws Exception {
 		rawClass = c;
 		fields = c.getFields();
 
@@ -35,19 +35,21 @@
 			extra = x;
 		else
 			extra = null;
-		
+
 		try {
 			Object template = c.newInstance();
 
 			for (int i = 0; i < fields.length; i++) {
 				defaults[i] = fields[i].get(template);
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// Ignore
 		}
 	}
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited) throws Exception {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws Exception {
 		app.append("{");
 		String del = "";
 		for (int i = 0; i < fields.length; i++) {
@@ -72,7 +74,9 @@
 		app.append("}");
 	}
 
-	@SuppressWarnings("unchecked") @Override Object decodeObject(Decoder r) throws Exception {
+	@SuppressWarnings("unchecked")
+	@Override
+	Object decodeObject(Decoder r) throws Exception {
 		assert r.current() == '{';
 		Object targetObject = rawClass.newInstance();
 
@@ -95,7 +99,7 @@
 			if (f != null) {
 				// We have a field and thus a type
 				Object value = r.codec.decode(f.getGenericType(), r);
-				if ( value != null || !r.codec.ignorenull)
+				if (value != null || !r.codec.ignorenull)
 					f.set(targetObject, value);
 			} else {
 				// No field, but may extra is defined
@@ -106,9 +110,9 @@
 					r.getExtra().put(rawClass.getName() + "." + key, value);
 				} else {
 
-					Map<String, Object> map = (Map<String, Object>) extra.get(targetObject);
+					Map<String,Object> map = (Map<String,Object>) extra.get(targetObject);
 					if (map == null) {
-						map = new LinkedHashMap<String, Object>();
+						map = new LinkedHashMap<String,Object>();
 						extra.set(targetObject, map);
 					}
 					Object value = r.codec.decode(null, r);
@@ -126,8 +130,8 @@
 				continue;
 			}
 
-			throw new IllegalArgumentException(
-					"Invalid character in parsing object, expected } or , but found " + (char) c);
+			throw new IllegalArgumentException("Invalid character in parsing object, expected } or , but found "
+					+ (char) c);
 		}
 		assert r.current() == '}';
 		r.read(); // skip closing
diff --git a/bundleplugin/src/main/java/aQute/lib/json/SpecialHandler.java b/bundleplugin/src/main/java/aQute/lib/json/SpecialHandler.java
index 33bde8f..bcd05ef 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/SpecialHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/SpecialHandler.java
@@ -13,16 +13,14 @@
 	final Constructor< ? >			constructor;
 	final static SimpleDateFormat	sdf	= new SimpleDateFormat();
 
-	public SpecialHandler(Class< ? > type, Constructor< ? > constructor,
-			Method valueOf) {
+	public SpecialHandler(Class< ? > type, Constructor< ? > constructor, Method valueOf) {
 		this.type = type;
 		this.constructor = constructor;
 		this.valueOf = valueOf;
 	}
 
 	@Override
-	void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException, Exception {
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception {
 		StringHandler.string(app, object.toString());
 	}
 
@@ -37,8 +35,7 @@
 		if (valueOf != null)
 			return valueOf.invoke(null, s);
 
-		throw new IllegalArgumentException("Do not know how to convert a "
-				+ type + " from a string");
+		throw new IllegalArgumentException("Do not know how to convert a " + type + " from a string");
 	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java b/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
index 2450ed0..8ebfee2 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
@@ -6,8 +6,8 @@
 
 public class StringHandler extends Handler {
 
-	@Override void encode(Encoder app, Object object, Map<Object, Type> visited)
-			throws IOException {
+	@Override
+	void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException {
 		string(app, object.toString());
 	}
 
@@ -17,43 +17,43 @@
 		for (int i = 0; i < s.length(); i++) {
 			char c = s.charAt(i);
 			switch (c) {
-			case '"':
-				app.append("\\\"");
-				break;
+				case '"' :
+					app.append("\\\"");
+					break;
 
-			case '\\':
-				app.append("\\\\");
-				break;
+				case '\\' :
+					app.append("\\\\");
+					break;
 
-			case '\b':
-				app.append("\\b");
-				break;
+				case '\b' :
+					app.append("\\b");
+					break;
 
-			case '\f':
-				app.append("\\f");
-				break;
+				case '\f' :
+					app.append("\\f");
+					break;
 
-			case '\n':
-				app.append("\\n");
-				break;
+				case '\n' :
+					app.append("\\n");
+					break;
 
-			case '\r':
-				app.append("\\r");
-				break;
+				case '\r' :
+					app.append("\\r");
+					break;
 
-			case '\t':
-				app.append("\\t");
-				break;
+				case '\t' :
+					app.append("\\t");
+					break;
 
-			default:
-				if (Character.isISOControl(c)) {
-					app.append("\\u");
-					app.append("0123456789ABCDEF".charAt(0xF & (c >> 12)));
-					app.append("0123456789ABCDEF".charAt(0xF & (c >> 8)));
-					app.append("0123456789ABCDEF".charAt(0xF & (c >> 4)));
-					app.append("0123456789ABCDEF".charAt(0xF & (c >> 0)));
-				} else
-					app.append(c);
+				default :
+					if (Character.isISOControl(c)) {
+						app.append("\\u");
+						app.append("0123456789ABCDEF".charAt(0xF & (c >> 12)));
+						app.append("0123456789ABCDEF".charAt(0xF & (c >> 8)));
+						app.append("0123456789ABCDEF".charAt(0xF & (c >> 4)));
+						app.append("0123456789ABCDEF".charAt(0xF & (c >> 0)));
+					} else
+						app.append(c);
 			}
 		}
 		app.append('"');
@@ -113,29 +113,29 @@
 			sb.append((char) c);
 			if (instring)
 				switch (c) {
-				case '"':
-					instring = true;
-					break;
+					case '"' :
+						instring = true;
+						break;
 
-				case '[':
-				case '{':
-					level++;
-					break;
+					case '[' :
+					case '{' :
+						level++;
+						break;
 
-				case ']':
-				case '}':
-					level--;
-					break;
+					case ']' :
+					case '}' :
+						level--;
+						break;
 				}
 			else
 				switch (c) {
-				case '"':
-					instring = false;
-					break;
+					case '"' :
+						instring = false;
+						break;
 
-				case '\\':
-					sb.append((char) isr.read());
-					break;
+					case '\\' :
+						sb.append((char) isr.read());
+						break;
 				}
 
 			c = isr.read();
diff --git a/bundleplugin/src/main/java/aQute/lib/justif/Justif.java b/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
index 663a9d6..841d009 100644
--- a/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
+++ b/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
@@ -2,11 +2,10 @@
 
 import java.util.*;
 
-
 public class Justif {
-	int []tabs;
-	
-	public Justif(int width, int ... tabs) {
+	int[]	tabs;
+
+	public Justif(int width, int... tabs) {
 		this.tabs = tabs;
 	}
 
@@ -24,7 +23,7 @@
 	 */
 	public void wrap(StringBuilder sb) {
 		List<Integer> indents = new ArrayList<Integer>();
-		
+
 		int indent = 0;
 		int linelength = 0;
 		int lastSpace = 0;
@@ -33,72 +32,71 @@
 
 		while (r < sb.length()) {
 			switch (sb.charAt(r++)) {
-			case '\n':
-				linelength = 0;
-				
-				indent = indents.isEmpty() ? 0 : indents.remove(0);
-				begin = true;
-				lastSpace = 0;
-				break;
-
-			case ' ':
-				if (begin)
-					indent++;
-				lastSpace = r - 1;
-				linelength++;
-				break;
-
-			case '\t':
-				indents.add(indent);
-				indent = linelength;
-				sb.deleteCharAt(--r);
-				
-				if (r < sb.length()) {
-					char digit = sb.charAt(r);
-					if (Character.isDigit(digit)) {
-						sb.deleteCharAt(r--);
-
-						int column = (digit - '0');
-						if (column < tabs.length)
-							indent = tabs[column];
-						else
-							indent = column * 8;
-
-						int diff = indent - linelength;
-						if (diff > 0) {
-							for (int i=0; i<diff; i++) {
-								sb.insert(r, ' ');
-							}
-							r += diff;
-							linelength += diff;
-						}
-					}
-				}
-				break;
-
-			case '\f':
-				linelength = 100000; // force a break
-				lastSpace = r-1;
-
-				//$FALL-THROUGH$
-
-			default:
-				linelength++;
-				begin = false;
-				if (lastSpace != 0 && linelength > 60) {
-					sb.setCharAt(lastSpace, '\n');
+				case '\n' :
 					linelength = 0;
 
-					for (int i = 0; i < indent; i++) {
-						sb.insert(lastSpace + 1, ' ');
-						linelength++;
-					}
-					r += indent;
+					indent = indents.isEmpty() ? 0 : indents.remove(0);
+					begin = true;
 					lastSpace = 0;
-				}
+					break;
+
+				case ' ' :
+					if (begin)
+						indent++;
+					lastSpace = r - 1;
+					linelength++;
+					break;
+
+				case '\t' :
+					indents.add(indent);
+					indent = linelength;
+					sb.deleteCharAt(--r);
+
+					if (r < sb.length()) {
+						char digit = sb.charAt(r);
+						if (Character.isDigit(digit)) {
+							sb.deleteCharAt(r);
+
+							int column = (digit - '0');
+							if (column < tabs.length)
+								indent = tabs[column];
+							else
+								indent = column * 8;
+
+							int diff = indent - linelength;
+							if (diff > 0) {
+								for (int i = 0; i < diff; i++) {
+									sb.insert(r, ' ');
+								}
+								r += diff;
+								linelength += diff;
+							}
+						}
+					}
+					break;
+
+				case '\f' :
+					linelength = 100000; // force a break
+					lastSpace = r - 1;
+
+					//$FALL-THROUGH$
+
+				default :
+					linelength++;
+					begin = false;
+					if (lastSpace != 0 && linelength > 60) {
+						sb.setCharAt(lastSpace, '\n');
+						linelength = 0;
+
+						for (int i = 0; i < indent; i++) {
+							sb.insert(lastSpace + 1, ' ');
+							linelength++;
+						}
+						r += indent;
+						lastSpace = 0;
+					}
 			}
 		}
 	}
 
-
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/About.java b/bundleplugin/src/main/java/aQute/lib/osgi/About.java
index 7265212..0fdf402 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/About.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/About.java
@@ -4,48 +4,36 @@
 
 /**
  * This package contains a number of classes that assists by analyzing JARs and
- * constructing bundles.
- * 
- * The Analyzer class can be used to analyze an existing bundle and can create a
- * manifest specification from proposed (wildcard) Export-Package,
- * Bundle-Includes, and Import-Package headers.
- * 
- * The Builder class can use the headers to construct a JAR from the classpath.
- * 
- * The Verifier class can take an existing JAR and verify that all headers are
- * correctly set. It will verify the syntax of the headers, match it against the
- * proper contents, and verify imports and exports.
- * 
- * A number of utility classes are available.
- * 
- * Jar, provides an abstraction of a Jar file. It has constructors for creating
- * a Jar from a stream, a directory, or a jar file. A Jar, keeps a collection
- * Resource's. There are Resource implementations for File, from ZipFile, or
- * from a stream (which copies the data). The Jar tries to minimize the work
- * during build up so that it is cheap to use. The Resource's can be used to
- * iterate over the names and later read the resources when needed.
- * 
+ * constructing bundles. The Analyzer class can be used to analyze an existing
+ * bundle and can create a manifest specification from proposed (wildcard)
+ * Export-Package, Bundle-Includes, and Import-Package headers. The Builder
+ * class can use the headers to construct a JAR from the classpath. The Verifier
+ * class can take an existing JAR and verify that all headers are correctly set.
+ * It will verify the syntax of the headers, match it against the proper
+ * contents, and verify imports and exports. A number of utility classes are
+ * available. Jar, provides an abstraction of a Jar file. It has constructors
+ * for creating a Jar from a stream, a directory, or a jar file. A Jar, keeps a
+ * collection Resource's. There are Resource implementations for File, from
+ * ZipFile, or from a stream (which copies the data). The Jar tries to minimize
+ * the work during build up so that it is cheap to use. The Resource's can be
+ * used to iterate over the names and later read the resources when needed.
  * Clazz, provides a parser for the class files. This will be used to define the
- * imports and exports.
- * 
- * Headers are translated to {@link Parameters} that contains all headers (the
- * order is maintained). The attribute of each header are maintained in an
- * {@link Attrs}. Each additional file in a header definition will have its own
- * entry (only native code does not work this way). The ':' of directives is
- * considered part of the name. This allows attributes and directives to be
- * maintained in the Attributes map.
- * 
- * An important aspect of the specification is to allow the use of wildcards.
- * Wildcards select from a set and can decorate the entries with new attributes.
- * This functionality is implemented in Instructions.
- * 
- * Much of the information calculated is in packages. A package is identified
- * by a PackageRef (and a type by a TypeRef). The namespace is maintained
- * by {@link Descriptors}, which here is owned by {@link Analyzer}. A special
- * class, {@link Packages} maintains the attributes that are found in the code.
+ * imports and exports. Headers are translated to {@link Parameters} that
+ * contains all headers (the order is maintained). The attribute of each header
+ * are maintained in an {@link Attrs}. Each additional file in a header
+ * definition will have its own entry (only native code does not work this way).
+ * The ':' of directives is considered part of the name. This allows attributes
+ * and directives to be maintained in the Attributes map. An important aspect of
+ * the specification is to allow the use of wildcards. Wildcards select from a
+ * set and can decorate the entries with new attributes. This functionality is
+ * implemented in Instructions. Much of the information calculated is in
+ * packages. A package is identified by a PackageRef (and a type by a TypeRef).
+ * The namespace is maintained by {@link Descriptors}, which here is owned by
+ * {@link Analyzer}. A special class, {@link Packages} maintains the attributes
+ * that are found in the code.
  * 
  * @version $Revision$
  */
 public class About {
-
+	// Empty
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/AbstractResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/AbstractResource.java
index 4c52103..782e615 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/AbstractResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/AbstractResource.java
@@ -3,52 +3,54 @@
 import java.io.*;
 
 public abstract class AbstractResource implements Resource {
-    String extra;
-    byte[] calculated;
-    long   lastModified;
+	String	extra;
+	byte[]	calculated;
+	long	lastModified;
 
-    protected AbstractResource(long modified) {
-        lastModified = modified;
-    }
+	protected AbstractResource(long modified) {
+		lastModified = modified;
+	}
 
-    public String getExtra() {
-        return extra;
-    }
+	public String getExtra() {
+		return extra;
+	}
 
-    public long lastModified() {
-        return lastModified;
-    }
+	public long lastModified() {
+		return lastModified;
+	}
 
-    public InputStream openInputStream() throws IOException {
-        return new ByteArrayInputStream(getLocalBytes());
-    }
+	public InputStream openInputStream() throws IOException {
+		return new ByteArrayInputStream(getLocalBytes());
+	}
 
-    private byte[] getLocalBytes() throws IOException {
-        try {
-            if (calculated != null)
-                return calculated;
+	private byte[] getLocalBytes() throws IOException {
+		try {
+			if (calculated != null)
+				return calculated;
 
-            return calculated = getBytes();
-        } catch (IOException e) {
-            throw e;
-        } catch (Exception e) {
-            IOException ee = new IOException("Opening resource");
-            ee.initCause(e);
-            throw ee;
-        }
-    }
+			return calculated = getBytes();
+		}
+		catch (IOException e) {
+			throw e;
+		}
+		catch (Exception e) {
+			IOException ee = new IOException("Opening resource");
+			ee.initCause(e);
+			throw ee;
+		}
+	}
 
-    public void setExtra(String extra) {
-        this.extra = extra;
-    }
+	public void setExtra(String extra) {
+		this.extra = extra;
+	}
 
-    public void write(OutputStream out) throws IOException {
-        out.write(getLocalBytes());
-    }
+	public void write(OutputStream out) throws IOException {
+		out.write(getLocalBytes());
+	}
 
-    abstract protected byte[] getBytes() throws Exception;
-    
-    public long size() throws IOException {
-    	return getLocalBytes().length;
-    }
+	abstract protected byte[] getBytes() throws Exception;
+
+	public long size() throws IOException {
+		return getLocalBytes().length;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java b/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
index 8be2edb..8af9bc7 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
@@ -42,6 +42,7 @@
 import aQute.libg.cryptography.*;
 import aQute.libg.generics.*;
 import aQute.libg.header.*;
+import aQute.libg.reporter.*;
 import aQute.libg.version.Version;
 
 public class Analyzer extends Processor {
@@ -57,30 +58,31 @@
 	private TypeRef									activator;
 
 	// Global parameters
-	private final MultiMap<PackageRef, PackageRef>	uses					= new MultiMap<PackageRef, PackageRef>(
-																					PackageRef.class,
-																					PackageRef.class,
+	private final MultiMap<PackageRef,PackageRef>	uses					= new MultiMap<PackageRef,PackageRef>(
+																					PackageRef.class, PackageRef.class,
 																					true);
 	private final Packages							classpathExports		= new Packages();
 	private final Descriptors						descriptors				= new Descriptors();
 	private final List<Jar>							classpath				= list();
-	private final Map<TypeRef, Clazz>				classspace				= map();
-	private final Map<TypeRef, Clazz>				importedClassesCache	= map();
+	private final Map<TypeRef,Clazz>				classspace				= map();
+	private final Map<TypeRef,Clazz>				importedClassesCache	= map();
 	private boolean									analyzed				= false;
 	private boolean									diagnostics				= false;
 	private boolean									inited					= false;
+	final protected AnalyzerMessages				msgs					= ReporterMessages.base(this,
+																					AnalyzerMessages.class);
 
 	public Analyzer(Processor parent) {
 		super(parent);
 	}
 
-	public Analyzer() {
-	}
+	public Analyzer() {}
 
 	/**
 	 * Specifically for Maven
 	 * 
-	 * @param properties the properties
+	 * @param properties
+	 *            the properties
 	 */
 
 	public static Properties getManifest(File dirOrJar) throws Exception {
@@ -280,7 +282,6 @@
 	}
 
 	/**
-	 * 
 	 * @return
 	 */
 	boolean isResourceOnly() {
@@ -306,9 +307,8 @@
 		boolean noExtraHeaders = "true".equalsIgnoreCase(getProperty(NOEXTRAHEADERS));
 
 		if (!noExtraHeaders) {
-			main.putValue(CREATED_BY,
-					System.getProperty("java.version") + " (" + System.getProperty("java.vendor")
-							+ ")");
+			main.putValue(CREATED_BY, System.getProperty("java.version") + " (" + System.getProperty("java.vendor")
+					+ ")");
 			main.putValue(TOOL, "Bnd-" + getBndVersion());
 			main.putValue(BND_LASTMODIFIED, "" + System.currentTimeMillis());
 		}
@@ -323,8 +323,7 @@
 		// Remove all the Java packages from the imports
 		if (!imports.isEmpty()) {
 			main.putValue(IMPORT_PACKAGE, printClauses(imports));
-		}
-		else {
+		} else {
 			main.remove(IMPORT_PACKAGE);
 		}
 
@@ -360,8 +359,7 @@
 				continue;
 			}
 
-			if (header.equals(BUNDLE_CLASSPATH) || header.equals(EXPORT_PACKAGE)
-					|| header.equals(IMPORT_PACKAGE))
+			if (header.equals(BUNDLE_CLASSPATH) || header.equals(EXPORT_PACKAGE) || header.equals(IMPORT_PACKAGE))
 				continue;
 
 			if (header.equalsIgnoreCase("Name")) {
@@ -374,14 +372,12 @@
 				if (value != null && main.getValue(header) == null) {
 					if (value.trim().length() == 0)
 						main.remove(header);
+					else if (value.trim().equals(EMPTY_HEADER))
+						main.putValue(header, "");
 					else
-						if (value.trim().equals(EMPTY_HEADER))
-							main.putValue(header, "");
-						else
-							main.putValue(header, value);
+						main.putValue(header, value);
 				}
-			}
-			else {
+			} else {
 				// TODO should we report?
 			}
 		}
@@ -424,9 +420,7 @@
 
 	/**
 	 * Parse the namesection as instructions and then match them against the
-	 * current set of resources
-	 * 
-	 * For example:
+	 * current set of resources For example:
 	 * 
 	 * <pre>
 	 * 	-namesection: *;baz=true, abc/def/bar/X.class=3
@@ -435,7 +429,6 @@
 	 * The raw value of {@link Constants#NAMESECTION} is used but the values of
 	 * the attributes are replaced where @ is set to the resource name. This
 	 * allows macro to operate on the resource
-	 * 
 	 */
 
 	private void doNamesection(Jar dot, Manifest manifest) {
@@ -451,7 +444,7 @@
 		// to the manifest for the given resource name. Then add all
 		// attributes from the instruction to that name section.
 		//
-		for (Map.Entry<Instruction, Attrs> instr : instructions.entrySet()) {
+		for (Map.Entry<Instruction,Attrs> instr : instructions.entrySet()) {
 			boolean matched = false;
 
 			// For each instruction
@@ -480,7 +473,7 @@
 						// name section
 						//
 
-						for (Map.Entry<String, String> property : instr.getValue().entrySet()) {
+						for (Map.Entry<String,String> property : instr.getValue().entrySet()) {
 							setProperty("@", path);
 							try {
 								String processed = getReplacer().process(property.getValue());
@@ -496,8 +489,7 @@
 			}
 
 			if (!matched && resources.size() > 0)
-				warning("The instruction %s in %s did not match any resources", instr.getKey(),
-						NAMESECTION);
+				warning("The instruction %s in %s did not match any resources", instr.getKey(), NAMESECTION);
 		}
 
 	}
@@ -532,10 +524,8 @@
 				manifest.getEntries().put(path, attrs);
 			}
 			attrs.putValue(name, getProperty(header));
-		}
-		else {
-			warning("Invalid header (starts with @ but does not seem to be for the Name section): %s",
-					header);
+		} else {
+			warning("Invalid header (starts with @ but does not seem to be for the Name section): %s", header);
 		}
 	}
 
@@ -554,13 +544,11 @@
 			String projectName = getBase().getName();
 			if (value == null || value.equals("bnd.bnd")) {
 				value = projectName;
+			} else if (value.endsWith(".bnd")) {
+				value = value.substring(0, value.length() - 4);
+				if (!value.startsWith(getBase().getName()))
+					value = projectName + "." + value;
 			}
-			else
-				if (value.endsWith(".bnd")) {
-					value = value.substring(0, value.length() - 4);
-					if (!value.startsWith(getBase().getName()))
-						value = projectName + "." + value;
-				}
 		}
 
 		if (value == null)
@@ -579,13 +567,14 @@
 	/**
 	 * Calculate an export header solely based on the contents of a JAR file
 	 * 
-	 * @param bundle The jar file to analyze
+	 * @param bundle
+	 *            The jar file to analyze
 	 * @return
 	 */
 	public String calculateExportsFromContents(Jar bundle) {
 		String ddel = "";
 		StringBuilder sb = new StringBuilder();
-		Map<String, Map<String, Resource>> map = bundle.getDirectories();
+		Map<String,Map<String,Resource>> map = bundle.getDirectories();
 		for (Iterator<String> i = map.keySet().iterator(); i.hasNext();) {
 			String directory = i.next();
 			if (directory.equals("META-INF") || directory.startsWith("META-INF/"))
@@ -644,7 +633,7 @@
 		return unreachable;
 	}
 
-	public MultiMap<PackageRef, PackageRef> getUses() {
+	public MultiMap<PackageRef,PackageRef> getUses() {
 		return uses;
 	}
 
@@ -663,6 +652,7 @@
 			return Long.parseLong(time);
 		}
 		catch (Exception e) {
+			// Ignore
 		}
 		return 0;
 	}
@@ -693,7 +683,8 @@
 	 * Merge the existing manifest with the instructions but do not override
 	 * existing properties.
 	 * 
-	 * @param manifest The manifest to merge with
+	 * @param manifest
+	 *            The manifest to merge with
 	 * @throws IOException
 	 */
 	public void mergeManifest(Manifest manifest) throws IOException {
@@ -729,8 +720,7 @@
 			if (classpath[i].exists()) {
 				Jar current = new Jar(classpath[i]);
 				list.add(current);
-			}
-			else {
+			} else {
 				error("Missing file on classpath: %s", classpath[i]);
 			}
 		}
@@ -799,8 +789,10 @@
 	 * Try to get a Jar from a file name/path or a url, or in last resort from
 	 * the classpath name part of their files.
 	 * 
-	 * @param name URL or filename relative to the base
-	 * @param from Message identifying the caller for errors
+	 * @param name
+	 *            URL or filename relative to the base
+	 * @param from
+	 *            Message identifying the caller for errors
 	 * @return null or a Jar with the contents for the name
 	 */
 	Jar getJarFromName(String name, String from) {
@@ -856,15 +848,13 @@
 	}
 
 	/**
-	 * 
 	 * @param manifests
 	 * @throws Exception
 	 */
-	private void merge(Manifest result, Manifest old) throws IOException {
+	private void merge(Manifest result, Manifest old) {
 		if (old != null) {
-			for (Iterator<Map.Entry<Object, Object>> e = old.getMainAttributes().entrySet()
-					.iterator(); e.hasNext();) {
-				Map.Entry<Object, Object> entry = e.next();
+			for (Iterator<Map.Entry<Object,Object>> e = old.getMainAttributes().entrySet().iterator(); e.hasNext();) {
+				Map.Entry<Object,Object> entry = e.next();
 				Attributes.Name name = (Attributes.Name) entry.getKey();
 				String value = (String) entry.getValue();
 				if (name.toString().equalsIgnoreCase("Created-By"))
@@ -874,11 +864,10 @@
 			}
 
 			// do not overwrite existing entries
-			Map<String, Attributes> oldEntries = old.getEntries();
-			Map<String, Attributes> newEntries = result.getEntries();
-			for (Iterator<Map.Entry<String, Attributes>> e = oldEntries.entrySet().iterator(); e
-					.hasNext();) {
-				Map.Entry<String, Attributes> entry = e.next();
+			Map<String,Attributes> oldEntries = old.getEntries();
+			Map<String,Attributes> newEntries = result.getEntries();
+			for (Iterator<Map.Entry<String,Attributes>> e = oldEntries.entrySet().iterator(); e.hasNext();) {
+				Map.Entry<String,Attributes> entry = e.next();
 				if (!newEntries.containsKey(entry.getKey())) {
 					newEntries.put(entry.getKey(), entry.getValue());
 				}
@@ -891,7 +880,8 @@
 	 * not using an invalid case. We do allow this to set headers that should
 	 * not be processed by us but should be used by the framework.
 	 * 
-	 * @param properties Properties to verify.
+	 * @param properties
+	 *            Properties to verify.
 	 */
 
 	void verifyManifestHeadersCase(Properties properties) {
@@ -910,26 +900,21 @@
 	/**
 	 * We will add all exports to the imports unless there is a -noimport
 	 * directive specified on an export. This directive is skipped for the
-	 * manifest.
-	 * 
-	 * We also remove any version parameter so that augmentImports can do the
-	 * version policy.
-	 * 
-	 * The following method is really tricky and evolved over time. Coming from
-	 * the original background of OSGi, it was a weird idea for me to have a
-	 * public package that should not be substitutable. I was so much convinced
-	 * that this was the right rule that I rücksichtlos imported them all. Alas,
-	 * the real world was more subtle than that. It turns out that it is not a
-	 * good idea to always import. First, there must be a need to import, i.e.
-	 * there must be a contained package that refers to the exported package for
-	 * it to make use importing that package. Second, if an exported package
-	 * refers to an internal package than it should not be imported.
-	 * 
-	 * Additionally, it is necessary to treat the exports in groups. If an
-	 * exported package refers to another exported packages than it must be in
-	 * the same group. A framework can only substitute exports for imports for
-	 * the whole of such a group. WHY????? Not clear anymore ...
-	 * 
+	 * manifest. We also remove any version parameter so that augmentImports can
+	 * do the version policy. The following method is really tricky and evolved
+	 * over time. Coming from the original background of OSGi, it was a weird
+	 * idea for me to have a public package that should not be substitutable. I
+	 * was so much convinced that this was the right rule that I rücksichtlos
+	 * imported them all. Alas, the real world was more subtle than that. It
+	 * turns out that it is not a good idea to always import. First, there must
+	 * be a need to import, i.e. there must be a contained package that refers
+	 * to the exported package for it to make use importing that package.
+	 * Second, if an exported package refers to an internal package than it
+	 * should not be imported. Additionally, it is necessary to treat the
+	 * exports in groups. If an exported package refers to another exported
+	 * packages than it must be in the same group. A framework can only
+	 * substitute exports for imports for the whole of such a group. WHY?????
+	 * Not clear anymore ...
 	 */
 	Packages doExportsToImports(Packages exports) {
 
@@ -1003,7 +988,7 @@
 
 	public boolean referred(PackageRef packageName) {
 		// return true;
-		for (Map.Entry<PackageRef, List<PackageRef>> contained : uses.entrySet()) {
+		for (Map.Entry<PackageRef,List<PackageRef>> contained : uses.entrySet()) {
 			if (!contained.getKey().equals(packageName)) {
 				if (contained.getValue().contains(packageName))
 					return true;
@@ -1013,7 +998,6 @@
 	}
 
 	/**
-	 * 
 	 * @param jar
 	 */
 	private void getExternalExports(Jar jar, Packages classpathExports) {
@@ -1022,7 +1006,7 @@
 			if (m != null) {
 				Domain domain = Domain.domain(m);
 				Parameters exported = domain.getExportPackage();
-				for (Entry<String, Attrs> e : exported.entrySet()) {
+				for (Entry<String,Attrs> e : exported.entrySet()) {
 					PackageRef ref = getPackageRef(e.getKey());
 					if (!classpathExports.containsKey(ref)) {
 						// TODO e.getValue().put(SOURCE_DIRECTIVE,
@@ -1055,8 +1039,7 @@
 			setProperty(CURRENT_PACKAGE, packageName);
 			try {
 				Attrs importAttributes = imports.get(packageRef);
-				Attrs exportAttributes = exports.get(packageRef,
-						classpathExports.get(packageRef, new Attrs()));
+				Attrs exportAttributes = exports.get(packageRef, classpathExports.get(packageRef, new Attrs()));
 
 				String exportVersion = exportAttributes.getVersion();
 				String importRange = importAttributes.getVersion();
@@ -1064,8 +1047,7 @@
 				if (exportVersion == null) {
 					// TODO Should check if the source is from a bundle.
 
-				}
-				else {
+				} else {
 
 					//
 					// Version Policy - Import version substitution. We
@@ -1076,8 +1058,7 @@
 					//
 
 					boolean provider = isTrue(importAttributes.get(PROVIDE_DIRECTIVE))
-							|| isTrue(exportAttributes.get(PROVIDE_DIRECTIVE))
-							|| provided.contains(packageRef);
+							|| isTrue(exportAttributes.get(PROVIDE_DIRECTIVE)) || provided.contains(packageRef);
 
 					exportVersion = cleanupVersion(exportVersion);
 
@@ -1087,8 +1068,7 @@
 						if (importRange != null) {
 							importRange = cleanupVersion(importRange);
 							importRange = getReplacer().process(importRange);
-						}
-						else
+						} else
 							importRange = getVersionPolicy(provider);
 
 					}
@@ -1180,7 +1160,7 @@
 				if (exporterAttributes == null)
 					continue;
 
-				for (Map.Entry<String, String> entry : exporterAttributes.entrySet()) {
+				for (Map.Entry<String,String> entry : exporterAttributes.entrySet()) {
 					String key = entry.getKey();
 					if (key.equalsIgnoreCase(SPECIFICATION_VERSION))
 						key = VERSION_ATTRIBUTE;
@@ -1202,9 +1182,7 @@
 	}
 
 	/**
-	 * Fixup Attributes
-	 * 
-	 * Execute any macros on an export and
+	 * Fixup Attributes Execute any macros on an export and
 	 */
 
 	void fixupAttributes(Attrs attributes) {
@@ -1236,7 +1214,7 @@
 		}
 
 		// Remove any ! valued attributes
-		for (Iterator<Entry<String, String>> i = attributes.entrySet().iterator(); i.hasNext();) {
+		for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) {
 			String v = i.next().getValue();
 			if (v.equals("!"))
 				i.remove();
@@ -1246,8 +1224,10 @@
 	/**
 	 * Calculate a version from a version policy.
 	 * 
-	 * @param version The actual exported version
-	 * @param impl true for implementations and false for clients
+	 * @param version
+	 *            The actual exported version
+	 * @param impl
+	 *            true for implementations and false for clients
 	 */
 
 	String calculateVersionRange(String version, boolean impl) {
@@ -1267,7 +1247,7 @@
 	 * @param uses
 	 * @throws MojoExecutionException
 	 */
-	void doUses(Packages exports, MultiMap<PackageRef, PackageRef> uses, Packages imports) {
+	void doUses(Packages exports, MultiMap<PackageRef,PackageRef> uses, Packages imports) {
 		if ("true".equalsIgnoreCase(getProperty(NOUSES)))
 			return;
 
@@ -1291,8 +1271,8 @@
 	 * @param uses
 	 * @param imports
 	 */
-	protected void doUses(PackageRef packageRef, Packages exports,
-			MultiMap<PackageRef, PackageRef> uses, Packages imports) {
+	protected void doUses(PackageRef packageRef, Packages exports, MultiMap<PackageRef,PackageRef> uses,
+			Packages imports) {
 		Attrs clause = exports.get(packageRef);
 
 		// Check if someone already set the uses: directive
@@ -1328,12 +1308,10 @@
 				setProperty(CURRENT_USES, sb.toString());
 				override = getReplacer().process(override);
 				unsetProperty(CURRENT_USES);
-			}
-			else
+			} else
 				// This is for backward compatibility 0.0.287
 				// can be deprecated over time
-				override = override.replaceAll(USES_USES, Matcher.quoteReplacement(sb.toString()))
-						.trim();
+				override = override.replaceAll(USES_USES, Matcher.quoteReplacement(sb.toString())).trim();
 
 			if (override.endsWith(","))
 				override = override.substring(0, override.length() - 1);
@@ -1374,8 +1352,7 @@
 	 * @param value
 	 * @throws Exception
 	 */
-	void setPackageInfo(PackageRef packageRef, Resource r, Packages classpathExports)
-			throws Exception {
+	void setPackageInfo(PackageRef packageRef, Resource r, Packages classpathExports) throws Exception {
 		if (r == null)
 			return;
 
@@ -1418,18 +1395,15 @@
 			out.println("Classpath used");
 			for (Jar jar : getClasspath()) {
 				out.printf("File                                : %s%n", jar.getSource());
-				out.printf("File abs path                       : %s%n", jar.getSource()
-						.getAbsolutePath());
+				out.printf("File abs path                       : %s%n", jar.getSource().getAbsolutePath());
 				out.printf("Name                                : %s%n", jar.getName());
-				Map<String, Map<String, Resource>> dirs = jar.getDirectories();
-				for (Map.Entry<String, Map<String, Resource>> entry : dirs.entrySet()) {
-					Map<String, Resource> dir = entry.getValue();
+				Map<String,Map<String,Resource>> dirs = jar.getDirectories();
+				for (Map.Entry<String,Map<String,Resource>> entry : dirs.entrySet()) {
+					Map<String,Resource> dir = entry.getValue();
 					String name = entry.getKey().replace('/', '.');
 					if (dir != null) {
-						out.printf("                                      %-30s %d%n", name,
-								dir.size());
-					}
-					else {
+						out.printf("                                      %-30s %d%n", name, dir.size());
+					} else {
 						out.printf("                                      %-30s <<empty>>%n", name);
 					}
 				}
@@ -1449,9 +1423,8 @@
 
 	/**
 	 * Findpath looks through the contents of the JAR and finds paths that end
-	 * with the given regular expression
-	 * 
-	 * ${findpath (; reg-expr (; replacement)? )? }
+	 * with the given regular expression ${findpath (; reg-expr (; replacement)?
+	 * )? }
 	 * 
 	 * @param args
 	 * @return
@@ -1466,8 +1439,8 @@
 
 	String findPath(String name, String[] args, boolean fullPathName) {
 		if (args.length > 3) {
-			warning("Invalid nr of arguments to " + name + " " + Arrays.asList(args)
-					+ ", syntax: ${" + name + " (; reg-expr (; replacement)? )? }");
+			warning("Invalid nr of arguments to " + name + " " + Arrays.asList(args) + ", syntax: ${" + name
+					+ " (; reg-expr (; replacement)? )? }");
 			return null;
 		}
 
@@ -1507,9 +1480,9 @@
 		return sb.toString();
 	}
 
-	public void putAll(Map<String, String> additional, boolean force) {
-		for (Iterator<Map.Entry<String, String>> i = additional.entrySet().iterator(); i.hasNext();) {
-			Map.Entry<String, String> entry = i.next();
+	public void putAll(Map<String,String> additional, boolean force) {
+		for (Iterator<Map.Entry<String,String>> i = additional.entrySet().iterator(); i.hasNext();) {
+			Map.Entry<String,String> entry = i.next();
 			if (force || getProperties().get(entry.getKey()) == null)
 				setProperty(entry.getKey(), entry.getValue());
 		}
@@ -1544,15 +1517,12 @@
 		for (Object jar : jars) {
 			if (jar instanceof Jar)
 				addClasspath((Jar) jar);
+			else if (jar instanceof File)
+				addClasspath((File) jar);
+			else if (jar instanceof String)
+				addClasspath(getFile((String) jar));
 			else
-				if (jar instanceof File)
-					addClasspath((File) jar);
-				else
-					if (jar instanceof String)
-						addClasspath(getFile((String) jar));
-					else
-						error("Cannot convert to JAR to add to classpath %s. Not a File, Jar, or String",
-								jar);
+				error("Cannot convert to JAR to add to classpath %s. Not a File, Jar, or String", jar);
 		}
 	}
 
@@ -1577,8 +1547,7 @@
 
 		if (bcp.isEmpty()) {
 			analyzeJar(dot, "", true);
-		}
-		else {
+		} else {
 			boolean okToIncludeDirs = true;
 
 			for (String path : bcp.keySet()) {
@@ -1613,8 +1582,7 @@
 					catch (Exception e) {
 						warning("Invalid bundle classpath entry: " + path + " " + e);
 					}
-				}
-				else {
+				} else {
 					if (dot.getDirectories().containsKey(path)) {
 						// if directories are used, we should not have dot as we
 						// would have the classes in these directories on the
@@ -1623,8 +1591,7 @@
 							warning("Bundle-ClassPath uses a directory '%s' as well as '.'. This means bnd does not know if a directory is a package.",
 									path, path);
 						analyzeJar(dot, Processor.appendPath(path) + "/", true);
-					}
-					else {
+					} else {
 						if (!"optional".equals(info.get(RESOLUTION_DIRECTIVE)))
 							warning("No sub JAR or directory " + path);
 					}
@@ -1646,7 +1613,7 @@
 	 * @throws IOException
 	 */
 	private boolean analyzeJar(Jar jar, String prefix, boolean okToIncludeDirs) throws Exception {
-		Map<String, Clazz> mismatched = new HashMap<String, Clazz>();
+		Map<String,Clazz> mismatched = new HashMap<String,Clazz>();
 
 		next: for (String path : jar.getResources().keySet()) {
 			if (path.startsWith(prefix)) {
@@ -1668,8 +1635,7 @@
 						// we found a class since the bcp has a tendency
 						// to overlap
 						if (!packageRef.isMetaData()) {
-							Resource pinfo = jar.getResource(prefix + packageRef.getPath()
-									+ "/packageinfo");
+							Resource pinfo = jar.getResource(prefix + packageRef.getPath() + "/packageinfo");
 							setPackageInfo(packageRef, pinfo, classpathExports);
 						}
 					}
@@ -1690,8 +1656,7 @@
 								// package-info can contain an Export annotation
 								info = new Attrs();
 								parsePackageInfoClass(clazz, info);
-							}
-							else {
+							} else {
 								// Otherwise we just parse it simply
 								clazz.parseClassFile();
 							}
@@ -1712,16 +1677,14 @@
 						// warning
 						if (okToIncludeDirs) // assume already reported
 							mismatched.put(clazz.getAbsolutePath(), clazz);
-					}
-					else {
+					} else {
 						classspace.put(clazz.getClassName(), clazz);
 						PackageRef packageRef = clazz.getClassName().getPackageRef();
 
 						if (!contained.containsKey(packageRef)) {
 							contained.put(packageRef);
 							if (!packageRef.isMetaData()) {
-								Resource pinfo = jar.getResource(prefix + packageRef.getPath()
-										+ "/packageinfo");
+								Resource pinfo = jar.getResource(prefix + packageRef.getPath() + "/packageinfo");
 								setPackageInfo(packageRef, pinfo, classpathExports);
 							}
 						}
@@ -1767,92 +1730,87 @@
 							if (Verifier.VERSION.matcher(version).matches())
 								info.put(VERSION_ATTRIBUTE, version);
 							else
-								error("Export annotation in %s has invalid version info: %s",
-										clazz, version);
+								error("Export annotation in %s has invalid version info: %s", clazz, version);
 						}
-					}
-					else {
+					} else {
 						// Verify this matches with packageinfo
 						String presentVersion = info.get(VERSION_ATTRIBUTE);
 						try {
 							Version av = new Version(presentVersion);
 							Version bv = new Version(version);
 							if (!av.equals(bv)) {
-								error("Version from annotation for %s differs with packageinfo or Manifest",
-										clazz.getClassName().getFQN());
+								error("Version from annotation for %s differs with packageinfo or Manifest", clazz
+										.getClassName().getFQN());
 							}
 						}
 						catch (Exception e) {
 							// Ignore
 						}
 					}
-				}
-				else
-					if (name.equals(Export.class.getName())) {
+				} else if (name.equals(Export.class.getName())) {
 
-						// Check mandatory attributes
-						Attrs attrs = doAttrbutes((Object[]) a.get(Export.MANDATORY), clazz,
-								getReplacer());
-						if (!attrs.isEmpty()) {
-							info.putAll(attrs);
-							info.put(MANDATORY_DIRECTIVE, Processor.join(attrs.keySet()));
-						}
+					// Check mandatory attributes
+					Attrs attrs = doAttrbutes((Object[]) a.get(Export.MANDATORY), clazz, getReplacer());
+					if (!attrs.isEmpty()) {
+						info.putAll(attrs);
+						info.put(MANDATORY_DIRECTIVE, Processor.join(attrs.keySet()));
+					}
 
-						// Check optional attributes
-						attrs = doAttrbutes((Object[]) a.get(Export.OPTIONAL), clazz, getReplacer());
-						if (!attrs.isEmpty()) {
-							info.putAll(attrs);
-						}
+					// Check optional attributes
+					attrs = doAttrbutes((Object[]) a.get(Export.OPTIONAL), clazz, getReplacer());
+					if (!attrs.isEmpty()) {
+						info.putAll(attrs);
+					}
 
-						// Check Included classes
-						Object[] included = a.get(Export.INCLUDE);
-						if (included != null && included.length > 0) {
-							StringBuilder sb = new StringBuilder();
-							String del = "";
-							for (Object i : included) {
-								Matcher m = OBJECT_REFERENCE.matcher((String) i);
-								if (m.matches()) {
-									sb.append(del);
-									sb.append(m.group(2));
-									del = ",";
-								}
-							}
-							info.put(INCLUDE_DIRECTIVE, sb.toString());
-						}
-
-						// Check Excluded classes
-						Object[] excluded = a.get(Export.EXCLUDE);
-						if (excluded != null && excluded.length > 0) {
-							StringBuilder sb = new StringBuilder();
-							String del = "";
-							for (Object i : excluded) {
-								Matcher m = OBJECT_REFERENCE.matcher((String) i);
-								if (m.matches()) {
-									sb.append(del);
-									sb.append(m.group(2));
-									del = ",";
-								}
-							}
-							info.put(EXCLUDE_DIRECTIVE, sb.toString());
-						}
-
-						// Check Uses
-						Object[] uses = a.get(Export.USES);
-						if (uses != null && uses.length > 0) {
-							String old = info.get(USES_DIRECTIVE);
-							if (old == null)
-								old = "";
-							StringBuilder sb = new StringBuilder(old);
-							String del = sb.length() == 0 ? "" : ",";
-
-							for (Object use : uses) {
+					// Check Included classes
+					Object[] included = a.get(Export.INCLUDE);
+					if (included != null && included.length > 0) {
+						StringBuilder sb = new StringBuilder();
+						String del = "";
+						for (Object i : included) {
+							Matcher m = OBJECT_REFERENCE.matcher((String) i);
+							if (m.matches()) {
 								sb.append(del);
-								sb.append(use);
+								sb.append(m.group(2));
 								del = ",";
 							}
-							info.put(USES_DIRECTIVE, sb.toString());
 						}
+						info.put(INCLUDE_DIRECTIVE, sb.toString());
 					}
+
+					// Check Excluded classes
+					Object[] excluded = a.get(Export.EXCLUDE);
+					if (excluded != null && excluded.length > 0) {
+						StringBuilder sb = new StringBuilder();
+						String del = "";
+						for (Object i : excluded) {
+							Matcher m = OBJECT_REFERENCE.matcher((String) i);
+							if (m.matches()) {
+								sb.append(del);
+								sb.append(m.group(2));
+								del = ",";
+							}
+						}
+						info.put(EXCLUDE_DIRECTIVE, sb.toString());
+					}
+
+					// Check Uses
+					Object[] uses = a.get(Export.USES);
+					if (uses != null && uses.length > 0) {
+						String old = info.get(USES_DIRECTIVE);
+						if (old == null)
+							old = "";
+						StringBuilder sb = new StringBuilder(old);
+						String del = sb.length() == 0 ? "" : ",";
+
+						for (Object use : uses) {
+							sb.append(del);
+							sb.append(use);
+							del = ",";
+						}
+						info.put(USES_DIRECTIVE, sb.toString());
+					}
+				}
 			}
 
 		});
@@ -1866,14 +1824,11 @@
 	 * @param VERSION_STRING
 	 * @return
 	 */
-	static Pattern	fuzzyVersion		= Pattern
-												.compile(
-														"(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?",
-														Pattern.DOTALL);
-	static Pattern	fuzzyVersionRange	= Pattern
-												.compile(
-														"(\\(|\\[)\\s*([-\\da-zA-Z.]+)\\s*,\\s*([-\\da-zA-Z.]+)\\s*(\\]|\\))",
-														Pattern.DOTALL);
+	static Pattern	fuzzyVersion		= Pattern.compile("(\\d+)(\\.(\\d+)(\\.(\\d+))?)?([^a-zA-Z0-9](.*))?",
+												Pattern.DOTALL);
+	static Pattern	fuzzyVersionRange	= Pattern.compile(
+												"(\\(|\\[)\\s*([-\\da-zA-Z.]+)\\s*,\\s*([-\\da-zA-Z.]+)\\s*(\\]|\\))",
+												Pattern.DOTALL);
 	static Pattern	fuzzyModifier		= Pattern.compile("(\\d+[.-])*(.*)", Pattern.DOTALL);
 
 	static Pattern	nummeric			= Pattern.compile("\\d*");
@@ -1893,49 +1848,47 @@
 			String suffix = m.group(4);
 			return prefix + cleanupVersion(first) + "," + cleanupVersion(last) + suffix;
 		}
-		else {
-			m = fuzzyVersion.matcher(version);
-			if (m.matches()) {
-				StringBuilder result = new StringBuilder();
-				String major = removeLeadingZeroes(m.group(1));
-				String minor = removeLeadingZeroes(m.group(3));
-				String micro = removeLeadingZeroes(m.group(5));
-				String qualifier = m.group(7);
 
-				if (major != null) {
-					result.append(major);
-					if (minor != null) {
+		m = fuzzyVersion.matcher(version);
+		if (m.matches()) {
+			StringBuilder result = new StringBuilder();
+			String major = removeLeadingZeroes(m.group(1));
+			String minor = removeLeadingZeroes(m.group(3));
+			String micro = removeLeadingZeroes(m.group(5));
+			String qualifier = m.group(7);
+
+			if (major != null) {
+				result.append(major);
+				if (minor != null) {
+					result.append(".");
+					result.append(minor);
+					if (micro != null) {
 						result.append(".");
-						result.append(minor);
-						if (micro != null) {
-							result.append(".");
-							result.append(micro);
-							if (qualifier != null) {
-								result.append(".");
-								cleanupModifier(result, qualifier);
-							}
-						}
-						else
-							if (qualifier != null) {
-								result.append(".0.");
-								cleanupModifier(result, qualifier);
-							}
-					}
-					else
+						result.append(micro);
 						if (qualifier != null) {
-							result.append(".0.0.");
+							result.append(".");
 							cleanupModifier(result, qualifier);
 						}
-					return result.toString();
+					} else if (qualifier != null) {
+						result.append(".0.");
+						cleanupModifier(result, qualifier);
+					}
+				} else if (qualifier != null) {
+					result.append(".0.0.");
+					cleanupModifier(result, qualifier);
 				}
+				return result.toString();
 			}
 		}
 		return version;
 	}
 
 	private static String removeLeadingZeroes(String group) {
+		if (group == null)
+			return null;
+
 		int n = 0;
-		while (group != null && n < group.length() - 1 && group.charAt(n) == '0')
+		while (n < group.length() - 1 && group.charAt(n) == '0')
 			n++;
 		if (n == 0)
 			return group;
@@ -1950,8 +1903,7 @@
 
 		for (int i = 0; i < modifier.length(); i++) {
 			char c = modifier.charAt(i);
-			if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
-					|| c == '_' || c == '-')
+			if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '-')
 				result.append(c);
 		}
 	}
@@ -1972,17 +1924,16 @@
 
 			return getProperty(VERSIONPOLICY, DEFAULT_PROVIDER_POLICY);
 		}
-		else {
-			String s = getProperty(CONSUMER_POLICY);
-			if (s != null)
-				return s;
+		String s = getProperty(CONSUMER_POLICY);
+		if (s != null)
+			return s;
 
-			s = getProperty(VERSIONPOLICY_USES);
-			if (s != null)
-				return s;
+		s = getProperty(VERSIONPOLICY_USES);
+		if (s != null)
+			return s;
 
-			return getProperty(VERSIONPOLICY, DEFAULT_CONSUMER_POLICY);
-		}
+		return getProperty(VERSIONPOLICY, DEFAULT_CONSUMER_POLICY);
+
 		// String vp = implemented ? getProperty(VERSIONPOLICY_IMPL) :
 		// getProperty(VERSIONPOLICY_USES);
 		//
@@ -2019,24 +1970,21 @@
 		Set<Clazz> matched = new HashSet<Clazz>(classspace.values());
 		for (int i = 1; i < args.length; i++) {
 			if (args.length < i + 1)
-				throw new IllegalArgumentException(
-						"${classes} macro must have odd number of arguments. " + _classesHelp);
+				throw new IllegalArgumentException("${classes} macro must have odd number of arguments. "
+						+ _classesHelp);
 
 			String typeName = args[i];
 			if (typeName.equalsIgnoreCase("extending"))
 				typeName = "extends";
-			else
-				if (typeName.equalsIgnoreCase("importing"))
-					typeName = "imports";
-				else
-					if (typeName.equalsIgnoreCase("implementing"))
-						typeName = "implements";
+			else if (typeName.equalsIgnoreCase("importing"))
+				typeName = "imports";
+			else if (typeName.equalsIgnoreCase("implementing"))
+				typeName = "implements";
 
 			Clazz.QUERY type = Clazz.QUERY.valueOf(typeName.toUpperCase());
 
 			if (type == null)
-				throw new IllegalArgumentException("${classes} has invalid type: " + typeName
-						+ ". " + _classesHelp);
+				throw new IllegalArgumentException("${classes} has invalid type: " + typeName + ". " + _classesHelp);
 
 			Instruction instr = null;
 			if (Clazz.HAS_ARGUMENT.contains(type)) {
@@ -2058,9 +2006,7 @@
 	 */
 
 	public String _exporters(String args[]) throws Exception {
-		Macro.verifyCommand(
-				args,
-				"${exporters;<packagename>}, returns the list of jars that export the given package",
+		Macro.verifyCommand(args, "${exporters;<packagename>}, returns the list of jars that export the given package",
 				null, 2, 2);
 		StringBuilder sb = new StringBuilder();
 		String del = "";
@@ -2074,14 +2020,15 @@
 		return sb.toString();
 	}
 
-	public Map<TypeRef, Clazz> getClassspace() {
+	public Map<TypeRef,Clazz> getClassspace() {
 		return classspace;
 	}
 
 	/**
 	 * Locate a resource on the class path.
 	 * 
-	 * @param path Path of the reosurce
+	 * @param path
+	 *            Path of the reosurce
 	 * @return A resource or <code>null</code>
 	 */
 	public Resource findResource(String path) {
@@ -2158,7 +2105,7 @@
 		if (require == null || require.isEmpty())
 			return;
 
-		Hashtable<String, String> map = new Hashtable<String, String>();
+		Hashtable<String,String> map = new Hashtable<String,String>();
 		map.put(Constants.VERSION_FILTER, getBndVersion());
 
 		for (String filter : require.keySet()) {
@@ -2181,8 +2128,9 @@
 	static String	_md5Help	= "${md5;path}";
 
 	public String _md5(String args[]) throws Exception {
-		Macro.verifyCommand(args, _md5Help,
-				new Pattern[] {null, null, Pattern.compile("base64|hex")}, 2, 3);
+		Macro.verifyCommand(args, _md5Help, new Pattern[] {
+				null, null, Pattern.compile("base64|hex")
+		}, 2, 3);
 
 		Digester<MD5> digester = MD5.getDigester();
 		Resource r = dot.getResource(args[1]);
@@ -2193,8 +2141,8 @@
 		boolean hex = args.length > 2 && args[2].equals("hex");
 		if (hex)
 			return Hex.toHexString(digester.digest().digest());
-		else
-			return Base64.encodeBase64(digester.digest().digest());
+
+		return Base64.encodeBase64(digester.digest().digest());
 	}
 
 	/**
@@ -2204,8 +2152,9 @@
 	static String	_sha1Help	= "${sha1;path}";
 
 	public String _sha1(String args[]) throws Exception {
-		Macro.verifyCommand(args, _sha1Help,
-				new Pattern[] {null, null, Pattern.compile("base64|hex")}, 2, 3);
+		Macro.verifyCommand(args, _sha1Help, new Pattern[] {
+				null, null, Pattern.compile("base64|hex")
+		}, 2, 3);
 		Digester<SHA1> digester = SHA1.getDigester();
 		Resource r = dot.getResource(args[1]);
 		if (r == null)
@@ -2248,7 +2197,6 @@
 	 * are ordered so that the instructor can define which pattern matches
 	 * first. Attributes in the instructions override any attributes from the
 	 * actual.<br/>
-	 * 
 	 * A pattern is a modified regexp so it looks like globbing. The * becomes a
 	 * .* just like the ? becomes a .?. '.' are replaced with \\. Additionally,
 	 * if the pattern starts with an exclamation mark, it will remove that
@@ -2263,10 +2211,10 @@
 	 * </ul>
 	 * Enough rope to hang the average developer I would say.
 	 * 
-	 * 
-	 * @param instructions the instructions with patterns.
-	 * @param source the actual found packages, contains no duplicates
-	 * 
+	 * @param instructions
+	 *            the instructions with patterns.
+	 * @param source
+	 *            the actual found packages, contains no duplicates
 	 * @return Only the packages that were filtered by the given instructions
 	 */
 
@@ -2319,8 +2267,7 @@
 			// doing and inserted a literal. So
 			// we ignore any not matched literals
 			if (instruction.isLiteral()) {
-				result.merge(getPackageRef(instruction.getLiteral()), true,
-						instructions.get(instruction));
+				result.merge(getPackageRef(instruction.getLiteral()), true, instructions.get(instruction));
 				i.remove();
 				continue;
 			}
@@ -2379,7 +2326,8 @@
 	 * Untitled-[n]
 	 * </pre>
 	 * 
-	 * @param output may be null, otherwise a file path relative to base
+	 * @param output
+	 *            may be null, otherwise a file path relative to base
 	 */
 	public File getOutputFile(String output) {
 
@@ -2394,16 +2342,14 @@
 				outputDir = outputFile;
 			else
 				return outputFile;
-		}
-		else
+		} else
 			outputDir = getBase();
 
 		if (getBundleSymbolicName() != null) {
 			String bsn = getBundleSymbolicName();
 			String version = getBundleVersion();
 			Version v = Version.parseVersion(version);
-			String outputName = bsn + "-" + v.getWithoutQualifier()
-					+ Constants.DEFAULT_JAR_EXTENSION;
+			String outputName = bsn + "-" + v.getWithoutQualifier() + Constants.DEFAULT_JAR_EXTENSION;
 			return new File(outputDir, outputName);
 		}
 
@@ -2413,8 +2359,7 @@
 			return new File(outputDir, outputName);
 		}
 
-		error("Cannot establish an output name from %s, nor bsn, nor source file name, using Untitled",
-				output);
+		error("Cannot establish an output name from %s, nor bsn, nor source file name, using Untitled", output);
 		int n = 0;
 		File f = getFile(outputDir, "Untitled");
 		while (f.isFile()) {
@@ -2428,9 +2373,11 @@
 	 * source file has the same path as the output. It will also only save if
 	 * the file was modified or the force flag is true
 	 * 
-	 * @param output the output file, if null {@link #getOutputFile(String)} is
-	 *        used.
-	 * @param force if it needs to be overwritten
+	 * @param output
+	 *            the output file, if null {@link #getOutputFile(String)} is
+	 *            used.
+	 * @param force
+	 *            if it needs to be overwritten
 	 * @throws Exception
 	 */
 
@@ -2441,8 +2388,8 @@
 		Jar jar = getJar();
 		File source = jar.getSource();
 
-		trace("check for modified build=%s file=%s, diff=%s", jar.lastModified(),
-				output.lastModified(), jar.lastModified() - output.lastModified());
+		trace("check for modified build=%s file=%s, diff=%s", jar.lastModified(), output.lastModified(),
+				jar.lastModified() - output.lastModified());
 
 		if (!output.exists() || output.lastModified() <= jar.lastModified() || force) {
 			output.getParentFile().mkdirs();
@@ -2450,8 +2397,7 @@
 				File bak = new File(source.getParentFile(), source.getName() + ".bak");
 				if (!source.renameTo(bak)) {
 					error("Could not create backup file %s", bak);
-				}
-				else
+				} else
 					source.delete();
 			}
 			try {
@@ -2464,10 +2410,9 @@
 			}
 			return true;
 		}
-		else {
-			trace("Not modified %s", output);
-			return false;
-		}
+		trace("Not modified %s", output);
+		return false;
+
 	}
 
 	/**
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java b/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java
new file mode 100644
index 0000000..3efea0a
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/AnalyzerMessages.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package aQute.lib.osgi;
+
+import aQute.libg.reporter.*;
+
+public interface AnalyzerMessages extends Messages {
+/**/
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java b/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
index 86f8caa..cafe0e3 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Annotation.java
@@ -6,16 +6,16 @@
 import aQute.bnd.annotation.metatype.*;
 import aQute.lib.osgi.Descriptors.TypeRef;
 
-@SuppressWarnings("unchecked") public class Annotation {
+@SuppressWarnings("unchecked")
+public class Annotation {
 	TypeRef				name;
-	Map<String, Object>	elements;
+	Map<String,Object>	elements;
 	ElementType			member;
 	RetentionPolicy		policy;
 
-	public Annotation(TypeRef name, Map<String, Object> elements, ElementType member,
-			RetentionPolicy policy) {
+	public Annotation(TypeRef name, Map<String,Object> elements, ElementType member, RetentionPolicy policy) {
 		this.name = name;
-		if ( elements == null)
+		if (elements == null)
 			this.elements = Collections.emptyMap();
 		else
 			this.elements = elements;
@@ -30,11 +30,11 @@
 	public ElementType getElementType() {
 		return member;
 	}
-	
+
 	public RetentionPolicy getRetentionPolicy() {
 		return policy;
 	}
-	
+
 	public String toString() {
 		return name + ":" + member + ":" + policy + ":" + elements;
 	}
@@ -56,19 +56,20 @@
 	public Set<String> keySet() {
 		if (elements == null)
 			return Collections.emptySet();
-		
+
 		return elements.keySet();
 	}
+
 	public <T extends java.lang.annotation.Annotation> T getAnnotation() throws Exception {
 		String cname = name.getFQN();
 		Class<T> c = (Class<T>) getClass().getClassLoader().loadClass(cname);
 		return getAnnotation(c);
 	}
-	public <T extends java.lang.annotation.Annotation> T getAnnotation(Class<T> c)
-			throws Exception {
+
+	public <T extends java.lang.annotation.Annotation> T getAnnotation(Class<T> c) throws Exception {
 		String cname = name.getFQN();
-		if ( ! c.getName().equals(cname))
+		if (!c.getName().equals(cname))
 			return null;
-		return Configurable.createConfigurable(c, elements );
+		return Configurable.createConfigurable(c, elements);
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
index 3126056..58d112d 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
@@ -23,19 +23,14 @@
 import aQute.libg.header.*;
 
 /**
- * Include-Resource: ( [name '=' ] file )+
- * 
- * Private-Package: package-decl ( ',' package-decl )*
- * 
- * Export-Package: package-decl ( ',' package-decl )*
- * 
+ * Include-Resource: ( [name '=' ] file )+ Private-Package: package-decl ( ','
+ * package-decl )* Export-Package: package-decl ( ',' package-decl )*
  * Import-Package: package-decl ( ',' package-decl )*
  * 
  * @version $Revision$
  */
 public class Builder extends Analyzer {
-	static Pattern					IR_PATTERN			= Pattern
-																.compile("[{]?-?@?(?:[^=]+=)?\\s*([^}!]+).*");
+	static Pattern					IR_PATTERN			= Pattern.compile("[{]?-?@?(?:[^=]+=)?\\s*([^}!]+).*");
 	private final DiffPluginImpl	differ				= new DiffPluginImpl();
 	private Pattern					xdoNotCopy			= null;
 	private static final int		SPLIT_MERGE_LAST	= 1;
@@ -50,8 +45,7 @@
 		super(parent);
 	}
 
-	public Builder() {
-	}
+	public Builder() {}
 
 	public Jar build() throws Exception {
 		trace("build");
@@ -60,8 +54,7 @@
 			return null;
 
 		if (getProperty(CONDUIT) != null)
-			error("Specified " + CONDUIT
-					+ " but calls build() instead of builds() (might be a programmer error");
+			error("Specified " + CONDUIT + " but calls build() instead of builds() (might be a programmer error");
 
 		Jar dot = new Jar("dot");
 		try {
@@ -77,6 +70,8 @@
 		doIncludeResources(dot);
 		doWab(dot);
 
+		doBndInfo(dot);
+
 		// Check if we override the calculation of the
 		// manifest. We still need to calculated it because
 		// we need to have analyzed the classpath.
@@ -95,8 +90,7 @@
 				catch (Exception e) {
 					error(MANIFEST + " while reading manifest file", e);
 				}
-			}
-			else {
+			} else {
 				error(MANIFEST + ", no such file " + mf);
 			}
 		}
@@ -133,6 +127,21 @@
 	}
 
 	/**
+	 * Make sure any bnd.info files are properly processed
+	 * 
+	 * @param jar
+	 */
+
+	private void doBndInfo(Jar jar) {
+		for (Entry<String,Resource> e : jar.getResources().entrySet()) {
+			if (e.getKey().endsWith("/bnd.info")) {
+				PreprocessResource pp = new PreprocessResource(this, e.getValue());
+				e.setValue(pp);
+			}
+		}
+	}
+
+	/**
 	 * Check if we need to calculate any checksums.
 	 * 
 	 * @param dot
@@ -215,16 +224,14 @@
 				for (String part : parts) {
 					File sub = getFile(f.getParentFile(), part);
 					if (!sub.exists() || !sub.getParentFile().equals(f.getParentFile())) {
-						warning("Invalid Class-Path entry %s in %s, must exist and must reside in same directory",
-								sub, f);
-					}
-					else {
+						warning("Invalid Class-Path entry %s in %s, must exist and must reside in same directory", sub,
+								f);
+					} else {
 						addWabLib(dot, sub);
 					}
 				}
 			}
-		}
-		else {
+		} else {
 			error("WAB lib does not exist %s", f);
 		}
 	}
@@ -255,14 +262,11 @@
 		changedFile(f);
 	}
 
-	protected void changedFile(File f) {
-	}
+	protected void changedFile(File f) {}
 
 	/**
-	 * Sign the jar file.
-	 * 
-	 * -sign : <alias> [ ';' 'password:=' <password> ] [ ';' 'keystore:='
-	 * <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )*
+	 * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';'
+	 * 'keystore:=' <keystore> ] [ ';' 'sign-password:=' <pw> ] ( ',' ... )*
 	 * 
 	 * @return
 	 */
@@ -276,7 +280,7 @@
 		List<SignerPlugin> signers = getPlugins(SignerPlugin.class);
 
 		Parameters infos = parseHeader(signing);
-		for (Entry<String, Attrs> entry : infos.entrySet()) {
+		for (Entry<String,Attrs> entry : infos.entrySet()) {
 			for (SignerPlugin signer : signers) {
 				signer.sign(this, entry.getKey());
 			}
@@ -303,7 +307,7 @@
 		addClose(jar);
 		for (PackageRef pref : referred) {
 			for (Jar cpe : getClasspath()) {
-				Map<String, Resource> map = cpe.getDirectories().get(pref.getPath());
+				Map<String,Resource> map = cpe.getDirectories().get(pref.getPath());
 				if (map != null) {
 					jar.addDirectory(map, false);
 					break;
@@ -335,7 +339,7 @@
 	}
 
 	public void cleanupVersion(Packages packages, String defaultVersion) {
-		for (Map.Entry<PackageRef, Attrs> entry : packages.entrySet()) {
+		for (Map.Entry<PackageRef,Attrs> entry : packages.entrySet()) {
 			Attrs attributes = entry.getValue();
 			String v = attributes.get(Constants.VERSION_ATTRIBUTE);
 			if (v == null && defaultVersion != null) {
@@ -343,8 +347,7 @@
 					v = defaultVersion;
 					if (isPedantic())
 						warning("Used bundle version %s for exported package %s", v, entry.getKey());
-				}
-				else {
+				} else {
 					if (isPedantic())
 						warning("No export version for exported package %s", entry.getKey());
 				}
@@ -369,8 +372,9 @@
 			String packagePath = packageRef.getPath();
 
 			boolean found = false;
-			String[] fixed = {"packageinfo", "package.html", "module-info.java",
-					"package-info.java"};
+			String[] fixed = {
+					"packageinfo", "package.html", "module-info.java", "package-info.java"
+			};
 
 			for (Iterator<File> i = getSourcePath().iterator(); i.hasNext();) {
 				File root = i.next();
@@ -401,8 +405,7 @@
 					Resource resource = jar.getResource(sourcePath);
 					if (resource != null) {
 						dot.putResource("OSGI-OPT/src/" + sourcePath, resource);
-					}
-					else {
+					} else {
 						resource = jar.getResource("OSGI-OPT/src/" + sourcePath);
 						if (resource != null) {
 							dot.putResource("OSGI-OPT/src/" + sourcePath, resource);
@@ -411,8 +414,7 @@
 				}
 			}
 			if (getSourcePath().isEmpty())
-				warning("Including sources but " + SOURCEPATH
-						+ " does not contain any source directories ");
+				warning("Including sources but " + SOURCEPATH + " does not contain any source directories ");
 			// TODO copy from the jars where they came from
 		}
 	}
@@ -432,8 +434,7 @@
 						File f = getFile(file);
 						if (!f.isDirectory()) {
 							error("Adding a sourcepath that is not a directory: " + f);
-						}
-						else {
+						} else {
 							sourcePath.add(f);
 						}
 					}
@@ -451,13 +452,13 @@
 		getInfo(verifier);
 	}
 
-	private void doExpand(Jar dot) throws IOException {
+	private void doExpand(Jar dot) {
 
 		// Build an index of the class path that we can then
 		// use destructively
-		MultiMap<String, Jar> packages = new MultiMap<String, Jar>();
+		MultiMap<String,Jar> packages = new MultiMap<String,Jar>();
 		for (Jar srce : getClasspath()) {
-			for (Entry<String, Map<String, Resource>> e : srce.getDirectories().entrySet()) {
+			for (Entry<String,Map<String,Resource>> e : srce.getDirectories().entrySet()) {
 				if (e.getValue() != null)
 					packages.add(e.getKey(), srce);
 			}
@@ -474,8 +475,7 @@
 			Set<Instruction> unused = doExpand(dot, packages, privateFilter);
 
 			if (!unused.isEmpty()) {
-				warning("Unused Private-Package instructions, no such package(s) on the class path: %s",
-						unused);
+				warning("Unused Private-Package instructions, no such package(s) on the class path: %s", unused);
 			}
 		}
 
@@ -500,10 +500,10 @@
 	 * @param name
 	 * @param instructions
 	 */
-	private Set<Instruction> doExpand(Jar jar, MultiMap<String, Jar> index, Instructions filter) {
+	private Set<Instruction> doExpand(Jar jar, MultiMap<String,Jar> index, Instructions filter) {
 		Set<Instruction> unused = Create.set();
 
-		for (Entry<Instruction, Attrs> e : filter.entrySet()) {
+		for (Entry<Instruction,Attrs> e : filter.entrySet()) {
 			Instruction instruction = e.getKey();
 			if (instruction.isDuplicate())
 				continue;
@@ -518,9 +518,8 @@
 
 			boolean used = false;
 
-			for (Iterator<Entry<String, List<Jar>>> entry = index.entrySet().iterator(); entry
-					.hasNext();) {
-				Entry<String, List<Jar>> p = entry.next();
+			for (Iterator<Entry<String,List<Jar>>> entry = index.entrySet().iterator(); entry.hasNext();) {
+				Entry<String,List<Jar>> p = entry.next();
 
 				String directory = p.getKey();
 				PackageRef packageRef = getPackageRef(directory);
@@ -626,14 +625,9 @@
 	private void copy(Jar dest, Jar srce, String path, boolean overwrite) {
 		dest.copy(srce, path, overwrite);
 
-		String key = path + "/bnd.info";
-		Resource r = dest.getResource(key);
-		if (r != null)
-			dest.putResource(key, new PreprocessResource(this, r));
-
 		if (hasSources()) {
 			String srcPath = "OSGI-OPT/src/" + path;
-			Map<String, Resource> srcContents = srce.getDirectories().get(srcPath);
+			Map<String,Resource> srcContents = srce.getDirectories().get(srcPath);
 			if (srcContents != null) {
 				dest.addDirectory(srcContents, overwrite);
 			}
@@ -680,16 +674,19 @@
 	/**
 	 * Matches the instructions against a package.
 	 * 
-	 * @param instructions The list of instructions
-	 * @param pack The name of the package
-	 * @param unused The total list of patterns, matched patterns are removed
-	 * @param source The name of the source container, can be filtered upon with
-	 *        the from: directive.
+	 * @param instructions
+	 *            The list of instructions
+	 * @param pack
+	 *            The name of the package
+	 * @param unused
+	 *            The total list of patterns, matched patterns are removed
+	 * @param source
+	 *            The name of the source container, can be filtered upon with
+	 *            the from: directive.
 	 * @return
 	 */
-	private Instruction matches(Instructions instructions, String pack, Set<Instruction> unused,
-			String source) {
-		for (Entry<Instruction, Attrs> entry : instructions.entrySet()) {
+	private Instruction matches(Instructions instructions, String pack, Set<Instruction> unused, String source) {
+		for (Entry<Instruction,Attrs> entry : instructions.entrySet()) {
 			Instruction pattern = entry.getKey();
 
 			// It is possible to filter on the source of the
@@ -728,8 +725,7 @@
 			includes = getProperty(INCLUDERESOURCE);
 			if (includes == null || includes.length() == 0)
 				includes = getProperty("Include-Resource");
-		}
-		else
+		} else
 			warning("Please use -includeresource instead of Bundle-Includes");
 
 		doIncludeResource(jar, includes);
@@ -741,15 +737,14 @@
 		doIncludeResource(jar, clauses);
 	}
 
-	private void doIncludeResource(Jar jar, Parameters clauses) throws ZipException, IOException,
-			Exception {
-		for (Entry<String, Attrs> entry : clauses.entrySet()) {
+	private void doIncludeResource(Jar jar, Parameters clauses) throws ZipException, IOException, Exception {
+		for (Entry<String,Attrs> entry : clauses.entrySet()) {
 			doIncludeResource(jar, entry.getKey(), entry.getValue());
 		}
 	}
 
-	private void doIncludeResource(Jar jar, String name, Map<String, String> extra)
-			throws ZipException, IOException, Exception {
+	private void doIncludeResource(Jar jar, String name, Map<String,String> extra) throws ZipException, IOException,
+			Exception {
 
 		boolean preprocess = false;
 		boolean absentIsOk = false;
@@ -771,56 +766,47 @@
 		}
 
 		if (source.startsWith("@")) {
-			extractFromJar(jar, source.substring(1), parts.length == 1 ? "" : destination,
-					absentIsOk);
-		}
-		else
-			if (extra.containsKey("cmd")) {
-				doCommand(jar, source, destination, extra, preprocess, absentIsOk);
+			extractFromJar(jar, source.substring(1), parts.length == 1 ? "" : destination, absentIsOk);
+		} else if (extra.containsKey("cmd")) {
+			doCommand(jar, source, destination, extra, preprocess, absentIsOk);
+		} else if (extra.containsKey("literal")) {
+			String literal = extra.get("literal");
+			Resource r = new EmbeddedResource(literal.getBytes("UTF-8"), 0);
+			String x = extra.get("extra");
+			if (x != null)
+				r.setExtra(x);
+			jar.putResource(name, r);
+		} else {
+			File sourceFile;
+			String destinationPath;
+
+			sourceFile = getFile(source);
+			if (parts.length == 1) {
+				// Directories should be copied to the root
+				// but files to their file name ...
+				if (sourceFile.isDirectory())
+					destinationPath = "";
+				else
+					destinationPath = sourceFile.getName();
+			} else {
+				destinationPath = parts[0];
 			}
-			else
-				if (extra.containsKey("literal")) {
-					String literal = extra.get("literal");
-					Resource r = new EmbeddedResource(literal.getBytes("UTF-8"), 0);
-					String x = extra.get("extra");
-					if (x != null)
-						r.setExtra(x);
-					jar.putResource(name, r);
-				}
-				else {
-					File sourceFile;
-					String destinationPath;
+			// Handle directories
+			if (sourceFile.isDirectory()) {
+				destinationPath = doResourceDirectory(jar, extra, preprocess, sourceFile, destinationPath);
+				return;
+			}
 
-					sourceFile = getFile(source);
-					if (parts.length == 1) {
-						// Directories should be copied to the root
-						// but files to their file name ...
-						if (sourceFile.isDirectory())
-							destinationPath = "";
-						else
-							destinationPath = sourceFile.getName();
-					}
-					else {
-						destinationPath = parts[0];
-					}
-					// Handle directories
-					if (sourceFile.isDirectory()) {
-						destinationPath = doResourceDirectory(jar, extra, preprocess, sourceFile,
-								destinationPath);
-						return;
-					}
+			// destinationPath = checkDestinationPath(destinationPath);
 
-					// destinationPath = checkDestinationPath(destinationPath);
+			if (!sourceFile.exists()) {
+				if (absentIsOk)
+					return;
 
-					if (!sourceFile.exists()) {
-						if (absentIsOk)
-							return;
-
-						noSuchFile(jar, name, extra, source, destinationPath);
-					}
-					else
-						copy(jar, destinationPath, sourceFile, preprocess, extra);
-				}
+				noSuchFile(jar, name, extra, source, destinationPath);
+			} else
+				copy(jar, destinationPath, sourceFile, preprocess, extra);
+		}
 	}
 
 	/**
@@ -831,13 +817,10 @@
 	 * {@link Macro#_lsa(String[])} or {@link Macro#_lsb(String[])} macro. The
 	 * repetition will repeat the given command for each item. The @} macro can
 	 * be used to replace the current item. If no {@code for} is given, the
-	 * source is used as the only item.
-	 * 
-	 * If the destination contains a macro, each iteration will create a new
-	 * file, otherwise the destination name is used.
-	 * 
-	 * The execution of the command is delayed until the JAR is actually written
-	 * to the file system for performance reasons.
+	 * source is used as the only item. If the destination contains a macro,
+	 * each iteration will create a new file, otherwise the destination name is
+	 * used. The execution of the command is delayed until the JAR is actually
+	 * written to the file system for performance reasons.
 	 * 
 	 * @param jar
 	 * @param source
@@ -846,8 +829,8 @@
 	 * @param preprocess
 	 * @param absentIsOk
 	 */
-	private void doCommand(Jar jar, String source, String destination, Map<String, String> extra,
-			boolean preprocess, boolean absentIsOk) {
+	private void doCommand(Jar jar, String source, String destination, Map<String,String> extra, boolean preprocess,
+			boolean absentIsOk) {
 		String repeat = extra.get("for"); // TODO constant
 		if (repeat == null)
 			repeat = source;
@@ -857,10 +840,9 @@
 		for (String required : requires) {
 			File file = getFile(required);
 			if (!file.isFile()) {
-				error("Include-Resource.cmd for %s, requires %s, but no such file %s", source,
-						required, file.getAbsoluteFile());
-			}
-			else
+				error("Include-Resource.cmd for %s, requires %s, but no such file %s", source, required,
+						file.getAbsoluteFile());
+			} else
 				lastModified = Math.max(lastModified, file.lastModified());
 		}
 
@@ -874,7 +856,7 @@
 			cr = new CombinedResource();
 		}
 		trace("last modified requires %s", lastModified);
-		
+
 		for (String item : items) {
 			setProperty("@", item);
 			try {
@@ -883,7 +865,7 @@
 				File file = getFile(item);
 
 				Resource r = new CommandResource(command, this, Math.max(lastModified,
-						file.exists() ? file.lastModified():0L));
+						file.exists() ? file.lastModified() : 0L));
 
 				if (preprocess)
 					r = new PreprocessResource(this, r);
@@ -897,15 +879,15 @@
 				unsetProperty("@");
 			}
 		}
-		
+
 		// Add last so the correct modification date is used
 		// to update the modified time.
-		if ( cr != null)
+		if (cr != null)
 			jar.putResource(destination, cr);
 	}
 
-	private String doResourceDirectory(Jar jar, Map<String, String> extra, boolean preprocess,
-			File sourceFile, String destinationPath) throws Exception {
+	private String doResourceDirectory(Jar jar, Map<String,String> extra, boolean preprocess, File sourceFile,
+			String destinationPath) throws Exception {
 		String filter = extra.get("filter:");
 		boolean flatten = isTrue(extra.get("flatten:"));
 		boolean recursive = true;
@@ -917,22 +899,21 @@
 		Instruction.Filter iFilter = null;
 		if (filter != null) {
 			iFilter = new Instruction.Filter(new Instruction(filter), recursive, getDoNotCopy());
-		}
-		else {
+		} else {
 			iFilter = new Instruction.Filter(null, recursive, getDoNotCopy());
 		}
 
-		Map<String, File> files = newMap();
+		Map<String,File> files = newMap();
 		resolveFiles(sourceFile, iFilter, recursive, destinationPath, files, flatten);
 
-		for (Map.Entry<String, File> entry : files.entrySet()) {
+		for (Map.Entry<String,File> entry : files.entrySet()) {
 			copy(jar, entry.getKey(), entry.getValue(), preprocess, extra);
 		}
 		return destinationPath;
 	}
 
-	private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path,
-			Map<String, File> files, boolean flatten) {
+	private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path, Map<String,File> files,
+			boolean flatten) {
 
 		if (doNotCopy(dir.getName())) {
 			return;
@@ -951,8 +932,7 @@
 					resolveFiles(file, filter, recursive, nextPath, files, flatten);
 				}
 				// Directories are ignored otherwise
-			}
-			else {
+			} else {
 				String p = appendPath(path, file.getName());
 				if (files.containsKey(p))
 					warning("Include-Resource overwrites entry %s from file %s", p, file);
@@ -961,8 +941,8 @@
 		}
 	}
 
-	private void noSuchFile(Jar jar, String clause, Map<String, String> extra, String source,
-			String destinationPath) throws Exception {
+	private void noSuchFile(Jar jar, String clause, Map<String,String> extra, String source, String destinationPath)
+			throws Exception {
 		Jar src = getJarFromName(source, "Include-Resource " + source);
 		if (src != null) {
 			// Do not touch the manifest so this also
@@ -970,16 +950,14 @@
 			src.setDoNotTouchManifest();
 			JarResource jarResource = new JarResource(src);
 			jar.putResource(destinationPath, jarResource);
-		}
-		else {
+		} else {
 			Resource lastChance = make.process(source);
 			if (lastChance != null) {
 				String x = extra.get("extra");
 				if (x != null)
 					lastChance.setExtra(x);
 				jar.putResource(destinationPath, lastChance);
-			}
-			else
+			} else
 				error("Input file does not exist: " + source);
 		}
 	}
@@ -994,8 +972,8 @@
 	 * @throws ZipException
 	 * @throws IOException
 	 */
-	private void extractFromJar(Jar jar, String source, String destination, boolean absentIsOk)
-			throws ZipException, IOException {
+	private void extractFromJar(Jar jar, String source, String destination, boolean absentIsOk) throws ZipException,
+			IOException {
 		// Inline all resources and classes from another jar
 		// optionally appended with a modified regular expression
 		// like @zip.jar!/META-INF/MANIFEST.MF
@@ -1018,8 +996,7 @@
 				return;
 
 			error("Can not find JAR file " + source);
-		}
-		else {
+		} else {
 			addAll(jar, sub, instr, destination);
 		}
 	}
@@ -1027,8 +1004,10 @@
 	/**
 	 * Add all the resources in the given jar that match the given filter.
 	 * 
-	 * @param sub the jar
-	 * @param filter a pattern that should match the resoures in sub to be added
+	 * @param sub
+	 *            the jar
+	 * @param filter
+	 *            a pattern that should match the resoures in sub to be added
 	 */
 	public boolean addAll(Jar to, Jar sub, Instruction filter) {
 		return addAll(to, sub, filter, "");
@@ -1037,8 +1016,10 @@
 	/**
 	 * Add all the resources in the given jar that match the given filter.
 	 * 
-	 * @param sub the jar
-	 * @param filter a pattern that should match the resoures in sub to be added
+	 * @param sub
+	 *            the jar
+	 * @param filter
+	 *            a pattern that should match the resoures in sub to be added
 	 */
 	public boolean addAll(Jar to, Jar sub, Instruction filter, String destination) {
 		boolean dupl = false;
@@ -1047,14 +1028,12 @@
 				continue;
 
 			if (filter == null || filter.matches(name) != filter.isNegated())
-				dupl |= to.putResource(Processor.appendPath(destination, name),
-						sub.getResource(name), true);
+				dupl |= to.putResource(Processor.appendPath(destination, name), sub.getResource(name), true);
 		}
 		return dupl;
 	}
 
-	private void copy(Jar jar, String path, File from, boolean preprocess, Map<String, String> extra)
-			throws Exception {
+	private void copy(Jar jar, String path, File from, boolean preprocess, Map<String,String> extra) throws Exception {
 		if (doNotCopy(from.getName()))
 			return;
 
@@ -1064,8 +1043,7 @@
 			for (int i = 0; i < files.length; i++) {
 				copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra);
 			}
-		}
-		else {
+		} else {
 			if (from.exists()) {
 				Resource resource = new FileResource(from);
 				if (preprocess) {
@@ -1081,8 +1059,7 @@
 				if (isTrue(extra.get(LIB_DIRECTIVE))) {
 					setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH), path));
 				}
-			}
-			else {
+			} else {
 				error("Input file does not exist: " + from);
 			}
 		}
@@ -1242,16 +1219,15 @@
 	public String _maven_version(String args[]) {
 		if (args.length > 2)
 			error("${maven_version} macro receives too many arguments " + Arrays.toString(args));
-		else
-			if (args.length < 2)
-				error("${maven_version} macro has no arguments, use ${maven_version;1.2.3-SNAPSHOT}");
-			else {
-				return cleanupVersion(args[1]);
-			}
+		else if (args.length < 2)
+			error("${maven_version} macro has no arguments, use ${maven_version;1.2.3-SNAPSHOT}");
+		else {
+			return cleanupVersion(args[1]);
+		}
 		return null;
 	}
 
-	public String _permissions(String args[]) throws IOException {
+	public String _permissions(String args[]) {
 		StringBuilder sb = new StringBuilder();
 
 		for (String arg : args) {
@@ -1268,16 +1244,12 @@
 					sb.append(exp);
 					sb.append("\" \"export\")\r\n");
 				}
-			}
+			} else if ("admin".equals(arg) || "all".equals(arg)) {
+				sb.append("(org.osgi.framework.AdminPermission)");
+			} else if ("permissions".equals(arg))
+				;
 			else
-				if ("admin".equals(arg) || "all".equals(arg)) {
-					sb.append("(org.osgi.framework.AdminPermission)");
-				}
-				else
-					if ("permissions".equals(arg))
-						;
-					else
-						error("Invalid option in ${permissions}: %s", arg);
+				error("Invalid option in ${permissions}: %s", arg);
 		}
 		return sb.toString();
 	}
@@ -1293,7 +1265,7 @@
 	/**
 	 * Check if the given resource is in scope of this bundle. That is, it
 	 * checks if the Include-Resource includes this resource or if it is a class
-	 * file it is on the class path and the Export-Pacakge or Private-Package
+	 * file it is on the class path and the Export-Package or Private-Package
 	 * include this resource.
 	 * 
 	 * @param f
@@ -1303,8 +1275,7 @@
 		Parameters clauses = parseHeader(getProperty(Constants.EXPORT_PACKAGE));
 		clauses.putAll(parseHeader(getProperty(Constants.PRIVATE_PACKAGE)));
 		if (isTrue(getProperty(Constants.UNDERTEST))) {
-			clauses.putAll(parseHeader(getProperty(Constants.TESTPACKAGES,
-					"test;presence:=optional")));
+			clauses.putAll(parseHeader(getProperty(Constants.TESTPACKAGES, "test;presence:=optional")));
 		}
 
 		Collection<String> ir = getIncludedResourcePrefixes();
@@ -1313,7 +1284,12 @@
 
 		for (File r : resources) {
 			String cpEntry = getClasspathEntrySuffix(r);
+
 			if (cpEntry != null) {
+
+				if (cpEntry.equals("")) // Meaning we actually have a CPE
+					return true;
+
 				String pack = Descriptors.getPackage(cpEntry);
 				Instruction i = matches(instructions, pack, null, r.getName());
 				if (i != null)
@@ -1340,7 +1316,7 @@
 	private Collection<String> getIncludedResourcePrefixes() {
 		List<String> prefixes = new ArrayList<String>();
 		Parameters includeResource = getIncludeResource();
-		for (Entry<String, Attrs> p : includeResource.entrySet()) {
+		for (Entry<String,Attrs> p : includeResource.entrySet()) {
 			if (p.getValue().containsKey("literal"))
 				continue;
 
@@ -1354,19 +1330,26 @@
 	}
 
 	/**
-	 * Answer the string of the resource that it has in the container.
+	 * Answer the string of the resource that it has in the container. It is
+	 * possible that the resource is a classpath entry. In that case an empty
+	 * string is returned.
 	 * 
-	 * @param resource The resource to look for
-	 * @return
+	 * @param resource
+	 *            The resource to look for
+	 * @return A suffix on the classpath or "" if the resource is a class path
+	 *         entry
 	 * @throws Exception
 	 */
 	public String getClasspathEntrySuffix(File resource) throws Exception {
 		for (Jar jar : getClasspath()) {
 			File source = jar.getSource();
 			if (source != null) {
+
 				source = source.getCanonicalFile();
 				String sourcePath = source.getAbsolutePath();
 				String resourcePath = resource.getAbsolutePath();
+				if (sourcePath.equals(resourcePath))
+					return ""; // Matches a classpath entry
 
 				if (resourcePath.startsWith(sourcePath)) {
 					// Make sure that the path name is translated correctly
@@ -1381,11 +1364,9 @@
 	}
 
 	/**
-	 * doNotCopy
-	 * 
-	 * The doNotCopy variable maintains a patter for files that should not be
-	 * copied. There is a default {@link #DEFAULT_DO_NOT_COPY} but this ca be
-	 * overridden with the {@link Constants#DONOTCOPY} property.
+	 * doNotCopy The doNotCopy variable maintains a patter for files that should
+	 * not be copied. There is a default {@link #DEFAULT_DO_NOT_COPY} but this
+	 * ca be overridden with the {@link Constants#DONOTCOPY} property.
 	 */
 
 	public boolean doNotCopy(String v) {
@@ -1442,7 +1423,7 @@
 		if (tree == null)
 			tree = differ.tree(this);
 
-		for (Entry<String, Attrs> entry : diffs.entrySet()) {
+		for (Entry<String,Attrs> entry : diffs.entrySet()) {
 			String path = entry.getKey();
 			File file = getFile(path);
 			if (!file.isFile()) {
@@ -1470,11 +1451,9 @@
 								error("Differ %s", p);
 						else {
 							if (warning)
-								warning("Diff found a difference in %s for packages %s", file,
-										instructions);
+								warning("Diff found a difference in %s for packages %s", file, instructions);
 							else
-								error("Diff found a difference in %s for packages %s", file,
-										instructions);
+								error("Diff found a difference in %s for packages %s", file, instructions);
 							show(p, "", warning);
 						}
 					}
@@ -1529,7 +1508,7 @@
 
 		Baseline baseline = new Baseline(this, differ);
 
-		for (Entry<String, Attrs> entry : diffs.entrySet()) {
+		for (Entry<String,Attrs> entry : diffs.entrySet()) {
 			String path = entry.getKey();
 			File file = getFile(path);
 			if (!file.isFile()) {
@@ -1540,9 +1519,8 @@
 			Set<Info> infos = baseline.baseline(dot, other, null);
 			for (Info info : infos) {
 				if (info.mismatch) {
-					error("%s %-50s %-10s %-10s %-10s %-10s %-10s\n", info.mismatch ? '*' : ' ',
-							info.packageName, info.packageDiff.getDelta(), info.newerVersion,
-							info.olderVersion, info.suggestedVersion,
+					error("%s %-50s %-10s %-10s %-10s %-10s %-10s\n", info.mismatch ? '*' : ' ', info.packageName,
+							info.packageDiff.getDelta(), info.newerVersion, info.olderVersion, info.suggestedVersion,
 							info.suggestedIfProviders == null ? "-" : info.suggestedIfProviders);
 				}
 			}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/BundleId.java b/bundleplugin/src/main/java/aQute/lib/osgi/BundleId.java
index e500e53..87fc25f 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/BundleId.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/BundleId.java
@@ -1,9 +1,7 @@
 package aQute.lib.osgi;
 
-
 /**
  * Holds the bundle bsn + version pair
- * 
  */
 public class BundleId implements Comparable<BundleId> {
 	final String	bsn;
@@ -29,16 +27,16 @@
 	public boolean equals(Object o) {
 		return this == o || ((o instanceof BundleId) && compareTo((BundleId) o) == 0);
 	}
-	
+
 	public int hashCode() {
 		return bsn.hashCode() ^ version.hashCode();
 	}
 
 	public int compareTo(BundleId other) {
 		int result = bsn.compareTo(other.bsn);
-		if ( result != 0)
+		if (result != 0)
 			return result;
-		
+
 		return version.compareTo(other.version);
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java b/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
index c878665..7c3d759 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
@@ -3,89 +3,81 @@
 import aQute.lib.osgi.Descriptors.TypeRef;
 
 public class ClassDataCollector {
-    public void classBegin(int access, TypeRef name) {
-    }
+	public void classBegin(int access, TypeRef name) {}
 
-    public boolean classStart(int access, TypeRef className) {
-        classBegin(access,className);
-        return true;
-    }
+	public boolean classStart(int access, TypeRef className) {
+		classBegin(access, className);
+		return true;
+	}
 
-    public void extendsClass(TypeRef zuper) throws Exception {
-    }
+	public void extendsClass(TypeRef zuper) throws Exception {}
 
-    public void implementsInterfaces(TypeRef[] interfaces) throws Exception {
-    }
+	public void implementsInterfaces(TypeRef[] interfaces) throws Exception {}
 
-    public void addReference(TypeRef ref) {
-    }
+	public void addReference(TypeRef ref) {}
 
-    public void annotation(Annotation annotation) {
-    }
+	public void annotation(Annotation annotation) {}
 
-    public void parameter(int p) {
-    }
+	public void parameter(int p) {}
 
-    public void method(Clazz.MethodDef defined) {
-    }
+	public void method(Clazz.MethodDef defined) {}
 
-    public void field(Clazz.FieldDef defined) {
-    }
+	public void field(Clazz.FieldDef defined) {}
 
-    public void reference(Clazz.MethodDef referenced) {
-    }
+	public void reference(Clazz.MethodDef referenced) {}
 
-    public void reference(Clazz.FieldDef referenced) {
-    }
+	public void reference(Clazz.FieldDef referenced) {}
 
-    public void classEnd() throws Exception {
-    }
+	public void classEnd() throws Exception {}
 
-    public void deprecated() throws Exception {
-    }
+	public void deprecated() throws Exception {}
 
-
-    /**
-     * The EnclosingMethod attribute
-     * 
-     * @param cName The name of the enclosing class, never null. Name is with slashes.
-     * @param mName The name of the enclosing method in the class with cName or null
-     * @param mDescriptor The descriptor of this type
-     */
+	/**
+	 * The EnclosingMethod attribute
+	 * 
+	 * @param cName
+	 *            The name of the enclosing class, never null. Name is with
+	 *            slashes.
+	 * @param mName
+	 *            The name of the enclosing method in the class with cName or
+	 *            null
+	 * @param mDescriptor
+	 *            The descriptor of this type
+	 */
 	public void enclosingMethod(TypeRef cName, String mName, String mDescriptor) {
-		
+
 	}
 
 	/**
 	 * The InnerClass attribute
 	 * 
-	 * @param innerClass The name of the inner class (with slashes). Can be null.
-	 * @param outerClass The name of the outer class (with slashes) Can be null.
-	 * @param innerName The name inside the outer class, can be null.
-	 * @param modifiers The access flags 
-	 * @throws Exception 
+	 * @param innerClass
+	 *            The name of the inner class (with slashes). Can be null.
+	 * @param outerClass
+	 *            The name of the outer class (with slashes) Can be null.
+	 * @param innerName
+	 *            The name inside the outer class, can be null.
+	 * @param modifiers
+	 *            The access flags
+	 * @throws Exception
 	 */
-	public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName,
-			int innerClassAccessFlags) throws Exception {		
-	}
+	public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
+			throws Exception {}
 
-	public void signature(String signature) {
-	}
+	public void signature(String signature) {}
 
-	public void constant(Object object) {
-	}
+	public void constant(Object object) {}
 
-	public void memberEnd() {
-	}
+	public void memberEnd() {}
 
 	public void version(int minor, int major) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
 	public void referenceMethod(int access, TypeRef className, String method, String descriptor) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java b/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java
index e182e1f..d54b084 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java
@@ -87,10 +87,8 @@
 
 	}
 
-	public final static EnumSet<QUERY>	HAS_ARGUMENT	= EnumSet.of(QUERY.IMPLEMENTS,
-																QUERY.EXTENDS, QUERY.IMPORTS,
-																QUERY.NAMED, QUERY.VERSION,
-																QUERY.ANNOTATED);
+	public final static EnumSet<QUERY>	HAS_ARGUMENT	= EnumSet.of(QUERY.IMPLEMENTS, QUERY.EXTENDS, QUERY.IMPORTS,
+																QUERY.NAMED, QUERY.VERSION, QUERY.ANNOTATED);
 
 	/**
 	 * <pre>
@@ -106,29 +104,29 @@
 	 * 
 	 * @param mod
 	 */
-	final static int					ACC_PUBLIC		= 0x0001;					// Declared
+	final static int					ACC_PUBLIC		= 0x0001;												// Declared
 	// public;
 	// may
 	// be
 	// accessed
 	// from outside its package.
-	final static int					ACC_FINAL		= 0x0010;					// Declared
+	final static int					ACC_FINAL		= 0x0010;												// Declared
 	// final;
 	// no
 	// subclasses
 	// allowed.
-	final static int					ACC_SUPER		= 0x0020;					// Treat
+	final static int					ACC_SUPER		= 0x0020;												// Treat
 	// superclass
 	// methods
 	// specially when invoked by the
 	// invokespecial instruction.
-	final static int					ACC_INTERFACE	= 0x0200;					// Is
+	final static int					ACC_INTERFACE	= 0x0200;												// Is
 	// an
 	// interface,
 	// not
 	// a
 	// classs
-	final static int					ACC_ABSTRACT	= 0x0400;					// Declared
+	final static int					ACC_ABSTRACT	= 0x0400;												// Declared
 
 	// a thing not in the source code
 	final static int					ACC_SYNTHETIC	= 0x1000;
@@ -303,7 +301,7 @@
 	}
 
 	final static byte	SkipTable[]	= { //
-									0, // 0 non existent
+			0, // 0 non existent
 			-1, // 1 CONSTANT_utf8 UTF 8, handled in
 			// method
 			-1, // 2
@@ -371,7 +369,8 @@
 		InputStream in = resource.openInputStream();
 		try {
 			return parseClassFile(in, cd);
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -381,7 +380,8 @@
 		try {
 			this.cd = cd;
 			return parseClassFile(din);
-		} finally {
+		}
+		finally {
 			cd = null;
 			din.close();
 		}
@@ -409,59 +409,59 @@
 		process: for (int poolIndex = 1; poolIndex < count; poolIndex++) {
 			byte tag = in.readByte();
 			switch (tag) {
-			case 0:
-				break process;
-			case 1:
-				constantUtf8(in, poolIndex);
-				break;
+				case 0 :
+					break process;
+				case 1 :
+					constantUtf8(in, poolIndex);
+					break;
 
-			case 3:
-				constantInteger(in, poolIndex);
-				break;
+				case 3 :
+					constantInteger(in, poolIndex);
+					break;
 
-			case 4:
-				constantFloat(in, poolIndex);
-				break;
+				case 4 :
+					constantFloat(in, poolIndex);
+					break;
 
-			// For some insane optimization reason are
-			// the long and the double two entries in the
-			// constant pool. See 4.4.5
-			case 5:
-				constantLong(in, poolIndex);
-				poolIndex++;
-				break;
+				// For some insane optimization reason are
+				// the long and the double two entries in the
+				// constant pool. See 4.4.5
+				case 5 :
+					constantLong(in, poolIndex);
+					poolIndex++;
+					break;
 
-			case 6:
-				constantDouble(in, poolIndex);
-				poolIndex++;
-				break;
+				case 6 :
+					constantDouble(in, poolIndex);
+					poolIndex++;
+					break;
 
-			case 7:
-				constantClass(in, poolIndex);
-				break;
+				case 7 :
+					constantClass(in, poolIndex);
+					break;
 
-			case 8:
-				constantString(in, poolIndex);
-				break;
+				case 8 :
+					constantString(in, poolIndex);
+					break;
 
-			case 10: // Method ref
-			case 11: // Interface Method ref
-				methodRef(in, poolIndex);
-				break;
+				case 10 : // Method ref
+				case 11 : // Interface Method ref
+					methodRef(in, poolIndex);
+					break;
 
-			// Name and Type
-			case 12:
-				nameAndType(in, poolIndex, tag);
-				break;
+				// Name and Type
+				case 12 :
+					nameAndType(in, poolIndex, tag);
+					break;
 
-			// We get the skip count for each record type
-			// from the SkipTable. This will also automatically
-			// abort when
-			default:
-				if (tag == 2)
-					throw new IOException("Invalid tag " + tag);
-				in.skipBytes(SkipTable[tag]);
-				break;
+				// We get the skip count for each record type
+				// from the SkipTable. This will also automatically
+				// abort when
+				default :
+					if (tag == 2)
+						throw new IOException("Invalid tag " + tag);
+					in.skipBytes(SkipTable[tag]);
+					break;
 			}
 		}
 
@@ -499,8 +499,7 @@
 			if (interfacesCount > 0) {
 				interfaces = new TypeRef[interfacesCount];
 				for (int i = 0; i < interfacesCount; i++)
-					interfaces[i] = analyzer.getTypeRef((String) pool[intPool[in
-							.readUnsignedShort()]]);
+					interfaces[i] = analyzer.getTypeRef((String) pool[intPool[in.readUnsignedShort()]]);
 				if (cd != null)
 					cd.implementsInterfaces(interfaces);
 			}
@@ -526,8 +525,7 @@
 					crawl = true;
 				}
 				if (cd != null)
-					cd.field(last = new FieldDef(access_flags, name, pool[descriptor_index]
-							.toString()));
+					cd.field(last = new FieldDef(access_flags, name, pool[descriptor_index].toString()));
 				descriptors.add(Integer.valueOf(descriptor_index));
 				doAttributes(in, ElementType.FIELD, false);
 			}
@@ -539,24 +537,21 @@
 			// can do this efficiently
 			//
 			if (crawl) {
-				forName = findMethodReference("java/lang/Class", "forName",
-						"(Ljava/lang/String;)Ljava/lang/Class;");
-				class$ = findMethodReference(className.getBinary(), "class$",
-						"(Ljava/lang/String;)Ljava/lang/Class;");
-			} else if (major == 48 ) {
-				forName = findMethodReference("java/lang/Class", "forName",
-						"(Ljava/lang/String;)Ljava/lang/Class;");
+				forName = findMethodReference("java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
+				class$ = findMethodReference(className.getBinary(), "class$", "(Ljava/lang/String;)Ljava/lang/Class;");
+			} else if (major == 48) {
+				forName = findMethodReference("java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;");
 				if (forName > 0) {
 					crawl = true;
 					class$ = findMethodReference(className.getBinary(), "class$",
 							"(Ljava/lang/String;)Ljava/lang/Class;");
 				}
 			}
-			
+
 			// There are some serious changes in the
 			// class file format. So we do not do any crawling
 			// it has also become less important
-			if ( major >= JAVA.OpenJDK7.major )
+			if (major >= JAVA.OpenJDK7.major)
 				crawl = false;
 
 			//
@@ -614,7 +609,8 @@
 			Set<TypeRef> xref = this.xref;
 			reset();
 			return xref;
-		} finally {
+		}
+		finally {
 			if (cd != null)
 				cd.classEnd();
 		}
@@ -633,8 +629,7 @@
 			pool[poolIndex] = intPool[poolIndex];
 	}
 
-	protected void pool(Object[] pool, int[] intPool) {
-	}
+	protected void pool(Object[] pool, int[] intPool) {}
 
 	/**
 	 * @param in
@@ -762,8 +757,7 @@
 	 *            The stream
 	 * @throws Exception
 	 */
-	private void doAttributes(DataInputStream in, ElementType member, boolean crawl)
-			throws Exception {
+	private void doAttributes(DataInputStream in, ElementType member, boolean crawl) throws Exception {
 		int attributesCount = in.readUnsignedShort();
 		for (int j = 0; j < attributesCount; j++) {
 			// skip name CONSTANT_Utf8 pointer
@@ -778,8 +772,7 @@
 	 *            the data stream
 	 * @throws Exception
 	 */
-	private void doAttribute(DataInputStream in, ElementType member, boolean crawl)
-			throws Exception {
+	private void doAttribute(DataInputStream in, ElementType member, boolean crawl) throws Exception {
 		int attribute_name_index = in.readUnsignedShort();
 		String attributeName = (String) pool[attribute_name_index];
 		long attribute_length = in.readInt();
@@ -825,7 +818,6 @@
 	 * }
 	 * </pre>
 	 * 
-	 * 
 	 * @param in
 	 * @throws IOException
 	 */
@@ -996,83 +988,84 @@
 		while (bb.remaining() > 0) {
 			int instruction = 0xFF & bb.get();
 			switch (instruction) {
-			case OpCodes.ldc:
-				lastReference = 0xFF & bb.get();
-				break;
+				case OpCodes.ldc :
+					lastReference = 0xFF & bb.get();
+					break;
 
-			case OpCodes.ldc_w:
-				lastReference = 0xFFFF & bb.getShort();
-				break;
+				case OpCodes.ldc_w :
+					lastReference = 0xFFFF & bb.getShort();
+					break;
 
-			case OpCodes.invokespecial: {
-				int mref = 0xFFFF & bb.getShort();
-				if (cd != null)
-					getMethodDef(0, mref);
-				break;
-			}
+				case OpCodes.invokespecial : {
+					int mref = 0xFFFF & bb.getShort();
+					if (cd != null)
+						getMethodDef(0, mref);
+					break;
+				}
 
-			case OpCodes.invokevirtual: {
-				int mref = 0xFFFF & bb.getShort();
-				if (cd != null)
-					getMethodDef(0, mref);
-				break;
-			}
+				case OpCodes.invokevirtual : {
+					int mref = 0xFFFF & bb.getShort();
+					if (cd != null)
+						getMethodDef(0, mref);
+					break;
+				}
 
-			case OpCodes.invokeinterface: {
-				int mref = 0xFFFF & bb.getShort();
-				if (cd != null)
-					getMethodDef(0, mref);
-				break;
-			}
+				case OpCodes.invokeinterface : {
+					int mref = 0xFFFF & bb.getShort();
+					if (cd != null)
+						getMethodDef(0, mref);
+					break;
+				}
 
-			case OpCodes.invokestatic: {
-				int methodref = 0xFFFF & bb.getShort();
-				if (cd != null)
-					getMethodDef(0, methodref);
+				case OpCodes.invokestatic : {
+					int methodref = 0xFFFF & bb.getShort();
+					if (cd != null)
+						getMethodDef(0, methodref);
 
-				if ((methodref == forName || methodref == class$) && lastReference != -1
-						&& pool[intPool[lastReference]] instanceof String) {
-					String fqn = (String) pool[intPool[lastReference]];
-					if (!fqn.equals("class") && fqn.indexOf('.') > 0) {
-						TypeRef clazz = analyzer.getTypeRefFromFQN(fqn);
-						referTo(clazz);
+					if ((methodref == forName || methodref == class$) && lastReference != -1
+							&& pool[intPool[lastReference]] instanceof String) {
+						String fqn = (String) pool[intPool[lastReference]];
+						if (!fqn.equals("class") && fqn.indexOf('.') > 0) {
+							TypeRef clazz = analyzer.getTypeRefFromFQN(fqn);
+							referTo(clazz);
+						}
+						lastReference = -1;
+					}
+					break;
+				}
+
+				case OpCodes.tableswitch :
+					// Skip to place divisible by 4
+					while ((bb.position() & 0x3) != 0)
+						bb.get();
+					/* int deflt = */
+					bb.getInt();
+					int low = bb.getInt();
+					int high = bb.getInt();
+					try {
+						bb.position(bb.position() + (high - low + 1) * 4);
+					}
+					catch (Exception e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
 					}
 					lastReference = -1;
-				}
-				break;
-			}
+					break;
 
-			case OpCodes.tableswitch:
-				// Skip to place divisible by 4
-				while ((bb.position() & 0x3) != 0)
-					bb.get();
-				/* int deflt = */
-				bb.getInt();
-				int low = bb.getInt();
-				int high = bb.getInt();
-				try {
-					bb.position(bb.position() + (high - low + 1) * 4);
-				} catch (Exception e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-				lastReference = -1;
-				break;
+				case OpCodes.lookupswitch :
+					// Skip to place divisible by 4
+					while ((bb.position() & 0x3) != 0)
+						bb.get();
+					/* deflt = */
+					bb.getInt();
+					int npairs = bb.getInt();
+					bb.position(bb.position() + npairs * 8);
+					lastReference = -1;
+					break;
 
-			case OpCodes.lookupswitch:
-				// Skip to place divisible by 4
-				while ((bb.position() & 0x3) != 0)
-					bb.get();
-				/* deflt = */
-				bb.getInt();
-				int npairs = bb.getInt();
-				bb.position(bb.position() + npairs * 8);
-				lastReference = -1;
-				break;
-
-			default:
-				lastReference = -1;
-				bb.position(bb.position() + OpCodes.OFFSETS[instruction]);
+				default :
+					lastReference = -1;
+					bb.position(bb.position() + OpCodes.OFFSETS[instruction]);
 			}
 		}
 	}
@@ -1082,8 +1075,8 @@
 		this.sourceFile = pool[sourcefile_index].toString();
 	}
 
-	private void doParameterAnnotations(DataInputStream in, ElementType member,
-			RetentionPolicy policy) throws IOException {
+	private void doParameterAnnotations(DataInputStream in, ElementType member, RetentionPolicy policy)
+			throws IOException {
 		int num_parameters = in.readUnsignedByte();
 		for (int p = 0; p < num_parameters; p++) {
 			if (cd != null)
@@ -1092,8 +1085,7 @@
 		}
 	}
 
-	private void doAnnotations(DataInputStream in, ElementType member, RetentionPolicy policy)
-			throws IOException {
+	private void doAnnotations(DataInputStream in, ElementType member, RetentionPolicy policy) throws IOException {
 		int num_annotations = in.readUnsignedShort(); // # of annotations
 		for (int a = 0; a < num_annotations; a++) {
 			if (cd == null)
@@ -1105,8 +1097,8 @@
 		}
 	}
 
-	private Annotation doAnnotation(DataInputStream in, ElementType member, RetentionPolicy policy,
-			boolean collect) throws IOException {
+	private Annotation doAnnotation(DataInputStream in, ElementType member, RetentionPolicy policy, boolean collect)
+			throws IOException {
 		int type_index = in.readUnsignedShort();
 		if (annotations == null)
 			annotations = new HashSet<TypeRef>();
@@ -1122,14 +1114,14 @@
 		}
 		TypeRef name = analyzer.getTypeRef((String) pool[type_index]);
 		int num_element_value_pairs = in.readUnsignedShort();
-		Map<String, Object> elements = null;
+		Map<String,Object> elements = null;
 		for (int v = 0; v < num_element_value_pairs; v++) {
 			int element_name_index = in.readUnsignedShort();
 			String element = (String) pool[element_name_index];
 			Object value = doElementValue(in, member, policy, collect);
 			if (collect) {
 				if (elements == null)
-					elements = new LinkedHashMap<String, Object>();
+					elements = new LinkedHashMap<String,Object>();
 				elements.put(element, value);
 			}
 		}
@@ -1139,56 +1131,54 @@
 			return null;
 	}
 
-	private Object doElementValue(DataInputStream in, ElementType member, RetentionPolicy policy,
-			boolean collect) throws IOException {
+	private Object doElementValue(DataInputStream in, ElementType member, RetentionPolicy policy, boolean collect)
+			throws IOException {
 		char tag = (char) in.readUnsignedByte();
 		switch (tag) {
-		case 'B': // Byte
-		case 'C': // Character
-		case 'I': // Integer
-		case 'S': // Short
-			int const_value_index = in.readUnsignedShort();
-			return intPool[const_value_index];
+			case 'B' : // Byte
+			case 'C' : // Character
+			case 'I' : // Integer
+			case 'S' : // Short
+				int const_value_index = in.readUnsignedShort();
+				return intPool[const_value_index];
 
-		case 'D': // Double
-		case 'F': // Float
-		case 's': // String
-		case 'J': // Long
-			const_value_index = in.readUnsignedShort();
-			return pool[const_value_index];
+			case 'D' : // Double
+			case 'F' : // Float
+			case 's' : // String
+			case 'J' : // Long
+				const_value_index = in.readUnsignedShort();
+				return pool[const_value_index];
 
-		case 'Z': // Boolean
-			const_value_index = in.readUnsignedShort();
-			return pool[const_value_index] == null || pool[const_value_index].equals(0) ? false
-					: true;
+			case 'Z' : // Boolean
+				const_value_index = in.readUnsignedShort();
+				return pool[const_value_index] == null || pool[const_value_index].equals(0) ? false : true;
 
-		case 'e': // enum constant
-			int type_name_index = in.readUnsignedShort();
-			if (policy == RetentionPolicy.RUNTIME)
-				descriptors.add(Integer.valueOf(type_name_index));
-			int const_name_index = in.readUnsignedShort();
-			return pool[const_name_index];
+			case 'e' : // enum constant
+				int type_name_index = in.readUnsignedShort();
+				if (policy == RetentionPolicy.RUNTIME)
+					descriptors.add(Integer.valueOf(type_name_index));
+				int const_name_index = in.readUnsignedShort();
+				return pool[const_name_index];
 
-		case 'c': // Class
-			int class_info_index = in.readUnsignedShort();
-			if (policy == RetentionPolicy.RUNTIME)
-				descriptors.add(Integer.valueOf(class_info_index));
-			return pool[class_info_index];
+			case 'c' : // Class
+				int class_info_index = in.readUnsignedShort();
+				if (policy == RetentionPolicy.RUNTIME)
+					descriptors.add(Integer.valueOf(class_info_index));
+				return pool[class_info_index];
 
-		case '@': // Annotation type
-			return doAnnotation(in, member, policy, collect);
+			case '@' : // Annotation type
+				return doAnnotation(in, member, policy, collect);
 
-		case '[': // Array
-			int num_values = in.readUnsignedShort();
-			Object[] result = new Object[num_values];
-			for (int i = 0; i < num_values; i++) {
-				result[i] = doElementValue(in, member, policy, collect);
-			}
-			return result;
+			case '[' : // Array
+				int num_values = in.readUnsignedShort();
+				Object[] result = new Object[num_values];
+				for (int i = 0; i < num_values; i++) {
+					result[i] = doElementValue(in, member, policy, collect);
+				}
+				return result;
 
-		default:
-			throw new IllegalArgumentException("Invalid value for Annotation ElementValue tag "
-					+ tag);
+			default :
+				throw new IllegalArgumentException("Invalid value for Annotation ElementValue tag " + tag);
 		}
 	}
 
@@ -1213,9 +1203,7 @@
 
 	/**
 	 * This method parses a descriptor and adds the package of the descriptor to
-	 * the referenced packages.
-	 * 
-	 * The syntax of the descriptor is:
+	 * the referenced packages. The syntax of the descriptor is:
 	 * 
 	 * <pre>
 	 *   descriptor ::= ( '(' reference * ')' )? reference
@@ -1363,17 +1351,12 @@
 	}
 
 	/**
-	 * .class construct for different compilers
-	 * 
-	 * sun 1.1 Detect static variable class$com$acme$MyClass 1.2 " 1.3 " 1.4 "
-	 * 1.5 ldc_w (class) 1.6 "
-	 * 
-	 * eclipse 1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 "
-	 * 1.5 ldc (class) 1.6 "
-	 * 
-	 * 1.5 and later is not an issue, sun pre 1.5 is easy to detect the static
-	 * variable that decodes the class name. For eclipse, the class$0 gives away
-	 * we have a reference encoded in a string.
+	 * .class construct for different compilers sun 1.1 Detect static variable
+	 * class$com$acme$MyClass 1.2 " 1.3 " 1.4 " 1.5 ldc_w (class) 1.6 " eclipse
+	 * 1.1 class$0, ldc (string), invokestatic Class.forName 1.2 " 1.3 " 1.5 ldc
+	 * (class) 1.6 " 1.5 and later is not an issue, sun pre 1.5 is easy to
+	 * detect the static variable that decodes the class name. For eclipse, the
+	 * class$0 gives away we have a reference encoded in a string.
 	 * compilerversions/compilerversions.jar contains test versions of all
 	 * versions/compilers.
 	 */
@@ -1388,65 +1371,65 @@
 
 	public boolean is(QUERY query, Instruction instr, Analyzer analyzer) throws Exception {
 		switch (query) {
-		case ANY:
-			return true;
+			case ANY :
+				return true;
 
-		case NAMED:
-			if (instr.matches(getClassName().getDottedOnly()))
-				return !instr.isNegated();
-			return false;
-
-		case VERSION:
-			String v = major + "." + minor;
-			if (instr.matches(v))
-				return !instr.isNegated();
-			return false;
-
-		case IMPLEMENTS:
-			for (int i = 0; interfaces != null && i < interfaces.length; i++) {
-				if (instr.matches(interfaces[i].getDottedOnly()))
+			case NAMED :
+				if (instr.matches(getClassName().getDottedOnly()))
 					return !instr.isNegated();
-			}
-			break;
-
-		case EXTENDS:
-			if (zuper == null)
 				return false;
 
-			if (instr.matches(zuper.getDottedOnly()))
-				return !instr.isNegated();
-			break;
-
-		case PUBLIC:
-			return Modifier.isPublic(accessx);
-
-		case CONCRETE:
-			return !Modifier.isAbstract(accessx);
-
-		case ANNOTATED:
-			if (annotations == null)
+			case VERSION :
+				String v = major + "." + minor;
+				if (instr.matches(v))
+					return !instr.isNegated();
 				return false;
 
-			for (TypeRef annotation : annotations) {
-				if (instr.matches(annotation.getFQN()))
+			case IMPLEMENTS :
+				for (int i = 0; interfaces != null && i < interfaces.length; i++) {
+					if (instr.matches(interfaces[i].getDottedOnly()))
+						return !instr.isNegated();
+				}
+				break;
+
+			case EXTENDS :
+				if (zuper == null)
+					return false;
+
+				if (instr.matches(zuper.getDottedOnly()))
 					return !instr.isNegated();
-			}
+				break;
 
-			return false;
+			case PUBLIC :
+				return Modifier.isPublic(accessx);
 
-		case RUNTIMEANNOTATIONS:
-			return hasClassAnnotations;
-		case CLASSANNOTATIONS:
-			return hasClassAnnotations;
+			case CONCRETE :
+				return !Modifier.isAbstract(accessx);
 
-		case ABSTRACT:
-			return Modifier.isAbstract(accessx);
+			case ANNOTATED :
+				if (annotations == null)
+					return false;
 
-		case IMPORTS:
-			for (PackageRef imp : imports) {
-				if (instr.matches(imp.getFQN()))
-					return !instr.isNegated();
-			}
+				for (TypeRef annotation : annotations) {
+					if (instr.matches(annotation.getFQN()))
+						return !instr.isNegated();
+				}
+
+				return false;
+
+			case RUNTIMEANNOTATIONS :
+				return hasClassAnnotations;
+			case CLASSANNOTATIONS :
+				return hasClassAnnotations;
+
+			case ABSTRACT :
+				return Modifier.isAbstract(accessx);
+
+			case IMPORTS :
+				for (PackageRef imp : imports) {
+					if (instr.matches(imp.getFQN()))
+						return !instr.isNegated();
+				}
 		}
 
 		if (zuper == null)
@@ -1465,12 +1448,11 @@
 
 	/**
 	 * Called when crawling the byte code and a method reference is found
-	 * 
 	 */
 	void getMethodDef(int access, int methodRefPoolIndex) {
-		if ( methodRefPoolIndex == 0)
+		if (methodRefPoolIndex == 0)
 			return;
-		
+
 		Object o = pool[methodRefPoolIndex];
 		if (o != null && o instanceof Assoc) {
 			Assoc assoc = (Assoc) o;
@@ -1493,8 +1475,7 @@
 				throw new IllegalArgumentException(
 						"Invalid class file (or parsing is wrong), Assoc is not method ref! (10)");
 		} else
-			throw new IllegalArgumentException(
-					"Invalid class file (or parsing is wrong), Not an assoc at a method ref");
+			throw new IllegalArgumentException("Invalid class file (or parsing is wrong), Not an assoc at a method ref");
 	}
 
 	public boolean isPublic() {
@@ -1519,26 +1500,26 @@
 			return string.substring(1, string.length() - 1).replace('/', '.');
 
 		switch (string.charAt(0)) {
-		case 'V':
-			return "void";
-		case 'B':
-			return "byte";
-		case 'C':
-			return "char";
-		case 'I':
-			return "int";
-		case 'S':
-			return "short";
-		case 'D':
-			return "double";
-		case 'F':
-			return "float";
-		case 'J':
-			return "long";
-		case 'Z':
-			return "boolean";
-		case '[': // Array
-			return objectDescriptorToFQN(string.substring(1)) + "[]";
+			case 'V' :
+				return "void";
+			case 'B' :
+				return "byte";
+			case 'C' :
+				return "char";
+			case 'I' :
+				return "int";
+			case 'S' :
+				return "short";
+			case 'D' :
+				return "double";
+			case 'F' :
+				return "float";
+			case 'J' :
+				return "long";
+			case 'Z' :
+				return "boolean";
+			case '[' : // Array
+				return objectDescriptorToFQN(string.substring(1)) + "[]";
 		}
 		throw new IllegalArgumentException("Invalid type character in descriptor " + string);
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
index e8566db..d76b695 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CombinedResource.java
@@ -14,16 +14,15 @@
  * limitations under the License.
  */
 
-
 package aQute.lib.osgi;
 
 import java.io.*;
 import java.util.*;
 
 public class CombinedResource extends WriteResource {
-	final List<Resource> resources = new ArrayList<Resource>();
-	long lastModified = 0;
-	
+	final List<Resource>	resources		= new ArrayList<Resource>();
+	long					lastModified	= 0;
+
 	@Override
 	public void write(final OutputStream out) throws IOException, Exception {
 		OutputStream unclosable = new FilterOutputStream(out) {
@@ -31,7 +30,7 @@
 				// Ignore
 			}
 		};
-		for ( Resource r : resources ) {
+		for (Resource r : resources) {
 			r.write(unclosable);
 			unclosable.flush();
 		}
@@ -47,5 +46,4 @@
 		resources.add(r);
 	}
 
-
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
index c9e3c8a..0fa43fe 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-
 package aQute.lib.osgi;
 
 import java.io.*;
@@ -22,10 +21,10 @@
 import aQute.libg.command.*;
 
 public class CommandResource extends WriteResource {
-	final long lastModified;
-	final Builder domain;
-	final String command;
-	
+	final long		lastModified;
+	final Builder	domain;
+	final String	command;
+
 	public CommandResource(String command, Builder domain, long lastModified) {
 		this.lastModified = lastModified;
 		this.domain = domain;
@@ -38,25 +37,26 @@
 		StringBuilder stdout = new StringBuilder();
 		try {
 			domain.trace("executing command %s", command);
-			Command cmd = new Command("sh -l");
+			Command cmd = new Command("sh");
 			cmd.inherit();
 			String oldpath = cmd.var("PATH");
-			
+
 			String path = domain.getProperty("-PATH");
 			if (path != null) {
-				path = path.replaceAll("\\s*,\\s*",File.pathSeparator);
+				path = path.replaceAll("\\s*,\\s*", File.pathSeparator);
 				path = path.replaceAll("\\$\\{@\\}", oldpath);
 				cmd.var("PATH", path);
 				domain.trace("PATH: %s", path);
 			}
 			OutputStreamWriter osw = new OutputStreamWriter(out);
-			int result = cmd.execute(command,stdout, errors);
+			int result = cmd.execute(command, stdout, errors);
 			osw.append(stdout);
 			osw.flush();
-			if ( result != 0) {
+			if (result != 0) {
 				domain.error("executing command failed %s %s", command, stdout + "\n" + errors);
 			}
-		} catch( Exception e) {
+		}
+		catch (Exception e) {
 			domain.error("executing command failed %s %s", command, e.getMessage());
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
index 8df703f..df0bbf0 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
@@ -12,294 +12,293 @@
 	 * @syntax Bundle-ActivationPolicy ::= policy ( ’;’ directive )* policy ::=
 	 *         ’lazy’
 	 */
-	String								BND_ADDXMLTOTEST							= "Bnd-AddXMLToTest";
-	String								BUNDLE_ACTIVATIONPOLICY						= "Bundle-ActivationPolicy";
-	String								BUNDLE_ACTIVATOR							= "Bundle-Activator";
-	String								BUNDLE_BLUEPRINT							= "Bundle-Copyright";
-	String								BUNDLE_CATEGORY								= "Bundle-Category";
-	String								BUNDLE_CLASSPATH							= "Bundle-ClassPath";
-	String								BUNDLE_CONTACTADDRESS						= "Bundle-ContactAddress";
-	String								BUNDLE_COPYRIGHT							= "Bundle-Copyright";
-	String								BUNDLE_DESCRIPTION							= "Bundle-Description";
-	String								BUNDLE_DOCURL								= "Bundle-DocURL";
-	String								BUNDLE_ICON									= "Bundle-Icon";
-	String								BUNDLE_LICENSE								= "Bundle-License";
-	String								BUNDLE_LOCALIZATION							= "Bundle-Localization";
-	String								BUNDLE_MANIFESTVERSION						= "Bundle-ManifestVersion";
-	String								BUNDLE_NAME									= "Bundle-Name";
-	String								BUNDLE_NATIVECODE							= "Bundle-NativeCode";
-	String								BUNDLE_REQUIREDEXECUTIONENVIRONMENT			= "Bundle-RequiredExecutionEnvironment";
-	String								BUNDLE_SYMBOLICNAME							= "Bundle-SymbolicName";
-	String								BUNDLE_UPDATELOCATION						= "Bundle-UpdateLocation";
-	String								BUNDLE_VENDOR								= "Bundle-Vendor";
-	String								BUNDLE_VERSION								= "Bundle-Version";
-	String								DYNAMICIMPORT_PACKAGE						= "DynamicImport-Package";
-	String								EXPORT_PACKAGE								= "Export-Package";
-	String								EXPORT_SERVICE								= "Export-Service";
-	String								FRAGMENT_HOST								= "Fragment-Host";
-	String								IMPORT_PACKAGE								= "Import-Package";
-	String								IMPORT_SERVICE								= "Import-Service";
-	String								PROVIDE_CAPABILITY							= "Provide-Capability";
-	String								REQUIRE_BUNDLE								= "Require-Bundle";
-	String								REQUIRE_CAPABILITY							= "Require-Capability";
-	String								SERVICE_COMPONENT							= "Service-Component";
+	String							BND_ADDXMLTOTEST							= "Bnd-AddXMLToTest";
+	String							BUNDLE_ACTIVATIONPOLICY						= "Bundle-ActivationPolicy";
+	String							BUNDLE_ACTIVATOR							= "Bundle-Activator";
+	String							BUNDLE_BLUEPRINT							= "Bundle-Copyright";
+	String							BUNDLE_CATEGORY								= "Bundle-Category";
+	String							BUNDLE_CLASSPATH							= "Bundle-ClassPath";
+	String							BUNDLE_CONTACTADDRESS						= "Bundle-ContactAddress";
+	String							BUNDLE_COPYRIGHT							= "Bundle-Copyright";
+	String							BUNDLE_DESCRIPTION							= "Bundle-Description";
+	String							BUNDLE_DOCURL								= "Bundle-DocURL";
+	String							BUNDLE_ICON									= "Bundle-Icon";
+	String							BUNDLE_LICENSE								= "Bundle-License";
+	String							BUNDLE_LOCALIZATION							= "Bundle-Localization";
+	String							BUNDLE_MANIFESTVERSION						= "Bundle-ManifestVersion";
+	String							BUNDLE_NAME									= "Bundle-Name";
+	String							BUNDLE_NATIVECODE							= "Bundle-NativeCode";
+	String							BUNDLE_REQUIREDEXECUTIONENVIRONMENT			= "Bundle-RequiredExecutionEnvironment";
+	String							BUNDLE_SYMBOLICNAME							= "Bundle-SymbolicName";
+	String							BUNDLE_UPDATELOCATION						= "Bundle-UpdateLocation";
+	String							BUNDLE_VENDOR								= "Bundle-Vendor";
+	String							BUNDLE_VERSION								= "Bundle-Version";
+	String							DYNAMICIMPORT_PACKAGE						= "DynamicImport-Package";
+	String							EXPORT_PACKAGE								= "Export-Package";
+	String							EXPORT_SERVICE								= "Export-Service";
+	String							FRAGMENT_HOST								= "Fragment-Host";
+	String							IMPORT_PACKAGE								= "Import-Package";
+	String							IMPORT_SERVICE								= "Import-Service";
+	String							PROVIDE_CAPABILITY							= "Provide-Capability";
+	String							REQUIRE_BUNDLE								= "Require-Bundle";
+	String							REQUIRE_CAPABILITY							= "Require-Capability";
+	String							SERVICE_COMPONENT							= "Service-Component";
 
-	String								PRIVATE_PACKAGE								= "Private-Package";
-	String								IGNORE_PACKAGE								= "Ignore-Package";
-	String								INCLUDE_RESOURCE							= "Include-Resource";
-	String								CONDITIONAL_PACKAGE							= "Conditional-Package";
-	String								BND_LASTMODIFIED							= "Bnd-LastModified";
-	String								CREATED_BY									= "Created-By";
-	String								TOOL										= "Tool";
-	String								TESTCASES									= "Test-Cases";
-	String								SIGNATURE_TEST								= "-signaturetest";
+	String							PRIVATE_PACKAGE								= "Private-Package";
+	String							IGNORE_PACKAGE								= "Ignore-Package";
+	String							INCLUDE_RESOURCE							= "Include-Resource";
+	String							CONDITIONAL_PACKAGE							= "Conditional-Package";
+	String							BND_LASTMODIFIED							= "Bnd-LastModified";
+	String							CREATED_BY									= "Created-By";
+	String							TOOL										= "Tool";
+	String							TESTCASES									= "Test-Cases";
+	String							SIGNATURE_TEST								= "-signaturetest";
 
-	String								headers[]									= {
-			BUNDLE_ACTIVATOR, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION,
-			BUNDLE_DOCURL, BUNDLE_LOCALIZATION, BUNDLE_NATIVECODE, BUNDLE_VENDOR, BUNDLE_VERSION,
-			BUNDLE_LICENSE, BUNDLE_CLASSPATH, SERVICE_COMPONENT, EXPORT_PACKAGE, IMPORT_PACKAGE,
-			BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION, BUNDLE_NAME, BUNDLE_NATIVECODE,
-			BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION,
-			FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, INCLUDE_RESOURCE, REQUIRE_BUNDLE,
-			IMPORT_SERVICE, EXPORT_SERVICE, CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES,
-			SIGNATURE_TEST, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY					};
+	String							headers[]									= {
+			BUNDLE_ACTIVATOR, BUNDLE_CONTACTADDRESS, BUNDLE_COPYRIGHT, BUNDLE_DESCRIPTION, BUNDLE_DOCURL,
+			BUNDLE_LOCALIZATION, BUNDLE_NATIVECODE, BUNDLE_VENDOR, BUNDLE_VERSION, BUNDLE_LICENSE, BUNDLE_CLASSPATH,
+			SERVICE_COMPONENT, EXPORT_PACKAGE, IMPORT_PACKAGE, BUNDLE_LOCALIZATION, BUNDLE_MANIFESTVERSION,
+			BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_REQUIREDEXECUTIONENVIRONMENT, BUNDLE_SYMBOLICNAME, BUNDLE_VERSION,
+			FRAGMENT_HOST, PRIVATE_PACKAGE, IGNORE_PACKAGE, INCLUDE_RESOURCE, REQUIRE_BUNDLE, IMPORT_SERVICE,
+			EXPORT_SERVICE, CONDITIONAL_PACKAGE, BND_LASTMODIFIED, TESTCASES, SIGNATURE_TEST, REQUIRE_CAPABILITY,
+			PROVIDE_CAPABILITY
+																				};
 
-	String								BUILDPATH									= "-buildpath";
-	String								BUILDPACKAGES								= "-buildpackages";
-	String								BUMPPOLICY									= "-bumppolicy";
-	String								CONDUIT										= "-conduit";
-	String								COMPILER_SOURCE								= "-source";
-	String								COMPILER_TARGET								= "-target";
-	String								DEPENDSON									= "-dependson";
-	String								DEPLOY										= "-deploy";
-	String								DEPLOYREPO									= "-deployrepo";
-	String								DIGESTS										= "-digests";
-	String								DSANNOTATIONS								= "-dsannotations";
-	String								DONOTCOPY									= "-donotcopy";
-	String								DEBUG										= "-debug";
-	String								EXPORT_CONTENTS								= "-exportcontents";
-	String								FAIL_OK										= "-failok";
-	String								INCLUDE										= "-include";
-	String								INCLUDERESOURCE								= "-includeresource";
-	String								MAKE										= "-make";
-	String								METATYPE									= "-metatype";
-	String								MANIFEST									= "-manifest";
-	String								SAVEMANIFEST								= "-savemanifest";
-	String								NAMESECTION									= "-namesection";
-	String								NODEFAULTVERSION							= "-nodefaultversion";
-	String								NOEXTRAHEADERS								= "-noextraheaders";
-	String								NOMANIFEST									= "-nomanifest";
-	String								NOUSES										= "-nouses";
+	String							BUILDPATH									= "-buildpath";
+	String							BUILDPACKAGES								= "-buildpackages";
+	String							BUMPPOLICY									= "-bumppolicy";
+	String							CONDUIT										= "-conduit";
+	String							COMPILER_SOURCE								= "-source";
+	String							COMPILER_TARGET								= "-target";
+	String							DEPENDSON									= "-dependson";
+	String							DEPLOY										= "-deploy";
+	String							DEPLOYREPO									= "-deployrepo";
+	String							DIGESTS										= "-digests";
+	String							DSANNOTATIONS								= "-dsannotations";
+	String							DONOTCOPY									= "-donotcopy";
+	String							DEBUG										= "-debug";
+	String							EXPORT_CONTENTS								= "-exportcontents";
+	String							FAIL_OK										= "-failok";
+	String							INCLUDE										= "-include";
+	String							INCLUDERESOURCE								= "-includeresource";
+	String							MAKE										= "-make";
+	String							METATYPE									= "-metatype";
+	String							MANIFEST									= "-manifest";
+	String							SAVEMANIFEST								= "-savemanifest";
+	String							NAMESECTION									= "-namesection";
+	String							NODEFAULTVERSION							= "-nodefaultversion";
+	String							NOEXTRAHEADERS								= "-noextraheaders";
+	String							NOMANIFEST									= "-nomanifest";
+	String							NOUSES										= "-nouses";
 	@Deprecated
-	String								NOPE										= "-nope";
-	String								NOBUNDLES									= "-nobundles";
-	String								PEDANTIC									= "-pedantic";
-	String								PLUGIN										= "-plugin";
-	String								PLUGINPATH									= "-pluginpath";
-	String								POM											= "-pom";
-	String								RELEASEREPO									= "-releaserepo";
-	String								REMOVEHEADERS								= "-removeheaders";
-	String								RESOURCEONLY								= "-resourceonly";
-	String								SOURCES										= "-sources";
-	String								SOURCEPATH									= "-sourcepath";
-	String								SUB											= "-sub";
-	String								RUNPROPERTIES								= "-runproperties";
-	String								RUNSYSTEMPACKAGES							= "-runsystempackages";
-	String								RUNBUNDLES									= "-runbundles";
-	String								RUNPATH										= "-runpath";
-	String								RUNSTORAGE									= "-runstorage";
-	String								RUNBUILDS									= "-runbuilds";
-	String								RUNPATH_MAIN_DIRECTIVE						= "main:";
-	String								RUNPATH_LAUNCHER_DIRECTIVE					= "launcher:";
-	String								RUNVM										= "-runvm";
-	String								RUNTRACE									= "-runtrace";
-	String								RUNFRAMEWORK								= "-runframework";
-	String								RUNTIMEOUT									= "-runtimeout";
-	String								SNAPSHOT									= "-snapshot";
-	String								RUNFRAMEWORK_SERVICES						= "services";
-	String								RUNFRAMEWORK_NONE							= "none";
-	String								REPORTNEWER									= "-reportnewer";
-	String								SIGN										= "-sign";
-	String								TESTPACKAGES								= "-testpackages";
-	String								TESTREPORT									= "-testreport";
-	String								TESTPATH									= "-testpath";
-	String								TESTCONTINUOUS								= "-testcontinuous";
-	String								UNDERTEST									= "-undertest";
-	String								VERBOSE										= "-verbose";
+	String							NOPE										= "-nope";
+	String							NOBUNDLES									= "-nobundles";
+	String							PEDANTIC									= "-pedantic";
+	String							PLUGIN										= "-plugin";
+	String							PLUGINPATH									= "-pluginpath";
+	String							POM											= "-pom";
+	String							RELEASEREPO									= "-releaserepo";
+	String							REMOVEHEADERS								= "-removeheaders";
+	String							RESOURCEONLY								= "-resourceonly";
+	String							SOURCES										= "-sources";
+	String							SOURCEPATH									= "-sourcepath";
+	String							SUB											= "-sub";
+	String							RUNPROPERTIES								= "-runproperties";
+	String							RUNSYSTEMPACKAGES							= "-runsystempackages";
+	String							RUNBUNDLES									= "-runbundles";
+	String							RUNPATH										= "-runpath";
+	String							RUNSTORAGE									= "-runstorage";
+	String							RUNBUILDS									= "-runbuilds";
+	String							RUNPATH_MAIN_DIRECTIVE						= "main:";
+	String							RUNPATH_LAUNCHER_DIRECTIVE					= "launcher:";
+	String							RUNVM										= "-runvm";
+	String							RUNTRACE									= "-runtrace";
+	String							RUNFRAMEWORK								= "-runframework";
+	String							RUNTIMEOUT									= "-runtimeout";
+	String							SNAPSHOT									= "-snapshot";
+	String							RUNFRAMEWORK_SERVICES						= "services";
+	String							RUNFRAMEWORK_NONE							= "none";
+	String							REPORTNEWER									= "-reportnewer";
+	String							SIGN										= "-sign";
+	String							TESTPACKAGES								= "-testpackages";
+	String							TESTREPORT									= "-testreport";
+	String							TESTPATH									= "-testpath";
+	String							TESTCONTINUOUS								= "-testcontinuous";
+	String							UNDERTEST									= "-undertest";
+	String							VERBOSE										= "-verbose";
 	@Deprecated
-	String								VERSIONPOLICY_IMPL							= "-versionpolicy-impl";
+	String							VERSIONPOLICY_IMPL							= "-versionpolicy-impl";
 	@Deprecated
-	String								VERSIONPOLICY_USES							= "-versionpolicy-uses";
-	String								PROVIDER_POLICY								= "-provider-policy";
-	String								CONSUMER_POLICY								= "-consumer-policy";
+	String							VERSIONPOLICY_USES							= "-versionpolicy-uses";
+	String							PROVIDER_POLICY								= "-provider-policy";
+	String							CONSUMER_POLICY								= "-consumer-policy";
 	@Deprecated
-	String								VERSIONPOLICY								= "-versionpolicy";
-	String								WAB											= "-wab";
-	String								WABLIB										= "-wablib";
-	String								REQUIRE_BND									= "-require-bnd";
+	String							VERSIONPOLICY								= "-versionpolicy";
+	String							WAB											= "-wab";
+	String							WABLIB										= "-wablib";
+	String							REQUIRE_BND									= "-require-bnd";
 
 	// Deprecated
-	String								CLASSPATH									= "-classpath";
-	String								OUTPUT										= "-output";
+	String							CLASSPATH									= "-classpath";
+	String							OUTPUT										= "-output";
 
-	String								options[]									= {BUILDPATH,
-			BUMPPOLICY, CONDUIT, CLASSPATH, CONSUMER_POLICY, DEPENDSON, DONOTCOPY, EXPORT_CONTENTS,
-			FAIL_OK, INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, NOEXTRAHEADERS, NOUSES, NOBUNDLES,
-			PEDANTIC, PLUGIN, POM, PROVIDER_POLICY, REMOVEHEADERS, RESOURCEONLY, SOURCES,
-			SOURCEPATH, SOURCES, SOURCEPATH, SUB, RUNBUNDLES, RUNPATH, RUNSYSTEMPACKAGES,
-			RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTPATH, TESTPACKAGES, TESTREPORT, VERBOSE,
-			NOMANIFEST, DEPLOYREPO, RELEASEREPO, SAVEMANIFEST, RUNVM, WAB, WABLIB, RUNFRAMEWORK,
-			RUNTRACE, TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS, DSANNOTATIONS				};
+	String							options[]									= {
+			BUILDPATH, BUMPPOLICY, CONDUIT, CLASSPATH, CONSUMER_POLICY, DEPENDSON, DONOTCOPY, EXPORT_CONTENTS, FAIL_OK,
+			INCLUDE, INCLUDERESOURCE, MAKE, MANIFEST, NOEXTRAHEADERS, NOUSES, NOBUNDLES, PEDANTIC, PLUGIN, POM,
+			PROVIDER_POLICY, REMOVEHEADERS, RESOURCEONLY, SOURCES, SOURCEPATH, SOURCES, SOURCEPATH, SUB, RUNBUNDLES,
+			RUNPATH, RUNSYSTEMPACKAGES, RUNPROPERTIES, REPORTNEWER, UNDERTEST, TESTPATH, TESTPACKAGES, TESTREPORT,
+			VERBOSE, NOMANIFEST, DEPLOYREPO, RELEASEREPO, SAVEMANIFEST, RUNVM, WAB, WABLIB, RUNFRAMEWORK, RUNTRACE,
+			TESTCONTINUOUS, SNAPSHOT, NAMESECTION, DIGESTS, DSANNOTATIONS
+																				};
 
 	// Ignore bundle specific headers. These bundles do not make
 	// a lot of sense to inherit
-	String[]							BUNDLE_SPECIFIC_HEADERS						= new String[] {
-			INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, BUNDLE_NATIVECODE,
-			BUNDLE_SYMBOLICNAME, IMPORT_PACKAGE, EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE,
-			FRAGMENT_HOST, REQUIRE_BUNDLE, PRIVATE_PACKAGE, EXPORT_CONTENTS, TESTCASES, NOMANIFEST,
-			SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY, PROVIDE_CAPABILITY, DSANNOTATIONS, SERVICE_COMPONENT		};
+	String[]						BUNDLE_SPECIFIC_HEADERS						= new String[] {
+			INCLUDE_RESOURCE, BUNDLE_ACTIVATOR, BUNDLE_CLASSPATH, BUNDLE_NAME, BUNDLE_NATIVECODE, BUNDLE_SYMBOLICNAME,
+			IMPORT_PACKAGE, EXPORT_PACKAGE, DYNAMICIMPORT_PACKAGE, FRAGMENT_HOST, REQUIRE_BUNDLE, PRIVATE_PACKAGE,
+			EXPORT_CONTENTS, TESTCASES, NOMANIFEST, SIGNATURE_TEST, WAB, WABLIB, REQUIRE_CAPABILITY,
+			PROVIDE_CAPABILITY, DSANNOTATIONS, SERVICE_COMPONENT
+																				};
 
-	char								DUPLICATE_MARKER							= '~';
-	String								SPECIFICATION_VERSION						= "specification-version";
-	String								SPLIT_PACKAGE_DIRECTIVE						= "-split-package:";
-	String								IMPORT_DIRECTIVE							= "-import:";
-	String								NO_IMPORT_DIRECTIVE							= "-noimport:";
-	String								REMOVE_ATTRIBUTE_DIRECTIVE					= "-remove-attribute:";
-	String								LIB_DIRECTIVE								= "lib:";
-	String								NOANNOTATIONS								= "-noannotations";
-	String								COMMAND_DIRECTIVE							= "command:";
-	String								USES_DIRECTIVE								= "uses:";
-	String								MANDATORY_DIRECTIVE							= "mandatory:";
-	String								INCLUDE_DIRECTIVE							= "include:";
-	String								PROVIDE_DIRECTIVE							= "provide:";
-	String								EXCLUDE_DIRECTIVE							= "exclude:";
-	String								PRESENCE_DIRECTIVE							= "presence:";
-	String								PRIVATE_DIRECTIVE							= "private:";
-	String								SINGLETON_DIRECTIVE							= "singleton:";
-	String								EXTENSION_DIRECTIVE							= "extension:";
-	String								VISIBILITY_DIRECTIVE						= "visibility:";
-	String								FRAGMENT_ATTACHMENT_DIRECTIVE				= "fragment-attachment:";
-	String								RESOLUTION_DIRECTIVE						= "resolution:";
-	String								PATH_DIRECTIVE								= "path:";
-	String								SIZE_ATTRIBUTE								= "size";
-	String								LINK_ATTRIBUTE								= "link";
-	String								NAME_ATTRIBUTE								= "name";
-	String								DESCRIPTION_ATTRIBUTE						= "description";
-	String								OSNAME_ATTRIBUTE							= "osname";
-	String								OSVERSION_ATTRIBUTE							= "osversion";
-	String								PROCESSOR_ATTRIBUTE							= "processor";
-	String								LANGUAGE_ATTRIBUTE							= "language";
-	String								SELECTION_FILTER_ATTRIBUTE					= "selection-filter";
-	String								BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE	= "blueprint.wait-for-dependencies";
-	String								BLUEPRINT_TIMEOUT_ATTRIBUTE					= "blueprint.timeout";
-	String								VERSION_ATTRIBUTE							= "version";
-	String								BUNDLE_SYMBOLIC_NAME_ATTRIBUTE				= "bundle-symbolic-name";
-	String								BUNDLE_VERSION_ATTRIBUTE					= "bundle-version";
-	String								FROM_DIRECTIVE								= "from:";
+	char							DUPLICATE_MARKER							= '~';
+	String							SPECIFICATION_VERSION						= "specification-version";
+	String							SPLIT_PACKAGE_DIRECTIVE						= "-split-package:";
+	String							IMPORT_DIRECTIVE							= "-import:";
+	String							NO_IMPORT_DIRECTIVE							= "-noimport:";
+	String							REMOVE_ATTRIBUTE_DIRECTIVE					= "-remove-attribute:";
+	String							LIB_DIRECTIVE								= "lib:";
+	String							NOANNOTATIONS								= "-noannotations";
+	String							COMMAND_DIRECTIVE							= "command:";
+	String							USES_DIRECTIVE								= "uses:";
+	String							MANDATORY_DIRECTIVE							= "mandatory:";
+	String							INCLUDE_DIRECTIVE							= "include:";
+	String							PROVIDE_DIRECTIVE							= "provide:";
+	String							EXCLUDE_DIRECTIVE							= "exclude:";
+	String							PRESENCE_DIRECTIVE							= "presence:";
+	String							PRIVATE_DIRECTIVE							= "private:";
+	String							SINGLETON_DIRECTIVE							= "singleton:";
+	String							EXTENSION_DIRECTIVE							= "extension:";
+	String							VISIBILITY_DIRECTIVE						= "visibility:";
+	String							FRAGMENT_ATTACHMENT_DIRECTIVE				= "fragment-attachment:";
+	String							RESOLUTION_DIRECTIVE						= "resolution:";
+	String							PATH_DIRECTIVE								= "path:";
+	String							SIZE_ATTRIBUTE								= "size";
+	String							LINK_ATTRIBUTE								= "link";
+	String							NAME_ATTRIBUTE								= "name";
+	String							DESCRIPTION_ATTRIBUTE						= "description";
+	String							OSNAME_ATTRIBUTE							= "osname";
+	String							OSVERSION_ATTRIBUTE							= "osversion";
+	String							PROCESSOR_ATTRIBUTE							= "processor";
+	String							LANGUAGE_ATTRIBUTE							= "language";
+	String							SELECTION_FILTER_ATTRIBUTE					= "selection-filter";
+	String							BLUEPRINT_WAIT_FOR_DEPENDENCIES_ATTRIBUTE	= "blueprint.wait-for-dependencies";
+	String							BLUEPRINT_TIMEOUT_ATTRIBUTE					= "blueprint.timeout";
+	String							VERSION_ATTRIBUTE							= "version";
+	String							BUNDLE_SYMBOLIC_NAME_ATTRIBUTE				= "bundle-symbolic-name";
+	String							BUNDLE_VERSION_ATTRIBUTE					= "bundle-version";
+	String							FROM_DIRECTIVE								= "from:";
 
-	String								KEYSTORE_LOCATION_DIRECTIVE					= "keystore:";
-	String								KEYSTORE_PROVIDER_DIRECTIVE					= "provider:";
-	String								KEYSTORE_PASSWORD_DIRECTIVE					= "password:";
-	String								SIGN_PASSWORD_DIRECTIVE						= "sign-password:";
+	String							KEYSTORE_LOCATION_DIRECTIVE					= "keystore:";
+	String							KEYSTORE_PROVIDER_DIRECTIVE					= "provider:";
+	String							KEYSTORE_PASSWORD_DIRECTIVE					= "password:";
+	String							SIGN_PASSWORD_DIRECTIVE						= "sign-password:";
 
-	String								NONE										= "none";
+	String							NONE										= "none";
 
-	String								directives[]								= {
-			SPLIT_PACKAGE_DIRECTIVE, NO_IMPORT_DIRECTIVE, IMPORT_DIRECTIVE, RESOLUTION_DIRECTIVE,
-			INCLUDE_DIRECTIVE, USES_DIRECTIVE, EXCLUDE_DIRECTIVE, KEYSTORE_LOCATION_DIRECTIVE,
-			KEYSTORE_PROVIDER_DIRECTIVE, KEYSTORE_PASSWORD_DIRECTIVE, SIGN_PASSWORD_DIRECTIVE,
-			COMMAND_DIRECTIVE, NOANNOTATIONS, LIB_DIRECTIVE, RUNPATH_LAUNCHER_DIRECTIVE,
-			FROM_DIRECTIVE, PRIVATE_DIRECTIVE
+	String							directives[]								= {
+			SPLIT_PACKAGE_DIRECTIVE, NO_IMPORT_DIRECTIVE, IMPORT_DIRECTIVE, RESOLUTION_DIRECTIVE, INCLUDE_DIRECTIVE,
+			USES_DIRECTIVE, EXCLUDE_DIRECTIVE, KEYSTORE_LOCATION_DIRECTIVE, KEYSTORE_PROVIDER_DIRECTIVE,
+			KEYSTORE_PASSWORD_DIRECTIVE, SIGN_PASSWORD_DIRECTIVE, COMMAND_DIRECTIVE, NOANNOTATIONS, LIB_DIRECTIVE,
+			RUNPATH_LAUNCHER_DIRECTIVE, FROM_DIRECTIVE, PRIVATE_DIRECTIVE
 
-																					// TODO
-																					};
+																				// TODO
+																				};
 
-	String								USES_USES									= "<<USES>>";
-	String								CURRENT_USES								= "@uses";
-	String								IMPORT_REFERENCE							= "reference";
-	String								IMPORT_PRIVATE								= "private";
-	String[]							importDirectives							= {
-			IMPORT_REFERENCE, IMPORT_PRIVATE										};
+	String							USES_USES									= "<<USES>>";
+	String							CURRENT_USES								= "@uses";
+	String							IMPORT_REFERENCE							= "reference";
+	String							IMPORT_PRIVATE								= "private";
+	String[]						importDirectives							= {
+			IMPORT_REFERENCE, IMPORT_PRIVATE
+																				};
 
-	static final Pattern				VALID_PROPERTY_TYPES						= Pattern
-																							.compile("(String|Long|Double|Float|Integer|Byte|Character|Boolean|Short)");
+	static final Pattern			VALID_PROPERTY_TYPES						= Pattern
+																						.compile("(String|Long|Double|Float|Integer|Byte|Character|Boolean|Short)");
 
-	String								DEFAULT_BND_EXTENSION						= ".bnd";
-	String								DEFAULT_JAR_EXTENSION						= ".jar";
-	String								DEFAULT_BAR_EXTENSION						= ".bar";
-	String								DEFAULT_BNDRUN_EXTENSION					= ".bndrun";
-	String[]							METAPACKAGES								= {"META-INF",
-			"OSGI-INF", "OSGI-OPT"													};
+	String							DEFAULT_BND_EXTENSION						= ".bnd";
+	String							DEFAULT_JAR_EXTENSION						= ".jar";
+	String							DEFAULT_BAR_EXTENSION						= ".bar";
+	String							DEFAULT_BNDRUN_EXTENSION					= ".bndrun";
+	String[]						METAPACKAGES								= {
+			"META-INF", "OSGI-INF", "OSGI-OPT"
+																				};
 
-	String								CURRENT_VERSION								= "@";
-	String								CURRENT_PACKAGE								= "@package";
+	String							CURRENT_VERSION								= "@";
+	String							CURRENT_PACKAGE								= "@package";
 
-	String								BUILDFILES									= "buildfiles";
+	String							BUILDFILES									= "buildfiles";
 
-	String								EMPTY_HEADER								= "<<EMPTY>>";
+	String							EMPTY_HEADER								= "<<EMPTY>>";
 
-	String								EMBEDDED_REPO								= "/embedded-repo.jar";
-	String								LAUNCHER_PLUGIN								= "Launcher-Plugin";
-	String								TESTER_PLUGIN								= "Tester-Plugin";
+	String							EMBEDDED_REPO								= "/embedded-repo.jar";
+	String							LAUNCHER_PLUGIN								= "Launcher-Plugin";
+	String							TESTER_PLUGIN								= "Tester-Plugin";
 
-	String								DEFAULT_LAUNCHER_BSN						= "biz.aQute.launcher";
-	String								DEFAULT_TESTER_BSN							= "biz.aQute.junit";
+	String							DEFAULT_LAUNCHER_BSN						= "biz.aQute.launcher";
+	String							DEFAULT_TESTER_BSN							= "biz.aQute.junit";
 
-	String								DEFAULT_DO_NOT_COPY							= "CVS|\\.svn|\\.git|\\.DS_Store";
+	String							DEFAULT_DO_NOT_COPY							= "CVS|\\.svn|\\.git|\\.DS_Store";
 
-	Charset								DEFAULT_CHARSET								= Charset
-																							.forName("UTF8");
-	String								VERSION_FILTER								= "version";
-	String								PROVIDER_TYPE_DIRECTIVE						= "x-provider-type:";
+	Charset							DEFAULT_CHARSET								= Charset.forName("UTF8");
+	String							VERSION_FILTER								= "version";
+	String							PROVIDER_TYPE_DIRECTIVE						= "x-provider-type:";
 
 	/**
 	 * Component constants
 	 */
-	public final static String			NAMESPACE_STEM								= "http://www.osgi.org/xmlns/scr";
-	public final static String			JIDENTIFIER									= "<<identifier>>";
-	public final static String			COMPONENT_NAME								= "name:";
-	public final static String			COMPONENT_FACTORY							= "factory:";
-	public final static String			COMPONENT_SERVICEFACTORY					= "servicefactory:";
-	public final static String			COMPONENT_IMMEDIATE							= "immediate:";
-	public final static String			COMPONENT_ENABLED							= "enabled:";
-	public final static String			COMPONENT_DYNAMIC							= "dynamic:";
-	public final static String			COMPONENT_MULTIPLE							= "multiple:";
-	public final static String			COMPONENT_PROVIDE							= "provide:";
-	public final static String			COMPONENT_OPTIONAL							= "optional:";
-	public final static String			COMPONENT_PROPERTIES						= "properties:";
-	public final static String			COMPONENT_IMPLEMENTATION					= "implementation:";
-	public final static String			COMPONENT_DESIGNATE							= "designate:";
-	public final static String			COMPONENT_DESIGNATEFACTORY					= "designateFactory:";
-	public final static String			COMPONENT_DESCRIPTORS						= ".descriptors:";
+	public final static String		NAMESPACE_STEM								= "http://www.osgi.org/xmlns/scr";
+	public final static String		JIDENTIFIER									= "<<identifier>>";
+	public final static String		COMPONENT_NAME								= "name:";
+	public final static String		COMPONENT_FACTORY							= "factory:";
+	public final static String		COMPONENT_SERVICEFACTORY					= "servicefactory:";
+	public final static String		COMPONENT_IMMEDIATE							= "immediate:";
+	public final static String		COMPONENT_ENABLED							= "enabled:";
+	public final static String		COMPONENT_DYNAMIC							= "dynamic:";
+	public final static String		COMPONENT_MULTIPLE							= "multiple:";
+	public final static String		COMPONENT_PROVIDE							= "provide:";
+	public final static String		COMPONENT_OPTIONAL							= "optional:";
+	public final static String		COMPONENT_PROPERTIES						= "properties:";
+	public final static String		COMPONENT_IMPLEMENTATION					= "implementation:";
+	public final static String		COMPONENT_DESIGNATE							= "designate:";
+	public final static String		COMPONENT_DESIGNATEFACTORY					= "designateFactory:";
+	public final static String		COMPONENT_DESCRIPTORS						= ".descriptors:";
 
 	// v1.1.0
-	public final static String			COMPONENT_VERSION							= "version:";
-	public final static String			COMPONENT_CONFIGURATION_POLICY				= "configuration-policy:";
-	public final static String			COMPONENT_MODIFIED							= "modified:";
-	public final static String			COMPONENT_ACTIVATE							= "activate:";
-	public final static String			COMPONENT_DEACTIVATE						= "deactivate:";
+	public final static String		COMPONENT_VERSION							= "version:";
+	public final static String		COMPONENT_CONFIGURATION_POLICY				= "configuration-policy:";
+	public final static String		COMPONENT_MODIFIED							= "modified:";
+	public final static String		COMPONENT_ACTIVATE							= "activate:";
+	public final static String		COMPONENT_DEACTIVATE						= "deactivate:";
 
-	final static Map<String, String>	EMPTY										= Collections
-																							.emptyMap();
+	final static Map<String,String>	EMPTY										= Collections.emptyMap();
 
-	public final static String[]		componentDirectives							= new String[] {
-			COMPONENT_FACTORY, COMPONENT_IMMEDIATE, COMPONENT_ENABLED, COMPONENT_DYNAMIC,
-			COMPONENT_MULTIPLE, COMPONENT_PROVIDE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES,
-			COMPONENT_IMPLEMENTATION, COMPONENT_SERVICEFACTORY, COMPONENT_VERSION,
-			COMPONENT_CONFIGURATION_POLICY, COMPONENT_MODIFIED, COMPONENT_ACTIVATE,
-			COMPONENT_DEACTIVATE, COMPONENT_NAME, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE,
-			COMPONENT_DESIGNATEFACTORY												};
+	public final static String[]	componentDirectives							= new String[] {
+			COMPONENT_FACTORY, COMPONENT_IMMEDIATE, COMPONENT_ENABLED, COMPONENT_DYNAMIC, COMPONENT_MULTIPLE,
+			COMPONENT_PROVIDE, COMPONENT_OPTIONAL, COMPONENT_PROPERTIES, COMPONENT_IMPLEMENTATION,
+			COMPONENT_SERVICEFACTORY, COMPONENT_VERSION, COMPONENT_CONFIGURATION_POLICY, COMPONENT_MODIFIED,
+			COMPONENT_ACTIVATE, COMPONENT_DEACTIVATE, COMPONENT_NAME, COMPONENT_DESCRIPTORS, COMPONENT_DESIGNATE,
+			COMPONENT_DESIGNATEFACTORY
+																				};
 
-	public final static Set<String>		SET_COMPONENT_DIRECTIVES					= new HashSet<String>(
-																							Arrays.asList(componentDirectives));
+	public final static Set<String>	SET_COMPONENT_DIRECTIVES					= new HashSet<String>(
+																						Arrays.asList(componentDirectives));
 
-	public final static Set<String>		SET_COMPONENT_DIRECTIVES_1_1				= //
-																					new HashSet<String>(
-																							Arrays.asList(
-																									COMPONENT_VERSION,
-																									COMPONENT_CONFIGURATION_POLICY,
-																									COMPONENT_MODIFIED,
-																									COMPONENT_ACTIVATE,
-																									COMPONENT_DEACTIVATE));
+	public final static Set<String>	SET_COMPONENT_DIRECTIVES_1_1				= //
+																				new HashSet<String>(Arrays.asList(
+																						COMPONENT_VERSION,
+																						COMPONENT_CONFIGURATION_POLICY,
+																						COMPONENT_MODIFIED,
+																						COMPONENT_ACTIVATE,
+																						COMPONENT_DEACTIVATE));
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Descriptors.java b/bundleplugin/src/main/java/aQute/lib/osgi/Descriptors.java
index 366ca57..c15e436 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Descriptors.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Descriptors.java
@@ -5,30 +5,29 @@
 import aQute.libg.generics.*;
 
 public class Descriptors {
-	Map<String, TypeRef>	typeRefCache	= Create.map();
-	Map<String, Descriptor>	descriptorCache	= Create.map();
-	Map<String, PackageRef>	packageCache	= Create.map();
+	Map<String,TypeRef>		typeRefCache		= Create.map();
+	Map<String,Descriptor>	descriptorCache		= Create.map();
+	Map<String,PackageRef>	packageCache		= Create.map();
 
 	// MUST BE BEFORE PRIMITIVES, THEY USE THE DEFAULT PACKAGE!!
-	final static PackageRef	DEFAULT_PACKAGE	= new PackageRef();
+	final static PackageRef	DEFAULT_PACKAGE		= new PackageRef();
 	final static PackageRef	PRIMITIVE_PACKAGE	= new PackageRef();
-	
-	final static TypeRef	VOID			= new ConcreteRef("V", "void", PRIMITIVE_PACKAGE);
-	final static TypeRef	BOOLEAN			= new ConcreteRef("Z", "boolean", PRIMITIVE_PACKAGE);
-	final static TypeRef	BYTE			= new ConcreteRef("B", "byte", PRIMITIVE_PACKAGE);
-	final static TypeRef	CHAR			= new ConcreteRef("C", "char", PRIMITIVE_PACKAGE);
-	final static TypeRef	SHORT			= new ConcreteRef("S", "short", PRIMITIVE_PACKAGE);
-	final static TypeRef	INTEGER			= new ConcreteRef("I", "int", PRIMITIVE_PACKAGE);
-	final static TypeRef	LONG			= new ConcreteRef("J", "long", PRIMITIVE_PACKAGE);
-	final static TypeRef	DOUBLE			= new ConcreteRef("D", "double", PRIMITIVE_PACKAGE);
-	final static TypeRef	FLOAT			= new ConcreteRef("F", "float", PRIMITIVE_PACKAGE);
 
+	final static TypeRef	VOID				= new ConcreteRef("V", "void", PRIMITIVE_PACKAGE);
+	final static TypeRef	BOOLEAN				= new ConcreteRef("Z", "boolean", PRIMITIVE_PACKAGE);
+	final static TypeRef	BYTE				= new ConcreteRef("B", "byte", PRIMITIVE_PACKAGE);
+	final static TypeRef	CHAR				= new ConcreteRef("C", "char", PRIMITIVE_PACKAGE);
+	final static TypeRef	SHORT				= new ConcreteRef("S", "short", PRIMITIVE_PACKAGE);
+	final static TypeRef	INTEGER				= new ConcreteRef("I", "int", PRIMITIVE_PACKAGE);
+	final static TypeRef	LONG				= new ConcreteRef("J", "long", PRIMITIVE_PACKAGE);
+	final static TypeRef	DOUBLE				= new ConcreteRef("D", "double", PRIMITIVE_PACKAGE);
+	final static TypeRef	FLOAT				= new ConcreteRef("F", "float", PRIMITIVE_PACKAGE);
 
 	{
 		packageCache.put("", DEFAULT_PACKAGE);
 	}
 
-	public interface TypeRef extends Comparable<TypeRef>{
+	public interface TypeRef extends Comparable<TypeRef> {
 		String getBinary();
 
 		String getFQN();
@@ -55,7 +54,7 @@
 
 	}
 
-	public static class PackageRef implements Comparable<PackageRef>{
+	public static class PackageRef implements Comparable<PackageRef> {
 		final String	binaryName;
 		final String	fqn;
 		final boolean	java;
@@ -63,21 +62,23 @@
 		private PackageRef(String binaryName) {
 			this.binaryName = fqnToBinary(binaryName);
 			this.fqn = binaryToFQN(binaryName);
-			this.java = this.fqn.startsWith("java.") ; // && !this.fqn.equals("java.sql)"
-			
+			this.java = this.fqn.startsWith("java."); // &&
+														// !this.fqn.equals("java.sql)"
+
 			// For some reason I excluded java.sql but the classloader will
 			// delegate anyway. So lost the understanding why I did it??
 		}
 
 		private PackageRef() {
 			this.binaryName = "";
-			this.fqn=".";
+			this.fqn = ".";
 			this.java = false;
 		}
 
 		public PackageRef getDuplicate() {
-			return new PackageRef(binaryName+Constants.DUPLICATE_MARKER);
+			return new PackageRef(binaryName + Constants.DUPLICATE_MARKER);
 		}
+
 		public String getFQN() {
 			return fqn;
 		}
@@ -97,7 +98,7 @@
 		public String toString() {
 			return fqn;
 		}
-		
+
 		boolean isDefaultPackage() {
 			return this.fqn.equals(".");
 		}
@@ -109,16 +110,16 @@
 		public int compareTo(PackageRef other) {
 			return fqn.compareTo(other.fqn);
 		}
-		
+
 		public boolean equals(Object o) {
 			assert o instanceof PackageRef;
 			return o == this;
 		}
-		
+
 		public int hashCode() {
 			return super.hashCode();
 		}
-		
+
 		/**
 		 * Decide if the package is a metadata package.
 		 * 
@@ -128,7 +129,7 @@
 		public boolean isMetaData() {
 			if (isDefaultPackage())
 				return true;
-			
+
 			for (int i = 0; i < Constants.METAPACKAGES.length; i++) {
 				if (fqn.startsWith(Constants.METAPACKAGES[i]))
 					return true;
@@ -146,7 +147,7 @@
 		final PackageRef	packageRef;
 
 		ConcreteRef(PackageRef packageRef, String binaryName) {
-			if ( packageRef.getFQN().length() < 2 )
+			if (packageRef.getFQN().length() < 2)
 				System.err.println("in default pack? " + binaryName);
 			this.binaryName = binaryName;
 			this.fqn = binaryToFQN(binaryName);
@@ -220,11 +221,11 @@
 		}
 
 		public int compareTo(TypeRef other) {
-			if ( this == other)
+			if (this == other)
 				return 0;
 			return fqn.compareTo(other.getFQN());
 		}
-		
+
 	}
 
 	private static class ArrayRef implements TypeRef {
@@ -249,7 +250,7 @@
 		public String getSourcePath() {
 			return component.getSourcePath();
 		}
-		
+
 		public boolean isPrimitive() {
 			return false;
 		}
@@ -294,17 +295,17 @@
 		}
 
 		public int compareTo(TypeRef other) {
-			if ( this == other)
+			if (this == other)
 				return 0;
-			
+
 			return getFQN().compareTo(other.getFQN());
 		}
 
 	}
 
-	public TypeRef getTypeRef(String binaryClassName) {		
+	public TypeRef getTypeRef(String binaryClassName) {
 		assert !binaryClassName.endsWith(".class");
-		
+
 		TypeRef ref = typeRefCache.get(binaryClassName);
 		if (ref != null)
 			return ref;
@@ -315,34 +316,34 @@
 		} else {
 			if (binaryClassName.length() >= 1) {
 				switch (binaryClassName.charAt(0)) {
-				case 'V':
-					return VOID;
-				case 'B':
-					return BYTE;
-				case 'C':
-					return CHAR;
-				case 'I':
-					return INTEGER;
-				case 'S':
-					return SHORT;
-				case 'D':
-					return DOUBLE;
-				case 'F':
-					return FLOAT;
-				case 'J':
-					return LONG;
-				case 'Z':
-					return BOOLEAN;
-				case 'L':
-					binaryClassName = binaryClassName.substring(1, binaryClassName.length() - 1);
-					break;
+					case 'V' :
+						return VOID;
+					case 'B' :
+						return BYTE;
+					case 'C' :
+						return CHAR;
+					case 'I' :
+						return INTEGER;
+					case 'S' :
+						return SHORT;
+					case 'D' :
+						return DOUBLE;
+					case 'F' :
+						return FLOAT;
+					case 'J' :
+						return LONG;
+					case 'Z' :
+						return BOOLEAN;
+					case 'L' :
+						binaryClassName = binaryClassName.substring(1, binaryClassName.length() - 1);
+						break;
 				}
 				// falls trough for other 1 letter class names
 			}
 			ref = typeRefCache.get(binaryClassName);
-			if ( ref != null)
+			if (ref != null)
 				return ref;
-			
+
 			PackageRef pref;
 			int n = binaryClassName.lastIndexOf('/');
 			if (n < 0)
@@ -352,13 +353,13 @@
 
 			ref = new ConcreteRef(pref, binaryClassName);
 		}
-		
+
 		typeRefCache.put(binaryClassName, ref);
 		return ref;
 	}
 
 	public PackageRef getPackageRef(String binaryPackName) {
-		if (binaryPackName.indexOf('.') >= 0 ) {
+		if (binaryPackName.indexOf('.') >= 0) {
 			binaryPackName = binaryPackName.replace('.', '/');
 		}
 		PackageRef ref = packageCache.get(binaryPackName);
@@ -411,28 +412,28 @@
 			}
 
 			switch (c) {
-			case 'L':
-				while ((c = descriptor.charAt(index++)) != ';') {
-					// TODO
+				case 'L' :
+					while ((c = descriptor.charAt(index++)) != ';') {
+						// TODO
+						sb.append(c);
+					}
+					break;
+
+				case 'V' :
+				case 'B' :
+				case 'C' :
+				case 'I' :
+				case 'S' :
+				case 'D' :
+				case 'F' :
+				case 'J' :
+				case 'Z' :
 					sb.append(c);
-				}
-				break;
+					break;
 
-			case 'V':
-			case 'B':
-			case 'C':
-			case 'I':
-			case 'S':
-			case 'D':
-			case 'F':
-			case 'J':
-			case 'Z':
-				sb.append(c);
-				break;
-
-			default:
-				throw new IllegalArgumentException("Invalid type in descriptor: " + c + " from "
-						+ descriptor + "[" + index + "]");
+				default :
+					throw new IllegalArgumentException("Invalid type in descriptor: " + c + " from " + descriptor + "["
+							+ index + "]");
 			}
 			types.add(getTypeRef(sb.toString()));
 			return index;
@@ -450,13 +451,11 @@
 			if (other == null || other.getClass() != getClass())
 				return false;
 
-			return Arrays.equals(prototype, ((Descriptor) other).prototype)
-					&& type == ((Descriptor) other).type;
+			return Arrays.equals(prototype, ((Descriptor) other).prototype) && type == ((Descriptor) other).type;
 		}
 
 		public int hashCode() {
-			return prototype == null ? type.hashCode() : type.hashCode()
-					^ Arrays.hashCode(prototype);
+			return prototype == null ? type.hashCode() : type.hashCode() ^ Arrays.hashCode(prototype);
 		}
 
 		public String toString() {
@@ -470,7 +469,7 @@
 
 	public static String getShortName(String fqn) {
 		assert fqn.indexOf('/') < 0;
-		
+
 		int n = fqn.lastIndexOf('.');
 		if (n >= 0) {
 			return fqn.substring(n + 1);
@@ -480,10 +479,10 @@
 
 	public static String binaryToFQN(String binary) {
 		StringBuilder sb = new StringBuilder();
-		for ( int i=0, l=binary.length(); i<l; i++) {
+		for (int i = 0, l = binary.length(); i < l; i++) {
 			char c = binary.charAt(i);
-			
-			if ( c == '/')
+
+			if (c == '/')
 				sb.append('.');
 			else
 				sb.append(c);
@@ -514,35 +513,35 @@
 	}
 
 	public TypeRef getTypeRefFromFQN(String fqn) {
-		if ( fqn.equals("boolean"))
+		if (fqn.equals("boolean"))
 			return BOOLEAN;
-		
-		if ( fqn.equals("byte"))
+
+		if (fqn.equals("byte"))
 			return BOOLEAN;
-		
-		if ( fqn.equals("char"))
+
+		if (fqn.equals("char"))
 			return CHAR;
-		
-		if ( fqn.equals("short"))
+
+		if (fqn.equals("short"))
 			return SHORT;
-		
-		if ( fqn.equals("int"))
+
+		if (fqn.equals("int"))
 			return INTEGER;
-		
-		if ( fqn.equals("long"))
+
+		if (fqn.equals("long"))
 			return LONG;
-		
-		if ( fqn.equals("float"))
+
+		if (fqn.equals("float"))
 			return FLOAT;
-		
-		if ( fqn.equals("double"))
+
+		if (fqn.equals("double"))
 			return DOUBLE;
-		
+
 		return getTypeRef(fqnToBinary(fqn));
 	}
 
 	public TypeRef getTypeRefFromPath(String path) {
 		assert path.endsWith(".class");
-		return getTypeRef(path.substring(0,path.length()-6));
+		return getTypeRef(path.substring(0, path.length() - 6));
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java b/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
index b6ef379..f520378 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Domain.java
@@ -13,7 +13,6 @@
  * This class abstracts domains that have properties holding OSGi meta data. It
  * provides access to the keys, the set method and the get method. It then
  * provides convenient methods to access these properties via semantic methods.
- * 
  */
 public abstract class Domain implements Iterable<String> {
 
@@ -38,15 +37,18 @@
 	public static Domain domain(final Attributes attrs) {
 		return new Domain() {
 
-			@Override public String get(String key) {
+			@Override
+			public String get(String key) {
 				return attrs.getValue(key);
 			}
 
-			@Override public void set(String key, String value) {
+			@Override
+			public void set(String key, String value) {
 				attrs.putValue(key, value);
 			}
 
-			@Override public Iterator<String> iterator() {
+			@Override
+			public Iterator<String> iterator() {
 				final Iterator<Object> it = attrs.keySet().iterator();
 
 				return new Iterator<String>() {
@@ -70,19 +72,23 @@
 	public static Domain domain(final Processor processor) {
 		return new Domain() {
 
-			@Override public String get(String key) {
+			@Override
+			public String get(String key) {
 				return processor.getProperty(key);
 			}
 
-			@Override public String get(String key, String deflt) {
+			@Override
+			public String get(String key, String deflt) {
 				return processor.getProperty(key, deflt);
 			}
 
-			@Override public void set(String key, String value) {
+			@Override
+			public void set(String key, String value) {
 				processor.setProperty(key, value);
 			}
 
-			@Override public Iterator<String> iterator() {
+			@Override
+			public Iterator<String> iterator() {
 				final Iterator<String> it = processor.getPropertyKeys(true).iterator();
 
 				return new Iterator<String>() {
@@ -104,18 +110,21 @@
 		};
 	}
 
-	public static Domain domain(final Map<String, String> map) {
+	public static Domain domain(final Map<String,String> map) {
 		return new Domain() {
 
-			@Override public String get(String key) {
+			@Override
+			public String get(String key) {
 				return map.get(key);
 			}
 
-			@Override public void set(String key, String value) {
+			@Override
+			public void set(String key, String value) {
 				map.put(key, value);
 			}
 
-			@Override public Iterator<String> iterator() {
+			@Override
+			public Iterator<String> iterator() {
 				return map.keySet().iterator();
 			}
 		};
@@ -155,7 +164,7 @@
 
 	public Parameters getIncludeResource() {
 		Parameters ic = getParameters(INCLUDE_RESOURCE);
-		ic.putAll( getParameters(INCLUDERESOURCE));
+		ic.putAll(getParameters(INCLUDERESOURCE));
 		return ic;
 	}
 
@@ -232,24 +241,24 @@
 	public void setBundleSymbolicName(String s) {
 		set(BUNDLE_SYMBOLICNAME, s);
 	}
-	
+
 	public String getBundleVersion() {
 		return get(BUNDLE_VERSION);
 	}
 
 	public void setBundleVersion(String version) {
 		Version v = new Version(version);
-		set(BUNDLE_VERSION,v.toString());
+		set(BUNDLE_VERSION, v.toString());
 	}
 
 	public void setBundleVersion(Version version) {
-		set(BUNDLE_VERSION,version.toString());
+		set(BUNDLE_VERSION, version.toString());
 	}
 
 	public void setFailOk(boolean b) {
-		set(FAIL_OK, b+"");
+		set(FAIL_OK, b + "");
 	}
-	
+
 	public boolean isFailOk() {
 		return Processor.isTrue(get(FAIL_OK));
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/EmbeddedResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/EmbeddedResource.java
index ebc93ee..3aff084 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/EmbeddedResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/EmbeddedResource.java
@@ -75,7 +75,8 @@
 		InputStream in = resource.openInputStream();
 		try {
 			build(sub, in, resource.lastModified());
-		} catch( Exception e ) {
+		}
+		catch (Exception e) {
 			e.printStackTrace();
 		}
 		finally {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/FileResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/FileResource.java
index b849878..4d2459d 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/FileResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/FileResource.java
@@ -6,7 +6,7 @@
 public class FileResource implements Resource {
 	File	file;
 	String	extra;
-	
+
 	public FileResource(File file) {
 		this.file = file;
 	}
@@ -16,11 +16,7 @@
 	}
 
 	public static void build(Jar jar, File directory, Pattern doNotCopy) {
-		traverse(
-				jar,
-				directory.getAbsolutePath().length(),
-				directory,
-				doNotCopy);
+		traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
 	}
 
 	public String toString() {
@@ -31,8 +27,7 @@
 		copy(this, out);
 	}
 
-	static synchronized void copy(Resource resource, OutputStream out)
-			throws Exception {
+	static synchronized void copy(Resource resource, OutputStream out) throws Exception {
 		InputStream in = resource.openInputStream();
 		try {
 			byte buffer[] = new byte[20000];
@@ -47,19 +42,17 @@
 		}
 	}
 
-	static void traverse(Jar jar, int rootlength, File directory,
-			Pattern doNotCopy) {
+	static void traverse(Jar jar, int rootlength, File directory, Pattern doNotCopy) {
 		if (doNotCopy != null && doNotCopy.matcher(directory.getName()).matches())
 			return;
 		jar.updateModified(directory.lastModified(), "Dir change");
-		
+
 		File files[] = directory.listFiles();
 		for (int i = 0; i < files.length; i++) {
 			if (files[i].isDirectory())
 				traverse(jar, rootlength, files[i], doNotCopy);
 			else {
-				String path = files[i].getAbsolutePath().substring(
-						rootlength + 1);
+				String path = files[i].getAbsolutePath().substring(rootlength + 1);
 				if (File.separatorChar != '/')
 					path = path.replace(File.separatorChar, '/');
 				jar.putResource(path, new FileResource(files[i]), true);
@@ -78,8 +71,8 @@
 	public void setExtra(String extra) {
 		this.extra = extra;
 	}
-	
+
 	public long size() {
-	    return (int) file.length();
+		return (int) file.length();
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
index 9263e3c..c92de90 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
@@ -60,8 +60,7 @@
 		if (s.startsWith("!")) {
 			negated = true;
 			s = s.substring(1);
-		}
-		else
+		} else
 			negated = false;
 
 		if (input.equals("*")) {
@@ -75,8 +74,7 @@
 		if (s.startsWith("=")) {
 			match = s.substring(1);
 			literal = true;
-		}
-		else {
+		} else {
 			boolean wildcards = false;
 
 			StringBuilder sb = new StringBuilder();
@@ -90,8 +88,7 @@
 							sb.append("(\\..*)?");
 							wildcards = true;
 							break loop;
-						}
-						else
+						} else
 							sb.append("\\.");
 
 						break;
@@ -119,8 +116,7 @@
 			if (!wildcards) {
 				literal = true;
 				match = s;
-			}
-			else {
+			} else {
 				literal = false;
 				match = sb.toString();
 			}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
index e74150c..679c374 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
@@ -4,25 +4,24 @@
 
 import aQute.libg.header.*;
 
-public class Instructions implements Map<Instruction, Attrs> {
-	private LinkedHashMap<Instruction, Attrs>	map;
-	static Map<Instruction, Attrs>				EMPTY	= Collections.emptyMap();
+public class Instructions implements Map<Instruction,Attrs> {
+	private LinkedHashMap<Instruction,Attrs>	map;
+	static Map<Instruction,Attrs>				EMPTY	= Collections.emptyMap();
 
 	public Instructions(Instructions other) {
 		if (other.map != null && !other.map.isEmpty()) {
-			map = new LinkedHashMap<Instruction, Attrs>(other.map);
+			map = new LinkedHashMap<Instruction,Attrs>(other.map);
 		}
 	}
 
 	public Instructions(Collection<String> other) {
-		if ( other != null)
-			for ( String s : other  ) {
-				put( new Instruction(s), null);
+		if (other != null)
+			for (String s : other) {
+				put(new Instruction(s), null);
 			}
 	}
 
-	public Instructions() {
-	}
+	public Instructions() {}
 
 	public Instructions(Parameters contained) {
 		append(contained);
@@ -43,7 +42,8 @@
 		return map.containsKey(name);
 	}
 
-	@Deprecated public boolean containsKey(Object name) {
+	@Deprecated
+	public boolean containsKey(Object name) {
 		assert name instanceof Instruction;
 		if (map == null)
 			return false;
@@ -58,7 +58,8 @@
 		return map.containsValue(value);
 	}
 
-	@Deprecated public boolean containsValue(Object value) {
+	@Deprecated
+	public boolean containsValue(Object value) {
 		assert value instanceof Attrs;
 		if (map == null)
 			return false;
@@ -66,14 +67,15 @@
 		return map.containsValue((Attrs) value);
 	}
 
-	public Set<java.util.Map.Entry<Instruction, Attrs>> entrySet() {
+	public Set<java.util.Map.Entry<Instruction,Attrs>> entrySet() {
 		if (map == null)
 			return EMPTY.entrySet();
 
 		return map.entrySet();
 	}
 
-	@Deprecated public Attrs get(Object key) {
+	@Deprecated
+	public Attrs get(Object key) {
 		assert key instanceof Instruction;
 		if (map == null)
 			return null;
@@ -101,21 +103,22 @@
 
 	public Attrs put(Instruction key, Attrs value) {
 		if (map == null)
-			map = new LinkedHashMap<Instruction, Attrs>();
+			map = new LinkedHashMap<Instruction,Attrs>();
 
 		return map.put(key, value);
 	}
 
-	public void putAll(Map<? extends Instruction, ? extends Attrs> map) {
+	public void putAll(Map< ? extends Instruction, ? extends Attrs> map) {
 		if (this.map == null)
 			if (map.isEmpty())
 				return;
 			else
-				this.map = new LinkedHashMap<Instruction, Attrs>();
+				this.map = new LinkedHashMap<Instruction,Attrs>();
 		this.map.putAll(map);
 	}
 
-	@Deprecated public Attrs remove(Object var0) {
+	@Deprecated
+	public Attrs remove(Object var0) {
 		assert var0 instanceof Instruction;
 		if (map == null)
 			return null;
@@ -147,19 +150,20 @@
 	}
 
 	public void append(Parameters other) {
-		for (Map.Entry<String, Attrs> e : other.entrySet()) {
-			put( new Instruction(e.getKey()), e.getValue());
+		for (Map.Entry<String,Attrs> e : other.entrySet()) {
+			put(new Instruction(e.getKey()), e.getValue());
 		}
 	}
+
 	public <T> Collection<T> select(Collection<T> set, boolean emptyIsAll) {
-		return select(set,null, emptyIsAll);
+		return select(set, null, emptyIsAll);
 	}
-	
+
 	public <T> Collection<T> select(Collection<T> set, Set<Instruction> unused, boolean emptyIsAll) {
 		List<T> input = new ArrayList<T>(set);
-		if ( emptyIsAll && isEmpty())
+		if (emptyIsAll && isEmpty())
 			return input;
-		
+
 		List<T> result = new ArrayList<T>();
 
 		for (Instruction instruction : keySet()) {
@@ -174,13 +178,12 @@
 					used = true;
 				}
 			}
-			if ( !used && unused != null)
+			if (!used && unused != null)
 				unused.add(instruction);
 		}
 		return result;
 	}
 
-
 	public <T> Collection<T> reject(Collection<T> set) {
 		List<T> input = new ArrayList<T>(set);
 		List<T> result = new ArrayList<T>();
@@ -195,22 +198,22 @@
 					o.remove();
 				} else
 					result.add(oo);
-					
+
 			}
 		}
 		return result;
 	}
 
 	public boolean matches(String value) {
-		if ( size() == 0)
+		if (size() == 0)
 			return true;
-		
-		for ( Instruction i : keySet()) {
-			if ( i.matches(value)) {
-				if ( i.isNegated())
-					return false;		// we deny this one explicitly
+
+		for (Instruction i : keySet()) {
+			if (i.matches(value)) {
+				if (i.isNegated())
+					return false; // we deny this one explicitly
 				else
-					return true;		// we allow it explicitly
+					return true; // we allow it explicitly
 			}
 		}
 		return false;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java b/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
index 497198b..032a7d1 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
@@ -18,21 +18,21 @@
 		DEFLATE, STORE
 	}
 
-	public static final Object[]				EMPTY_ARRAY	= new Jar[0];
-	final Map<String, Resource>					resources	= new TreeMap<String, Resource>();
-	final Map<String, Map<String, Resource>>	directories	= new TreeMap<String, Map<String, Resource>>();
-	Manifest									manifest;
-	boolean										manifestFirst;
-	String										name;
-	File										source;
-	ZipFile										zipFile;
-	long										lastModified;
-	String										lastModifiedReason;
-	Reporter									reporter;
-	boolean										doNotTouchManifest;
-	boolean										nomanifest;
-	Compression									compression	= Compression.DEFLATE;
-	boolean										closed;
+	public static final Object[]			EMPTY_ARRAY	= new Jar[0];
+	final Map<String,Resource>				resources	= new TreeMap<String,Resource>();
+	final Map<String,Map<String,Resource>>	directories	= new TreeMap<String,Map<String,Resource>>();
+	Manifest								manifest;
+	boolean									manifestFirst;
+	String									name;
+	File									source;
+	ZipFile									zipFile;
+	long									lastModified;
+	String									lastModifiedReason;
+	Reporter								reporter;
+	boolean									doNotTouchManifest;
+	boolean									nomanifest;
+	Compression								compression	= Compression.DEFLATE;
+	boolean									closed;
 
 	public Jar(String name) {
 		this.name = name;
@@ -46,8 +46,7 @@
 		else if (dirOrFile.isFile()) {
 			zipFile = ZipResource.build(this, dirOrFile);
 		} else {
-			throw new IllegalArgumentException("A Jar can only accept a valid file or directory: "
-					+ dirOrFile);
+			throw new IllegalArgumentException("A Jar can only accept a valid file or directory: " + dirOrFile);
 		}
 	}
 
@@ -119,9 +118,9 @@
 				manifestFirst = true;
 		}
 		String dir = getDirectory(path);
-		Map<String, Resource> s = directories.get(dir);
+		Map<String,Resource> s = directories.get(dir);
 		if (s == null) {
-			s = new TreeMap<String, Resource>();
+			s = new TreeMap<String,Resource>();
 			directories.put(dir, s);
 			int n = dir.lastIndexOf('/');
 			while (n > 0) {
@@ -156,23 +155,23 @@
 		return path.substring(0, n);
 	}
 
-	public Map<String, Map<String, Resource>> getDirectories() {
+	public Map<String,Map<String,Resource>> getDirectories() {
 		check();
 		return directories;
 	}
 
-	public Map<String, Resource> getResources() {
+	public Map<String,Resource> getResources() {
 		check();
 		return resources;
 	}
 
-	public boolean addDirectory(Map<String, Resource> directory, boolean overwrite) {
+	public boolean addDirectory(Map<String,Resource> directory, boolean overwrite) {
 		check();
 		boolean duplicates = false;
 		if (directory == null)
 			return false;
 
-		for (Map.Entry<String, Resource> entry : directory.entrySet()) {
+		for (Map.Entry<String,Resource> entry : directory.entrySet()) {
 			String key = entry.getKey();
 			if (!key.endsWith(".java")) {
 				duplicates |= putResource(key, entry.getValue(), overwrite);
@@ -211,7 +210,8 @@
 		try {
 			Manifest m = new Manifest(fin);
 			setManifest(m);
-		} finally {
+		}
+		finally {
 			fin.close();
 		}
 	}
@@ -222,12 +222,14 @@
 			OutputStream out = new FileOutputStream(file);
 			try {
 				write(out);
-			} finally {
+			}
+			finally {
 				IO.close(out);
 			}
 			return;
 
-		} catch (Exception t) {
+		}
+		catch (Exception t) {
 			file.delete();
 			throw t;
 		}
@@ -240,16 +242,15 @@
 
 	public void write(OutputStream out) throws Exception {
 		check();
-		ZipOutputStream jout = nomanifest || doNotTouchManifest ? new ZipOutputStream(out)
-				: new JarOutputStream(out);
+		ZipOutputStream jout = nomanifest || doNotTouchManifest ? new ZipOutputStream(out) : new JarOutputStream(out);
 
 		switch (compression) {
-		case STORE:
-			jout.setMethod(ZipOutputStream.DEFLATED);
-			break;
+			case STORE :
+				jout.setMethod(ZipOutputStream.DEFLATED);
+				break;
 
-		default:
-			// default is DEFLATED
+			default :
+				// default is DEFLATED
 		}
 
 		Set<String> done = new HashSet<String>();
@@ -264,7 +265,7 @@
 		} else
 			doManifest(done, jout);
 
-		for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
+		for (Map.Entry<String,Resource> entry : getResources().entrySet()) {
 			// Skip metainf contents
 			if (!done.contains(entry.getKey()))
 				writeResource(jout, directories, entry.getKey(), entry.getValue());
@@ -309,11 +310,8 @@
 	/**
 	 * Unfortunately we have to write our own manifest :-( because of a stupid
 	 * bug in the manifest code. It tries to handle UTF-8 but the way it does it
-	 * it makes the bytes platform dependent.
-	 * 
-	 * So the following code outputs the manifest.
-	 * 
-	 * A Manifest consists of
+	 * it makes the bytes platform dependent. So the following code outputs the
+	 * manifest. A Manifest consists of
 	 * 
 	 * <pre>
 	 *   'Manifest-Version: 1.0\r\n'
@@ -328,11 +326,12 @@
 	 * 
 	 * Lines in the manifest should not exceed 72 bytes (! this is where the
 	 * manifest screwed up as well when 16 bit unicodes were used).
-	 * 
 	 * <p>
 	 * As a bonus, we can now sort the manifest!
 	 */
-	static byte[]	CONTINUE	= new byte[] { '\r', '\n', ' ' };
+	static byte[]	CONTINUE	= new byte[] {
+			'\r', '\n', ' '
+								};
 
 	/**
 	 * Main function to output a manifest properly in UTF-8.
@@ -362,7 +361,6 @@
 
 	/**
 	 * Write out an entry, handling proper unicode and line length constraints
-	 * 
 	 */
 	private static void writeEntry(OutputStream out, String name, String value) throws IOException {
 		int n = write(out, 0, name + ": ");
@@ -428,15 +426,15 @@
 	 *             when something fails
 	 */
 	private static void attributes(Attributes value, OutputStream out) throws IOException {
-		TreeMap<String, String> map = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
-		for (Map.Entry<Object, Object> entry : value.entrySet()) {
+		TreeMap<String,String> map = new TreeMap<String,String>(String.CASE_INSENSITIVE_ORDER);
+		for (Map.Entry<Object,Object> entry : value.entrySet()) {
 			map.put(entry.getKey().toString(), entry.getValue().toString());
 		}
 
 		map.remove("Manifest-Version"); // get rid of
 		// manifest
 		// version
-		for (Map.Entry<String, String> entry : map.entrySet()) {
+		for (Map.Entry<String,String> entry : map.entrySet()) {
 			writeEntry(out, entry.getKey(), entry.getValue());
 		}
 	}
@@ -444,7 +442,7 @@
 	private static Manifest clean(Manifest org) {
 
 		Manifest result = new Manifest();
-		for (Map.Entry<?, ?> entry : org.getMainAttributes().entrySet()) {
+		for (Map.Entry< ? , ? > entry : org.getMainAttributes().entrySet()) {
 			String nice = clean((String) entry.getValue());
 			result.getMainAttributes().put(entry.getKey(), nice);
 		}
@@ -455,7 +453,7 @@
 				result.getEntries().put(name, attrs);
 			}
 
-			for (Map.Entry<?, ?> entry : org.getAttributes(name).entrySet()) {
+			for (Map.Entry< ? , ? > entry : org.getAttributes(name).entrySet()) {
 				String nice = clean((String) entry.getValue());
 				attrs.put((Attributes.Name) entry.getKey(), nice);
 			}
@@ -475,8 +473,8 @@
 		return sb.toString();
 	}
 
-	private void writeResource(ZipOutputStream jout, Set<String> directories, String path,
-			Resource resource) throws Exception {
+	private void writeResource(ZipOutputStream jout, Set<String> directories, String path, Resource resource)
+			throws Exception {
 		if (resource == null)
 			return;
 		try {
@@ -493,13 +491,13 @@
 			jout.putNextEntry(ze);
 			resource.write(jout);
 			jout.closeEntry();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new Exception("Problem writing resource " + path, e);
 		}
 	}
 
-	void createDirectories(Set<String> directories, ZipOutputStream zip, String name)
-			throws IOException {
+	void createDirectories(Set<String> directories, ZipOutputStream zip, String name) throws IOException {
 		int index = name.lastIndexOf('/');
 		if (index > 0) {
 			String path = name.substring(0, index);
@@ -545,8 +543,7 @@
 				continue;
 
 			if (filter == null || filter.matches(name) != filter.isNegated())
-				dupl |= putResource(Processor.appendPath(destination, name), sub.getResource(name),
-						true);
+				dupl |= putResource(Processor.appendPath(destination, name), sub.getResource(name), true);
 		}
 		return dupl;
 	}
@@ -556,7 +553,8 @@
 		if (zipFile != null)
 			try {
 				zipFile.close();
-			} catch (IOException e) {
+			}
+			catch (IOException e) {
 				// Ignore
 			}
 		resources.clear();
@@ -589,7 +587,7 @@
 		check();
 		List<String> list = new ArrayList<String>(directories.size());
 
-		for (Map.Entry<String, Map<String, Resource>> i : directories.entrySet()) {
+		for (Map.Entry<String,Map<String,Resource>> i : directories.entrySet()) {
 			if (i.getValue() != null) {
 				String path = i.getKey();
 				String pack = path.replace('/', '.');
@@ -622,7 +620,7 @@
 		check();
 		Resource resource = resources.remove(path);
 		String dir = getDirectory(path);
-		Map<String, Resource> mdir = directories.get(dir);
+		Map<String,Resource> mdir = directories.get(dir);
 		// must be != null
 		mdir.remove(path);
 		return resource;
@@ -644,7 +642,9 @@
 	public void calcChecksums(String algorithms[]) throws Exception {
 		check();
 		if (algorithms == null)
-			algorithms = new String[] { "SHA", "MD5" };
+			algorithms = new String[] {
+					"SHA", "MD5"
+			};
 
 		Manifest m = getManifest();
 		if (m == null) {
@@ -659,7 +659,7 @@
 
 		byte buffer[] = new byte[30000];
 
-		for (Map.Entry<String, Resource> entry : resources.entrySet()) {
+		for (Map.Entry<String,Resource> entry : resources.entrySet()) {
 
 			// Skip the manifest
 			if (entry.getKey().equals("META-INF/MANIFEST.MF"))
@@ -681,7 +681,8 @@
 						d.update(buffer, 0, size);
 					size = in.read(buffer);
 				}
-			} finally {
+			}
+			finally {
 				in.close();
 			}
 			for (MessageDigest d : digests)
@@ -737,7 +738,7 @@
 			throw new IllegalArgumentException("Not a dir: " + dir.getAbsolutePath());
 		}
 
-		for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
+		for (Map.Entry<String,Resource> entry : getResources().entrySet()) {
 			File f = getFile(dir, entry.getKey());
 			f.getParentFile().mkdirs();
 			IO.copy(entry.getValue().openInputStream(), f);
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/JarResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/JarResource.java
index 0c0adcd..c51aba3 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/JarResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/JarResource.java
@@ -17,7 +17,8 @@
 	public void write(OutputStream out) throws Exception {
 		try {
 			jar.write(out);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			e.printStackTrace();
 			throw e;
 		}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java b/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
index 4ddd625..36c16dd 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
@@ -17,17 +17,10 @@
  * based on a properties and a domain. The domain can implement functions that
  * start with a "_" and take args[], the names of these functions are available
  * as functions in the macro processor (without the _). Macros can nest to any
- * depth but may not contain loops.
- * 
- * Add POSIX macros: ${#parameter} String length.
- * 
- * ${parameter%word} Remove smallest suffix pattern.
- * 
- * ${parameter%%word} Remove largest suffix pattern.
- * 
- * ${parameter#word} Remove smallest prefix pattern.
- * 
- * ${parameter##word} Remove largest prefix pattern.
+ * depth but may not contain loops. Add POSIX macros: ${#parameter} String
+ * length. ${parameter%word} Remove smallest suffix pattern. ${parameter%%word}
+ * Remove largest suffix pattern. ${parameter#word} Remove smallest prefix
+ * pattern. ${parameter##word} Remove largest prefix pattern.
  */
 public class Macro implements Replacer {
 	Processor	domain;
@@ -66,39 +59,32 @@
 					result.append(replace(variable.toString(), link));
 					return index;
 				}
+			} else if (c1 == begin)
+				nesting++;
+			else if (c1 == '\\' && index < line.length() - 1 && line.charAt(index) == '$') {
+				// remove the escape backslash and interpret the dollar
+				// as a
+				// literal
+				index++;
+				variable.append('$');
+				continue outer;
+			} else if (c1 == '$' && index < line.length() - 2) {
+				char c2 = line.charAt(index);
+				char terminator = getTerminator(c2);
+				if (terminator != 0) {
+					index = process(line, index + 1, c2, terminator, variable, link);
+					continue outer;
+				}
+			} else if (c1 == '.' && index < line.length() && line.charAt(index) == '/') {
+				// Found the sequence ./
+				if (index == 1 || Character.isWhitespace(line.charAt(index - 2))) {
+					// make sure it is preceded by whitespace or starts at begin
+					index++;
+					variable.append(domain.getBase().getAbsolutePath());
+					variable.append('/');
+					continue outer;
+				}
 			}
-			else
-				if (c1 == begin)
-					nesting++;
-				else
-					if (c1 == '\\' && index < line.length() - 1 && line.charAt(index) == '$') {
-						// remove the escape backslash and interpret the dollar
-						// as a
-						// literal
-						index++;
-						variable.append('$');
-						continue outer;
-					}
-					else
-						if (c1 == '$' && index < line.length() - 2) {
-							char c2 = line.charAt(index);
-							char terminator = getTerminator(c2);
-							if (terminator != 0) {
-								index = process(line, index + 1, c2, terminator, variable, link);
-								continue outer;
-							}
-						}
-						else
-							if (c1 == '.' && index < line.length() && line.charAt(index) == '/') {
-								// Found the sequence ./
-								if (index == 1 || Character.isWhitespace(line.charAt(index - 2))) {
-									// make sure it is preceded by whitespace or starts at begin
-									index++;
-									variable.append(domain.getBase().getAbsolutePath());
-									variable.append('/');
-									continue outer;
-								}
-							}
 			variable.append(c1);
 		}
 		result.append(variable);
@@ -171,12 +157,10 @@
 				}
 				if (!flattening && !key.equals("@"))
 					domain.warning("No translation found for macro: " + key);
-			}
-			else {
+			} else {
 				domain.warning("Found empty macro key");
 			}
-		}
-		else {
+		} else {
 			domain.warning("Found null macro key");
 		}
 		return "${" + key + "}";
@@ -235,18 +219,20 @@
 		else {
 			String cname = "_" + method.replaceAll("-", "_");
 			try {
-				Method m = target.getClass().getMethod(cname, new Class[] {String[].class});
-				return (String) m.invoke(target, new Object[] {args});
+				Method m = target.getClass().getMethod(cname, new Class[] {
+					String[].class
+				});
+				return (String) m.invoke(target, new Object[] {
+					args
+				});
 			}
 			catch (NoSuchMethodException e) {
 				// Ignore
 			}
 			catch (InvocationTargetException e) {
 				if (e.getCause() instanceof IllegalArgumentException) {
-					domain.error("%s, for cmd: %s, arguments; %s", e.getMessage(), method,
-							Arrays.toString(args));
-				}
-				else {
+					domain.error("%s, for cmd: %s, arguments; %s", e.getMessage(), method, Arrays.toString(args));
+				} else {
 					domain.warning("Exception in replace: " + e.getCause());
 					e.getCause().printStackTrace();
 				}
@@ -395,7 +381,6 @@
 	}
 
 	/**
-	 * 
 	 * replace ; <list> ; regex ; replace
 	 * 
 	 * @param args
@@ -453,16 +438,12 @@
 			if (path.endsWith(".class")) {
 				String name = path.substring(0, path.length() - 6).replace('/', '.');
 				names.add(name);
+			} else if (path.endsWith(".java")) {
+				String name = path.substring(0, path.length() - 5).replace('/', '.');
+				names.add(name);
+			} else {
+				domain.warning("in toclassname, " + args[1] + " is not a class path because it does not end in .class");
 			}
-			else
-				if (path.endsWith(".java")) {
-					String name = path.substring(0, path.length() - 5).replace('/', '.');
-					names.add(name);
-				}
-				else {
-					domain.warning("in toclassname, " + args[1]
-							+ " is not a class path because it does not end in .class");
-				}
 		}
 		return Processor.join(names, ",");
 	}
@@ -495,8 +476,7 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${dir;...}");
 			return null;
-		}
-		else {
+		} else {
 			String del = "";
 			StringBuilder sb = new StringBuilder();
 			for (int i = 1; i < args.length; i++) {
@@ -516,8 +496,7 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${basename;...}");
 			return null;
-		}
-		else {
+		} else {
 			String del = "";
 			StringBuilder sb = new StringBuilder();
 			for (int i = 1; i < args.length; i++) {
@@ -537,8 +516,7 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${isfile;...}");
 			return null;
-		}
-		else {
+		} else {
 			boolean isfile = true;
 			for (int i = 1; i < args.length; i++) {
 				File f = new File(args[i]).getAbsoluteFile();
@@ -553,8 +531,7 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${isdir;...}");
 			return null;
-		}
-		else {
+		} else {
 			boolean isdir = true;
 			for (int i = 1; i < args.length; i++) {
 				File f = new File(args[i]).getAbsoluteFile();
@@ -568,28 +545,33 @@
 	public String _tstamp(String args[]) {
 		String format = "yyyyMMddHHmm";
 		long now = System.currentTimeMillis();
+		TimeZone tz = TimeZone.getTimeZone("UTC");
 
 		if (args.length > 1) {
 			format = args[1];
-			if (args.length > 2) {
-				now = Long.parseLong(args[2]);
-				if (args.length > 3) {
-					domain.warning("Too many arguments for tstamp: " + Arrays.toString(args));
-				}
-			}
 		}
+		if (args.length > 2) {
+			tz = TimeZone.getTimeZone(args[2]);
+		}
+		if (args.length > 3) {
+			now = Long.parseLong(args[3]);
+		}
+		if (args.length > 4) {
+			domain.warning("Too many arguments for tstamp: " + Arrays.toString(args));
+		}
+
 		SimpleDateFormat sdf = new SimpleDateFormat(format);
+		sdf.setTimeZone(tz);
+
 		return sdf.format(new Date(now));
 	}
 
 	/**
 	 * Wildcard a directory. The lists can contain Instruction that are matched
-	 * against the given directory
-	 * 
-	 * ${lsr;<dir>;<list>(;<list>)*} ${lsa;<dir>;<list>(;<list>)*}
+	 * against the given directory ${lsr;<dir>;<list>(;<list>)*}
+	 * ${lsa;<dir>;<list>(;<list>)*}
 	 * 
 	 * @author aqute
-	 * 
 	 */
 
 	public String _lsr(String args[]) {
@@ -602,22 +584,18 @@
 
 	String ls(String args[], boolean relative) {
 		if (args.length < 2)
-			throw new IllegalArgumentException(
-					"the ${ls} macro must at least have a directory as parameter");
+			throw new IllegalArgumentException("the ${ls} macro must at least have a directory as parameter");
 
 		File dir = domain.getFile(args[1]);
 		if (!dir.isAbsolute())
-			throw new IllegalArgumentException(
-					"the ${ls} macro directory parameter is not absolute: " + dir);
+			throw new IllegalArgumentException("the ${ls} macro directory parameter is not absolute: " + dir);
 
 		if (!dir.exists())
-			throw new IllegalArgumentException(
-					"the ${ls} macro directory parameter does not exist: " + dir);
+			throw new IllegalArgumentException("the ${ls} macro directory parameter does not exist: " + dir);
 
 		if (!dir.isDirectory())
 			throw new IllegalArgumentException(
-					"the ${ls} macro directory parameter points to a file instead of a directory: "
-							+ dir);
+					"the ${ls} macro directory parameter points to a file instead of a directory: " + dir);
 
 		List<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));
 
@@ -652,9 +630,6 @@
 	 * version=&quot;[${version;==;${@}},${version;=+;${@}})&quot;
 	 * </pre>
 	 * 
-	 * 
-	 * 
-	 * 
 	 * @param args
 	 * @return
 	 */
@@ -662,9 +637,10 @@
 	final static Pattern	MASK				= Pattern.compile(MASK_STRING);
 	final static String		_versionHelp		= "${version;<mask>;<version>}, modify a version\n"
 														+ "<mask> ::= [ M [ M [ M [ MQ ]]]\n"
-														+ "M ::= '+' | '-' | MQ\n"
-														+ "MQ ::= '~' | '='";
-	final static Pattern	_versionPattern[]	= new Pattern[] {null, null, MASK, Verifier.VERSION};
+														+ "M ::= '+' | '-' | MQ\n" + "MQ ::= '~' | '='";
+	final static Pattern	_versionPattern[]	= new Pattern[] {
+			null, null, MASK, Verifier.VERSION
+												};
 
 	public String _version(String args[]) {
 		verifyCommand(args, _versionHelp, null, 2, 3);
@@ -699,26 +675,23 @@
 			if (c != '~') {
 				if (i == 3) {
 					result = version.getQualifier();
+				} else if (Character.isDigit(c)) {
+					// Handle masks like +00, =+0
+					result = String.valueOf(c);
+				} else {
+					int x = version.get(i);
+					switch (c) {
+						case '+' :
+							x++;
+							break;
+						case '-' :
+							x--;
+							break;
+						case '=' :
+							break;
+					}
+					result = Integer.toString(x);
 				}
-				else
-					if (Character.isDigit(c)) {
-						// Handle masks like +00, =+0
-						result = String.valueOf(c);
-					}
-					else {
-						int x = version.get(i);
-						switch (c) {
-							case '+' :
-								x++;
-								break;
-							case '-' :
-								x--;
-								break;
-							case '=' :
-								break;
-						}
-						result = Integer.toString(x);
-					}
 				if (result != null) {
 					sb.append(del);
 					del = ".";
@@ -741,12 +714,14 @@
 	 * @return
 	 */
 
-	static Pattern	RANGE_MASK		= Pattern.compile("(\\[|\\()(" + MASK_STRING + "),("
-											+ MASK_STRING + ")(\\]|\\))");
+	static Pattern	RANGE_MASK		= Pattern.compile("(\\[|\\()(" + MASK_STRING + "),(" + MASK_STRING + ")(\\]|\\))");
 	static String	_rangeHelp		= "${range;<mask>[;<version>]}, range for version, if version not specified lookyp ${@}\n"
 											+ "<mask> ::= [ M [ M [ M [ MQ ]]]\n"
-											+ "M ::= '+' | '-' | MQ\n" + "MQ ::= '~' | '='";
-	static Pattern	_rangePattern[]	= new Pattern[] {null, RANGE_MASK};
+											+ "M ::= '+' | '-' | MQ\n"
+											+ "MQ ::= '~' | '='";
+	static Pattern	_rangePattern[]	= new Pattern[] {
+			null, RANGE_MASK
+									};
 
 	public String _range(String args[]) {
 		verifyCommand(args, _rangeHelp, _rangePattern, 2, 3);
@@ -780,8 +755,7 @@
 		String s = sb.toString();
 		VersionRange vr = new VersionRange(s);
 		if (!(vr.includes(vr.getHigh()) || vr.includes(vr.getLow()))) {
-			domain.error("${range} macro created an invalid range %s from %s and mask %s", s,
-					version, spec);
+			domain.error("${range} macro created an invalid range %s from %s and mask %s", s, version, spec);
 		}
 		return sb.toString();
 	}
@@ -861,43 +835,36 @@
 		File f = domain.getFile(args[1]);
 		if (f.isFile()) {
 			return IO.collect(f);
+		} else if (f.isDirectory()) {
+			return Arrays.toString(f.list());
+		} else {
+			try {
+				URL url = new URL(args[1]);
+				return IO.collect(url, "UTF-8");
+			}
+			catch (MalformedURLException mfue) {
+				// Ignore here
+			}
+			return null;
 		}
-		else
-			if (f.isDirectory()) {
-				return Arrays.toString(f.list());
-			}
-			else {
-				try {
-					URL url = new URL(args[1]);
-					return IO.collect(url, "UTF-8");
-				}
-				catch (MalformedURLException mfue) {
-					// Ignore here
-				}
-				return null;
-			}
 	}
 
-	public static void verifyCommand(String args[], String help, Pattern[] patterns, int low,
-			int high) {
+	public static void verifyCommand(String args[], String help, Pattern[] patterns, int low, int high) {
 		String message = "";
 		if (args.length > high) {
 			message = "too many arguments";
-		}
-		else
-			if (args.length < low) {
-				message = "too few arguments";
-			}
-			else {
-				for (int i = 0; patterns != null && i < patterns.length && i < args.length; i++) {
-					if (patterns[i] != null) {
-						Matcher m = patterns[i].matcher(args[i]);
-						if (!m.matches())
-							message += String.format("Argument %s (%s) does not match %s\n", i,
-									args[i], patterns[i].pattern());
-					}
+		} else if (args.length < low) {
+			message = "too few arguments";
+		} else {
+			for (int i = 0; patterns != null && i < patterns.length && i < args.length; i++) {
+				if (patterns[i] != null) {
+					Matcher m = patterns[i].matcher(args[i]);
+					if (!m.matches())
+						message += String.format("Argument %s (%s) does not match %s\n", i, args[i],
+								patterns[i].pattern());
 				}
 			}
+		}
 		if (message.length() != 0) {
 			StringBuilder sb = new StringBuilder();
 			String del = "${";
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/OpCodes.java b/bundleplugin/src/main/java/aQute/lib/osgi/OpCodes.java
index f0d3134..17b6d2b 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/OpCodes.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/OpCodes.java
@@ -1,51 +1,58 @@
 package aQute.lib.osgi;
 
 public class OpCodes {
-	final static short	nop				= 0x00;			// [No change] performs
-														// no
+	final static short	nop				= 0x00;			// [No change]
+															// performs
+															// no
 	// operation
-	final static short	aconst_null		= 0x01;			// ? null pushes a null
+	final static short	aconst_null		= 0x01;			// ? null pushes a
+															// null
 	// reference onto the stack
-	final static short	iconst_m1		= 0x02;			// ? -1 loads the int
-														// value -1
+	final static short	iconst_m1		= 0x02;			// ? -1 loads the
+															// int
+															// value -1
 	// onto the stack
 	final static short	iconst_0		= 0x03;			// ? 0 loads the int
-														// value 0
+															// value 0
 	// onto the stack
 	final static short	iconst_1		= 0x04;			// ? 1 loads the int
-														// value 1
+															// value 1
 	// onto the stack
 	final static short	iconst_2		= 0x05;			// ? 2 loads the int
-														// value 2
+															// value 2
 	// onto the stack
 	final static short	iconst_3		= 0x06;			// ? 3 loads the int
-														// value 3
+															// value 3
 	// onto the stack
 	final static short	iconst_4		= 0x07;			// ? 4 loads the int
-														// value 4
+															// value 4
 	// onto the stack
 	final static short	iconst_5		= 0x08;			// ? 5 loads the int
-														// value 5
+															// value 5
 	// onto the stack
-	final static short	lconst_0		= 0x09;			// ? 0L pushes the long
-														// 0 onto
+	final static short	lconst_0		= 0x09;			// ? 0L pushes the
+															// long
+															// 0 onto
 	// the stack
-	final static short	bipush			= 0x10;			// byte ? value pushes a
-														// byte
+	final static short	bipush			= 0x10;			// byte ? value
+															// pushes a
+															// byte
 	// onto the stack as an integer
 	// value
-	final static short	sipush			= 0x11;			// byte1, byte2 ? value
-														// pushes a
+	final static short	sipush			= 0x11;			// byte1, byte2 ?
+															// value
+															// pushes a
 	// signed integer (byte1 << 8 +
 	// byte2) onto the stack
-	final static short	ldc				= 0x12;			// index ? value pushes
-														// a
+	final static short	ldc				= 0x12;			// index ? value
+															// pushes
+															// a
 	// constant #index from a
 	// constant pool (String, int,
 	// float or class type) onto the
 	// stack
 	final static short	ldc_w			= 0x13;			// indexbyte1,
-														// indexbyte2 ?
+															// indexbyte2 ?
 	// value pushes a constant
 	// #index from a constant pool
 	// (String, int, float or class
@@ -53,393 +60,433 @@
 	// index is constructed as
 	// indexbyte1 << 8 + indexbyte2)
 	final static short	ldc2_w			= 0x14;			// indexbyte1,
-														// indexbyte2 ?
+															// indexbyte2 ?
 	// value pushes a constant
 	// #index from a constant pool
 	// (double or long) onto the
 	// stack (wide index is
 	// constructed as indexbyte1 <<
 	// 8 + indexbyte2)
-	final static short	iload			= 0x15;			// index ? value loads
-														// an int
+	final static short	iload			= 0x15;			// index ? value
+															// loads
+															// an int
 	// value from a variable #index
-	final static short	lload			= 0x16;			// index ? value load a
-														// long
+	final static short	lload			= 0x16;			// index ? value
+															// load a
+															// long
 	// value from a local variable
 	// #index
-	final static short	fload			= 0x17;			// index ? value loads a
-														// float
+	final static short	fload			= 0x17;			// index ? value
+															// loads a
+															// float
 	// value from a local variable
 	// #index
-	final static short	dload			= 0x18;			// index ? value loads a
-														// double
+	final static short	dload			= 0x18;			// index ? value
+															// loads a
+															// double
 	// value from a local variable
 	// #index
 	final static short	aload			= 0x19;			// index ? objectref
-														// loads a
+															// loads a
 	// reference onto the stack from
 	// a local variable #index
-	final static short	lload_2			= 0x20;			// ? value load a long
-														// value
+	final static short	lload_2			= 0x20;			// ? value load a
+															// long
+															// value
 	// from a local variable 2
-	final static short	lload_3			= 0x21;			// ? value load a long
-														// value
+	final static short	lload_3			= 0x21;			// ? value load a
+															// long
+															// value
 	// from a local variable 3
-	final static short	fload_0			= 0x22;			// ? value loads a float
-														// value
+	final static short	fload_0			= 0x22;			// ? value loads a
+															// float
+															// value
 	// from local variable 0
-	final static short	fload_1			= 0x23;			// ? value loads a float
-														// value
+	final static short	fload_1			= 0x23;			// ? value loads a
+															// float
+															// value
 	// from local variable 1
-	final static short	fload_2			= 0x24;			// ? value loads a float
-														// value
+	final static short	fload_2			= 0x24;			// ? value loads a
+															// float
+															// value
 	// from local variable 2
-	final static short	fload_3			= 0x25;			// ? value loads a float
-														// value
+	final static short	fload_3			= 0x25;			// ? value loads a
+															// float
+															// value
 	// from local variable 3
 	final static short	dload_0			= 0x26;			// ? value loads a
-														// double from
+															// double from
 	// local variable 0
 	final static short	dload_1			= 0x27;			// ? value loads a
-														// double from
+															// double from
 	// local variable 1
 	final static short	dload_2			= 0x28;			// ? value loads a
-														// double from
+															// double from
 	// local variable 2
 	final static short	dload_3			= 0x29;			// ? value loads a
-														// double from
+															// double from
 	// local variable 3
 	final static short	faload			= 0x30;			// arrayref, index ?
-														// value loads
+															// value loads
 	// a float from an array
 	final static short	daload			= 0x31;			// arrayref, index ?
-														// value loads
+															// value loads
 	// a double from an array
 	final static short	aaload			= 0x32;			// arrayref, index ?
-														// value loads
+															// value loads
 	// onto the stack a reference
 	// from an array
 	final static short	baload			= 0x33;			// arrayref, index ?
-														// value loads
+															// value loads
 	// a byte or Boolean value from
 	// an array
 	final static short	caload			= 0x34;			// arrayref, index ?
-														// value loads
+															// value loads
 	// a char from an array
 	final static short	saload			= 0x35;			// arrayref, index ?
-														// value load
+															// value load
 	// short from array
-	final static short	istore			= 0x36;			// index value ? store
-														// int value
+	final static short	istore			= 0x36;			// index value ?
+															// store
+															// int value
 	// into variable #index
-	final static short	lstore			= 0x37;			// index value ? store a
-														// long
+	final static short	lstore			= 0x37;			// index value ?
+															// store a
+															// long
 	// value in a local variable
 	// #index
-	final static short	fstore			= 0x38;			// index value ? stores
-														// a float
+	final static short	fstore			= 0x38;			// index value ?
+															// stores
+															// a float
 	// value into a local variable
 	// #index
-	final static short	dstore			= 0x39;			// index value ? stores
-														// a double
+	final static short	dstore			= 0x39;			// index value ?
+															// stores
+															// a double
 	// value into a local variable
 	// #index
-	final static short	lstore_1		= 0x40;			// value ? store a long
-														// value in
+	final static short	lstore_1		= 0x40;			// value ? store a
+															// long
+															// value in
 	// a local variable 1
-	final static short	lstore_2		= 0x41;			// value ? store a long
-														// value in
+	final static short	lstore_2		= 0x41;			// value ? store a
+															// long
+															// value in
 	// a local variable 2
-	final static short	lstore_3		= 0x42;			// value ? store a long
-														// value in
+	final static short	lstore_3		= 0x42;			// value ? store a
+															// long
+															// value in
 	// a local variable 3
 	final static short	fstore_0		= 0x43;			// value ? stores a
-														// float value
+															// float value
 	// into local variable 0
 	final static short	fstore_1		= 0x44;			// value ? stores a
-														// float value
+															// float value
 	// into local variable 1
 	final static short	fstore_2		= 0x45;			// value ? stores a
-														// float value
+															// float value
 	// into local variable 2
 	final static short	fstore_3		= 0x46;			// value ? stores a
-														// float value
+															// float value
 	// into local variable 3
 	final static short	dstore_0		= 0x47;			// value ? stores a
-														// double into
+															// double into
 	// local variable 0
 	final static short	dstore_1		= 0x48;			// value ? stores a
-														// double into
+															// double into
 	// local variable 1
 	final static short	dstore_2		= 0x49;			// value ? stores a
-														// double into
+															// double into
 	// local variable 2
 	final static short	lastore			= 0x50;			// arrayref, index,
-														// value ?
+															// value ?
 	// store a long to an array
 	final static short	fastore			= 0x51;			// arreyref, index,
-														// value ?
+															// value ?
 	// stores a float in an array
 	final static short	dastore			= 0x52;			// arrayref, index,
-														// value ?
+															// value ?
 	// stores a double into an array
 	final static short	aastore			= 0x53;			// arrayref, index,
-														// value ?
+															// value ?
 	// stores into a reference to an
 	// array
 	final static short	bastore			= 0x54;			// arrayref, index,
-														// value ?
+															// value ?
 	// stores a byte or Boolean
 	// value into an array
 	final static short	castore			= 0x55;			// arrayref, index,
-														// value ?
+															// value ?
 	// stores a char into an array
 	final static short	sastore			= 0x56;			// arrayref, index,
-														// value ?
+															// value ?
 	// store short to array
-	final static short	pop				= 0x57;			// value ? discards the
-														// top
+	final static short	pop				= 0x57;			// value ? discards
+															// the
+															// top
 	// value on the stack
-	final static short	pop2			= 0x58;			// {value2, value1} ?
-														// discards
+	final static short	pop2			= 0x58;			// {value2, value1}
+															// ?
+															// discards
 	// the top two values on the
 	// stack (or one value, if it is
 	// a double or long)
-	final static short	dup				= 0x59;			// value ? value, value
+	final static short	dup				= 0x59;			// value ? value,
+															// value
 	// duplicates the value on top
 	// of the stack
 	final static short	iadd			= 0x60;			// value1, value2 ?
-														// result adds
+															// result adds
 	// two ints together
 	final static short	ladd			= 0x61;			// value1, value2 ?
-														// result add
+															// result add
 	// two longs
 	final static short	fadd			= 0x62;			// value1, value2 ?
-														// result adds
+															// result adds
 	// two floats
 	final static short	dadd			= 0x63;			// value1, value2 ?
-														// result adds
+															// result adds
 	// two doubles
 	final static short	isub			= 0x64;			// value1, value2 ?
-														// result int
+															// result int
 	// subtract
 	final static short	lsub			= 0x65;			// value1, value2 ?
-														// result
+															// result
 	// subtract two longs
 	final static short	fsub			= 0x66;			// value1, value2 ?
-														// result
+															// result
 	// subtracts two floats
 	final static short	dsub			= 0x67;			// value1, value2 ?
-														// result
+															// result
 	// subtracts a double from
 	// another
 	final static short	imul			= 0x68;			// value1, value2 ?
-														// result
+															// result
 	// multiply two integers
 	final static short	lmul			= 0x69;			// value1, value2 ?
-														// result
+															// result
 	// multiplies two longs
 	final static short	irem			= 0x70;			// value1, value2 ?
-														// result
+															// result
 	// logical int remainder
 	final static short	lrem			= 0x71;			// value1, value2 ?
-														// result
+															// result
 	// remainder of division of two
 	// longs
 	final static short	frem			= 0x72;			// value1, value2 ?
-														// result gets
+															// result gets
 	// the remainder from a division
 	// between two floats
 	final static short	drem			= 0x73;			// value1, value2 ?
-														// result gets
+															// result gets
 	// the remainder from a division
 	// between two doubles
-	final static short	ineg			= 0x74;			// value ? result negate
-														// int
+	final static short	ineg			= 0x74;			// value ? result
+															// negate
+															// int
 	final static short	lneg			= 0x75;			// value ? result
-														// negates a long
+															// negates a long
 	final static short	fneg			= 0x76;			// value ? result
-														// negates a
+															// negates a
 	// float
 	final static short	dneg			= 0x77;			// value ? result
-														// negates a
+															// negates a
 	// double
 	final static short	ishl			= 0x78;			// value1, value2 ?
-														// result int
+															// result int
 	// shift left
 	final static short	lshl			= 0x79;			// value1, value2 ?
-														// result
+															// result
 	// bitwise shift left of a long
 	// value1 by value2 positions
 	final static short	ior				= 0x80;			// value1, value2 ?
-														// result
+															// result
 	// logical int or
 	final static short	lor				= 0x81;			// value1, value2 ?
-														// result
+															// result
 	// bitwise or of two longs
 	final static short	ixor			= 0x82;			// value1, value2 ?
-														// result int
+															// result int
 	// xor
 	final static short	lxor			= 0x83;			// value1, value2 ?
-														// result
+															// result
 	// bitwise exclusive or of two
 	// longs
 	final static short	iinc			= 0x84;			// index, const [No
-														// change]
+															// change]
 	// increment local variable
 	// #index by signed byte const
 	final static short	i2l				= 0x85;			// value ? result
-														// converts an
+															// converts an
 	// int into a long
 	final static short	i2f				= 0x86;			// value ? result
-														// converts an
+															// converts an
 	// int into a float
 	final static short	i2d				= 0x87;			// value ? result
-														// converts an
+															// converts an
 	// int into a double
 	final static short	l2i				= 0x88;			// value ? result
-														// converts a
+															// converts a
 	// long to an int
 	final static short	l2f				= 0x89;			// value ? result
-														// converts a
+															// converts a
 	// long to a float
 	final static short	d2f				= 0x90;			// value ? result
-														// converts a
+															// converts a
 	// double to a float
 	final static short	i2b				= 0x91;			// value ? result
-														// converts an
+															// converts an
 	// int into a byte
 	final static short	i2c				= 0x92;			// value ? result
-														// converts an
+															// converts an
 	// int into a character
 	final static short	i2s				= 0x93;			// value ? result
-														// converts an
+															// converts an
 	// int into a short
 	final static short	lcmp			= 0x94;			// value1, value2 ?
-														// result
+															// result
 	// compares two longs values
 	final static short	fcmpl			= 0x95;			// value1, value2 ?
-														// result
+															// result
 	// compares two floats
 	final static short	fcmpg			= 0x96;			// value1, value2 ?
-														// result
+															// result
 	// compares two floats
 	final static short	dcmpl			= 0x97;			// value1, value2 ?
-														// result
+															// result
 	// compares two doubles
 	final static short	dcmpg			= 0x98;			// value1, value2 ?
-														// result
+															// result
 	// compares two doubles
 	final static short	ifeq			= 0x99;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is 0, branch
 	// to instruction at
 	// branchoffset (signed short
 	// constructed from unsigned
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
-	final static short	lconst_1		= 0x0a;			// ? 1L pushes the long
-														// 1 onto
+	final static short	lconst_1		= 0x0a;			// ? 1L pushes the
+															// long
+															// 1 onto
 	// the stack
-	final static short	fconst_0		= 0x0b;			// ? 0.0f pushes 0.0f on
-														// the
+	final static short	fconst_0		= 0x0b;			// ? 0.0f pushes
+															// 0.0f on
+															// the
 	// stack
-	final static short	fconst_1		= 0x0c;			// ? 1.0f pushes 1.0f on
-														// the
+	final static short	fconst_1		= 0x0c;			// ? 1.0f pushes
+															// 1.0f on
+															// the
 	// stack
-	final static short	fconst_2		= 0x0d;			// ? 2.0f pushes 2.0f on
-														// the
+	final static short	fconst_2		= 0x0d;			// ? 2.0f pushes
+															// 2.0f on
+															// the
 	// stack
 	final static short	dconst_0		= 0x0e;			// ? 0.0 pushes the
-														// constant 0.0
+															// constant 0.0
 	// onto the stack
 	final static short	dconst_1		= 0x0f;			// ? 1.0 pushes the
-														// constant 1.0
+															// constant 1.0
 	// onto the stack
-	final static short	iload_0			= 0x1a;			// ? value loads an int
-														// value
+	final static short	iload_0			= 0x1a;			// ? value loads an
+															// int
+															// value
 	// from variable 0
-	final static short	iload_1			= 0x1b;			// ? value loads an int
-														// value
+	final static short	iload_1			= 0x1b;			// ? value loads an
+															// int
+															// value
 	// from variable 1
-	final static short	iload_2			= 0x1c;			// ? value loads an int
-														// value
+	final static short	iload_2			= 0x1c;			// ? value loads an
+															// int
+															// value
 	// from variable 2
-	final static short	iload_3			= 0x1d;			// ? value loads an int
-														// value
+	final static short	iload_3			= 0x1d;			// ? value loads an
+															// int
+															// value
 	// from variable 3
-	final static short	lload_0			= 0x1e;			// ? value load a long
-														// value
+	final static short	lload_0			= 0x1e;			// ? value load a
+															// long
+															// value
 	// from a local variable 0
-	final static short	lload_1			= 0x1f;			// ? value load a long
-														// value
+	final static short	lload_1			= 0x1f;			// ? value load a
+															// long
+															// value
 	// from a local variable 1
-	final static short	aload_0			= 0x2a;			// ? objectref loads a
-														// reference
+	final static short	aload_0			= 0x2a;			// ? objectref loads
+															// a
+															// reference
 	// onto the stack from local
 	// variable 0
-	final static short	aload_1			= 0x2b;			// ? objectref loads a
-														// reference
+	final static short	aload_1			= 0x2b;			// ? objectref loads
+															// a
+															// reference
 	// onto the stack from local
 	// variable 1
-	final static short	aload_2			= 0x2c;			// ? objectref loads a
-														// reference
+	final static short	aload_2			= 0x2c;			// ? objectref loads
+															// a
+															// reference
 	// onto the stack from local
 	// variable 2
-	final static short	aload_3			= 0x2d;			// ? objectref loads a
-														// reference
+	final static short	aload_3			= 0x2d;			// ? objectref loads
+															// a
+															// reference
 	// onto the stack from local
 	// variable 3
 	final static short	iaload			= 0x2e;			// arrayref, index ?
-														// value loads
+															// value loads
 	// an int from an array
 	final static short	laload			= 0x2f;			// arrayref, index ?
-														// value load
+															// value load
 	// a long from an array
 	final static short	astore			= 0x3a;			// index objectref ?
-														// stores a
+															// stores a
 	// reference into a local
 	// variable #index
 	final static short	istore_0		= 0x3b;			// value ? store int
-														// value into
+															// value into
 	// variable 0
 	final static short	istore_1		= 0x3c;			// value ? store int
-														// value into
+															// value into
 	// variable 1
 	final static short	istore_2		= 0x3d;			// value ? store int
-														// value into
+															// value into
 	// variable 2
 	final static short	istore_3		= 0x3e;			// value ? store int
-														// value into
+															// value into
 	// variable 3
-	final static short	lstore_0		= 0x3f;			// value ? store a long
-														// value in
+	final static short	lstore_0		= 0x3f;			// value ? store a
+															// long
+															// value in
 	// a local variable 0
 	final static short	dstore_3		= 0x4a;			// value ? stores a
-														// double into
+															// double into
 	// local variable 3
-	final static short	astore_0		= 0x4b;			// objectref ? stores a
+	final static short	astore_0		= 0x4b;			// objectref ?
+															// stores a
 	// reference into local variable
 	// 0
-	final static short	astore_1		= 0x4c;			// objectref ? stores a
+	final static short	astore_1		= 0x4c;			// objectref ?
+															// stores a
 	// reference into local variable
 	// 1
-	final static short	astore_2		= 0x4d;			// objectref ? stores a
+	final static short	astore_2		= 0x4d;			// objectref ?
+															// stores a
 	// reference into local variable
 	// 2
-	final static short	astore_3		= 0x4e;			// objectref ? stores a
+	final static short	astore_3		= 0x4e;			// objectref ?
+															// stores a
 	// reference into local variable
 	// 3
 	final static short	iastore			= 0x4f;			// arrayref, index,
-														// value ?
+															// value ?
 	// stores an int into an array
 	final static short	dup_x1			= 0x5a;			// value2, value1 ?
-														// value1,
+															// value1,
 	// value2, value1 inserts a copy
 	// of the top value into the
 	// stack two values from the top
 	final static short	dup_x2			= 0x5b;			// value3, value2,
-														// value1 ?
+															// value1 ?
 	// value1, value3, value2,
 	// value1 inserts a copy of the
 	// top value into the stack two
@@ -448,8 +495,9 @@
 	// value3, too) or three values
 	// (if value2 is neither double
 	// nor long) from the top
-	final static short	dup2			= 0x5c;			// {value2, value1} ?
-														// {value2,
+	final static short	dup2			= 0x5c;			// {value2, value1}
+															// ?
+															// {value2,
 	// value1}, {value2, value1}
 	// duplicate top two stack words
 	// (two values, if value1 is not
@@ -457,85 +505,85 @@
 	// value, if value1 is double or
 	// long)
 	final static short	dup2_x1			= 0x5d;			// value3, {value2,
-														// value1} ?
+															// value1} ?
 	// {value2, value1}, value3,
 	// {value2, value1} duplicate
 	// two words and insert beneath
 	// third word (see explanation
 	// above)
 	final static short	dup2_x2			= 0x5e;			// {value4, value3},
-														// {value2,
+															// {value2,
 	// value1} ? {value2, value1},
 	// {value4, value3}, {value2,
 	// value1} duplicate two words
 	// and insert beneath fourth
 	// word
 	final static short	swap			= 0x5f;			// value2, value1 ?
-														// value1,
+															// value1,
 	// value2 swaps two top words on
 	// the stack (note that value1
 	// and value2 must not be double
 	// or long)
 	final static short	fmul			= 0x6a;			// value1, value2 ?
-														// result
+															// result
 	// multiplies two floats
 	final static short	dmul			= 0x6b;			// value1, value2 ?
-														// result
+															// result
 	// multiplies two doubles
 	final static short	idiv			= 0x6c;			// value1, value2 ?
-														// result
+															// result
 	// divides two integers
 	final static short	ldiv			= 0x6d;			// value1, value2 ?
-														// result
+															// result
 	// divide two longs
 	final static short	fdiv			= 0x6e;			// value1, value2 ?
-														// result
+															// result
 	// divides two floats
 	final static short	ddiv			= 0x6f;			// value1, value2 ?
-														// result
+															// result
 	// divides two doubles
 	final static short	ishr			= 0x7a;			// value1, value2 ?
-														// result int
+															// result int
 	// shift right
 	final static short	lshr			= 0x7b;			// value1, value2 ?
-														// result
+															// result
 	// bitwise shift right of a long
 	// value1 by value2 positions
 	final static short	iushr			= 0x7c;			// value1, value2 ?
-														// result int
+															// result int
 	// shift right
 	final static short	lushr			= 0x7d;			// value1, value2 ?
-														// result
+															// result
 	// bitwise shift right of a long
 	// value1 by value2 positions,
 	// unsigned
 	final static short	iand			= 0x7e;			// value1, value2 ?
-														// result
+															// result
 	// performs a logical and on two
 	// integers
 	final static short	land			= 0x7f;			// value1, value2 ?
-														// result
+															// result
 	// bitwise and of two longs
 	final static short	l2d				= 0x8a;			// value ? result
-														// converts a
+															// converts a
 	// long to a double
 	final static short	f2i				= 0x8b;			// value ? result
-														// converts a
+															// converts a
 	// float to an int
 	final static short	f2l				= 0x8c;			// value ? result
-														// converts a
+															// converts a
 	// float to a long
 	final static short	f2d				= 0x8d;			// value ? result
-														// converts a
+															// converts a
 	// float to a double
 	final static short	d2i				= 0x8e;			// value ? result
-														// converts a
+															// converts a
 	// double to an int
 	final static short	d2l				= 0x8f;			// value ? result
-														// converts a
+															// converts a
 	// double to a long
 	final static short	ifne			= 0x9a;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is not 0,
 	// branch to instruction at
 	// branchoffset (signed short
@@ -543,7 +591,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	iflt			= 0x9b;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is less than
 	// 0, branch to instruction at
 	// branchoffset (signed short
@@ -551,7 +599,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	ifge			= 0x9c;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is greater
 	// than or equal to 0, branch to
 	// instruction at branchoffset
@@ -560,7 +608,7 @@
 	// branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	ifgt			= 0x9d;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is greater
 	// than 0, branch to instruction
 	// at branchoffset (signed short
@@ -568,7 +616,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	ifle			= 0x9e;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is less than
 	// or equal to 0, branch to
 	// instruction at branchoffset
@@ -577,7 +625,7 @@
 	// branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmpeq		= 0x9f;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if ints are
 	// equal, branch to instruction
 	// at branchoffset (signed short
@@ -585,7 +633,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmpne		= 0xa0;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if ints are
 	// not equal, branch to
 	// instruction at branchoffset
@@ -594,7 +642,7 @@
 	// branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmplt		= 0xa1;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if value1 is
 	// less than value2, branch to
 	// instruction at branchoffset
@@ -603,7 +651,7 @@
 	// branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmpge		= 0xa2;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if value1 is
 	// greater than or equal to
 	// value2, branch to instruction
@@ -612,7 +660,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmpgt		= 0xa3;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if value1 is
 	// greater than value2, branch
 	// to instruction at
@@ -621,7 +669,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_icmple		= 0xa4;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if value1 is
 	// less than or equal to value2,
 	// branch to instruction at
@@ -630,7 +678,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_acmpeq		= 0xa5;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if
 	// references are equal, branch
 	// to instruction at
@@ -639,7 +687,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	if_acmpne		= 0xa6;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value1, value2 ? if
 	// references are not equal,
 	// branch to instruction at
@@ -648,7 +696,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	goto_			= 0xa7;			// branchbyte1,
-														// branchbyte2 [no
+															// branchbyte2 [no
 	// change] goes to another
 	// instruction at branchoffset
 	// (signed short constructed
@@ -656,7 +704,7 @@
 	// branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	jsr				= 0xa8;			// branchbyte1,
-														// branchbyte2 ?
+															// branchbyte2 ?
 	// address jump to subroutine at
 	// branchoffset (signed short
 	// constructed from unsigned
@@ -664,12 +712,13 @@
 	// branchbyte2) and place the
 	// return address on the stack
 	final static short	ret				= 0xa9;			// index [No change]
-														// continue
+															// continue
 	// execution from address taken
 	// from a local variable #index
 	// (the asymmetry with jsr is
 	// intentional)
-	final static short	tableswitch		= 0xaa;			// [0-3 bytes padding],
+	final static short	tableswitch		= 0xaa;			// [0-3 bytes
+															// padding],
 	// defaultbyte1, defaultbyte2,
 	// defaultbyte3, defaultbyte4,
 	// lowbyte1, lowbyte2, lowbyte3,
@@ -679,7 +728,8 @@
 	// index ? continue execution
 	// from an address in the table
 	// at offset index
-	final static short	lookupswitch	= 0xab;			// <0-3 bytes padding>,
+	final static short	lookupswitch	= 0xab;			// <0-3 bytes
+															// padding>,
 	// defaultbyte1, defaultbyte2,
 	// defaultbyte3, defaultbyte4,
 	// npairs1, npairs2, npairs3,
@@ -690,32 +740,34 @@
 	// execution continues from the
 	// instruction at that address
 	final static short	ireturn			= 0xac;			// value ? [empty]
-														// returns an
+															// returns an
 	// integer from a method
 	final static short	lreturn			= 0xad;			// value ? [empty]
-														// returns a
+															// returns a
 	// long value
 	final static short	freturn			= 0xae;			// value ? [empty]
-														// returns a
+															// returns a
 	// float
 	final static short	dreturn			= 0xaf;			// value ? [empty]
-														// returns a
+															// returns a
 	// double from a method
-	final static short	areturn			= 0xb0;			// objectref ? [empty]
-														// returns a
+	final static short	areturn			= 0xb0;			// objectref ?
+															// [empty]
+															// returns a
 	// reference from a method
-	final static short	return_			= 0xb1;			// ? [empty] return void
-														// from
+	final static short	return_			= 0xb1;			// ? [empty] return
+															// void
+															// from
 	// method
 	final static short	getstatic		= 0xb2;			// index1, index2 ?
-														// value gets a
+															// value gets a
 	// static field value of a
 	// class, where the field is
 	// identified by field reference
 	// in the constant pool index
 	// (index1 << 8 + index2)
 	final static short	putstatic		= 0xb3;			// indexbyte1,
-														// indexbyte2 value
+															// indexbyte2 value
 	// ? set static field to value
 	// in a class, where the field
 	// is identified by a field
@@ -723,7 +775,7 @@
 	// pool (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	getfield		= 0xb4;			// index1, index2
-														// objectref ?
+															// objectref ?
 	// value gets a field value of
 	// an object objectref, where
 	// the field is identified by
@@ -731,7 +783,7 @@
 	// constant pool index (index1
 	// << 8 + index2)
 	final static short	putfield		= 0xb5;			// indexbyte1,
-														// indexbyte2
+															// indexbyte2
 	// objectref, value ? set field
 	// to value in an object
 	// objectref, where the field is
@@ -740,7 +792,7 @@
 	// pool (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	invokevirtual	= 0xb6;			// indexbyte1,
-														// indexbyte2
+															// indexbyte2
 	// objectref, [arg1, arg2, ...]
 	// ? invoke virtual method on
 	// object objectref, where the
@@ -749,7 +801,7 @@
 	// constant pool (indexbyte1 <<
 	// 8 + indexbyte2)
 	final static short	invokespecial	= 0xb7;			// indexbyte1,
-														// indexbyte2
+															// indexbyte2
 	// objectref, [arg1, arg2, ...]
 	// ? invoke instance method on
 	// object objectref, where the
@@ -758,7 +810,7 @@
 	// constant pool (indexbyte1 <<
 	// 8 + indexbyte2)
 	final static short	invokestatic	= 0xb8;			// indexbyte1,
-														// indexbyte2 [arg1,
+															// indexbyte2 [arg1,
 	// arg2, ...] ? invoke a static
 	// method, where the method is
 	// identified by method
@@ -766,7 +818,7 @@
 	// pool (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	invokeinterface	= 0xb9;			// indexbyte1,
-														// indexbyte2,
+															// indexbyte2,
 	// count, 0 objectref, [arg1,
 	// arg2, ...] ? invokes an
 	// interface method on object
@@ -777,22 +829,22 @@
 	// pool (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	xxxunusedxxx	= 0xba;			// this opcode is
-														// reserved "for
+															// reserved "for
 	// historical reasons"
 	final static short	new_			= 0xbb;			// indexbyte1,
-														// indexbyte2 ?
+															// indexbyte2 ?
 	// objectref creates new object
 	// of type identified by class
 	// reference in constant pool
 	// index (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	newarray		= 0xbc;			// atype count ?
-														// arrayref
+															// arrayref
 	// creates new array with count
 	// elements of primitive type
 	// identified by atype
 	final static short	anewarray		= 0xbd;			// indexbyte1,
-														// indexbyte2 count
+															// indexbyte2 count
 	// ? arrayref creates a new
 	// array of references of length
 	// count and component type
@@ -801,16 +853,17 @@
 	// << 8 + indexbyte2) in the
 	// constant pool
 	final static short	arraylength		= 0xbe;			// arrayref ? length
-														// gets the
+															// gets the
 	// length of an array
-	final static short	athrow			= 0xbf;			// objectref ? [empty],
+	final static short	athrow			= 0xbf;			// objectref ?
+															// [empty],
 	// objectref throws an error or
 	// exception (notice that the
 	// rest of the stack is cleared,
 	// leaving only a reference to
 	// the Throwable)
 	final static short	checkcast		= 0xc0;			// indexbyte1,
-														// indexbyte2
+															// indexbyte2
 	// objectref ? objectref checks
 	// whether an objectref is of a
 	// certain type, the class
@@ -819,7 +872,7 @@
 	// (indexbyte1 << 8 +
 	// indexbyte2)
 	final static short	instanceof_		= 0xc1;			// indexbyte1,
-														// indexbyte2
+															// indexbyte2
 	// objectref ? result determines
 	// if an object objectref is of
 	// a given type, identified by
@@ -827,19 +880,20 @@
 	// constant pool (indexbyte1 <<
 	// 8 + indexbyte2)
 	final static short	monitorenter	= 0xc2;			// objectref ? enter
-														// monitor for
+															// monitor for
 	// object ("grab the lock" -
 	// start of synchronized()
 	// section)
 	final static short	monitorexit		= 0xc3;			// objectref ? exit
-														// monitor for
+															// monitor for
 	// object ("release the lock" -
 	// end of synchronized()
 	// section)
-	final static short	wide			= 0xc4;			// opcode, indexbyte1,
+	final static short	wide			= 0xc4;			// opcode,
+															// indexbyte1,
 	// indexbyte2
 	final static short	multianewarray	= 0xc5;			// indexbyte1,
-														// indexbyte2,
+															// indexbyte2,
 	// dimensions count1,
 	// [count2,...] ? arrayref
 	// create a new array of
@@ -852,7 +906,7 @@
 	// each dimension is identified
 	// by count1, [count2, etc]
 	final static short	ifnull			= 0xc6;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is null,
 	// branch to instruction at
 	// branchoffset (signed short
@@ -860,7 +914,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	ifnonnull		= 0xc7;			// branchbyte1,
-														// branchbyte2
+															// branchbyte2
 	// value ? if value is not null,
 	// branch to instruction at
 	// branchoffset (signed short
@@ -868,7 +922,7 @@
 	// bytes branchbyte1 << 8 +
 	// branchbyte2)
 	final static short	goto_w			= 0xc8;			// branchbyte1,
-														// branchbyte2,
+															// branchbyte2,
 	// branchbyte3, branchbyte4 [no
 	// change] goes to another
 	// instruction at branchoffset
@@ -878,7 +932,7 @@
 	// branchbyte3 << 8 +
 	// branchbyte4)
 	final static short	jsr_w			= 0xc9;			// branchbyte1,
-														// branchbyte2,
+															// branchbyte2,
 	// branchbyte3, branchbyte4 ?
 	// address jump to subroutine at
 	// branchoffset (signed int
@@ -889,7 +943,7 @@
 	// branchbyte4) and place the
 	// return address on the stack
 	final static short	breakpoint		= 0xca;			// reserved for
-														// breakpoints in
+															// breakpoints in
 	// Java debuggers; should not
 	// appear in any class file
 	final static short	impdep1			= 0xfe;			// reserved for
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java b/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
index 09e8305..fae4597 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
@@ -5,21 +5,20 @@
 import aQute.lib.osgi.Descriptors.PackageRef;
 import aQute.libg.header.*;
 
-public class Packages implements Map<PackageRef, Attrs> {
-	private LinkedHashMap<PackageRef, Attrs>	map;
-	static Map<PackageRef, Attrs>		EMPTY	= Collections.emptyMap();
+public class Packages implements Map<PackageRef,Attrs> {
+	private LinkedHashMap<PackageRef,Attrs>	map;
+	static Map<PackageRef,Attrs>			EMPTY	= Collections.emptyMap();
 
 	public Packages(Packages other) {
 		if (other.map != null) {
-			map = new LinkedHashMap<Descriptors.PackageRef, Attrs>(other.map);
+			map = new LinkedHashMap<Descriptors.PackageRef,Attrs>(other.map);
 		}
 	}
 
-	public Packages() {
-	}
+	public Packages() {}
 
 	public void clear() {
-		if(map!=null)
+		if (map != null)
 			map.clear();
 	}
 
@@ -30,7 +29,8 @@
 		return map.containsKey(name);
 	}
 
-	@Deprecated public boolean containsKey(Object name) {
+	@Deprecated
+	public boolean containsKey(Object name) {
 		assert name instanceof PackageRef;
 		if (map == null)
 			return false;
@@ -45,7 +45,8 @@
 		return map.containsValue(value);
 	}
 
-	@Deprecated public boolean containsValue(Object value) {
+	@Deprecated
+	public boolean containsValue(Object value) {
 		assert value instanceof Attrs;
 		if (map == null)
 			return false;
@@ -53,14 +54,15 @@
 		return map.containsValue((Attrs) value);
 	}
 
-	public Set<java.util.Map.Entry<PackageRef, Attrs>> entrySet() {
+	public Set<java.util.Map.Entry<PackageRef,Attrs>> entrySet() {
 		if (map == null)
 			return EMPTY.entrySet();
 
 		return map.entrySet();
 	}
 
-	@Deprecated public Attrs get(Object key) {
+	@Deprecated
+	public Attrs get(Object key) {
 		assert key instanceof PackageRef;
 		if (map == null)
 			return null;
@@ -98,28 +100,29 @@
 
 	public Attrs put(PackageRef key, Attrs value) {
 		if (map == null)
-			map = new LinkedHashMap<PackageRef, Attrs>();
+			map = new LinkedHashMap<PackageRef,Attrs>();
 
 		return map.put(key, value);
 	}
 
-	public void putAll(Map<? extends PackageRef, ? extends Attrs> map) {
+	public void putAll(Map< ? extends PackageRef, ? extends Attrs> map) {
 		if (this.map == null)
 			if (map.isEmpty())
 				return;
 			else
-				this.map = new LinkedHashMap<PackageRef, Attrs>();
+				this.map = new LinkedHashMap<PackageRef,Attrs>();
 		this.map.putAll(map);
 	}
 
 	public void putAllIfAbsent(Map<PackageRef, ? extends Attrs> map) {
-		for(Map.Entry<PackageRef, ? extends Attrs> entry : map.entrySet() ) {
-			if ( !containsKey(entry.getKey()))
+		for (Map.Entry<PackageRef, ? extends Attrs> entry : map.entrySet()) {
+			if (!containsKey(entry.getKey()))
 				put(entry.getKey(), entry.getValue());
 		}
 	}
-	
-	@Deprecated public Attrs remove(Object var0) {
+
+	@Deprecated
+	public Attrs remove(Object var0) {
 		assert var0 instanceof PackageRef;
 		if (map == null)
 			return null;
@@ -150,7 +153,7 @@
 		if (map == null)
 			return null;
 
-		for (Map.Entry<PackageRef, Attrs> pr : map.entrySet()) {
+		for (Map.Entry<PackageRef,Attrs> pr : map.entrySet()) {
 			if (pr.getKey().getFQN().equals(s))
 				return pr.getValue();
 		}
@@ -161,7 +164,7 @@
 		if (map == null)
 			return null;
 
-		for (Map.Entry<PackageRef, Attrs> pr : map.entrySet()) {
+		for (Map.Entry<PackageRef,Attrs> pr : map.entrySet()) {
 			if (pr.getKey().getBinary().equals(s))
 				pr.getValue();
 		}
@@ -184,7 +187,7 @@
 
 	public void append(StringBuilder sb) {
 		String del = "";
-		for (Map.Entry<PackageRef, Attrs> s : entrySet()) {
+		for (Map.Entry<PackageRef,Attrs> s : entrySet()) {
 			sb.append(del);
 			sb.append(s.getKey());
 			if (!s.getValue().isEmpty()) {
@@ -196,11 +199,11 @@
 	}
 
 	public void merge(PackageRef ref, boolean unique, Attrs... attrs) {
-		if ( unique ) {
-			while ( containsKey(ref))
+		if (unique) {
+			while (containsKey(ref))
 				ref = ref.getDuplicate();
 		}
-		
+
 		Attrs org = put(ref);
 		for (Attrs a : attrs) {
 			if (a != null)
@@ -210,21 +213,20 @@
 
 	public Attrs get(PackageRef packageRef, Attrs deflt) {
 		Attrs mine = get(packageRef);
-		if ( mine!=null)
+		if (mine != null)
 			return mine;
-		
+
 		return deflt;
 	}
 
-
 	@Deprecated
 	public boolean equals(Object other) {
 		return super.equals(other);
 	}
-	
+
 	@Deprecated
 	public int hashCode() {
 		return super.hashCode();
 	}
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/PreprocessResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/PreprocessResource.java
index f003abc..8b3f79e 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/PreprocessResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/PreprocessResource.java
@@ -3,42 +3,43 @@
 import java.io.*;
 
 public class PreprocessResource extends AbstractResource {
-    final Resource  resource;
-    final Processor processor;
+	final Resource	resource;
+	final Processor	processor;
 
-    public PreprocessResource(Processor processor, Resource r) {
-        super(r.lastModified());
-        this.processor = processor;
-        this.resource = r;
-        setExtra(resource.getExtra());
-    }
+	public PreprocessResource(Processor processor, Resource r) {
+		super(r.lastModified());
+		this.processor = processor;
+		this.resource = r;
+		setExtra(resource.getExtra());
+	}
 
-    protected byte[] getBytes() throws Exception {
-        ByteArrayOutputStream bout = new ByteArrayOutputStream(2000);
-        OutputStreamWriter osw = new OutputStreamWriter(bout, Constants.DEFAULT_CHARSET);
-        PrintWriter pw = new PrintWriter(osw);
-        InputStream in = null;
-        BufferedReader rdr = null;
-        try {
+	protected byte[] getBytes() throws Exception {
+		ByteArrayOutputStream bout = new ByteArrayOutputStream(2000);
+		OutputStreamWriter osw = new OutputStreamWriter(bout, Constants.DEFAULT_CHARSET);
+		PrintWriter pw = new PrintWriter(osw);
+		InputStream in = null;
+		BufferedReader rdr = null;
+		try {
 			in = resource.openInputStream();
-            rdr = new BufferedReader(new InputStreamReader(in,"UTF8"));
-            String line = rdr.readLine();
-            while (line != null) {
-                line = processor.getReplacer().process(line);
-                pw.println(line);
-                line = rdr.readLine();
-            }
-            pw.flush();
-            byte [] data= bout.toByteArray();
-            return data;
-                
-        } finally {
+			rdr = new BufferedReader(new InputStreamReader(in, "UTF8"));
+			String line = rdr.readLine();
+			while (line != null) {
+				line = processor.getReplacer().process(line);
+				pw.println(line);
+				line = rdr.readLine();
+			}
+			pw.flush();
+			byte[] data = bout.toByteArray();
+			return data;
+
+		}
+		finally {
 			if (rdr != null) {
 				rdr.close();
 			}
 			if (in != null) {
 				in.close();
 			}
-        }        
-    }
+		}
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
index 655ce4d..ab1cf10 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
@@ -96,7 +96,7 @@
 		getInfo(processor, "");
 	}
 
-	private <T> void addAll(List<String> to, List<? extends T> from, String prefix) {
+	private <T> void addAll(List<String> to, List< ? extends T> from, String prefix) {
 		for (T x : from) {
 			to.add(prefix + x);
 		}
@@ -152,8 +152,7 @@
 		p.signal();
 	}
 
-	public void signal() {
-	}
+	public void signal() {}
 
 	public List<String> getWarnings() {
 		return warnings;
@@ -250,9 +249,8 @@
 	/**
 	 * Return a list of plugins. Plugins are defined with the -plugin command.
 	 * They are class names, optionally associated with attributes. Plugins can
-	 * implement the Plugin interface to see these attributes.
-	 * 
-	 * Any object can be a plugin.
+	 * implement the Plugin interface to see these attributes. Any object can be
+	 * a plugin.
 	 * 
 	 * @return
 	 */
@@ -295,7 +293,7 @@
 		CL loader = getLoader();
 
 		// First add the plugin-specific paths from their path: directives
-		for (Entry<String, Attrs> entry : plugins.entrySet()) {
+		for (Entry<String,Attrs> entry : plugins.entrySet()) {
 			String key = removeDuplicateMarker(entry.getKey());
 			String path = entry.getValue().get(PATH_DIRECTIVE);
 			if (path != null) {
@@ -305,9 +303,9 @@
 						File f = getFile(p).getAbsoluteFile();
 						loader.add(f.toURI().toURL());
 					}
-				} catch (Exception e) {
-					error("Problem adding path %s to loader for plugin %s. Exception: (%s)", path,
-							key, e);
+				}
+				catch (Exception e) {
+					error("Problem adding path %s to loader for plugin %s. Exception: (%s)", path, key, e);
 				}
 			}
 		}
@@ -320,14 +318,15 @@
 				try {
 					File f = getFile(path).getAbsoluteFile();
 					loader.add(f.toURI().toURL());
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					error("Problem adding path %s from global plugin path. Exception: %s", path, e);
 				}
 			}
 		}
 
 		// Load the plugins
-		for (Entry<String, Attrs> entry : plugins.entrySet()) {
+		for (Entry<String,Attrs> entry : plugins.entrySet()) {
 			String key = entry.getKey();
 
 			try {
@@ -339,11 +338,12 @@
 				key = removeDuplicateMarker(key);
 
 				try {
-					Class<?> c = (Class<?>) loader.loadClass(key);
+					Class< ? > c = (Class< ? >) loader.loadClass(key);
 					Object plugin = c.newInstance();
 					customize(plugin, entry.getValue());
 					list.add(plugin);
-				} catch (Throwable t) {
+				}
+				catch (Throwable t) {
 					// We can defer the error if the plugin specifies
 					// a command name. In that case, we'll verify that
 					// a bnd file does not contain any references to a
@@ -358,7 +358,8 @@
 						missingCommand.addAll(cs);
 					}
 				}
-			} catch (Throwable e) {
+			}
+			catch (Throwable e) {
 				error("Problem loading the plugin: %s exception: (%s)", key, e);
 			}
 		}
@@ -420,12 +421,12 @@
 		return new TreeSet<T>();
 	}
 
-	public static <K, V> Map<K, V> newMap() {
-		return new LinkedHashMap<K, V>();
+	public static <K, V> Map<K,V> newMap() {
+		return new LinkedHashMap<K,V>();
 	}
 
-	public static <K, V> Map<K, V> newHashMap() {
-		return new LinkedHashMap<K, V>();
+	public static <K, V> Map<K,V> newHashMap() {
+		return new LinkedHashMap<K,V>();
 	}
 
 	public <T> List<T> newList(Collection<T> t) {
@@ -436,15 +437,16 @@
 		return new TreeSet<T>(t);
 	}
 
-	public <K, V> Map<K, V> newMap(Map<K, V> t) {
-		return new LinkedHashMap<K, V>(t);
+	public <K, V> Map<K,V> newMap(Map<K,V> t) {
+		return new LinkedHashMap<K,V>(t);
 	}
 
 	public void close() {
 		for (Closeable c : toBeClosed) {
 			try {
 				c.close();
-			} catch (IOException e) {
+			}
+			catch (IOException e) {
 				// Who cares?
 			}
 		}
@@ -482,7 +484,8 @@
 			try {
 				Properties properties = loadProperties(file);
 				mergeProperties(properties, override);
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				error("Error loading properties file: " + file);
 			}
 		} else {
@@ -494,7 +497,7 @@
 	}
 
 	public void mergeProperties(Properties properties, boolean override) {
-		for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
+		for (Enumeration< ? > e = properties.propertyNames(); e.hasMoreElements();) {
 			String key = (String) e.nextElement();
 			String value = properties.getProperty(key);
 			if (override || !getProperties().containsKey(key))
@@ -513,8 +516,8 @@
 		setProperties(p);
 	}
 
-	public void addProperties(Map<?, ?> properties) {
-		for (Entry<?, ?> entry : properties.entrySet()) {
+	public void addProperties(Map< ? , ? > properties) {
+		for (Entry< ? , ? > entry : properties.entrySet()) {
 			setProperty(entry.getKey().toString(), entry.getValue() + "");
 		}
 	}
@@ -561,11 +564,11 @@
 				try {
 					File file = getFile(ubase, value).getAbsoluteFile();
 					if (!file.isFile() && fileMustExist) {
-						error("Included file " + file
-								+ (file.exists() ? " does not exist" : " is directory"));
+						error("Included file " + file + (file.exists() ? " does not exist" : " is directory"));
 					} else
 						doIncludeFile(file, overwrite, p);
-				} catch (Exception e) {
+				}
+				catch (Exception e) {
 					if (fileMustExist)
 						error("Error in processing included file: " + value, e);
 				}
@@ -610,10 +613,10 @@
 
 				doIncludes(file.getParentFile(), sub);
 				// make sure we do not override properties
-				for (Map.Entry<?, ?> entry : sub.entrySet()) {
+				for (Map.Entry< ? , ? > entry : sub.entrySet()) {
 					String key = (String) entry.getKey();
 					String value = (String) entry.getValue();
-					
+
 					if (overwrite || !target.containsKey(key)) {
 						target.setProperty(key, value);
 					} else if (extensionName != null) {
@@ -622,7 +625,8 @@
 							target.setProperty(extensionKey, value);
 					}
 				}
-			} finally {
+			}
+			finally {
 				IO.close(in);
 			}
 		}
@@ -645,8 +649,7 @@
 				if (changed)
 					break;
 
-				changed |= !file.exists()
-						|| updateModified(file.lastModified(), "include file: " + file);
+				changed |= !file.exists() || updateModified(file.lastModified(), "include file: " + file);
 			}
 		}
 
@@ -667,8 +670,7 @@
 		propertiesChanged();
 	}
 
-	public void propertiesChanged() {
-	}
+	public void propertiesChanged() {}
 
 	/**
 	 * Set the properties by file. Setting the properties this way will also set
@@ -705,7 +707,8 @@
 					error("No such properties file: " + propertiesFile);
 				}
 			}
-		} catch (IOException e) {
+		}
+		catch (IOException e) {
 			error("Could not load properties " + propertiesFile);
 		}
 	}
@@ -729,11 +732,11 @@
 	 * @param deflt
 	 * @return
 	 */
-	
+
 	public String getUnprocessedProperty(String key, String deflt) {
 		return getProperties().getProperty(key, deflt);
 	}
-	
+
 	/**
 	 * Get a property with preprocessing it with a proper default
 	 * 
@@ -802,7 +805,8 @@
 		try {
 			Properties p = loadProperties(in, file.getAbsolutePath());
 			return p;
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -818,7 +822,8 @@
 			Properties p = new Properties();
 			p.load(in);
 			return replaceAll(p, "\\$\\{\\.\\}", name);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			error("Error during loading properties file: " + name + ", error:" + e);
 			return new Properties();
 		}
@@ -832,8 +837,8 @@
 
 	public static Properties replaceAll(Properties p, String pattern, String replacement) {
 		Properties result = new Properties();
-		for (Iterator<Map.Entry<Object, Object>> i = p.entrySet().iterator(); i.hasNext();) {
-			Map.Entry<Object, Object> entry = i.next();
+		for (Iterator<Map.Entry<Object,Object>> i = p.entrySet().iterator(); i.hasNext();) {
+			Map.Entry<Object,Object> entry = i.next();
 			String key = (String) entry.getKey();
 			String value = (String) entry.getValue();
 			value = value.replaceAll(pattern, replacement);
@@ -850,17 +855,17 @@
 	 * @return the clauses
 	 * @throws IOException
 	 */
-	public static String printClauses(Map<?, ? extends Map<?, ?>> exports) throws IOException {
+	public static String printClauses(Map< ? , ? extends Map< ? , ? >> exports) throws IOException {
 		return printClauses(exports, false);
 	}
 
-	public static String printClauses(Map<?, ? extends Map<?, ?>> exports,
-			boolean checkMultipleVersions) throws IOException {
+	public static String printClauses(Map< ? , ? extends Map< ? , ? >> exports, boolean checkMultipleVersions)
+			throws IOException {
 		StringBuilder sb = new StringBuilder();
 		String del = "";
-		for (Entry<?, ? extends Map<?, ?>> entry : exports.entrySet()) {
+		for (Entry< ? , ? extends Map< ? , ? >> entry : exports.entrySet()) {
 			String name = entry.getKey().toString();
-			Map<?, ?> clause = entry.getValue();
+			Map< ? , ? > clause = entry.getValue();
 
 			// We allow names to be duplicated in the input
 			// by ending them with '~'. This is necessary to use
@@ -876,13 +881,13 @@
 		return sb.toString();
 	}
 
-	public static void printClause(Map<?, ?> map, StringBuilder sb) throws IOException {
+	public static void printClause(Map< ? , ? > map, StringBuilder sb) throws IOException {
 
-		for (Entry<?, ?> entry : map.entrySet()) {
+		for (Entry< ? , ? > entry : map.entrySet()) {
 			Object key = entry.getKey();
 			// Skip directives we do not recognize
-			if (key.equals(NO_IMPORT_DIRECTIVE) || key.equals(PROVIDE_DIRECTIVE)
-					|| key.equals(SPLIT_PACKAGE_DIRECTIVE) || key.equals(FROM_DIRECTIVE))
+			if (key.equals(NO_IMPORT_DIRECTIVE) || key.equals(PROVIDE_DIRECTIVE) || key.equals(SPLIT_PACKAGE_DIRECTIVE)
+					|| key.equals(FROM_DIRECTIVE))
 				continue;
 
 			String value = ((String) entry.getValue()).trim();
@@ -901,8 +906,8 @@
 	 * @throws IOException
 	 */
 	public static boolean quote(Appendable sb, String value) throws IOException {
-		boolean clean = (value.length() >= 2 && value.charAt(0) == '"' && value.charAt(value
-				.length() - 1) == '"') || Verifier.TOKEN.matcher(value).matches();
+		boolean clean = (value.length() >= 2 && value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"')
+				|| Verifier.TOKEN.matcher(value).matches();
 		if (!clean)
 			sb.append("\"");
 		sb.append(value);
@@ -1021,7 +1026,8 @@
 				sb.append(chars, 0, size);
 				size = ir.read(chars);
 			}
-		} finally {
+		}
+		finally {
 			ir.close();
 		}
 		return sb.toString();
@@ -1033,15 +1039,15 @@
 	 * @param args
 	 * @return
 	 */
-	public static String join(Collection<?> list, String delimeter) {
+	public static String join(Collection< ? > list, String delimeter) {
 		return join(delimeter, list);
 	}
 
-	public static String join(String delimeter, Collection<?>... list) {
+	public static String join(String delimeter, Collection< ? >... list) {
 		StringBuilder sb = new StringBuilder();
 		String del = "";
 		if (list != null) {
-			for (Collection<?> l : list) {
+			for (Collection< ? > l : list) {
 				for (Object item : l) {
 					sb.append(del);
 					sb.append(item);
@@ -1065,7 +1071,7 @@
 		return sb.toString();
 	}
 
-	public static String join(Collection<?>... list) {
+	public static String join(Collection< ? >... list) {
 		return join(",", list);
 	}
 
@@ -1160,11 +1166,12 @@
 			super.addURL(url);
 		}
 
-		public Class<?> loadClass(String name) throws NoClassDefFoundError {
+		public Class< ? > loadClass(String name) throws NoClassDefFoundError {
 			try {
-				Class<?> c = super.loadClass(name);
+				Class< ? > c = super.loadClass(name);
 				return c;
-			} catch (Throwable t) {
+			}
+			catch (Throwable t) {
 				StringBuilder sb = new StringBuilder();
 				sb.append(name);
 				sb.append(" not found, parent:  ");
@@ -1189,8 +1196,7 @@
 	 * Check if this is a valid project.
 	 */
 	public boolean exists() {
-		return base != null && base.isDirectory() && propertiesFile != null
-				&& propertiesFile.isFile();
+		return base != null && base.isDirectory() && propertiesFile != null && propertiesFile.isFile();
 	}
 
 	public boolean isOk() {
@@ -1225,8 +1231,7 @@
 			return true;
 
 		if (!missed.isEmpty())
-			System.err
-					.println("Missed the following patterns in the warnings or errors: " + missed);
+			System.err.println("Missed the following patterns in the warnings or errors: " + missed);
 
 		report(System.err);
 		return false;
@@ -1259,9 +1264,8 @@
 	 * Answer if the name is a missing plugin's command name. If a bnd file
 	 * contains the command name of a plugin, and that plugin is not available,
 	 * then an error is reported during manifest calculation. This allows the
-	 * plugin to fail to load when it is not needed.
-	 * 
-	 * We first get the plugins to ensure it is properly initialized.
+	 * plugin to fail to load when it is not needed. We first get the plugins to
+	 * ensure it is properly initialized.
 	 * 
 	 * @param name
 	 * @return
@@ -1282,7 +1286,6 @@
 	 * &#064;param prefix
 	 * &#064;param suffix
 	 * &#064;return
-	 * 
 	 */
 	public static String appendPath(String... parts) {
 		StringBuilder sb = new StringBuilder();
@@ -1331,8 +1334,7 @@
 				map.put(attr.substring(0, n), macro.process(attr.substring(n + 1)));
 			} else
 				throw new IllegalArgumentException(formatArrays(
-						"Invalid attribute on package-info.java in %s , %s. Must be <key>=<name> ",
-						clazz, attr));
+						"Invalid attribute on package-info.java in %s , %s. Must be <key>=<name> ", clazz, attr));
 		}
 		return map;
 	}
@@ -1385,7 +1387,7 @@
 		return join(result);
 	}
 
-	public synchronized Class<?> getClass(String type, File jar) throws Exception {
+	public synchronized Class< ? > getClass(String type, File jar) throws Exception {
 		CL cl = getLoader();
 		cl.add(jar.toURI().toURL());
 		return cl.loadClass(type);
@@ -1402,9 +1404,8 @@
 		tm = tm.toUpperCase();
 		TimeUnit unit = TimeUnit.MILLISECONDS;
 		Matcher m = Pattern
-				.compile(
-						"\\s*(\\d+)\\s*(NANOSECONDS|MICROSECONDS|MILLISECONDS|SECONDS|MINUTES|HOURS|DAYS)?")
-				.matcher(tm);
+				.compile("\\s*(\\d+)\\s*(NANOSECONDS|MICROSECONDS|MILLISECONDS|SECONDS|MINUTES|HOURS|DAYS)?").matcher(
+						tm);
 		if (m.matches()) {
 			long duration = Long.parseLong(tm);
 			String u = m.group(2);
@@ -1427,9 +1428,9 @@
 		if (args.length > 1) {
 			try {
 				numchars = Integer.parseInt(args[1]);
-			} catch (NumberFormatException e) {
-				throw new IllegalArgumentException(
-						"Invalid character count parameter in ${random} macro.");
+			}
+			catch (NumberFormatException e) {
+				throw new IllegalArgumentException("Invalid character count parameter in ${random} macro.");
 			}
 		}
 
@@ -1439,8 +1440,7 @@
 		}
 
 		char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
-		char[] alphanums = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
-				.toCharArray();
+		char[] alphanums = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".toCharArray();
 
 		char[] array = new char[numchars];
 		for (int i = 0; i < numchars; i++) {
@@ -1458,9 +1458,8 @@
 	/**
 	 * Set the current command thread. This must be balanced with the
 	 * {@link #end(Processor)} method. The method returns the previous command
-	 * owner or null.
-	 * 
-	 * The command owner will receive all warnings and error reports.
+	 * owner or null. The command owner will receive all warnings and error
+	 * reports.
 	 */
 
 	protected Processor beginHandleErrors(String message) {
@@ -1510,19 +1509,23 @@
 	/**
 	 * Overrides for the Domain class
 	 */
-	@Override public String get(String key) {
+	@Override
+	public String get(String key) {
 		return getProperty(key);
 	}
 
-	@Override public String get(String key, String deflt) {
+	@Override
+	public String get(String key, String deflt) {
 		return getProperty(key, deflt);
 	}
 
-	@Override public void set(String key, String value) {
+	@Override
+	public void set(String key, String value) {
 		getProperties().setProperty(key, value);
 	}
 
-	@Override public Iterator<String> iterator() {
+	@Override
+	public Iterator<String> iterator() {
 		Set<String> keys = keySet();
 		final Iterator<String> it = keys.iterator();
 
@@ -1565,7 +1568,8 @@
 			StringBuilder sb = new StringBuilder();
 			report(sb);
 			return sb.toString();
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			throw new RuntimeException(e);
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Resource.java b/bundleplugin/src/main/java/aQute/lib/osgi/Resource.java
index f7df287..6605eef 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Resource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Resource.java
@@ -3,10 +3,15 @@
 import java.io.*;
 
 public interface Resource {
-	InputStream openInputStream() throws Exception ;
+	InputStream openInputStream() throws Exception;
+
 	void write(OutputStream out) throws Exception;
+
 	long lastModified();
+
 	void setExtra(String extra);
+
 	String getExtra();
+
 	long size() throws Exception;
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/TagResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/TagResource.java
index 0318427..e138175 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/TagResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/TagResource.java
@@ -11,14 +11,14 @@
 		this.tag = tag;
 	}
 
-
 	public void write(OutputStream out) throws UnsupportedEncodingException {
 		OutputStreamWriter ow = new OutputStreamWriter(out, "UTF-8");
 		PrintWriter pw = new PrintWriter(ow);
 		pw.println("<?xml version='1.1'?>");
 		try {
 			tag.print(0, pw);
-		} finally {
+		}
+		finally {
 			pw.flush();
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/URLResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/URLResource.java
index 6e96f23..7c4772f 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/URLResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/URLResource.java
@@ -45,7 +45,7 @@
 		try {
 			if (url.getProtocol().equals("file:")) {
 				File file = new File(url.getPath());
-				if ( file.isFile())
+				if (file.isFile())
 					return size = file.length();
 			} else {
 				URLConnection con = url.openConnection();
@@ -59,7 +59,8 @@
 					}
 				}
 			}
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// Forget this exception, we do it the hard way
 		}
 		InputStream in = openInputStream();
@@ -67,11 +68,12 @@
 		try {
 			din = new DataInputStream(in);
 			long result = din.skipBytes(Integer.MAX_VALUE);
-			while( in.read() >= 0) {
+			while (in.read() >= 0) {
 				result += din.skipBytes(Integer.MAX_VALUE);
 			}
 			size = result;
-		} finally {
+		}
+		finally {
 			if (din != null) {
 				din.close();
 			}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java b/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
index 89bd7f0..27026ae 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
@@ -23,14 +23,11 @@
 	private boolean			r3;
 	private boolean			usesRequire;
 
-	final static Pattern	EENAME	= Pattern.compile("CDC-1\\.0/Foundation-1\\.0"
-											+ "|CDC-1\\.1/Foundation-1\\.1"
-											+ "|OSGi/Minimum-1\\.[1-9]" + "|JRE-1\\.1"
-											+ "|J2SE-1\\.2" + "|J2SE-1\\.3" + "|J2SE-1\\.4"
-											+ "|J2SE-1\\.5" + "|JavaSE-1\\.6" + "|JavaSE-1\\.7"
+	final static Pattern	EENAME	= Pattern.compile("CDC-1\\.0/Foundation-1\\.0" + "|CDC-1\\.1/Foundation-1\\.1"
+											+ "|OSGi/Minimum-1\\.[1-9]" + "|JRE-1\\.1" + "|J2SE-1\\.2" + "|J2SE-1\\.3"
+											+ "|J2SE-1\\.4" + "|J2SE-1\\.5" + "|JavaSE-1\\.6" + "|JavaSE-1\\.7"
 											+ "|PersonalJava-1\\.1" + "|PersonalJava-1\\.2"
-											+ "|CDC-1\\.0/PersonalBasis-1\\.0"
-											+ "|CDC-1\\.0/PersonalJava-1\\.0");
+											+ "|CDC-1\\.0/PersonalBasis-1\\.0" + "|CDC-1\\.0/PersonalJava-1\\.0");
 
 	final static int		V1_1	= 45;
 	final static int		V1_2	= 46;
@@ -69,37 +66,30 @@
 			new EE("PersonalJava-1.1", V1_1, V1_1), //
 			new EE("JavaSE-1.7", V1_7, V1_7), //
 			new EE("PersonalJava-1.1", V1_1, V1_1), //
-			new EE("PersonalJava-1.2", V1_1, V1_1),
-			new EE("CDC-1.0/PersonalBasis-1.0", V1_3, V1_1),
-			new EE("CDC-1.0/PersonalJava-1.0", V1_3, V1_1),
-			new EE("CDC-1.1/PersonalBasis-1.1", V1_3, V1_2),
-			new EE("CDC-1.1/PersonalJava-1.1", V1_3, V1_2)		};
+			new EE("PersonalJava-1.2", V1_1, V1_1), new EE("CDC-1.0/PersonalBasis-1.0", V1_3, V1_1),
+			new EE("CDC-1.0/PersonalJava-1.0", V1_3, V1_1), new EE("CDC-1.1/PersonalBasis-1.1", V1_3, V1_2),
+			new EE("CDC-1.1/PersonalJava-1.1", V1_3, V1_2)
+																};
 
-	final static Pattern		CARDINALITY_PATTERN				= Pattern
-																		.compile("single|multiple");
-	final static Pattern		RESOLUTION_PATTERN				= Pattern
-																		.compile("optional|mandatory");
+	final static Pattern		CARDINALITY_PATTERN				= Pattern.compile("single|multiple");
+	final static Pattern		RESOLUTION_PATTERN				= Pattern.compile("optional|mandatory");
 	final static Pattern		BUNDLEMANIFESTVERSION			= Pattern.compile("2");
 	public final static String	SYMBOLICNAME_STRING				= "[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)*";
-	public final static Pattern	SYMBOLICNAME					= Pattern
-																		.compile(SYMBOLICNAME_STRING);
+	public final static Pattern	SYMBOLICNAME					= Pattern.compile(SYMBOLICNAME_STRING);
 
 	public final static String	VERSION_STRING					= "[0-9]+(\\.[0-9]+(\\.[0-9]+(\\.[0-9A-Za-z_-]+)?)?)?";
 	public final static Pattern	VERSION							= Pattern.compile(VERSION_STRING);
 	final static Pattern		FILTEROP						= Pattern.compile("=|<=|>=|~=");
 	public final static Pattern	VERSIONRANGE					= Pattern.compile("((\\(|\\[)"
 
-																+ VERSION_STRING + ","
-																		+ VERSION_STRING
-																		+ "(\\]|\\)))|"
+																+ VERSION_STRING + "," + VERSION_STRING + "(\\]|\\)))|"
 																		+ VERSION_STRING);
 	final static Pattern		FILE							= Pattern
 																		.compile("/?[^/\"\n\r\u0000]+(/[^/\"\n\r\u0000]+)*");
 	final static Pattern		WILDCARDPACKAGE					= Pattern
 																		.compile("((\\p{Alnum}|_)+(\\.(\\p{Alnum}|_)+)*(\\.\\*)?)|\\*");
 	public final static Pattern	ISO639							= Pattern.compile("[A-Z][A-Z]");
-	public final static Pattern	HEADER_PATTERN					= Pattern
-																		.compile("[A-Za-z0-9][-a-zA-Z0-9_]+");
+	public final static Pattern	HEADER_PATTERN					= Pattern.compile("[A-Za-z0-9][-a-zA-Z0-9_]+");
 	public final static Pattern	TOKEN							= Pattern.compile("[-a-zA-Z0-9_]+");
 
 	public final static Pattern	NUMBERPATTERN					= Pattern.compile("\\d+");
@@ -110,18 +100,18 @@
 	public final static Pattern	URLPATTERN						= Pattern.compile(".*");
 	public final static Pattern	ANYPATTERN						= Pattern.compile(".*");
 	public final static Pattern	FILTERPATTERN					= Pattern.compile(".*");
-	public final static Pattern	TRUEORFALSEPATTERN				= Pattern
-																		.compile("true|false|TRUE|FALSE");
+	public final static Pattern	TRUEORFALSEPATTERN				= Pattern.compile("true|false|TRUE|FALSE");
 	public static final Pattern	WILDCARDNAMEPATTERN				= Pattern.compile(".*");
 	public static final Pattern	BUNDLE_ACTIVATIONPOLICYPATTERN	= Pattern.compile("lazy");
 
-	public final static String	EES[]							= { "CDC-1.0/Foundation-1.0",
-			"CDC-1.1/Foundation-1.1", "OSGi/Minimum-1.0", "OSGi/Minimum-1.1", "OSGi/Minimum-1.2",
-			"JRE-1.1", "J2SE-1.2", "J2SE-1.3", "J2SE-1.4", "J2SE-1.5", "JavaSE-1.6", "JavaSE-1.7",
-			"PersonalJava-1.1", "PersonalJava-1.2", "CDC-1.0/PersonalBasis-1.0",
-			"CDC-1.0/PersonalJava-1.0"							};
+	public final static String	EES[]							= {
+			"CDC-1.0/Foundation-1.0", "CDC-1.1/Foundation-1.1", "OSGi/Minimum-1.0", "OSGi/Minimum-1.1",
+			"OSGi/Minimum-1.2", "JRE-1.1", "J2SE-1.2", "J2SE-1.3", "J2SE-1.4", "J2SE-1.5", "JavaSE-1.6", "JavaSE-1.7",
+			"PersonalJava-1.1", "PersonalJava-1.2", "CDC-1.0/PersonalBasis-1.0", "CDC-1.0/PersonalJava-1.0"
+																};
 
-	public final static String	OSNAMES[]						= { "AIX", // IBM
+	public final static String	OSNAMES[]						= {
+			"AIX", // IBM
 			"DigitalUnix", // Compaq
 			"Embos", // Segger Embedded Software Solutions
 			"Epoc32", // SymbianOS Symbian OS
@@ -140,10 +130,11 @@
 			"VxWorks", // WindRiver Systems
 			"Windows95", "Win32", "Windows98", "WindowsNT", "WindowsCE", "Windows2000", // Win2000
 			"Windows2003", // Win2003
-			"WindowsXP", "WindowsVista",						};
+			"WindowsXP", "WindowsVista",
+																};
 
 	public final static String	PROCESSORNAMES[]				= { //
-																//
+			//
 			"68k", // Motorola 68000
 			"ARM_LE", // Intel Strong ARM. Deprecated because it does not
 			// specify the endianness. See the following two rows.
@@ -164,7 +155,8 @@
 			"V850E", // NEC V850E
 			"x86", // pentium i386
 			"i486", // i586 i686 Intel& AMD 32 bit
-			"x86-64",											};
+			"x86-64",
+																};
 
 	final Analyzer				analyzer;
 	private Instructions		dynamicImports;
@@ -265,7 +257,8 @@
 		try {
 			verifyFilter(value, 0);
 			return null;
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			return "Not a valid filter: " + value + e.getMessage();
 		}
 	}
@@ -281,8 +274,7 @@
 			if (packageRef.isDefaultPackage())
 				error("The Bundle Activator is not in the bundle and it is in the default package ");
 			else if (!analyzer.isImported(packageRef)) {
-				error("Bundle-Activator not found on the bundle class path nor in imports: "
-						+ bactivator);
+				error("Bundle-Activator not found on the bundle class path nor in imports: " + bactivator);
 			}
 		}
 	}
@@ -308,8 +300,7 @@
 	 * referred packages.
 	 */
 	private void verifyUnresolvedReferences() {
-		Set<PackageRef> unresolvedReferences = new TreeSet<PackageRef>(analyzer.getReferred()
-				.keySet());
+		Set<PackageRef> unresolvedReferences = new TreeSet<PackageRef>(analyzer.getReferred().keySet());
 		unresolvedReferences.removeAll(analyzer.getImports().keySet());
 		unresolvedReferences.removeAll(analyzer.getContained().keySet());
 
@@ -334,8 +325,8 @@
 					culprits.add(clazz.getAbsolutePath());
 			}
 
-			error("Unresolved references to %s by class(es) %s on the Bundle-Classpath: %s",
-					unresolvedReferences, culprits, analyzer.getBundleClasspath().keySet());
+			error("Unresolved references to %s by class(es) %s on the Bundle-Classpath: %s", unresolvedReferences,
+					culprits, analyzer.getBundleClasspath().keySet());
 		}
 	}
 
@@ -350,8 +341,8 @@
 		return dynamicImports.matches(pack.getFQN());
 	}
 
-	private boolean hasOverlap(Set<?> a, Set<?> b) {
-		for (Iterator<?> i = a.iterator(); i.hasNext();) {
+	private boolean hasOverlap(Set< ? > a, Set< ? > b) {
+		for (Iterator< ? > i = a.iterator(); i.hasNext();) {
 			if (b.contains(i.next()))
 				return true;
 		}
@@ -360,15 +351,14 @@
 
 	public void verify() throws Exception {
 		verifyHeaders();
-		verifyDirectives("Export-Package",
-				"uses:|mandatory:|include:|exclude:|" + IMPORT_DIRECTIVE, PACKAGEPATTERN, "package");
+		verifyDirectives("Export-Package", "uses:|mandatory:|include:|exclude:|" + IMPORT_DIRECTIVE, PACKAGEPATTERN,
+				"package");
 		verifyDirectives("Import-Package", "resolution:", PACKAGEPATTERN, "package");
 		verifyDirectives("Require-Bundle", "visibility:|resolution:", SYMBOLICNAME, "bsn");
 		verifyDirectives("Fragment-Host", "extension:", SYMBOLICNAME, "bsn");
 		verifyDirectives("Provide-Capability", "effective:|uses:", null, null);
-		verifyDirectives("Require-Capability", "effective:|resolution:|filter:", null,null);
-		verifyDirectives("Bundle-SymbolicName", "singleton:|fragment-attachment:|mandatory:",
-				SYMBOLICNAME,"bsn");
+		verifyDirectives("Require-Capability", "effective:|resolution:|filter:", null, null);
+		verifyDirectives("Bundle-SymbolicName", "singleton:|fragment-attachment:|mandatory:", SYMBOLICNAME, "bsn");
 
 		verifyManifestFirst();
 		verifyActivator();
@@ -397,15 +387,12 @@
 	}
 
 	private void verifyRequirements() {
-		Parameters map = parseHeader(manifest.getMainAttributes().getValue(
-				Constants.REQUIRE_CAPABILITY));
+		Parameters map = parseHeader(manifest.getMainAttributes().getValue(Constants.REQUIRE_CAPABILITY));
 		for (String key : map.keySet()) {
 			Attrs attrs = map.get(key);
 			verify(attrs, "filter:", FILTERPATTERN, false, "Requirement %s filter not correct", key);
-			verify(attrs, "cardinality:", CARDINALITY_PATTERN, false,
-					"Requirement %s cardinality not correct", key);
-			verify(attrs, "resolution:", RESOLUTION_PATTERN, false,
-					"Requirement %s resolution not correct", key);
+			verify(attrs, "cardinality:", CARDINALITY_PATTERN, false, "Requirement %s cardinality not correct", key);
+			verify(attrs, "resolution:", RESOLUTION_PATTERN, false, "Requirement %s resolution not correct", key);
 
 			if (key.equals("osgi.extender")) {
 				// No requirements on extender
@@ -451,20 +438,16 @@
 	}
 
 	private void verifyCapabilities() {
-		Parameters map = parseHeader(manifest.getMainAttributes().getValue(
-				Constants.PROVIDE_CAPABILITY));
+		Parameters map = parseHeader(manifest.getMainAttributes().getValue(Constants.PROVIDE_CAPABILITY));
 		for (String key : map.keySet()) {
 			Attrs attrs = map.get(key);
-			verify(attrs, "cardinality:", CARDINALITY_PATTERN, false,
-					"Requirement %s cardinality not correct", key);
-			verify(attrs, "resolution:", RESOLUTION_PATTERN, false,
-					"Requirement %s resolution not correct", key);
+			verify(attrs, "cardinality:", CARDINALITY_PATTERN, false, "Requirement %s cardinality not correct", key);
+			verify(attrs, "resolution:", RESOLUTION_PATTERN, false, "Requirement %s resolution not correct", key);
 
 			if (key.equals("osgi.extender")) {
 				verify(attrs, "osgi.extender", SYMBOLICNAME, true,
 						"Extender %s must always have the osgi.extender attribute set", key);
-				verify(attrs, "version", VERSION, true, "Extender %s must always have a version",
-						key);
+				verify(attrs, "version", VERSION, true, "Extender %s must always have a version", key);
 			} else if (key.equals("osgi.serviceloader")) {
 				verify(attrs, "register:", PACKAGEPATTERN, false,
 						"Service Loader extender register: directive not a fully qualified Java name");
@@ -493,8 +476,7 @@
 		}
 	}
 
-	private void verify(Attrs attrs, String ad, Pattern pattern, boolean mandatory, String msg,
-			String... args) {
+	private void verify(Attrs attrs, String ad, Pattern pattern, boolean mandatory, String msg, String... args) {
 		String v = attrs.get(ad);
 		if (v == null) {
 			if (mandatory)
@@ -519,7 +501,7 @@
 	private void verifyDirectives(String header, String directives, Pattern namePattern, String type) {
 		Pattern pattern = Pattern.compile(directives);
 		Parameters map = parseHeader(manifest.getMainAttributes().getValue(header));
-		for (Entry<String, Attrs> entry : map.entrySet()) {
+		for (Entry<String,Attrs> entry : map.entrySet()) {
 			String pname = removeDuplicateMarker(entry.getKey());
 
 			if (namePattern != null) {
@@ -529,7 +511,7 @@
 					else
 						warning("Invalid %s name: '%s'", type, pname);
 			}
-			
+
 			for (String key : entry.getValue().keySet()) {
 				if (key.endsWith(":")) {
 					if (!key.startsWith("x-")) {
@@ -537,8 +519,8 @@
 						if (m.matches())
 							continue;
 
-						warning("Unknown directive %s in %s, allowed directives are %s, and 'x-*'.",
-								key, header, directives.replace('|', ','));
+						warning("Unknown directive %s in %s, allowed directives are %s, and 'x-*'.", key, header,
+								directives.replace('|', ','));
 					}
 				}
 			}
@@ -578,7 +560,7 @@
 		else if (map.size() > 1)
 			warning("Bundle-ActivationPolicy has too many arguments %s", policy);
 		else {
-			Map<String, String> s = map.get("lazy");
+			Map<String,String> s = map.get("lazy");
 			if (s == null)
 				warning("Bundle-ActivationPolicy set but is not set to lazy: %s", policy);
 			else
@@ -635,10 +617,9 @@
 			if (!verify(name, WILDCARDPACKAGE))
 				error("DynamicImport-Package header contains an invalid package name: " + name);
 
-			Map<String, String> sub = map.get(name);
+			Map<String,String> sub = map.get(name);
 			if (r3 && sub.size() != 0) {
-				error("DynamicPackage-Import has attributes on import: "
-						+ name
+				error("DynamicPackage-Import has attributes on import: " + name
 						+ ". This is however, an <=R3 bundle and attributes on this header were introduced in R4. ");
 			}
 		}
@@ -706,8 +687,7 @@
 				index++;
 
 			if (expr.charAt(index) != '(')
-				throw new IllegalArgumentException("Filter mismatch: expected ( at position "
-						+ index + " : " + expr);
+				throw new IllegalArgumentException("Filter mismatch: expected ( at position " + index + " : " + expr);
 
 			index++; // skip (
 
@@ -715,50 +695,50 @@
 				index++;
 
 			switch (expr.charAt(index)) {
-			case '!':
-				index++; // skip !
-				while (Character.isWhitespace(expr.charAt(index)))
-					index++;
+				case '!' :
+					index++; // skip !
+					while (Character.isWhitespace(expr.charAt(index)))
+						index++;
 
-				if (expr.charAt(index) != '(')
-					throw new IllegalArgumentException(
-							"Filter mismatch: ! (not) must have one sub expression " + index
-									+ " : " + expr);
-				while (Character.isWhitespace(expr.charAt(index)))
-					index++;
+					if (expr.charAt(index) != '(')
+						throw new IllegalArgumentException("Filter mismatch: ! (not) must have one sub expression "
+								+ index + " : " + expr);
+					while (Character.isWhitespace(expr.charAt(index)))
+						index++;
 
-				index = verifyFilter(expr, index);
-				while (Character.isWhitespace(expr.charAt(index)))
-					index++;
-				if (expr.charAt(index) != ')')
-					throw new IllegalArgumentException("Filter mismatch: expected ) at position "
-							+ index + " : " + expr);
-				return index + 1;
-
-			case '&':
-			case '|':
-				index++; // skip operator
-				while (Character.isWhitespace(expr.charAt(index)))
-					index++;
-				while (expr.charAt(index) == '(') {
 					index = verifyFilter(expr, index);
 					while (Character.isWhitespace(expr.charAt(index)))
 						index++;
-				}
+					if (expr.charAt(index) != ')')
+						throw new IllegalArgumentException("Filter mismatch: expected ) at position " + index + " : "
+								+ expr);
+					return index + 1;
 
-				if (expr.charAt(index) != ')')
-					throw new IllegalArgumentException("Filter mismatch: expected ) at position "
-							+ index + " : " + expr);
-				return index + 1; // skip )
+				case '&' :
+				case '|' :
+					index++; // skip operator
+					while (Character.isWhitespace(expr.charAt(index)))
+						index++;
+					while (expr.charAt(index) == '(') {
+						index = verifyFilter(expr, index);
+						while (Character.isWhitespace(expr.charAt(index)))
+							index++;
+					}
 
-			default:
-				index = verifyFilterOperation(expr, index);
-				if (expr.charAt(index) != ')')
-					throw new IllegalArgumentException("Filter mismatch: expected ) at position "
-							+ index + " : " + expr);
-				return index + 1;
+					if (expr.charAt(index) != ')')
+						throw new IllegalArgumentException("Filter mismatch: expected ) at position " + index + " : "
+								+ expr);
+					return index + 1; // skip )
+
+				default :
+					index = verifyFilterOperation(expr, index);
+					if (expr.charAt(index) != ')')
+						throw new IllegalArgumentException("Filter mismatch: expected ) at position " + index + " : "
+								+ expr);
+					return index + 1;
 			}
-		} catch (IndexOutOfBoundsException e) {
+		}
+		catch (IndexOutOfBoundsException e) {
 			throw new IllegalArgumentException("Filter mismatch: early EOF from " + index);
 		}
 	}
@@ -777,19 +757,17 @@
 		}
 		String operator = sb.toString();
 		if (!verify(operator, FILTEROP))
-			throw new IllegalArgumentException("Filter error, illegal operator " + operator
-					+ " at index " + index);
+			throw new IllegalArgumentException("Filter error, illegal operator " + operator + " at index " + index);
 
 		sb = new StringBuilder();
 		while (")".indexOf(expr.charAt(index)) < 0) {
 			switch (expr.charAt(index)) {
-			case '\\':
-				if ("\\)(*".indexOf(expr.charAt(index + 1)) >= 0)
-					index++;
-				else
-					throw new IllegalArgumentException(
-							"Filter error, illegal use of backslash at index " + index
-									+ ". Backslash may only be used before * or () or \\");
+				case '\\' :
+					if ("\\)(*".indexOf(expr.charAt(index + 1)) >= 0)
+						index++;
+					else
+						throw new IllegalArgumentException("Filter error, illegal use of backslash at index " + index
+								+ ". Backslash may only be used before * or () or \\");
 			}
 			sb.append(expr.charAt(index++));
 		}
@@ -804,8 +782,7 @@
 		QuotedTokenizer st = new QuotedTokenizer(value.trim(), ",");
 		for (Iterator<String> i = st.getTokenSet().iterator(); i.hasNext();) {
 			if (!verify(i.next(), regex)) {
-				String msg = "Invalid value for " + name + ", " + value + " does not match "
-						+ regex.pattern();
+				String msg = "Invalid value for " + name + ", " + value + " does not match " + regex.pattern();
 				if (error)
 					error(msg);
 				else
@@ -827,8 +804,7 @@
 		Parameters map = parseHeader(value);
 		for (String header : map.keySet()) {
 			if (!regex.matcher(header).matches()) {
-				String msg = "Invalid value for " + name + ", " + value + " does not match "
-						+ regex.pattern();
+				String msg = "Invalid value for " + name + ", " + value + " does not match " + regex.pattern();
 				if (error)
 					error(msg);
 				else
@@ -926,8 +902,7 @@
 				IO.copy(in, digester);
 				digester.digest();
 				if (!expected.equals(digester.digest())) {
-					error("Checksum mismatch %s, expected %s, got %s", path, expected,
-							digester.digest());
+					error("Checksum mismatch %s, expected %s, got %s", path, expected, digester.digest());
 				}
 			}
 		}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/WriteResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/WriteResource.java
index 2acbe95..5cc5229 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/WriteResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/WriteResource.java
@@ -3,34 +3,37 @@
 import java.io.*;
 
 public abstract class WriteResource implements Resource {
-	String	extra;
-	volatile long size = -1;
-	
+	String			extra;
+	volatile long	size	= -1;
+
 	public InputStream openInputStream() throws Exception {
-	    PipedInputStream pin = new PipedInputStream();
-	    final PipedOutputStream pout = new PipedOutputStream(pin);
-	    Thread t = new Thread() {
-	        public void run() {
-	            try {
-                    write(pout);
-                    pout.flush();
-                } catch (Exception e) {
-    				e.printStackTrace();
-                } finally {
-                    try {
-                        pout.close();
-                    } catch (IOException e) {
-                        // Ignore
-                    }
-                }
-	        }
-	    };
-	    t.start();
-	    return pin;
+		PipedInputStream pin = new PipedInputStream();
+		final PipedOutputStream pout = new PipedOutputStream(pin);
+		Thread t = new Thread() {
+			public void run() {
+				try {
+					write(pout);
+					pout.flush();
+				}
+				catch (Exception e) {
+					e.printStackTrace();
+				}
+				finally {
+					try {
+						pout.close();
+					}
+					catch (IOException e) {
+						// Ignore
+					}
+				}
+			}
+		};
+		t.start();
+		return pin;
 	}
 
 	public abstract void write(OutputStream out) throws IOException, Exception;
-	
+
 	public abstract long lastModified();
 
 	public String getExtra() {
@@ -40,25 +43,28 @@
 	public void setExtra(String extra) {
 		this.extra = extra;
 	}
-	
-	static class CountingOutputStream extends OutputStream {
-		long size;
 
-		@Override public void write(int var0) throws IOException {
+	static class CountingOutputStream extends OutputStream {
+		long	size;
+
+		@Override
+		public void write(int var0) throws IOException {
 			size++;
 		}
-		
-		@Override public void write(byte[] buffer) throws IOException {
-			size+=buffer.length;
+
+		@Override
+		public void write(byte[] buffer) throws IOException {
+			size += buffer.length;
 		}
-		
-		@Override public void write(byte [] buffer, int start, int length) throws IOException {
-			size+=length;
+
+		@Override
+		public void write(byte[] buffer, int start, int length) throws IOException {
+			size += length;
 		}
 	}
-	
+
 	public long size() throws IOException, Exception {
-		if ( size == -1 ) {
+		if (size == -1) {
 			CountingOutputStream cout = new CountingOutputStream();
 			write(cout);
 			size = cout.size;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/ZipResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/ZipResource.java
index 126faba..f5e2095 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/ZipResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/ZipResource.java
@@ -6,83 +6,78 @@
 import java.util.zip.*;
 
 public class ZipResource implements Resource {
-    ZipFile  zip;
-    ZipEntry entry;
-    long     lastModified;
-    String   extra;
+	ZipFile		zip;
+	ZipEntry	entry;
+	long		lastModified;
+	String		extra;
 
-    ZipResource(ZipFile zip, ZipEntry entry, long lastModified) throws UnsupportedEncodingException {
-        this.zip = zip;
-        this.entry = entry;
-        this.lastModified = lastModified;
-        byte[] data = entry.getExtra();
-        if (data != null)
-            this.extra = new String(data, "UTF-8");
-    }
+	ZipResource(ZipFile zip, ZipEntry entry, long lastModified) throws UnsupportedEncodingException {
+		this.zip = zip;
+		this.entry = entry;
+		this.lastModified = lastModified;
+		byte[] data = entry.getExtra();
+		if (data != null)
+			this.extra = new String(data, "UTF-8");
+	}
 
-    public InputStream openInputStream() throws IOException {
-        return zip.getInputStream(entry);
-    }
+	public InputStream openInputStream() throws IOException {
+		return zip.getInputStream(entry);
+	}
 
-    public String toString() {
-        return ":" + zip.getName() + "(" + entry.getName() + "):";
-    }
+	public String toString() {
+		return ":" + zip.getName() + "(" + entry.getName() + "):";
+	}
 
-    public static ZipFile build(Jar jar, File file) throws ZipException,
-            IOException {
-        return build(jar, file, null);
-    }
+	public static ZipFile build(Jar jar, File file) throws ZipException, IOException {
+		return build(jar, file, null);
+	}
 
-    public static ZipFile build(Jar jar, File file, Pattern pattern)
-            throws ZipException, IOException {
+	public static ZipFile build(Jar jar, File file, Pattern pattern) throws ZipException, IOException {
 
-        try {
-            ZipFile zip = new ZipFile(file);
-            nextEntry: for (Enumeration<? extends ZipEntry> e = zip.entries(); e
-                    .hasMoreElements();) {
-                ZipEntry entry = e.nextElement();
-                if (pattern != null) {
-                    Matcher m = pattern.matcher(entry.getName());
-                    if (!m.matches())
-                        continue nextEntry;
-                }
-                if (!entry.isDirectory()) {
-                    long time = entry.getTime();
-                    if (time <= 0)
-                        time = file.lastModified();
-                    jar.putResource(entry.getName(), new ZipResource(zip,
-                            entry, time), true);
-                }
-            }
-            return zip;
-        } catch (ZipException ze) {
-            throw new ZipException("The JAR/ZIP file ("
-                    + file.getAbsolutePath() + ") seems corrupted, error: "
-                    + ze.getMessage());
-        } catch (FileNotFoundException e) {
-            throw new IllegalArgumentException("Problem opening JAR: "
-                    + file.getAbsolutePath());
-        }
-    }
+		try {
+			ZipFile zip = new ZipFile(file);
+			nextEntry: for (Enumeration< ? extends ZipEntry> e = zip.entries(); e.hasMoreElements();) {
+				ZipEntry entry = e.nextElement();
+				if (pattern != null) {
+					Matcher m = pattern.matcher(entry.getName());
+					if (!m.matches())
+						continue nextEntry;
+				}
+				if (!entry.isDirectory()) {
+					long time = entry.getTime();
+					if (time <= 0)
+						time = file.lastModified();
+					jar.putResource(entry.getName(), new ZipResource(zip, entry, time), true);
+				}
+			}
+			return zip;
+		}
+		catch (ZipException ze) {
+			throw new ZipException("The JAR/ZIP file (" + file.getAbsolutePath() + ") seems corrupted, error: "
+					+ ze.getMessage());
+		}
+		catch (FileNotFoundException e) {
+			throw new IllegalArgumentException("Problem opening JAR: " + file.getAbsolutePath());
+		}
+	}
 
-    public void write(OutputStream out) throws Exception {
-        FileResource.copy(this, out);
-    }
+	public void write(OutputStream out) throws Exception {
+		FileResource.copy(this, out);
+	}
 
-    public long lastModified() {
-        return lastModified;
-    }
+	public long lastModified() {
+		return lastModified;
+	}
 
-    public String getExtra() {
-        return extra;
-    }
+	public String getExtra() {
+		return extra;
+	}
 
-    public void setExtra(String extra) {
-        this.extra = extra;
-    }
+	public void setExtra(String extra) {
+		this.extra = extra;
+	}
 
-    
-    public long size() {
-    	return entry.getSize();
-    }
+	public long size() {
+		return entry.getSize();
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java b/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
index 6e01ddc..2244fd2 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
@@ -19,230 +19,220 @@
  * @version $Revision$
  */
 public class EclipseClasspath {
-    static DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
-                                                                 .newInstance();
-    DocumentBuilder               db;
-    File                          project;
-    File                          workspace;
-    Set<File>                     sources                = new LinkedHashSet<File>();
-    Set<File>                     allSources                = new LinkedHashSet<File>();
-    
-    Set<File>                     classpath              = new LinkedHashSet<File>();
-    List<File>                    dependents             = new ArrayList<File>();
-    File                          output;
-    boolean                       recurse                = true;
-    Set<File>                     exports                = new LinkedHashSet<File>();
-    Map<String, String>           properties             = new HashMap<String, String>();
-    Reporter                      reporter;
-    int                           options;
-    Set<File>                     bootclasspath          = new LinkedHashSet<File>();
+	static DocumentBuilderFactory	documentBuilderFactory	= DocumentBuilderFactory.newInstance();
+	DocumentBuilder					db;
+	File							project;
+	File							workspace;
+	Set<File>						sources					= new LinkedHashSet<File>();
+	Set<File>						allSources				= new LinkedHashSet<File>();
 
-    public final static int       DO_VARIABLES           = 1;
+	Set<File>						classpath				= new LinkedHashSet<File>();
+	List<File>						dependents				= new ArrayList<File>();
+	File							output;
+	boolean							recurse					= true;
+	Set<File>						exports					= new LinkedHashSet<File>();
+	Map<String,String>				properties				= new HashMap<String,String>();
+	Reporter						reporter;
+	int								options;
+	Set<File>						bootclasspath			= new LinkedHashSet<File>();
 
-    /**
-     * Parse an Eclipse project structure to discover the classpath.
-     * 
-     * @param workspace
-     *            Points to workspace
-     * @param project
-     *            Points to project
-     * @throws ParserConfigurationException
-     * @throws SAXException
-     * @throws IOException
-     */
+	public final static int			DO_VARIABLES			= 1;
 
-    public EclipseClasspath(Reporter reporter, File workspace, File project,
-            int options) throws Exception {
-        this.project = project.getCanonicalFile();
-        this.workspace = workspace.getCanonicalFile();
-        this.reporter = reporter;
-        db = documentBuilderFactory.newDocumentBuilder();
-        parse(this.project, true);
-        db = null;
-    }
+	/**
+	 * Parse an Eclipse project structure to discover the classpath.
+	 * 
+	 * @param workspace
+	 *            Points to workspace
+	 * @param project
+	 *            Points to project
+	 * @throws ParserConfigurationException
+	 * @throws SAXException
+	 * @throws IOException
+	 */
 
-    public EclipseClasspath(Reporter reporter, File workspace, File project)
-            throws Exception {
-        this(reporter, workspace, project, 0);
-    }
+	public EclipseClasspath(Reporter reporter, File workspace, File project, int options) throws Exception {
+		this.project = project.getCanonicalFile();
+		this.workspace = workspace.getCanonicalFile();
+		this.reporter = reporter;
+		db = documentBuilderFactory.newDocumentBuilder();
+		parse(this.project, true);
+		db = null;
+	}
 
-    /**
-     * Recursive routine to parse the files. If a sub project is detected, it is
-     * parsed before the parsing continues. This should give the right order.
-     * 
-     * @param project
-     *            Project directory
-     * @param top
-     *            If this is the top project
-     * @throws ParserConfigurationException
-     * @throws SAXException
-     * @throws IOException
-     */
-    void parse(File project, boolean top) throws ParserConfigurationException,
-            SAXException, IOException {
-        File file = new File(project, ".classpath");
-        if (!file.exists())
-            throw new FileNotFoundException(".classpath file not found: "
-                    + file.getAbsolutePath());
+	public EclipseClasspath(Reporter reporter, File workspace, File project) throws Exception {
+		this(reporter, workspace, project, 0);
+	}
 
-        Document doc = db.parse(file);
-        NodeList nodelist = doc.getDocumentElement().getElementsByTagName(
-                "classpathentry");
+	/**
+	 * Recursive routine to parse the files. If a sub project is detected, it is
+	 * parsed before the parsing continues. This should give the right order.
+	 * 
+	 * @param project
+	 *            Project directory
+	 * @param top
+	 *            If this is the top project
+	 * @throws ParserConfigurationException
+	 * @throws SAXException
+	 * @throws IOException
+	 */
+	void parse(File project, boolean top) throws ParserConfigurationException, SAXException, IOException {
+		File file = new File(project, ".classpath");
+		if (!file.exists())
+			throw new FileNotFoundException(".classpath file not found: " + file.getAbsolutePath());
 
-        if (nodelist == null)
-            throw new IllegalArgumentException(
-                    "Can not find classpathentry in classpath file");
+		Document doc = db.parse(file);
+		NodeList nodelist = doc.getDocumentElement().getElementsByTagName("classpathentry");
 
-        for (int i = 0; i < nodelist.getLength(); i++) {
-            Node node = nodelist.item(i);
-            NamedNodeMap attrs = node.getAttributes();
-            String kind = get(attrs, "kind");
-            if ("src".equals(kind)) {
-                String path = get(attrs, "path");
-                // TODO boolean exported = "true".equalsIgnoreCase(get(attrs,
-                // "exported"));
-                if (path.startsWith("/")) {
-                    // We have another project
-                    File subProject = getFile(workspace, project, path);
-                    if (recurse)
-                        parse(subProject, false);
-                    dependents.add(subProject.getCanonicalFile());
-                } else {
-                    File src = getFile(workspace, project, path);
-                    allSources.add(src);
-                    if (top) {
-                        // We only want the sources for our own project
-                        // or we'll compile all at once. Not a good idea
-                        // because project settings can differ.
-                        sources.add(src);
-                    }
-                }
-            } else if ("lib".equals(kind)) {
-                String path = get(attrs, "path");
-                boolean exported = "true".equalsIgnoreCase(get(attrs,
-                        "exported"));
-                if (top || exported) {
-                    File jar = getFile(workspace, project, path);
-                    if (jar.getName().startsWith("ee."))
-                        bootclasspath.add(jar);
-                    else
-                        classpath.add(jar);
-                    if (exported)
-                        exports.add(jar);
-                }
-            } else if ("output".equals(kind)) {
-                String path = get(attrs, "path");
-                path = path.replace('/', File.separatorChar);
-                output = getFile(workspace, project, path);
-                classpath.add(output);
-                exports.add(output);
-            } else if ("var".equals(kind)) {
-                boolean exported = "true".equalsIgnoreCase(get(attrs,
-                        "exported"));
-                File lib = replaceVar(get(attrs, "path"));
-                File slib = replaceVar(get(attrs, "sourcepath"));
-                if (lib != null) {
-                    classpath.add(lib);
-                    if (exported)
-                        exports.add(lib);
-                }
-                if (slib != null)
-                    sources.add(slib);
-            } else if ("con".equals(kind)) {
-                // Should do something useful ...
-            }
-        }
-    }
+		if (nodelist == null)
+			throw new IllegalArgumentException("Can not find classpathentry in classpath file");
 
-    private File getFile(File abs, File relative, String opath) {
-        String path = opath.replace('/', File.separatorChar);
-        File result = new File(path);
-        if (result.isAbsolute() && result.isFile()) {
-            return result;
-        }
-        if (path.startsWith(File.separator)) {
-            result = abs;
-            path = path.substring(1);
-        } else
-            result = relative;
+		for (int i = 0; i < nodelist.getLength(); i++) {
+			Node node = nodelist.item(i);
+			NamedNodeMap attrs = node.getAttributes();
+			String kind = get(attrs, "kind");
+			if ("src".equals(kind)) {
+				String path = get(attrs, "path");
+				// TODO boolean exported = "true".equalsIgnoreCase(get(attrs,
+				// "exported"));
+				if (path.startsWith("/")) {
+					// We have another project
+					File subProject = getFile(workspace, project, path);
+					if (recurse)
+						parse(subProject, false);
+					dependents.add(subProject.getCanonicalFile());
+				} else {
+					File src = getFile(workspace, project, path);
+					allSources.add(src);
+					if (top) {
+						// We only want the sources for our own project
+						// or we'll compile all at once. Not a good idea
+						// because project settings can differ.
+						sources.add(src);
+					}
+				}
+			} else if ("lib".equals(kind)) {
+				String path = get(attrs, "path");
+				boolean exported = "true".equalsIgnoreCase(get(attrs, "exported"));
+				if (top || exported) {
+					File jar = getFile(workspace, project, path);
+					if (jar.getName().startsWith("ee."))
+						bootclasspath.add(jar);
+					else
+						classpath.add(jar);
+					if (exported)
+						exports.add(jar);
+				}
+			} else if ("output".equals(kind)) {
+				String path = get(attrs, "path");
+				path = path.replace('/', File.separatorChar);
+				output = getFile(workspace, project, path);
+				classpath.add(output);
+				exports.add(output);
+			} else if ("var".equals(kind)) {
+				boolean exported = "true".equalsIgnoreCase(get(attrs, "exported"));
+				File lib = replaceVar(get(attrs, "path"));
+				File slib = replaceVar(get(attrs, "sourcepath"));
+				if (lib != null) {
+					classpath.add(lib);
+					if (exported)
+						exports.add(lib);
+				}
+				if (slib != null)
+					sources.add(slib);
+			} else if ("con".equals(kind)) {
+				// Should do something useful ...
+			}
+		}
+	}
 
-        StringTokenizer st = new StringTokenizer(path, File.separator);
-        while (st.hasMoreTokens()) {
-            String token = st.nextToken();
-            result = new File(result, token);
-        }
+	private File getFile(File abs, File relative, String opath) {
+		String path = opath.replace('/', File.separatorChar);
+		File result = new File(path);
+		if (result.isAbsolute() && result.isFile()) {
+			return result;
+		}
+		if (path.startsWith(File.separator)) {
+			result = abs;
+			path = path.substring(1);
+		} else
+			result = relative;
 
-        if (!result.exists())
-            System.err.println("File not found: project=" + project
-                    + " workspace=" + workspace + " path=" + opath + " file="
-                    + result);
-        return result;
-    }
+		StringTokenizer st = new StringTokenizer(path, File.separator);
+		while (st.hasMoreTokens()) {
+			String token = st.nextToken();
+			result = new File(result, token);
+		}
 
-    static Pattern PATH = Pattern.compile("([A-Z_]+)/(.*)");
+		if (!result.exists())
+			System.err.println("File not found: project=" + project + " workspace=" + workspace + " path=" + opath
+					+ " file=" + result);
+		return result;
+	}
 
-    private File replaceVar(String path) {
-        if ((options & DO_VARIABLES) == 0)
-            return null;
+	static Pattern	PATH	= Pattern.compile("([A-Z_]+)/(.*)");
 
-        Matcher m = PATH.matcher(path);
-        if (m.matches()) {
-            String var = m.group(1);
-            String remainder = m.group(2);
-            String base = properties.get(var);
-            if (base != null) {
-                File b = new File(base);
-                File f = new File(b, remainder.replace('/', File.separatorChar));
-                return f;
-            } else
-                reporter.error("Can't find replacement variable for: " + path);
-        } else
-            reporter.error("Cant split variable path: " + path);
-        return null;
-    }
+	private File replaceVar(String path) {
+		if ((options & DO_VARIABLES) == 0)
+			return null;
 
-    private String get(NamedNodeMap map, String name) {
-        Node node = map.getNamedItem(name);
-        if (node == null)
-            return null;
+		Matcher m = PATH.matcher(path);
+		if (m.matches()) {
+			String var = m.group(1);
+			String remainder = m.group(2);
+			String base = properties.get(var);
+			if (base != null) {
+				File b = new File(base);
+				File f = new File(b, remainder.replace('/', File.separatorChar));
+				return f;
+			} else
+				reporter.error("Can't find replacement variable for: " + path);
+		} else
+			reporter.error("Cant split variable path: " + path);
+		return null;
+	}
 
-        return node.getNodeValue();
-    }
+	private String get(NamedNodeMap map, String name) {
+		Node node = map.getNamedItem(name);
+		if (node == null)
+			return null;
 
-    public Set<File> getClasspath() {
-        return classpath;
-    }
+		return node.getNodeValue();
+	}
 
-    public Set<File> getSourcepath() {
-        return sources;
-    }
+	public Set<File> getClasspath() {
+		return classpath;
+	}
 
-    public File getOutput() {
-        return output;
-    }
+	public Set<File> getSourcepath() {
+		return sources;
+	}
 
-    public List<File> getDependents() {
-        return dependents;
-    }
+	public File getOutput() {
+		return output;
+	}
 
-    public void setRecurse(boolean recurse) {
-        this.recurse = recurse;
-    }
+	public List<File> getDependents() {
+		return dependents;
+	}
 
-    public Set<File> getExports() {
-        return exports;
-    }
+	public void setRecurse(boolean recurse) {
+		this.recurse = recurse;
+	}
 
-    public void setProperties(Map<String, String> map) {
-        this.properties = map;
-    }
+	public Set<File> getExports() {
+		return exports;
+	}
 
-    public Set<File> getBootclasspath() {
-        return bootclasspath;
-    }
+	public void setProperties(Map<String,String> map) {
+		this.properties = map;
+	}
 
-    public Set<File> getAllSources() {
-        return allSources;
-    }
+	public Set<File> getBootclasspath() {
+		return bootclasspath;
+	}
+
+	public Set<File> getAllSources() {
+		return allSources;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/putjar/DirectoryInputStream.java b/bundleplugin/src/main/java/aQute/lib/putjar/DirectoryInputStream.java
index 5bd8178..8731037 100644
--- a/bundleplugin/src/main/java/aQute/lib/putjar/DirectoryInputStream.java
+++ b/bundleplugin/src/main/java/aQute/lib/putjar/DirectoryInputStream.java
@@ -6,276 +6,278 @@
 import aQute.libg.fileiterator.*;
 
 public class DirectoryInputStream extends InputStream {
-    final File               root;
-    final FileIterator       fi;
-    File                     element;
-    int                      entries   = 0;
-    int                      state     = START;
-    long                     where     = 0;
+	final File					root;
+	final FileIterator			fi;
+	File						element;
+	int							entries		= 0;
+	int							state		= START;
+	long						where		= 0;
 
-    final static int         START     = 0;
-    final static int         HEADER    = 1;
-    final static int         DATA      = 2;
-    final static int         DIRECTORY = 4;
-    final static int         EOF       = 5;
+	final static int			START		= 0;
+	final static int			HEADER		= 1;
+	final static int			DATA		= 2;
+	final static int			DIRECTORY	= 4;
+	final static int			EOF			= 5;
 
-    final static InputStream eof       = new ByteArrayInputStream(new byte[0]);
-    ByteArrayOutputStream    directory = new ByteArrayOutputStream();
-    InputStream              current   = eof;
+	final static InputStream	eof			= new ByteArrayInputStream(new byte[0]);
+	ByteArrayOutputStream		directory	= new ByteArrayOutputStream();
+	InputStream					current		= eof;
 
-    public DirectoryInputStream(File dir) {
-        root = dir;
-        fi = new FileIterator(dir);
-    }
+	public DirectoryInputStream(File dir) {
+		root = dir;
+		fi = new FileIterator(dir);
+	}
 
-    @Override
-    public int read() throws IOException {
-        if (fi == null)
-            return -1;
+	@Override
+	public int read() throws IOException {
+		if (fi == null)
+			return -1;
 
-        int c = current.read();
-        if (c < 0) {
-            next();
-            c = current.read();
-        }
-        if (c >= 0)
-            where++;
+		int c = current.read();
+		if (c < 0) {
+			next();
+			c = current.read();
+		}
+		if (c >= 0)
+			where++;
 
-        return c;
-    }
+		return c;
+	}
 
-    void next() throws IOException {
-        switch (state) {
-        case START:
-        case DATA:
-            nextHeader();
-            break;
+	void next() throws IOException {
+		switch (state) {
+			case START :
+			case DATA :
+				nextHeader();
+				break;
 
-        case HEADER:
-            if (element.isFile() && element.length() > 0) {
-                current = new FileInputStream(element);
-                state = DATA;
-            } else
-                nextHeader();
-            break;
+			case HEADER :
+				if (element.isFile() && element.length() > 0) {
+					current = new FileInputStream(element);
+					state = DATA;
+				} else
+					nextHeader();
+				break;
 
-        case DIRECTORY:
-            state = EOF;
-            current = eof;
-            break;
+			case DIRECTORY :
+				state = EOF;
+				current = eof;
+				break;
 
-        case EOF:
-            break;
-        }
-    }
+			case EOF :
+				break;
+		}
+	}
 
-    private void nextHeader() throws IOException {
-        if (fi.hasNext()) {
-            element = fi.next();
-            state = HEADER;
-            current = getHeader(root, element);
-            entries++;
-        } else {
-            current = getDirectory();
-            state = DIRECTORY;
-        }
-    }
+	private void nextHeader() throws IOException {
+		if (fi.hasNext()) {
+			element = fi.next();
+			state = HEADER;
+			current = getHeader(root, element);
+			entries++;
+		} else {
+			current = getDirectory();
+			state = DIRECTORY;
+		}
+	}
 
-    /**
-     * <pre>
-     *     end of central dir signature    4 bytes  (0x06054b50)
-     *         number of this disk             2 bytes
-     *         number of the disk with the
-     *         start of the central directory  2 bytes
-     *         total number of entries in the
-     *         central directory on this disk  2 bytes
-     *         total number of entries in
-     *         the central directory           2 bytes
-     *         size of the central directory   4 bytes
-     *         offset of start of central
-     *         directory with respect to
-     *         the starting disk number        4 bytes
-     *         .ZIP file comment length        2 bytes
-     *         .ZIP file comment       (variable size)
-     * </pre>
-     * 
-     * @return
-     */
-    InputStream getDirectory() throws IOException {
-        long where = this.where;
-        int sizeDirectory = directory.size();
+	/**
+	 * <pre>
+	 *     end of central dir signature    4 bytes  (0x06054b50)
+	 *         number of this disk             2 bytes
+	 *         number of the disk with the
+	 *         start of the central directory  2 bytes
+	 *         total number of entries in the
+	 *         central directory on this disk  2 bytes
+	 *         total number of entries in
+	 *         the central directory           2 bytes
+	 *         size of the central directory   4 bytes
+	 *         offset of start of central
+	 *         directory with respect to
+	 *         the starting disk number        4 bytes
+	 *         .ZIP file comment length        2 bytes
+	 *         .ZIP file comment       (variable size)
+	 * </pre>
+	 * 
+	 * @return
+	 */
+	InputStream getDirectory() throws IOException {
+		long where = this.where;
+		int sizeDirectory = directory.size();
 
-        writeInt(directory, 0x504b0506); // Signature
-        writeShort(directory, 0); // # of disk
-        writeShort(directory, 0); // # of the disk with start of the central
-        // dir
-        writeShort(directory, entries); // # of entries
-        writeInt(directory, sizeDirectory); // Size of central dir
-        writeInt(directory, (int) where);
-        writeShort(directory, 0);
+		writeInt(directory, 0x504b0506); // Signature
+		writeShort(directory, 0); // # of disk
+		writeShort(directory, 0); // # of the disk with start of the central
+		// dir
+		writeShort(directory, entries); // # of entries
+		writeInt(directory, sizeDirectory); // Size of central dir
+		writeInt(directory, (int) where);
+		writeShort(directory, 0);
 
-        directory.close();
+		directory.close();
 
-        byte[] data = directory.toByteArray();
-        return new ByteArrayInputStream(data);
-    }
+		byte[] data = directory.toByteArray();
+		return new ByteArrayInputStream(data);
+	}
 
-    private void writeShort(OutputStream out, int v) throws IOException {
-        for (int i = 0; i < 2; i++) {
-            out.write((byte) (v & 0xFF));
-            v = v >> 8;
-        }
-    }
+	private void writeShort(OutputStream out, int v) throws IOException {
+		for (int i = 0; i < 2; i++) {
+			out.write((byte) (v & 0xFF));
+			v = v >> 8;
+		}
+	}
 
-    private void writeInt(OutputStream out, int v) throws IOException {
-        for (int i = 0; i < 4; i++) {
-            out.write((byte) (v & 0xFF));
-            v = v >> 8;
-        }
-    }
+	private void writeInt(OutputStream out, int v) throws IOException {
+		for (int i = 0; i < 4; i++) {
+			out.write((byte) (v & 0xFF));
+			v = v >> 8;
+		}
+	}
 
-    /**
-     * Local file header:
-     * 
-     * <pre>
-     * 
-     *         local file header signature     4 bytes  (0x04034b50)
-     *         version needed to extract       2 bytes
-     *         general purpose bit flag        2 bytes
-     *         compression method              2 bytes
-     *         last mod file time              2 bytes
-     *         last mod file date              2 bytes
-     *         crc-32                          4 bytes
-     *         compressed size                 4 bytes
-     *         uncompressed size               4 bytes
-     *         file name length                2 bytes
-     *         extra field length              2 bytes
-     * 
-     *         file name (variable size)
-     *         extra field (variable size)
-     * 
-     *     central file header signature   4 bytes  (0x02014b50)
-     *         version made by                 2 bytes
-     *         version needed to extract       2 bytes
-     *         general purpose bit flag        2 bytes
-     *         compression method              2 bytes
-     *         last mod file time              2 bytes
-     *         last mod file date              2 bytes
-     *         crc-32                          4 bytes
-     *         compressed size                 4 bytes
-     *         uncompressed size               4 bytes
-     *         file name length                2 bytes
-     *         extra field length              2 bytes
-     *         file comment length             2 bytes
-     *         disk number start               2 bytes
-     *         internal file attributes        2 bytes
-     *         external file attributes        4 bytes
-     *         relative offset of local header 4 bytes
-     * 
-     *         file name (variable size)
-     *         extra field (variable size)
-     *         file comment (variable size)
-     * </pre>
-     * </pre>
-     * 
-     * @param file
-     * @return
-     */
-    private InputStream getHeader(File root, File file) throws IOException {
-        long where = this.where;
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-        // Signature
-        writeInt(bout, 0x04034b50);
-        writeInt(directory, 0x504b0102);
+	/**
+	 * Local file header:
+	 * 
+	 * <pre>
+	 * 
+	 *         local file header signature     4 bytes  (0x04034b50)
+	 *         version needed to extract       2 bytes
+	 *         general purpose bit flag        2 bytes
+	 *         compression method              2 bytes
+	 *         last mod file time              2 bytes
+	 *         last mod file date              2 bytes
+	 *         crc-32                          4 bytes
+	 *         compressed size                 4 bytes
+	 *         uncompressed size               4 bytes
+	 *         file name length                2 bytes
+	 *         extra field length              2 bytes
+	 * 
+	 *         file name (variable size)
+	 *         extra field (variable size)
+	 * 
+	 *     central file header signature   4 bytes  (0x02014b50)
+	 *         version made by                 2 bytes
+	 *         version needed to extract       2 bytes
+	 *         general purpose bit flag        2 bytes
+	 *         compression method              2 bytes
+	 *         last mod file time              2 bytes
+	 *         last mod file date              2 bytes
+	 *         crc-32                          4 bytes
+	 *         compressed size                 4 bytes
+	 *         uncompressed size               4 bytes
+	 *         file name length                2 bytes
+	 *         extra field length              2 bytes
+	 *         file comment length             2 bytes
+	 *         disk number start               2 bytes
+	 *         internal file attributes        2 bytes
+	 *         external file attributes        4 bytes
+	 *         relative offset of local header 4 bytes
+	 * 
+	 *         file name (variable size)
+	 *         extra field (variable size)
+	 *         file comment (variable size)
+	 * </pre>
+	 * 
+	 * </pre>
+	 * 
+	 * @param file
+	 * @return
+	 */
+	private InputStream getHeader(File root, File file) throws IOException {
+		long where = this.where;
+		ByteArrayOutputStream bout = new ByteArrayOutputStream();
+		// Signature
+		writeInt(bout, 0x04034b50);
+		writeInt(directory, 0x504b0102);
 
-        // Version needed to extract
-        writeShort(directory, 0);
+		// Version needed to extract
+		writeShort(directory, 0);
 
-        // Version needed to extract
-        writeShort(bout, 10);
-        writeShort(directory, 10);
+		// Version needed to extract
+		writeShort(bout, 10);
+		writeShort(directory, 10);
 
-        // General purpose bit flag (use descriptor)
-        writeShort(bout, 0); // descriptor follows data
-        writeShort(directory, 0); // descriptor follows data
+		// General purpose bit flag (use descriptor)
+		writeShort(bout, 0); // descriptor follows data
+		writeShort(directory, 0); // descriptor follows data
 
-        // Compresson method (stored)
-        writeShort(bout, 0);
-        writeShort(directory, 0);
+		// Compresson method (stored)
+		writeShort(bout, 0);
+		writeShort(directory, 0);
 
-        // Mod time
-        writeInt(bout, 0);
-        writeInt(directory, 0);
+		// Mod time
+		writeInt(bout, 0);
+		writeInt(directory, 0);
 
-        if (file.isDirectory()) {
-            writeInt(bout, 0); // CRC
-            writeInt(bout, 0); // Compressed size
-            writeInt(bout, 0); // Uncompressed Size
-            writeInt(directory, 0);
-            writeInt(directory, 0);
-            writeInt(directory, 0);
-        } else {
-            CRC32 crc = getCRC(file);
-            writeInt(bout, (int) crc.getValue());
-            writeInt(bout, (int) file.length());
-            writeInt(bout, (int) file.length());
-            writeInt(directory, (int) crc.getValue());
-            writeInt(directory, (int) file.length());
-            writeInt(directory, (int) file.length());
-        }
+		if (file.isDirectory()) {
+			writeInt(bout, 0); // CRC
+			writeInt(bout, 0); // Compressed size
+			writeInt(bout, 0); // Uncompressed Size
+			writeInt(directory, 0);
+			writeInt(directory, 0);
+			writeInt(directory, 0);
+		} else {
+			CRC32 crc = getCRC(file);
+			writeInt(bout, (int) crc.getValue());
+			writeInt(bout, (int) file.length());
+			writeInt(bout, (int) file.length());
+			writeInt(directory, (int) crc.getValue());
+			writeInt(directory, (int) file.length());
+			writeInt(directory, (int) file.length());
+		}
 
-        String p = getPath(root, file);
-        if (file.isDirectory())
-            p = p + "/";
-        byte[] path = p.getBytes("UTF-8");
-        writeShort(bout, path.length);
-        writeShort(directory, path.length);
+		String p = getPath(root, file);
+		if (file.isDirectory())
+			p = p + "/";
+		byte[] path = p.getBytes("UTF-8");
+		writeShort(bout, path.length);
+		writeShort(directory, path.length);
 
-        writeShort(bout, 0); // extra length
-        writeShort(directory, 0);
+		writeShort(bout, 0); // extra length
+		writeShort(directory, 0);
 
-        bout.write(path);
+		bout.write(path);
 
-        writeShort(directory, 0); // File comment length
-        writeShort(directory, 0); // disk number start 2 bytes
-        writeShort(directory, 0); // internal file attributes 2 bytes
-        writeInt(directory, 0); // external file attributes 4 bytes
-        writeInt(directory, (int) where); // relative offset of local header 4
-        // bytes
+		writeShort(directory, 0); // File comment length
+		writeShort(directory, 0); // disk number start 2 bytes
+		writeShort(directory, 0); // internal file attributes 2 bytes
+		writeInt(directory, 0); // external file attributes 4 bytes
+		writeInt(directory, (int) where); // relative offset of local header 4
+		// bytes
 
-        directory.write(path);
+		directory.write(path);
 
-        byte[] bytes = bout.toByteArray();
-        return new ByteArrayInputStream(bytes);
-    }
+		byte[] bytes = bout.toByteArray();
+		return new ByteArrayInputStream(bytes);
+	}
 
-    private String getPath(File root, File file) {
-        if (file.equals(root))
-            return "";
+	private String getPath(File root, File file) {
+		if (file.equals(root))
+			return "";
 
-        String p = getPath(root, file.getParentFile());
-        if (p.length() == 0)
-            p = file.getName();
-        else {
-            p = p + "/" + file.getName();
-        }
-        return p;
-    }
+		String p = getPath(root, file.getParentFile());
+		if (p.length() == 0)
+			p = file.getName();
+		else {
+			p = p + "/" + file.getName();
+		}
+		return p;
+	}
 
-    private CRC32 getCRC(File file) throws IOException {
-        CRC32 crc = new CRC32();
-        FileInputStream in = new FileInputStream(file);
-        try {
-            byte data[] = new byte[10000];
-            int size = in.read(data);
-            while (size > 0) {
-                crc.update(data, 0, size);
-                size = in.read(data);
-            }
-        } finally {
-            in.close();
-        }
-        return crc;
-    }
+	private CRC32 getCRC(File file) throws IOException {
+		CRC32 crc = new CRC32();
+		FileInputStream in = new FileInputStream(file);
+		try {
+			byte data[] = new byte[10000];
+			int size = in.read(data);
+			while (size > 0) {
+				crc.update(data, 0, size);
+				size = in.read(data);
+			}
+		}
+		finally {
+			in.close();
+		}
+		return crc;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/JPAComponent.java b/bundleplugin/src/main/java/aQute/lib/spring/JPAComponent.java
index d9c60cd..4fcbc34 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/JPAComponent.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/JPAComponent.java
@@ -6,19 +6,17 @@
 
 /**
  * This component is called when we find a resource in the META-INF/*.xml
- * pattern. We parse the resource and and the imports to the builder.
- * 
- * Parsing is done with XSLT (first time I see the use of having XML for the
- * Spring configuration files!).
+ * pattern. We parse the resource and and the imports to the builder. Parsing is
+ * done with XSLT (first time I see the use of having XML for the Spring
+ * configuration files!).
  * 
  * @author aqute
- * 
  */
 public class JPAComponent extends XMLTypeProcessor {
-    
-    protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
-        List<XMLType> types = new ArrayList<XMLType>();        
-        process(types,"jpa.xsl", "META-INF", "persistence.xml");
-        return types;
-    }
+
+	protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
+		List<XMLType> types = new ArrayList<XMLType>();
+		process(types, "jpa.xsl", "META-INF", "persistence.xml");
+		return types;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/SpringComponent.java b/bundleplugin/src/main/java/aQute/lib/spring/SpringComponent.java
index 0109ad4..c8678a8 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/SpringComponent.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/SpringComponent.java
@@ -15,24 +15,21 @@
 
 /**
  * This component is called when we find a resource in the META-INF/*.xml
- * pattern. We parse the resource and and the imports to the builder.
- * 
- * Parsing is done with XSLT (first time I see the use of having XML for the
- * Spring configuration files!).
+ * pattern. We parse the resource and and the imports to the builder. Parsing is
+ * done with XSLT (first time I see the use of having XML for the Spring
+ * configuration files!).
  * 
  * @author aqute
- * 
  */
 public class SpringComponent implements AnalyzerPlugin {
-	static Transformer transformer;
-	static Pattern SPRING_SOURCE = Pattern.compile("META-INF/spring/.*\\.xml");
-	static Pattern QN = Pattern.compile("[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*");
+	static Transformer	transformer;
+	static Pattern		SPRING_SOURCE	= Pattern.compile("META-INF/spring/.*\\.xml");
+	static Pattern		QN				= Pattern.compile("[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*");
 
 	public static Set<CharSequence> analyze(InputStream in) throws Exception {
 		if (transformer == null) {
 			TransformerFactory tf = TransformerFactory.newInstance();
-			Source source = new StreamSource(SpringComponent.class
-					.getResourceAsStream("extract.xsl"));
+			Source source = new StreamSource(SpringComponent.class.getResourceAsStream("extract.xsl"));
 			transformer = tf.newTransformer(source);
 		}
 
@@ -66,30 +63,32 @@
 		return refers;
 	}
 
-    public boolean analyzeJar(Analyzer analyzer) throws Exception {
-	    Jar jar = analyzer.getJar();
-	    Map<String, Resource> dir = jar.getDirectories().get("META-INF/spring");
-		if ( dir == null || dir.isEmpty())
+	public boolean analyzeJar(Analyzer analyzer) throws Exception {
+		Jar jar = analyzer.getJar();
+		Map<String,Resource> dir = jar.getDirectories().get("META-INF/spring");
+		if (dir == null || dir.isEmpty())
 			return false;
-		
-		for (Iterator<Entry<String, Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
-			Entry<String, Resource> entry = i.next();
+
+		for (Iterator<Entry<String,Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
+			Entry<String,Resource> entry = i.next();
 			String path = entry.getKey();
 			Resource resource = entry.getValue();
 			if (SPRING_SOURCE.matcher(path).matches()) {
 				try {
-				InputStream in = resource.openInputStream();
-				Set<CharSequence> set = analyze(in);
-				in.close();
-				for (Iterator<CharSequence> r = set.iterator(); r.hasNext();) {
-					PackageRef pack = analyzer.getPackageRef((String) r.next());
-					if ( !QN.matcher(pack.getFQN()).matches())
-					    analyzer.warning("Package does not seem a package in spring resource ("+path+"): " + pack );
-					if (!analyzer.getReferred().containsKey(pack))
-						analyzer.getReferred().put(pack, new Attrs());
+					InputStream in = resource.openInputStream();
+					Set<CharSequence> set = analyze(in);
+					in.close();
+					for (Iterator<CharSequence> r = set.iterator(); r.hasNext();) {
+						PackageRef pack = analyzer.getPackageRef((String) r.next());
+						if (!QN.matcher(pack.getFQN()).matches())
+							analyzer.warning("Package does not seem a package in spring resource (" + path + "): "
+									+ pack);
+						if (!analyzer.getReferred().containsKey(pack))
+							analyzer.getReferred().put(pack, new Attrs());
+					}
 				}
-				} catch( Exception e ) {
-					analyzer.error("Unexpected exception in processing spring resources("+path+"): " + e );
+				catch (Exception e) {
+					analyzer.error("Unexpected exception in processing spring resources(" + path + "): " + e);
 				}
 			}
 		}
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/SpringXMLType.java b/bundleplugin/src/main/java/aQute/lib/spring/SpringXMLType.java
index 60eb922..b4840d0 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/SpringXMLType.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/SpringXMLType.java
@@ -6,28 +6,23 @@
 
 /**
  * This component is called when we find a resource in the META-INF/*.xml
- * pattern. We parse the resource and and the imports to the builder.
- * 
- * Parsing is done with XSLT (first time I see the use of having XML for the
- * Spring configuration files!).
+ * pattern. We parse the resource and and the imports to the builder. Parsing is
+ * done with XSLT (first time I see the use of having XML for the Spring
+ * configuration files!).
  * 
  * @author aqute
- * 
  */
 public class SpringXMLType extends XMLTypeProcessor {
 
-    protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
-        List<XMLType> types = new ArrayList<XMLType>();
-        
-        String header = analyzer.getProperty("Bundle-Blueprint", "OSGI-INF/blueprint");
-        process(types,"extract.xsl", header, ".*\\.xml");
-        header = analyzer.getProperty("Spring-Context", "META-INF/spring");
-        process(types,"extract.xsl", header, ".*\\.xml"); 
-        
-        return types;
-    }
+	protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
+		List<XMLType> types = new ArrayList<XMLType>();
 
- 
+		String header = analyzer.getProperty("Bundle-Blueprint", "OSGI-INF/blueprint");
+		process(types, "extract.xsl", header, ".*\\.xml");
+		header = analyzer.getProperty("Spring-Context", "META-INF/spring");
+		process(types, "extract.xsl", header, ".*\\.xml");
 
+		return types;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/XMLType.java b/bundleplugin/src/main/java/aQute/lib/spring/XMLType.java
index f7c6b33..7d65d1c 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/XMLType.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/XMLType.java
@@ -12,97 +12,92 @@
 import aQute.lib.osgi.Descriptors.PackageRef;
 
 public class XMLType {
-    
-    Transformer    transformer;
-    Pattern        paths;
-    String          root;
-    
-    
-    static Pattern QN = Pattern
-                              .compile("[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*");
 
-    public XMLType(URL source, String root, String paths ) throws Exception {
-        transformer = getTransformer(source);
-        this.paths = Pattern.compile(paths);
-        this.root = root;
-    }
-    
-    public Set<String> analyze(InputStream in) throws Exception {
-        Set<String> refers = new HashSet<String>();
+	Transformer		transformer;
+	Pattern			paths;
+	String			root;
 
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-        Result r = new StreamResult(bout);
-        Source s = new StreamSource(in);
-        transformer.transform(s, r);
+	static Pattern	QN	= Pattern.compile("[_A-Za-z$][_A-Za-z0-9$]*(\\.[_A-Za-z$][_A-Za-z0-9$]*)*");
 
-        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
-        bout.close();
+	public XMLType(URL source, String root, String paths) throws Exception {
+		transformer = getTransformer(source);
+		this.paths = Pattern.compile(paths);
+		this.root = root;
+	}
 
-        BufferedReader br = new BufferedReader(new InputStreamReader(bin, "UTF8"));
+	public Set<String> analyze(InputStream in) throws Exception {
+		Set<String> refers = new HashSet<String>();
 
-        String line = br.readLine();
-        while (line != null) {
-            line = line.trim();
-            if (line.length() > 0) {
-                String parts[] = line.split("\\s*,\\s*");
-                for (int i = 0; i < parts.length; i++) {
-                    int n = parts[i].lastIndexOf('.');
-                    if (n > 0) {
-                        refers.add(parts[i].subSequence(0, n).toString());
-                    }
-                }
-            }
-            line = br.readLine();
-        }
-        br.close();
-        return refers;
-    }
+		ByteArrayOutputStream bout = new ByteArrayOutputStream();
+		Result r = new StreamResult(bout);
+		Source s = new StreamSource(in);
+		transformer.transform(s, r);
 
-    public boolean analyzeJar(Analyzer analyzer) throws Exception {
-        Jar jar = analyzer.getJar();
-        Map<String,Resource> dir = jar.getDirectories().get(root);
-        if (dir == null || dir.isEmpty()) {
-            Resource resource  = jar.getResource(root);
-            if ( resource != null )
-                process(analyzer, root, resource);
-            return false;
-        }
+		ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
+		bout.close();
 
-        for (Iterator<Map.Entry<String,Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
-            Map.Entry<String,Resource> entry = i.next();
-            String path = entry.getKey();
-            Resource resource = entry.getValue();
-            if (paths.matcher(path).matches()) {
-                process(analyzer, path, resource);
-            }
-        }
-        return false;
-    }
+		BufferedReader br = new BufferedReader(new InputStreamReader(bin, "UTF8"));
 
-    private void process(Analyzer analyzer, String path, Resource resource) {
-        try {
-            InputStream in = resource.openInputStream();
-            Set<String> set = analyze(in);
-            in.close();
-            for (Iterator<String> r = set.iterator(); r.hasNext();) {
-                PackageRef pack = analyzer.getPackageRef(r.next());
-                if (!QN.matcher(pack.getFQN()).matches())
-                    analyzer
-                            .warning("Package does not seem a package in spring resource ("
-                                    + path + "): " + pack);
-                if (!analyzer.getReferred().containsKey(pack))
-                    analyzer.getReferred().put(pack);
-            }
-        } catch (Exception e) {
-            analyzer
-                    .error("Unexpected exception in processing spring resources("
-                            + path + "): " + e);
-        }
-    }
+		String line = br.readLine();
+		while (line != null) {
+			line = line.trim();
+			if (line.length() > 0) {
+				String parts[] = line.split("\\s*,\\s*");
+				for (int i = 0; i < parts.length; i++) {
+					int n = parts[i].lastIndexOf('.');
+					if (n > 0) {
+						refers.add(parts[i].subSequence(0, n).toString());
+					}
+				}
+			}
+			line = br.readLine();
+		}
+		br.close();
+		return refers;
+	}
 
-    protected Transformer getTransformer(java.net.URL url) throws Exception {
-        TransformerFactory tf = TransformerFactory.newInstance();
-        Source source = new StreamSource(url.openStream());
-        return tf.newTransformer(source);
-    }
+	public boolean analyzeJar(Analyzer analyzer) throws Exception {
+		Jar jar = analyzer.getJar();
+		Map<String,Resource> dir = jar.getDirectories().get(root);
+		if (dir == null || dir.isEmpty()) {
+			Resource resource = jar.getResource(root);
+			if (resource != null)
+				process(analyzer, root, resource);
+			return false;
+		}
+
+		for (Iterator<Map.Entry<String,Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
+			Map.Entry<String,Resource> entry = i.next();
+			String path = entry.getKey();
+			Resource resource = entry.getValue();
+			if (paths.matcher(path).matches()) {
+				process(analyzer, path, resource);
+			}
+		}
+		return false;
+	}
+
+	private void process(Analyzer analyzer, String path, Resource resource) {
+		try {
+			InputStream in = resource.openInputStream();
+			Set<String> set = analyze(in);
+			in.close();
+			for (Iterator<String> r = set.iterator(); r.hasNext();) {
+				PackageRef pack = analyzer.getPackageRef(r.next());
+				if (!QN.matcher(pack.getFQN()).matches())
+					analyzer.warning("Package does not seem a package in spring resource (" + path + "): " + pack);
+				if (!analyzer.getReferred().containsKey(pack))
+					analyzer.getReferred().put(pack);
+			}
+		}
+		catch (Exception e) {
+			analyzer.error("Unexpected exception in processing spring resources(" + path + "): " + e);
+		}
+	}
+
+	protected Transformer getTransformer(java.net.URL url) throws Exception {
+		TransformerFactory tf = TransformerFactory.newInstance();
+		Source source = new StreamSource(url.openStream());
+		return tf.newTransformer(source);
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java b/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
index 6ae0e7e..64abf3c 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
@@ -7,28 +7,25 @@
 import aQute.libg.header.*;
 
 public class XMLTypeProcessor implements AnalyzerPlugin {
-    
-    public boolean analyzeJar(Analyzer analyzer) throws Exception {
-        List<XMLType> types = getTypes(analyzer);
-        for ( XMLType type : types ) {
-            type.analyzeJar(analyzer);
-        }
-        return false;
-    }
-    
-    protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
-        return new ArrayList<XMLType>();
-    }
 
+	public boolean analyzeJar(Analyzer analyzer) throws Exception {
+		List<XMLType> types = getTypes(analyzer);
+		for (XMLType type : types) {
+			type.analyzeJar(analyzer);
+		}
+		return false;
+	}
 
-    protected void process(List<XMLType> types, String resource, String paths,
-            String pattern) throws Exception {
-        
-        Parameters map = Processor.parseHeader(paths,null);
-        for ( String path : map.keySet() ) {
-            types.add( new XMLType( getClass().getResource(resource), path, pattern ));
-        }
-    }
+	protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
+		return new ArrayList<XMLType>();
+	}
 
+	protected void process(List<XMLType> types, String resource, String paths, String pattern) throws Exception {
+
+		Parameters map = Processor.parseHeader(paths, null);
+		for (String path : map.keySet()) {
+			types.add(new XMLType(getClass().getResource(resource), path, pattern));
+		}
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/lib/tag/Tag.java b/bundleplugin/src/main/java/aQute/lib/tag/Tag.java
index 5ec25a0..03ae971 100755
--- a/bundleplugin/src/main/java/aQute/lib/tag/Tag.java
+++ b/bundleplugin/src/main/java/aQute/lib/tag/Tag.java
@@ -13,7 +13,7 @@
 public class Tag {
 	Tag							parent;													// Parent
 	String						name;														// Name
-	final Map<String, String>	attributes	= new LinkedHashMap<String, String>();
+	final Map<String,String>	attributes	= new LinkedHashMap<String,String>();
 	final List<Object>			content		= new ArrayList<Object>();						// Content
 	SimpleDateFormat			format		= new SimpleDateFormat("yyyyMMddHHmmss.SSS");
 	boolean						cdata;
@@ -35,13 +35,13 @@
 	/**
 	 * Construct a new Tag with a name.
 	 */
-	public Tag(String name, Map<String, String> attributes, Object... contents) {
+	public Tag(String name, Map<String,String> attributes, Object... contents) {
 		this(name, contents);
 		this.attributes.putAll(attributes);
 
 	}
 
-	public Tag(String name, Map<String, String> attributes) {
+	public Tag(String name, Map<String,String> attributes) {
 		this(name, attributes, new Object[0]);
 	}
 
@@ -139,7 +139,7 @@
 	/**
 	 * Answer the attributes as a Dictionary object.
 	 */
-	public Map<String, String> getAttributes() {
+	public Map<String,String> getAttributes() {
 		return attributes;
 	}
 
@@ -256,22 +256,22 @@
 				pos = 0;
 			}
 			switch (c) {
-			case '<':
-				pw.print("&lt;");
-				pos += 4;
-				break;
-			case '>':
-				pw.print("&gt;");
-				pos += 4;
-				break;
-			case '&':
-				pw.print("&amp;");
-				pos += 5;
-				break;
-			default:
-				pw.print(c);
-				pos++;
-				break;
+				case '<' :
+					pw.print("&lt;");
+					pos += 4;
+					break;
+				case '>' :
+					pw.print("&gt;");
+					pos += 4;
+					break;
+				case '&' :
+					pw.print("&amp;");
+					pos += 5;
+					break;
+				default :
+					pw.print(c);
+					pos++;
+					break;
 			}
 
 		}
@@ -285,21 +285,21 @@
 		for (int i = 0; i < s.length(); i++) {
 			char c = s.charAt(i);
 			switch (c) {
-			case '<':
-				sb.append("&lt;");
-				break;
-			case '>':
-				sb.append("&gt;");
-				break;
-			case '\"':
-				sb.append("&quot;");
-				break;
-			case '&':
-				sb.append("&amp;");
-				break;
-			default:
-				sb.append(c);
-				break;
+				case '<' :
+					sb.append("&lt;");
+					break;
+				case '>' :
+					sb.append("&gt;");
+					break;
+				case '\"' :
+					sb.append("&quot;");
+					break;
+				case '&' :
+					sb.append("&amp;");
+					break;
+				default :
+					sb.append(c);
+					break;
 			}
 		}
 		return sb.toString();
@@ -390,10 +390,8 @@
 		if (mapping == null) {
 			return tn == sn || (sn != null && sn.equals(tn));
 		}
-		String suri = sn == null ? mapping.getAttribute("xmlns") : mapping
-				.getAttribute("xmlns:" + sn);
-		String turi = tn == null ? child.findRecursiveAttribute("xmlns") : child
-				.findRecursiveAttribute("xmlns:" + tn);
+		String suri = sn == null ? mapping.getAttribute("xmlns") : mapping.getAttribute("xmlns:" + sn);
+		String turi = tn == null ? child.findRecursiveAttribute("xmlns") : child.findRecursiveAttribute("xmlns:" + tn);
 		return turi == suri || (turi != null && suri != null && turi.equals(suri));
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/libg/asn1/BER.java b/bundleplugin/src/main/java/aQute/libg/asn1/BER.java
index 4416dd4..bde15aa 100644
--- a/bundleplugin/src/main/java/aQute/libg/asn1/BER.java
+++ b/bundleplugin/src/main/java/aQute/libg/asn1/BER.java
@@ -5,468 +5,463 @@
 import java.util.*;
 
 public class BER implements Types {
-    DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss\\Z");
-    
-    final DataInputStream xin;
-    long                  position;
+	DateFormat				df	= new SimpleDateFormat("yyyyMMddHHmmss\\Z");
 
-    public BER(InputStream in) {
-        this.xin = new DataInputStream(in);
-    }
+	final DataInputStream	xin;
+	long					position;
 
-    public void dump(PrintStream out) throws Exception {
-        int type = readByte();
-        long length = readLength();
-        if (type == -1 || length == -1)
-            throw new EOFException("Empty file");
-        dump(out, type, length, "");
-    }
+	public BER(InputStream in) {
+		this.xin = new DataInputStream(in);
+	}
 
-    void dump(PrintStream out, int type, long length, String indent)
-            throws Exception {
-        int clss = type >> 6;
-        int nmbr = type & 0x1F;
-        boolean cnst = (type & 0x20) != 0;
+	public void dump(PrintStream out) throws Exception {
+		int type = readByte();
+		long length = readLength();
+		if (type == -1 || length == -1)
+			throw new EOFException("Empty file");
+		dump(out, type, length, "");
+	}
 
-        String tag = "[" + nmbr + "]";
-        if (clss == 0)
-            tag = TAGS[nmbr];
+	void dump(PrintStream out, int type, long length, String indent) throws Exception {
+		int clss = type >> 6;
+		int nmbr = type & 0x1F;
+		boolean cnst = (type & 0x20) != 0;
 
-        if (cnst) {
-            System.err.printf("%5d %s %s %s%n", length, indent, CLASSES[clss],
-                    tag);
-            while (length > 1) {
-                long atStart = getPosition();
-                int t2 = read();
-                long l2 = readLength();
-                dump(out, t2, l2, indent + "  ");
-                length -= getPosition() - atStart;
-            }
-        } else {
-            assert length < Integer.MAX_VALUE;
-            assert length >= 0;
-            byte[] data = new byte[(int) length];
-            readFully(data);
-            String summary;
+		String tag = "[" + nmbr + "]";
+		if (clss == 0)
+			tag = TAGS[nmbr];
 
-            switch (nmbr) {
-            case BOOLEAN:
-                assert length == 1;
-                summary = data[0] != 0 ? "true" : "false";
-                break;
+		if (cnst) {
+			System.err.printf("%5d %s %s %s%n", length, indent, CLASSES[clss], tag);
+			while (length > 1) {
+				long atStart = getPosition();
+				int t2 = read();
+				long l2 = readLength();
+				dump(out, t2, l2, indent + "  ");
+				length -= getPosition() - atStart;
+			}
+		} else {
+			assert length < Integer.MAX_VALUE;
+			assert length >= 0;
+			byte[] data = new byte[(int) length];
+			readFully(data);
+			String summary;
 
-            case INTEGER:
-                long n = toLong(data);
-                summary = n + "";
-                break;
+			switch (nmbr) {
+				case BOOLEAN :
+					assert length == 1;
+					summary = data[0] != 0 ? "true" : "false";
+					break;
 
-            case UTF8_STRING:
-            case IA5STRING:
-            case VISIBLE_STRING:
-            case UNIVERSAL_STRING:
-            case PRINTABLE_STRING:
-            case UTCTIME:
-                summary = new String(data, "UTF-8");
-                break;
+				case INTEGER :
+					long n = toLong(data);
+					summary = n + "";
+					break;
 
-            case OBJECT_IDENTIFIER:
-                summary = readOID(data);
-                break;
+				case UTF8_STRING :
+				case IA5STRING :
+				case VISIBLE_STRING :
+				case UNIVERSAL_STRING :
+				case PRINTABLE_STRING :
+				case UTCTIME :
+					summary = new String(data, "UTF-8");
+					break;
 
-            case GENERALIZED_TIME:
-            case GRAPHIC_STRING:
-            case GENERAL_STRING:
-            case CHARACTER_STRING:
+				case OBJECT_IDENTIFIER :
+					summary = readOID(data);
+					break;
 
-            case REAL:
-            case EOC:
-            case BIT_STRING:
-            case OCTET_STRING:
-            case NULL:
-            case OBJECT_DESCRIPTOR:
-            case EXTERNAL:
-            case ENUMERATED:
-            case EMBEDDED_PDV:
-            case RELATIVE_OID:
-            case NUMERIC_STRING:
-            case T61_STRING:
-            case VIDEOTEX_STRING:
-            case BMP_STRING:
-            default:
-                StringBuilder sb = new StringBuilder();
-                for (int i = 0; i < 10 && i < data.length; i++) {
-                    sb.append(Integer.toHexString(data[i]));
-                }
-                if (data.length > 10) {
-                    sb.append("...");
-                }
-                summary = sb.toString();
-                break;
-            }
-            out.printf("%5d %s %s %s %s\n", length, indent, CLASSES[clss], tag,
-                    summary);
-        }
-    }
+				case GENERALIZED_TIME :
+				case GRAPHIC_STRING :
+				case GENERAL_STRING :
+				case CHARACTER_STRING :
 
-    long toLong(byte[] data) {
-        if (data[0] < 0) {
-            for (int i = 0; i < data.length; i++)
-                data[i] = (byte) (0xFF ^ data[i]);
+				case REAL :
+				case EOC :
+				case BIT_STRING :
+				case OCTET_STRING :
+				case NULL :
+				case OBJECT_DESCRIPTOR :
+				case EXTERNAL :
+				case ENUMERATED :
+				case EMBEDDED_PDV :
+				case RELATIVE_OID :
+				case NUMERIC_STRING :
+				case T61_STRING :
+				case VIDEOTEX_STRING :
+				case BMP_STRING :
+				default :
+					StringBuilder sb = new StringBuilder();
+					for (int i = 0; i < 10 && i < data.length; i++) {
+						sb.append(Integer.toHexString(data[i]));
+					}
+					if (data.length > 10) {
+						sb.append("...");
+					}
+					summary = sb.toString();
+					break;
+			}
+			out.printf("%5d %s %s %s %s\n", length, indent, CLASSES[clss], tag, summary);
+		}
+	}
 
-            return -(toLong(data) + 1);
-        }
-        long n = 0;
-        for (int i = 0; i < data.length; i++) {
-            n = n * 256 + data[i];
-        }
-        return n;
-    }
+	long toLong(byte[] data) {
+		if (data[0] < 0) {
+			for (int i = 0; i < data.length; i++)
+				data[i] = (byte) (0xFF ^ data[i]);
 
-    /**
-     * 8.1.3.3 For the definite form, the length octets shall consist of one or
-     * more octets, and shall represent the number of octets in the contents
-     * octets using either the short form (see 8.1.3.4) or the long form (see
-     * 8.1.3.5) as a sender's option. NOTE – The short form can only be used if
-     * the number of octets in the contents octets is less than or equal to 127.
-     * 8.1.3.4 In the short form, the length octets shall consist of a single
-     * octet in which bit 8 is zero and bits 7 to 1 encode the number of octets
-     * in the contents octets (which may be zero), as an unsigned binary integer
-     * with bit 7 as the most significant bit. EXAMPLE L = 38 can be encoded as
-     * 001001102 8.1.3.5 In the long form, the length octets shall consist of an
-     * initial octet and one or more subsequent octets. The initial octet shall
-     * be encoded as follows: a) bit 8 shall be one; b) bits 7 to 1 shall encode
-     * the number of subsequent octets in the length octets, as an unsigned
-     * binary integer with bit 7 as the most significant bit; c) the value
-     * 111111112 shall not be used. ISO/IEC 8825-1:2003 (E) NOTE 1 – This
-     * restriction is introduced for possible future extension. Bits 8 to 1 of
-     * the first subsequent octet, followed by bits 8 to 1 of the second
-     * subsequent octet, followed in turn by bits 8 to 1 of each further octet
-     * up to and including the last subsequent octet, shall be the encoding of
-     * an unsigned binary integer equal to the number of octets in the contents
-     * octets, with bit 8 of the first subsequent octet as the most significant
-     * bit. EXAMPLE L = 201 can be encoded as: 100000012 110010012 NOTE 2 – In
-     * the long form, it is a sender's option whether to use more length octets
-     * than the minimum necessary. 8.1.3.6 For the indefinite form, the length
-     * octets indicate that the contents octets are terminated by
-     * end-of-contents octets (see 8.1.5), and shall consist of a single octet.
-     * 8.1.3.6.1 The single octet shall have bit 8 set to one, and bits 7 to 1
-     * set to zero. 8.1.3.6.2 If this form of length is used, then
-     * end-of-contents octets (see 8.1.5) shall be present in the encoding
-     * following the contents octets. 8.1.4 Contents octets The contents octets
-     * shall consist of zero, one or more octets, and shall encode the data
-     * value as specified in subsequent clauses. NOTE – The contents octets
-     * depend on the type of the data value; subsequent clauses follow the same
-     * sequence as the definition of types in ASN.1. 8.1.5 End-of-contents
-     * octets The end-of-contents octets shall be present if the length is
-     * encoded as specified in 8.1.3.6, otherwise they shall not be present. The
-     * end-of-contents octets shall consist of two zero octets. NOTE – The
-     * end-of-contents octets can be considered as the encoding of a value whose
-     * tag is universal class, whose form is primitive, whose number of the tag
-     * is zero, and whose contents are absent, thus:
-     * 
-     * End-of-contents Length Contents 0016 0016 Absent
-     * 
-     * @return
-     */
-    private long readLength() throws IOException {
-        long n = readByte();
-        if (n > 0) {
-            // short form
-            return n;
-        }
+			return -(toLong(data) + 1);
+		}
+		long n = 0;
+		for (int i = 0; i < data.length; i++) {
+			n = n * 256 + data[i];
+		}
+		return n;
+	}
+
+	/**
+	 * 8.1.3.3 For the definite form, the length octets shall consist of one or
+	 * more octets, and shall represent the number of octets in the contents
+	 * octets using either the short form (see 8.1.3.4) or the long form (see
+	 * 8.1.3.5) as a sender's option. NOTE – The short form can only be used if
+	 * the number of octets in the contents octets is less than or equal to 127.
+	 * 8.1.3.4 In the short form, the length octets shall consist of a single
+	 * octet in which bit 8 is zero and bits 7 to 1 encode the number of octets
+	 * in the contents octets (which may be zero), as an unsigned binary integer
+	 * with bit 7 as the most significant bit. EXAMPLE L = 38 can be encoded as
+	 * 001001102 8.1.3.5 In the long form, the length octets shall consist of an
+	 * initial octet and one or more subsequent octets. The initial octet shall
+	 * be encoded as follows: a) bit 8 shall be one; b) bits 7 to 1 shall encode
+	 * the number of subsequent octets in the length octets, as an unsigned
+	 * binary integer with bit 7 as the most significant bit; c) the value
+	 * 111111112 shall not be used. ISO/IEC 8825-1:2003 (E) NOTE 1 – This
+	 * restriction is introduced for possible future extension. Bits 8 to 1 of
+	 * the first subsequent octet, followed by bits 8 to 1 of the second
+	 * subsequent octet, followed in turn by bits 8 to 1 of each further octet
+	 * up to and including the last subsequent octet, shall be the encoding of
+	 * an unsigned binary integer equal to the number of octets in the contents
+	 * octets, with bit 8 of the first subsequent octet as the most significant
+	 * bit. EXAMPLE L = 201 can be encoded as: 100000012 110010012 NOTE 2 – In
+	 * the long form, it is a sender's option whether to use more length octets
+	 * than the minimum necessary. 8.1.3.6 For the indefinite form, the length
+	 * octets indicate that the contents octets are terminated by
+	 * end-of-contents octets (see 8.1.5), and shall consist of a single octet.
+	 * 8.1.3.6.1 The single octet shall have bit 8 set to one, and bits 7 to 1
+	 * set to zero. 8.1.3.6.2 If this form of length is used, then
+	 * end-of-contents octets (see 8.1.5) shall be present in the encoding
+	 * following the contents octets. 8.1.4 Contents octets The contents octets
+	 * shall consist of zero, one or more octets, and shall encode the data
+	 * value as specified in subsequent clauses. NOTE – The contents octets
+	 * depend on the type of the data value; subsequent clauses follow the same
+	 * sequence as the definition of types in ASN.1. 8.1.5 End-of-contents
+	 * octets The end-of-contents octets shall be present if the length is
+	 * encoded as specified in 8.1.3.6, otherwise they shall not be present. The
+	 * end-of-contents octets shall consist of two zero octets. NOTE – The
+	 * end-of-contents octets can be considered as the encoding of a value whose
+	 * tag is universal class, whose form is primitive, whose number of the tag
+	 * is zero, and whose contents are absent, thus: End-of-contents Length
+	 * Contents 0016 0016 Absent
+	 * 
+	 * @return
+	 */
+	private long readLength() throws IOException {
+		long n = readByte();
+		if (n > 0) {
+			// short form
+			return n;
+		}
 		// long form
 		int count = (int) (n & 0x7F);
 		if (count == 0) {
-		    // indefinite form
-		    return 0;
+			// indefinite form
+			return 0;
 		}
 		n = 0;
 		while (count-- > 0) {
-		    n = n * 256 + read();
+			n = n * 256 + read();
 		}
 		return n;
-    }
+	}
 
-    private int readByte() throws IOException {
-        position++;
-        return xin.readByte();
-    }
+	private int readByte() throws IOException {
+		position++;
+		return xin.readByte();
+	}
 
-    private void readFully(byte[] data) throws IOException {
-        position += data.length;
-        xin.readFully(data);
-    }
+	private void readFully(byte[] data) throws IOException {
+		position += data.length;
+		xin.readFully(data);
+	}
 
-    private long getPosition() {
-        return position;
-    }
+	private long getPosition() {
+		return position;
+	}
 
-    private int read() throws IOException {
-        position++;
-        return xin.read();
-    }
+	private int read() throws IOException {
+		position++;
+		return xin.read();
+	}
 
-    String readOID(byte[] data) {
-        StringBuilder sb = new StringBuilder();
-        sb.append((0xFF & data[0]) / 40);
-        sb.append(".");
-        sb.append((0xFF & data[0]) % 40);
+	String readOID(byte[] data) {
+		StringBuilder sb = new StringBuilder();
+		sb.append((0xFF & data[0]) / 40);
+		sb.append(".");
+		sb.append((0xFF & data[0]) % 40);
 
-        int i = 0;
-        while (++i < data.length) {
-            int n = 0;
-            while (data[i] < 0) {
-                n = n * 128 + (0x7F & data[i]);
-                i++;
-            }
-            n = n * 128 + data[i];
-            sb.append(".");
-            sb.append(n);
-        }
+		int i = 0;
+		while (++i < data.length) {
+			int n = 0;
+			while (data[i] < 0) {
+				n = n * 128 + (0x7F & data[i]);
+				i++;
+			}
+			n = n * 128 + data[i];
+			sb.append(".");
+			sb.append(n);
+		}
 
-        return sb.toString();
-    }
+		return sb.toString();
+	}
 
-    int getPayloadLength(PDU pdu) throws Exception {
-        switch (pdu.getTag() & 0x1F) {
-        case EOC:
-            return 1;
+	int getPayloadLength(PDU pdu) throws Exception {
+		switch (pdu.getTag() & 0x1F) {
+			case EOC :
+				return 1;
 
-        case BOOLEAN:
-            return 1;
+			case BOOLEAN :
+				return 1;
 
-        case INTEGER:
-            return size(pdu.getInt());
+			case INTEGER :
+				return size(pdu.getInt());
 
-        case UTF8_STRING:
-            String s = pdu.getString();
-            byte[] encoded = s.getBytes("UTF-8");
-            return encoded.length;
+			case UTF8_STRING :
+				String s = pdu.getString();
+				byte[] encoded = s.getBytes("UTF-8");
+				return encoded.length;
 
-        case IA5STRING:
-        case VISIBLE_STRING:
-        case UNIVERSAL_STRING:
-        case PRINTABLE_STRING:
-        case GENERALIZED_TIME:
-        case GRAPHIC_STRING:
-        case GENERAL_STRING:
-        case CHARACTER_STRING:
-        case UTCTIME:
-        case NUMERIC_STRING: {
-            String str = pdu.getString();
-            encoded = str.getBytes("ASCII");
-            return encoded.length;
-        }
+			case IA5STRING :
+			case VISIBLE_STRING :
+			case UNIVERSAL_STRING :
+			case PRINTABLE_STRING :
+			case GENERALIZED_TIME :
+			case GRAPHIC_STRING :
+			case GENERAL_STRING :
+			case CHARACTER_STRING :
+			case UTCTIME :
+			case NUMERIC_STRING : {
+				String str = pdu.getString();
+				encoded = str.getBytes("ASCII");
+				return encoded.length;
+			}
 
-        case OBJECT_IDENTIFIER:
-        case REAL:
-        case BIT_STRING:
-            return pdu.getBytes().length;
+			case OBJECT_IDENTIFIER :
+			case REAL :
+			case BIT_STRING :
+				return pdu.getBytes().length;
 
-        case OCTET_STRING:
-        case NULL:
-        case OBJECT_DESCRIPTOR:
-        case EXTERNAL:
-        case ENUMERATED:
-        case EMBEDDED_PDV:
-        case RELATIVE_OID:
-        case T61_STRING:
-        case VIDEOTEX_STRING:
-        case BMP_STRING:
-            return pdu.getBytes().length;
+			case OCTET_STRING :
+			case NULL :
+			case OBJECT_DESCRIPTOR :
+			case EXTERNAL :
+			case ENUMERATED :
+			case EMBEDDED_PDV :
+			case RELATIVE_OID :
+			case T61_STRING :
+			case VIDEOTEX_STRING :
+			case BMP_STRING :
+				return pdu.getBytes().length;
 
-        default:
-            throw new IllegalArgumentException("Invalid type: " + pdu);
-        }
-    }
+			default :
+				throw new IllegalArgumentException("Invalid type: " + pdu);
+		}
+	}
 
-    int size(long value) {
-        if (value < 128)
-            return 1;
+	int size(long value) {
+		if (value < 128)
+			return 1;
 
-        if (value <= 0xFF)
-            return 2;
+		if (value <= 0xFF)
+			return 2;
 
-        if (value <= 0xFFFF)
-            return 3;
+		if (value <= 0xFFFF)
+			return 3;
 
-        if (value <= 0xFFFFFF)
-            return 4;
+		if (value <= 0xFFFFFF)
+			return 4;
 
-        if (value <= 0xFFFFFFFF)
-            return 5;
+		if (value <= 0xFFFFFFFF)
+			return 5;
 
-        if (value <= 0xFFFFFFFFFFL)
-            return 6;
+		if (value <= 0xFFFFFFFFFFL)
+			return 6;
 
-        if (value <= 0xFFFFFFFFFFFFL)
-            return 7;
+		if (value <= 0xFFFFFFFFFFFFL)
+			return 7;
 
-        if (value <= 0xFFFFFFFFFFFFFFL)
-            return 8;
+		if (value <= 0xFFFFFFFFFFFFFFL)
+			return 8;
 
-        if (value <= 0xFFFFFFFFFFFFFFFFL)
-            return 9;
+		if (value <= 0xFFFFFFFFFFFFFFFFL)
+			return 9;
 
-        throw new IllegalArgumentException("length too long");
-    }
+		throw new IllegalArgumentException("length too long");
+	}
 
-    public void write(OutputStream out, PDU pdu) throws Exception {
-        byte id = 0;
+	public void write(OutputStream out, PDU pdu) throws Exception {
+		byte id = 0;
 
-        switch (pdu.getClss()) {
-        case UNIVERSAL:
-            id |= 0;
-            break;
-        case APPLICATION:
-            id |= 0x40;
-            break;
-        case CONTEXT:
-            id |= 0x80;
-            break;
-        case PRIVATE:
-            id |= 0xC0;
-            break;
-        }
+		switch (pdu.getClss()) {
+			case UNIVERSAL :
+				id |= 0;
+				break;
+			case APPLICATION :
+				id |= 0x40;
+				break;
+			case CONTEXT :
+				id |= 0x80;
+				break;
+			case PRIVATE :
+				id |= 0xC0;
+				break;
+		}
 
-        if (pdu.isConstructed())
-            id |= 0x20;
+		if (pdu.isConstructed())
+			id |= 0x20;
 
-        int tag = pdu.getTag();
-        if (tag >= 0 && tag < 31) {
-            id |= tag;
-        } else {
-            throw new UnsupportedOperationException("Cant do tags > 30");
-        }
+		int tag = pdu.getTag();
+		if (tag >= 0 && tag < 31) {
+			id |= tag;
+		} else {
+			throw new UnsupportedOperationException("Cant do tags > 30");
+		}
 
-        out.write(id);
+		out.write(id);
 
-        int length = getPayloadLength(pdu);
-        int size = size(length);
-        if (size == 1) {
-            out.write(length);
-        } else {
-            out.write(size);
-            while (--size >= 0) {
-                byte data = (byte) ((length >> (size * 8)) & 0xFF);
-                out.write(data);
-            }
-        }
-        writePayload(out, pdu);
-    }
+		int length = getPayloadLength(pdu);
+		int size = size(length);
+		if (size == 1) {
+			out.write(length);
+		} else {
+			out.write(size);
+			while (--size >= 0) {
+				byte data = (byte) ((length >> (size * 8)) & 0xFF);
+				out.write(data);
+			}
+		}
+		writePayload(out, pdu);
+	}
 
-    void writePayload(OutputStream out, PDU pdu) throws Exception {
-        switch (pdu.getTag()) {
-        case EOC:
-            out.write(0);
-            break;
+	void writePayload(OutputStream out, PDU pdu) throws Exception {
+		switch (pdu.getTag()) {
+			case EOC :
+				out.write(0);
+				break;
 
-        case BOOLEAN:
-            if (pdu.getBoolean())
-                out.write(-1);
-            else
-                out.write(0);
-            break;
+			case BOOLEAN :
+				if (pdu.getBoolean())
+					out.write(-1);
+				else
+					out.write(0);
+				break;
 
-        case ENUMERATED:
-        case INTEGER: {
-            long value = pdu.getInt();
-            int size = size(value);
-            for (int i = size; i >= 0; i--) {
-                byte b = (byte) ((value >> (i * 8)) & 0xFF);
-                out.write(b);
-            }
-        }
+			case ENUMERATED :
+			case INTEGER : {
+				long value = pdu.getInt();
+				int size = size(value);
+				for (int i = size; i >= 0; i--) {
+					byte b = (byte) ((value >> (i * 8)) & 0xFF);
+					out.write(b);
+				}
+			}
 
-        case BIT_STRING: {
-            byte bytes[] = pdu.getBytes();
-            int unused = bytes[0];
-            assert unused <= 7;
-            int[] mask = { 0xFF, 0x7F, 0x3F, 0x1F, 0xF, 0x7, 0x3, 0x1 };
-            bytes[bytes.length - 1] &= (byte) mask[unused];
-            out.write(bytes);
-            break;
-        }
+			case BIT_STRING : {
+				byte bytes[] = pdu.getBytes();
+				int unused = bytes[0];
+				assert unused <= 7;
+				int[] mask = {
+						0xFF, 0x7F, 0x3F, 0x1F, 0xF, 0x7, 0x3, 0x1
+				};
+				bytes[bytes.length - 1] &= (byte) mask[unused];
+				out.write(bytes);
+				break;
+			}
 
-        case RELATIVE_OID:
-        case OBJECT_IDENTIFIER: {
-            int[] oid = pdu.getOID();
-            assert oid.length > 2;
-            assert oid[0] < 4;
-            assert oid[1] < 40;
-            byte top = (byte) (oid[0] * 40 + oid[1]);
-            out.write(top);
-            for (int i = 2; i < oid.length; i++) {
-                putOid(out,oid[i]);
-            }
-            break;
-        }
+			case RELATIVE_OID :
+			case OBJECT_IDENTIFIER : {
+				int[] oid = pdu.getOID();
+				assert oid.length > 2;
+				assert oid[0] < 4;
+				assert oid[1] < 40;
+				byte top = (byte) (oid[0] * 40 + oid[1]);
+				out.write(top);
+				for (int i = 2; i < oid.length; i++) {
+					putOid(out, oid[i]);
+				}
+				break;
+			}
 
-        case OCTET_STRING: {
-            byte bytes[] = pdu.getBytes();
-            out.write(bytes);
-            break;
-        }
+			case OCTET_STRING : {
+				byte bytes[] = pdu.getBytes();
+				out.write(bytes);
+				break;
+			}
 
-        case NULL:
-            break;
+			case NULL :
+				break;
 
-        case BMP_STRING:
-        case GRAPHIC_STRING:
-        case VISIBLE_STRING:
-        case GENERAL_STRING:
-        case UNIVERSAL_STRING:
-        case CHARACTER_STRING:
-        case NUMERIC_STRING:
-        case PRINTABLE_STRING:
-        case VIDEOTEX_STRING:
-        case T61_STRING:
-        case REAL:
-        case EMBEDDED_PDV:
-        case EXTERNAL:
-            throw new UnsupportedEncodingException("dont know real, embedded PDV or external");
-            
-        case UTF8_STRING: {
-            String s = pdu.getString();
-            byte [] data = s.getBytes("UTF-8");
-            out.write(data);
-            break;
-        }
-        
-        case OBJECT_DESCRIPTOR:
-        case IA5STRING:
-            String s = pdu.getString();
-            byte [] data = s.getBytes("ASCII");
-            out.write(data);
-            break;
-            
-            
-        case SEQUENCE:
-        case SET: {
-            PDU pdus[] = pdu.getChildren();
-            for ( PDU p : pdus ) {
-                write(out, p);
-            }
-        }
-            
-        
-        case UTCTIME:
-        case GENERALIZED_TIME:
-            Date date = pdu.getDate();
-            String ss= df.format(date);
-            byte d[] = ss.getBytes("ASCII");
-            out.write(d);
-            break;
-            
-        }
-    }
-    
+			case BMP_STRING :
+			case GRAPHIC_STRING :
+			case VISIBLE_STRING :
+			case GENERAL_STRING :
+			case UNIVERSAL_STRING :
+			case CHARACTER_STRING :
+			case NUMERIC_STRING :
+			case PRINTABLE_STRING :
+			case VIDEOTEX_STRING :
+			case T61_STRING :
+			case REAL :
+			case EMBEDDED_PDV :
+			case EXTERNAL :
+				throw new UnsupportedEncodingException("dont know real, embedded PDV or external");
 
-    private void putOid(OutputStream out, int i) throws IOException {
-        if (i > 127) {
-            putOid(out, i >> 7);
-            out.write(0x80 + (i & 0x7F));
-        } else
-            out.write(i & 0x7F);
-    }
+			case UTF8_STRING : {
+				String s = pdu.getString();
+				byte[] data = s.getBytes("UTF-8");
+				out.write(data);
+				break;
+			}
+
+			case OBJECT_DESCRIPTOR :
+			case IA5STRING :
+				String s = pdu.getString();
+				byte[] data = s.getBytes("ASCII");
+				out.write(data);
+				break;
+
+			case SEQUENCE :
+			case SET : {
+				PDU pdus[] = pdu.getChildren();
+				for (PDU p : pdus) {
+					write(out, p);
+				}
+			}
+
+			case UTCTIME :
+			case GENERALIZED_TIME :
+				Date date = pdu.getDate();
+				String ss = df.format(date);
+				byte d[] = ss.getBytes("ASCII");
+				out.write(d);
+				break;
+
+		}
+	}
+
+	private void putOid(OutputStream out, int i) throws IOException {
+		if (i > 127) {
+			putOid(out, i >> 7);
+			out.write(0x80 + (i & 0x7F));
+		} else
+			out.write(i & 0x7F);
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java b/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
index 033928c..2fb29fb 100644
--- a/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
+++ b/bundleplugin/src/main/java/aQute/libg/asn1/PDU.java
@@ -3,112 +3,109 @@
 import java.util.*;
 
 public class PDU implements Types, Iterable<PDU> {
-    final int identifier;
-    final Object  payload;
-    byte data[] = new byte[100];
+	final int		identifier;
+	final Object	payload;
+	byte			data[]	= new byte[100];
 
+	public PDU(int id, Object payload) {
+		identifier = id;
+		this.payload = payload;
+	}
 
-    public PDU(int id, Object payload) {
-        identifier = id;
-        this.payload = payload;
-    }
+	public PDU(Date payload) {
+		identifier = UTCTIME;
+		this.payload = payload;
+	}
 
-    public PDU(Date payload) {
-        identifier = UTCTIME;
-        this.payload = payload;
-    }
+	public PDU(int n) {
+		this(UNIVERSAL + INTEGER, n);
+	}
 
-    public PDU(int n) {
-        this(UNIVERSAL+INTEGER, n);
-    }
+	public PDU(boolean value) {
+		this(UNIVERSAL + BOOLEAN, value);
+	}
 
-    public PDU(boolean value) {
-        this(UNIVERSAL+BOOLEAN, value);
-    }
+	public PDU(String s) throws Exception {
+		this(UNIVERSAL + IA5STRING, s);
+	}
 
-    public PDU(String s) throws Exception {
-        this(UNIVERSAL+IA5STRING, s);
-    }
-    
-    public PDU(byte[] data) {
-        this(UNIVERSAL+OCTET_STRING, data);
-    }
-    
-    public PDU(BitSet bits) {
-        this(UNIVERSAL+BIT_STRING, bits);
-    }
+	public PDU(byte[] data) {
+		this(UNIVERSAL + OCTET_STRING, data);
+	}
 
-    public PDU(int top, int l1, int... remainder) {
-        identifier = UNIVERSAL+OBJECT_IDENTIFIER;
-        int[] ids = new int[remainder.length + 2];
-        ids[0] = top;
-        ids[1] = l1;
-        System.arraycopy(remainder, 0, ids, 2, remainder.length);
-        payload = ids;
-    }
+	public PDU(BitSet bits) {
+		this(UNIVERSAL + BIT_STRING, bits);
+	}
 
-    public PDU(int tag, PDU... set) {
-        this(tag,(Object)set);
-    }
+	public PDU(int top, int l1, int... remainder) {
+		identifier = UNIVERSAL + OBJECT_IDENTIFIER;
+		int[] ids = new int[remainder.length + 2];
+		ids[0] = top;
+		ids[1] = l1;
+		System.arraycopy(remainder, 0, ids, 2, remainder.length);
+		payload = ids;
+	}
 
-    public PDU(PDU... set) {
-        this(SEQUENCE+CONSTRUCTED,set);
-    }
+	public PDU(int tag, PDU... set) {
+		this(tag, (Object) set);
+	}
 
+	public PDU(PDU... set) {
+		this(SEQUENCE + CONSTRUCTED, set);
+	}
 
-    public int getTag() {
-        return identifier & TAGMASK;
-    }
+	public int getTag() {
+		return identifier & TAGMASK;
+	}
 
-    int getClss() {
-        return identifier & CLASSMASK;
-    }
+	int getClss() {
+		return identifier & CLASSMASK;
+	}
 
-    public boolean isConstructed() {
-        return (identifier & CONSTRUCTED) != 0;
-    }
+	public boolean isConstructed() {
+		return (identifier & CONSTRUCTED) != 0;
+	}
 
-    public String getString() {
-        return (String) payload;
-    }
+	public String getString() {
+		return (String) payload;
+	}
 
-    public Iterator<PDU> iterator() {
-        return Arrays.asList((PDU[]) payload).iterator();
-    }
+	public Iterator<PDU> iterator() {
+		return Arrays.asList((PDU[]) payload).iterator();
+	}
 
-    
-    public int[] getOID() {
-        assert getTag() == OBJECT_IDENTIFIER;
-        return (int[]) payload;
-    }
+	public int[] getOID() {
+		assert getTag() == OBJECT_IDENTIFIER;
+		return (int[]) payload;
+	}
 
-    public Boolean getBoolean() {
-        assert getTag() == BOOLEAN;
-        return (Boolean) payload;
-    }
+	public Boolean getBoolean() {
+		assert getTag() == BOOLEAN;
+		return (Boolean) payload;
+	}
 
-    public BitSet getBits() {
-        assert getTag() == BIT_STRING;
-        return (BitSet) payload;
-    }
+	public BitSet getBits() {
+		assert getTag() == BIT_STRING;
+		return (BitSet) payload;
+	}
 
-    public int getInt() {
-        assert getTag() == INTEGER || getTag() == ENUMERATED;
-        return (Integer) payload;
-    }
+	public int getInt() {
+		assert getTag() == INTEGER || getTag() == ENUMERATED;
+		return (Integer) payload;
+	}
 
-    public byte[] getBytes() {
-        return (byte[]) payload;
-    }
+	public byte[] getBytes() {
+		return (byte[]) payload;
+	}
 
-    public PDU[] getChildren() {
-        assert isConstructed();
-        return (PDU[]) payload;
-    }
+	public PDU[] getChildren() {
+		assert isConstructed();
+		return (PDU[]) payload;
+	}
 
-    public Date getDate() {
-        assert getTag() == UTCTIME || getTag() == GENERALIZED_TIME;
-        return (Date) payload;
-    }
+	public Date getDate() {
+		assert getTag() == UTCTIME || getTag() == GENERALIZED_TIME;
+		return (Date) payload;
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/asn1/Types.java b/bundleplugin/src/main/java/aQute/libg/asn1/Types.java
index 630ed1c..8f189ed 100644
--- a/bundleplugin/src/main/java/aQute/libg/asn1/Types.java
+++ b/bundleplugin/src/main/java/aQute/libg/asn1/Types.java
@@ -1,65 +1,66 @@
 package aQute.libg.asn1;
 
 public interface Types {
-    int      UNIVERSAL         = 0x00000000;
-    int      APPLICATION       = 0x40000000;
-    int      CONTEXT           = 0x80000000;
-    int      PRIVATE           = 0xC0000000;
-    int      CLASSMASK         = 0xC0000000;
-    int      CONSTRUCTED       = 0x20000000;
-    int      TAGMASK           = 0x1FFFFFFF;
+	int			UNIVERSAL			= 0x00000000;
+	int			APPLICATION			= 0x40000000;
+	int			CONTEXT				= 0x80000000;
+	int			PRIVATE				= 0xC0000000;
+	int			CLASSMASK			= 0xC0000000;
+	int			CONSTRUCTED			= 0x20000000;
+	int			TAGMASK				= 0x1FFFFFFF;
 
-    String [] CLASSES = {"U", "A", "C", "P"};
-    
-    // Payload Primitve
-    int      EOC               = 0;                                // null
-    // x
-    int      BOOLEAN           = 1;                                // Boolean
-    // x
-    int      INTEGER           = 2;                                // Long
-    // x
-    int      BIT_STRING        = 3;                                // byte
-    // [] -
-    int      OCTET_STRING      = 4;                                // byte
-    // [] -
-    int      NULL              = 5;                                // null
-    // x
-    int      OBJECT_IDENTIFIER = 6;                                // int[]
-    // x
-    int      OBJECT_DESCRIPTOR = 7;                                // 
-    int      EXTERNAL          = 8;                                //
-    int      REAL              = 9;                                // double
-    // x
-    int      ENUMERATED        = 10;                               // 
-    int      EMBEDDED_PDV      = 11;                               //
-    int      UTF8_STRING       = 12;                               // String
-    int      RELATIVE_OID      = 13;                               // 
-    int      SEQUENCE          = 16;                               // 
-    int      SET               = 17;
-    int      NUMERIC_STRING    = 18;                               // String
-    int      PRINTABLE_STRING  = 19;                               // String
-    int      T61_STRING        = 20;                               // String
-    int      VIDEOTEX_STRING   = 21;                               // String
-    int      IA5STRING         = 22;                               // String
-    int      UTCTIME           = 23;                               // Date
-    int      GENERALIZED_TIME  = 24;                               // Date
-    int      GRAPHIC_STRING    = 25;                               // String
-    int      VISIBLE_STRING    = 26;                               // String
-    int      GENERAL_STRING    = 27;                               // String
-    int      UNIVERSAL_STRING  = 28;                               // String
-    int      CHARACTER_STRING  = 29;                               // String
-    int      BMP_STRING        = 30;                               // byte[]
+	String[]	CLASSES				= {
+			"U", "A", "C", "P"
+									};
 
-    String[] TAGS              = { "EOC               ",
-            "BOOLEAN           ", "INTEGER           ", "BIT_STRING        ",
-            "OCTET_STRING      ", "NULL              ", "OBJECT_IDENTIFIER ",
-            "OBJECT_DESCRIPTOR ", "EXTERNAL          ", "REAL              ",
-            "ENUMERATED        ", "EMBEDDED_PDV      ", "UTF8_STRING       ",
-            "RELATIVE_OID      ", "?(14)             ", "?(15)             ",
-            "SEQUENCE          ", "SET               ", "NUMERIC_STRING    ",
-            "PRINTABLE_STRING  ", "T61_STRING        ", "VIDEOTEX_STRING   ",
-            "IA5STRING         ", "UTCTIME           ", "GENERALIZED_TIME  ",
-            "GRAPHIC_STRING    ", "VISIBLE_STRING    ", "GENERAL_STRING    ",
-            "UNIVERSAL_STRING  ", "CHARACTER_STRING  ", "BMP_STRING        ", };
+	// Payload Primitve
+	int			EOC					= 0;			// null
+	// x
+	int			BOOLEAN				= 1;			// Boolean
+	// x
+	int			INTEGER				= 2;			// Long
+	// x
+	int			BIT_STRING			= 3;			// byte
+	// [] -
+	int			OCTET_STRING		= 4;			// byte
+	// [] -
+	int			NULL				= 5;			// null
+	// x
+	int			OBJECT_IDENTIFIER	= 6;			// int[]
+	// x
+	int			OBJECT_DESCRIPTOR	= 7;			//
+	int			EXTERNAL			= 8;			//
+	int			REAL				= 9;			// double
+	// x
+	int			ENUMERATED			= 10;			//
+	int			EMBEDDED_PDV		= 11;			//
+	int			UTF8_STRING			= 12;			// String
+	int			RELATIVE_OID		= 13;			//
+	int			SEQUENCE			= 16;			//
+	int			SET					= 17;
+	int			NUMERIC_STRING		= 18;			// String
+	int			PRINTABLE_STRING	= 19;			// String
+	int			T61_STRING			= 20;			// String
+	int			VIDEOTEX_STRING		= 21;			// String
+	int			IA5STRING			= 22;			// String
+	int			UTCTIME				= 23;			// Date
+	int			GENERALIZED_TIME	= 24;			// Date
+	int			GRAPHIC_STRING		= 25;			// String
+	int			VISIBLE_STRING		= 26;			// String
+	int			GENERAL_STRING		= 27;			// String
+	int			UNIVERSAL_STRING	= 28;			// String
+	int			CHARACTER_STRING	= 29;			// String
+	int			BMP_STRING			= 30;			// byte[]
+
+	String[]	TAGS				= {
+			"EOC               ", "BOOLEAN           ", "INTEGER           ", "BIT_STRING        ",
+			"OCTET_STRING      ", "NULL              ", "OBJECT_IDENTIFIER ", "OBJECT_DESCRIPTOR ",
+			"EXTERNAL          ", "REAL              ", "ENUMERATED        ", "EMBEDDED_PDV      ",
+			"UTF8_STRING       ", "RELATIVE_OID      ", "?(14)             ", "?(15)             ",
+			"SEQUENCE          ", "SET               ", "NUMERIC_STRING    ", "PRINTABLE_STRING  ",
+			"T61_STRING        ", "VIDEOTEX_STRING   ", "IA5STRING         ", "UTCTIME           ",
+			"GENERALIZED_TIME  ", "GRAPHIC_STRING    ", "VISIBLE_STRING    ", "GENERAL_STRING    ",
+			"UNIVERSAL_STRING  ", "CHARACTER_STRING  ", "BMP_STRING        ",
+									};
 
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/cafs/CAFS.java b/bundleplugin/src/main/java/aQute/libg/cafs/CAFS.java
index 0bb8d7b..38e67be 100644
--- a/bundleplugin/src/main/java/aQute/libg/cafs/CAFS.java
+++ b/bundleplugin/src/main/java/aQute/libg/cafs/CAFS.java
@@ -17,7 +17,6 @@
  * in the universe has a unique SHA-1. Hard to believe but people smarter than
  * me have come to that conclusion. This class maintains a compressed store of
  * SHA-1 identified files. So if you have the SHA-1, you can get the contents.
- * 
  * This makes it easy to store a SHA-1 instead of the whole file or maintain a
  * naming scheme. An added advantage is that it is always easy to verify you get
  * the right stuff. The SHA-1 Content Addressable File Store is the core
@@ -34,9 +33,9 @@
 												+ 4 // flags
 												+ 4 // compressed length
 												+ 4 // uncompressed length
-												+ KEYLENGTH	// key
+												+ KEYLENGTH // key
 												+ 2 // header checksum
-												;
+										;
 
 	final File			home;
 	Index				index;
@@ -69,8 +68,7 @@
 					store.writeInt(0);
 				channel.force(true);
 			} else
-				throw new IllegalArgumentException("Invalid store file, length is too short "
-						+ store);
+				throw new IllegalArgumentException("Invalid store file, length is too short " + store);
 			System.err.println(store.length());
 		}
 		store.seek(0);
@@ -101,7 +99,7 @@
 		synchronized (store) {
 			// First check if it already exists
 			SHA1 sha1 = new SHA1(md.digest());
-			
+
 			long search = index.search(sha1.digest());
 			if (search > 0)
 				return sha1;
@@ -136,7 +134,8 @@
 				update(sha1.digest(), compressed, totalLength);
 				index.insert(sha1.digest(), insertPoint);
 				return sha1;
-			} finally {
+			}
+			finally {
 				if (lock != null)
 					lock.release();
 			}
@@ -163,20 +162,20 @@
 			if (!verifySignature(store, CAFE))
 				throw new IllegalArgumentException("No signature");
 
-			int flags =store.readInt();
+			int flags = store.readInt();
 			int compressedLength = store.readInt();
 			int uncompressedLength = store.readInt();
 			readSha1 = new byte[KEYLENGTH];
 			store.read(readSha1);
 			SHA1 rsha1 = new SHA1(readSha1);
-			
+
 			if (!sha1.equals(rsha1))
 				throw new IOException("SHA1 read and asked mismatch: " + sha1 + " " + rsha1);
 
 			short crc = store.readShort(); // Read CRC
-			if ( crc != checksum(flags,compressedLength, uncompressedLength, readSha1))
+			if (crc != checksum(flags, compressedLength, uncompressedLength, readSha1))
 				throw new IllegalArgumentException("Invalid header checksum: " + sha1);
-			
+
 			buffer = new byte[compressedLength];
 			store.readFully(buffer);
 			return getSha1Stream(sha1, buffer, uncompressedLength);
@@ -192,8 +191,7 @@
 		synchronized (store) {
 			length = store.length();
 			if (length < 0x100)
-				throw new IllegalArgumentException(
-						"Store file is too small, need to be at least 256 bytes: " + store);
+				throw new IllegalArgumentException("Store file is too small, need to be at least 256 bytes: " + store);
 		}
 
 		RandomAccessFile in = new RandomAccessFile(new File(home, STOREFILE), "r");
@@ -219,7 +217,8 @@
 				ixf.renameTo(indexFile);
 				this.index = new Index(indexFile, KEYLENGTH);
 			}
-		} finally {
+		}
+		finally {
 			in.close();
 		}
 	}
@@ -228,7 +227,8 @@
 		synchronized (store) {
 			try {
 				store.close();
-			} finally {
+			}
+			finally {
 				index.close();
 			}
 		}
@@ -246,7 +246,7 @@
 		byte[] key = new byte[KEYLENGTH];
 		in.readFully(key);
 		SHA1 sha1 = new SHA1(key);
-		
+
 		byte[] buffer = new byte[compressedSize];
 		in.readFully(buffer);
 
@@ -262,20 +262,20 @@
 		return Arrays.equals(read, org);
 	}
 
-	private InputStream getSha1Stream(final SHA1 sha1, byte[] buffer, final int total)
-			throws NoSuchAlgorithmException {
+	private InputStream getSha1Stream(final SHA1 sha1, byte[] buffer, final int total) throws NoSuchAlgorithmException {
 		ByteArrayInputStream in = new ByteArrayInputStream(buffer);
 		InflaterInputStream iin = new InflaterInputStream(in) {
-			int count = 0;
-			final MessageDigest digestx = MessageDigest.getInstance(ALGORITHM);
-			final AtomicBoolean calculated = new AtomicBoolean();
-			
-			@Override public int read(byte[] data, int offset, int length) throws IOException {
+			int					count		= 0;
+			final MessageDigest	digestx		= MessageDigest.getInstance(ALGORITHM);
+			final AtomicBoolean	calculated	= new AtomicBoolean();
+
+			@Override
+			public int read(byte[] data, int offset, int length) throws IOException {
 				int size = super.read(data, offset, length);
 				if (size <= 0)
 					eof();
 				else {
-					count+=size;
+					count += size;
 					this.digestx.update(data, offset, size);
 				}
 				return size;
@@ -293,16 +293,17 @@
 			}
 
 			void eof() throws IOException {
-				if ( calculated.getAndSet(true))
+				if (calculated.getAndSet(true))
 					return;
-				
-				if ( count != total )
-					throw new IOException("Counts do not match. Expected to read: " + total + " Actually read: " + count);
-				
+
+				if (count != total)
+					throw new IOException("Counts do not match. Expected to read: " + total + " Actually read: "
+							+ count);
+
 				SHA1 calculatedSha1 = new SHA1(digestx.digest());
 				if (!sha1.equals(calculatedSha1))
-					throw ( new IOException("SHA1 caclulated and asked mismatch, asked: "
-							+ sha1 + ", \nfound: " +calculatedSha1));
+					throw (new IOException("SHA1 caclulated and asked mismatch, asked: " + sha1 + ", \nfound: "
+							+ calculatedSha1));
 			}
 
 			public void close() throws IOException {
@@ -327,87 +328,86 @@
 	 *             The exception
 	 */
 	private void update(byte[] sha1, byte[] compressed, int totalLength) throws IOException {
-		//System.err.println("pos: " + store.getFilePointer());
+		// System.err.println("pos: " + store.getFilePointer());
 		store.write(CAFE); // 00-03 Signature
 		store.writeInt(0); // 04-07 Flags for the future
 		store.writeInt(compressed.length); // 08-11 Length deflated data
 		store.writeInt(totalLength); // 12-15 Length
 		store.write(sha1); // 16-35
-		store.writeShort( checksum(0,compressed.length, totalLength, sha1));
+		store.writeShort(checksum(0, compressed.length, totalLength, sha1));
 		store.write(compressed);
 		channel.force(false);
 	}
 
-	
-	
 	private short checksum(int flags, int compressedLength, int totalLength, byte[] sha1) {
 		CRC32 crc = new CRC32();
 		crc.update(flags);
-		crc.update(flags>>8);
-		crc.update(flags>>16);
-		crc.update(flags>>24);
+		crc.update(flags >> 8);
+		crc.update(flags >> 16);
+		crc.update(flags >> 24);
 		crc.update(compressedLength);
-		crc.update(compressedLength>>8);
-		crc.update(compressedLength>>16);
-		crc.update(compressedLength>>24);
+		crc.update(compressedLength >> 8);
+		crc.update(compressedLength >> 16);
+		crc.update(compressedLength >> 24);
 		crc.update(totalLength);
-		crc.update(totalLength>>8);
-		crc.update(totalLength>>16);
-		crc.update(totalLength>>24);
+		crc.update(totalLength >> 8);
+		crc.update(totalLength >> 16);
+		crc.update(totalLength >> 24);
 		crc.update(sha1);
 		return (short) crc.getValue();
 	}
 
 	public Iterator<SHA1> iterator() {
-		
+
 		return new Iterator<SHA1>() {
-			long position = 0x100;
-			
+			long	position	= 0x100;
+
 			public boolean hasNext() {
-				synchronized(store) {
+				synchronized (store) {
 					try {
 						return position < store.length();
-					} catch (IOException e) {
+					}
+					catch (IOException e) {
 						throw new RuntimeException(e);
 					}
 				}
 			}
 
 			public SHA1 next() {
-				synchronized(store) {
+				synchronized (store) {
 					try {
 						store.seek(position);
-						byte [] signature = new byte[4];
+						byte[] signature = new byte[4];
 						store.readFully(signature);
-						if ( !Arrays.equals(CAFE, signature))
+						if (!Arrays.equals(CAFE, signature))
 							throw new IllegalArgumentException("No signature");
 
 						int flags = store.readInt();
 						int compressedLength = store.readInt();
 						int totalLength = store.readInt();
-						byte []sha1 = new byte[KEYLENGTH];
+						byte[] sha1 = new byte[KEYLENGTH];
 						store.readFully(sha1);
 						short crc = store.readShort();
-						if ( crc != checksum(flags,compressedLength, totalLength, sha1))
+						if (crc != checksum(flags, compressedLength, totalLength, sha1))
 							throw new IllegalArgumentException("Header checksum fails");
-						
+
 						position += HEADERLENGTH + compressedLength;
 						return new SHA1(sha1);
-					} catch (IOException e) {
+					}
+					catch (IOException e) {
 						throw new RuntimeException(e);
-					}				
+					}
 				}
 			}
 
 			public void remove() {
 				throw new UnsupportedOperationException("Remvoe not supported, CAFS is write once");
-			}			
+			}
 		};
 	}
 
-	
 	public boolean isEmpty() throws IOException {
-		synchronized(store) {
+		synchronized (store) {
 			return store.getFilePointer() <= 256;
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/classdump/ClassDumper.java b/bundleplugin/src/main/java/aQute/libg/classdump/ClassDumper.java
index e45cd39..adf9824 100755
--- a/bundleplugin/src/main/java/aQute/libg/classdump/ClassDumper.java
+++ b/bundleplugin/src/main/java/aQute/libg/classdump/ClassDumper.java
@@ -6,693 +6,645 @@
 import java.lang.reflect.*;
 
 public class ClassDumper {
-    /**
-     * <pre>
-     * ACC_PUBLIC 0x0001 Declared public; may be accessed from outside its
-     * package. 
-     * ACC_FINAL 0x0010 Declared final; no subclasses allowed.
-     * ACC_SUPER 0x0020 Treat superclass methods specially when invoked by the
-     * invokespecial instruction. 
-     * ACC_INTERFACE 0x0200 Is an interface, not a
-     * class. 
-     * ACC_ABSTRACT 0x0400 Declared abstract; may not be instantiated.
-     * </pre>
-     * 
-     * @param mod
-     */
-    final static int ACC_PUBLIC  = 0x0001; // Declared public; may be accessed
-                                            // from outside its package.
-    final static int ACC_FINAL     = 0x0010; // Declared final; no subclasses
-    // allowed.
-    final static int ACC_SUPER     = 0x0020; // Treat superclass methods
-    // specially when invoked by the
-    // invokespecial instruction.
-    final static int ACC_INTERFACE = 0x0200; // Is an interface, not a classs
-    final static int ACC_ABSTRACT  = 0x0400; // Declared abstract; may not be
-                                                // instantiated.
-    
-    final static class Assoc {
-        Assoc(byte tag, int a, int b) {
-            this.tag = tag;
-            this.a = a;
-            this.b = b;
-        }
+	/**
+	 * <pre>
+	 * ACC_PUBLIC 0x0001 Declared public; may be accessed from outside its
+	 * package. 
+	 * ACC_FINAL 0x0010 Declared final; no subclasses allowed.
+	 * ACC_SUPER 0x0020 Treat superclass methods specially when invoked by the
+	 * invokespecial instruction. 
+	 * ACC_INTERFACE 0x0200 Is an interface, not a
+	 * class. 
+	 * ACC_ABSTRACT 0x0400 Declared abstract; may not be instantiated.
+	 * </pre>
+	 * 
+	 * @param mod
+	 */
+	final static int	ACC_PUBLIC		= 0x0001;	// Declared public; may be
+													// accessed
+													// from outside its package.
+	final static int	ACC_FINAL		= 0x0010;	// Declared final; no
+													// subclasses
+	// allowed.
+	final static int	ACC_SUPER		= 0x0020;	// Treat superclass methods
+	// specially when invoked by the
+	// invokespecial instruction.
+	final static int	ACC_INTERFACE	= 0x0200;	// Is an interface, not a
+													// classs
+	final static int	ACC_ABSTRACT	= 0x0400;	// Declared abstract; may
+													// not be
+													// instantiated.
 
-        byte tag;
-        int  a;
-        int  b;
+	final static class Assoc {
+		Assoc(byte tag, int a, int b) {
+			this.tag = tag;
+			this.a = a;
+			this.b = b;
+		}
 
-    }
+		byte	tag;
+		int		a;
+		int		b;
 
-    final String        path;
-    final static String NUM_COLUMN = "%-30s %d\n";
-    final static String HEX_COLUMN = "%-30s %x\n";
-    final static String STR_COLUMN = "%-30s %s\n";
+	}
 
-    PrintStream         ps         = System.err;
-    Object[]            pool;
-    InputStream         in;
+	final String		path;
+	final static String	NUM_COLUMN	= "%-30s %d\n";
+	final static String	HEX_COLUMN	= "%-30s %x\n";
+	final static String	STR_COLUMN	= "%-30s %s\n";
 
-    public ClassDumper(String path) throws Exception {
-        this(path, new FileInputStream(new File(path)));
-    }
+	PrintStream			ps			= System.err;
+	Object[]			pool;
+	InputStream			in;
 
-    public ClassDumper(String path, InputStream in) throws IOException {
-        this.path = path;
-        this.in = in;
-    }
+	public ClassDumper(String path) throws Exception {
+		this(path, new FileInputStream(new File(path)));
+	}
 
-    public void dump(PrintStream ps) throws Exception {
-        if (ps != null)
-            this.ps = ps;
-        DataInputStream din = new DataInputStream(in);
-        parseClassFile(din);
-        din.close();
-    }
+	public ClassDumper(String path, InputStream in) throws IOException {
+		this.path = path;
+		this.in = in;
+	}
 
-    void parseClassFile(DataInputStream in) throws IOException {
-        int magic = in.readInt();
-        if (magic != 0xCAFEBABE)
-            throw new IOException("Not a valid class file (no CAFEBABE header)");
+	public void dump(PrintStream ps) throws Exception {
+		if (ps != null)
+			this.ps = ps;
+		DataInputStream din = new DataInputStream(in);
+		parseClassFile(din);
+		din.close();
+	}
 
-        ps.printf(HEX_COLUMN, "magic", magic);
-        int minor = in.readUnsignedShort(); // minor version
-        int major = in.readUnsignedShort(); // major version
-        ps.printf(STR_COLUMN, "version", "" + major + "." + minor);
-        int pool_size = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, "pool size", pool_size);
-        pool = new Object[pool_size];
+	void parseClassFile(DataInputStream in) throws IOException {
+		int magic = in.readInt();
+		if (magic != 0xCAFEBABE)
+			throw new IOException("Not a valid class file (no CAFEBABE header)");
 
-        process: for (int poolIndex = 1; poolIndex < pool_size; poolIndex++) {
-            byte tag = in.readByte();
+		ps.printf(HEX_COLUMN, "magic", magic);
+		int minor = in.readUnsignedShort(); // minor version
+		int major = in.readUnsignedShort(); // major version
+		ps.printf(STR_COLUMN, "version", "" + major + "." + minor);
+		int pool_size = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, "pool size", pool_size);
+		pool = new Object[pool_size];
 
-            switch (tag) {
-            case 0:
-                ps.printf("%30d tag (0)\n", poolIndex);
-                break process;
+		process: for (int poolIndex = 1; poolIndex < pool_size; poolIndex++) {
+			byte tag = in.readByte();
 
-            case 1:
-                String name = in.readUTF();
-                pool[poolIndex] = name;
-                ps.printf("%30d tag(1) utf8 '%s'\n", poolIndex, name);
-                break;
+			switch (tag) {
+				case 0 :
+					ps.printf("%30d tag (0)\n", poolIndex);
+					break process;
 
-            case 2:
-                throw new IOException("Invalid tag " + tag);
+				case 1 :
+					String name = in.readUTF();
+					pool[poolIndex] = name;
+					ps.printf("%30d tag(1) utf8 '%s'\n", poolIndex, name);
+					break;
 
-            case 3:
-                int i = in.readInt();
-                pool[poolIndex] = Integer.valueOf(i);
-                ps.printf("%30d tag(3) int %s\n", poolIndex, i);
-                break;
+				case 2 :
+					throw new IOException("Invalid tag " + tag);
 
-            case 4:
-                float f = in.readFloat();
-                pool[poolIndex] = new Float(f);
-                ps.printf("%30d tag(4) float %s\n", poolIndex, f);
-                break;
+				case 3 :
+					int i = in.readInt();
+					pool[poolIndex] = Integer.valueOf(i);
+					ps.printf("%30d tag(3) int %s\n", poolIndex, i);
+					break;
 
-            // For some insane optimization reason are
-            // the long and the double two entries in the
-            // constant pool. See 4.4.5
-            case 5:
-                long l = in.readLong();
-                pool[poolIndex] = Long.valueOf(l);
-                ps.printf("%30d tag(5) long %s\n", poolIndex, l);
-                poolIndex++;
-                break;
+				case 4 :
+					float f = in.readFloat();
+					pool[poolIndex] = new Float(f);
+					ps.printf("%30d tag(4) float %s\n", poolIndex, f);
+					break;
 
-            case 6:
-                double d = in.readDouble();
-                pool[poolIndex] = new Double(d);
-                ps.printf("%30d tag(6) double %s\n", poolIndex, d);
-                poolIndex++;
-                break;
+				// For some insane optimization reason are
+				// the long and the double two entries in the
+				// constant pool. See 4.4.5
+				case 5 :
+					long l = in.readLong();
+					pool[poolIndex] = Long.valueOf(l);
+					ps.printf("%30d tag(5) long %s\n", poolIndex, l);
+					poolIndex++;
+					break;
 
-            case 7:
-                int class_index = in.readUnsignedShort();
-                pool[poolIndex] = Integer.valueOf(class_index);
-                ps.printf("%30d tag(7) constant classs %d\n", poolIndex,
-                        class_index);
-                break;
+				case 6 :
+					double d = in.readDouble();
+					pool[poolIndex] = new Double(d);
+					ps.printf("%30d tag(6) double %s\n", poolIndex, d);
+					poolIndex++;
+					break;
 
-            case 8:
-                int string_index = in.readUnsignedShort();
-                pool[poolIndex] = Integer.valueOf(string_index);
-                ps.printf("%30d tag(8) constant string %d\n", poolIndex,
-                        string_index);
-                break;
+				case 7 :
+					int class_index = in.readUnsignedShort();
+					pool[poolIndex] = Integer.valueOf(class_index);
+					ps.printf("%30d tag(7) constant classs %d\n", poolIndex, class_index);
+					break;
 
-            case 9: // Field ref
-                class_index = in.readUnsignedShort();
-                int name_and_type_index = in.readUnsignedShort();
-                pool[poolIndex] = new Assoc((byte) 9, class_index,
-                        name_and_type_index);
-                ps.printf("%30d tag(9) field ref %d/%d\n", poolIndex,
-                        class_index, name_and_type_index);
-                break;
+				case 8 :
+					int string_index = in.readUnsignedShort();
+					pool[poolIndex] = Integer.valueOf(string_index);
+					ps.printf("%30d tag(8) constant string %d\n", poolIndex, string_index);
+					break;
 
-            case 10: // Method ref
-                class_index = in.readUnsignedShort();
-                name_and_type_index = in.readUnsignedShort();
-                pool[poolIndex] = new Assoc((byte) 10, class_index,
-                        name_and_type_index);
-                ps.printf("%30d tag(10) method ref %d/%d\n", poolIndex,
-                        class_index, name_and_type_index);
-                break;
+				case 9 : // Field ref
+					class_index = in.readUnsignedShort();
+					int name_and_type_index = in.readUnsignedShort();
+					pool[poolIndex] = new Assoc((byte) 9, class_index, name_and_type_index);
+					ps.printf("%30d tag(9) field ref %d/%d\n", poolIndex, class_index, name_and_type_index);
+					break;
 
-            case 11: // Interface and Method ref
-                class_index = in.readUnsignedShort();
-                name_and_type_index = in.readUnsignedShort();
-                pool[poolIndex] = new Assoc((byte) 11, class_index,
-                        name_and_type_index);
-                ps.printf("%30d tag(11) interface and method ref %d/%d\n",
-                        poolIndex, class_index, name_and_type_index);
-                break;
+				case 10 : // Method ref
+					class_index = in.readUnsignedShort();
+					name_and_type_index = in.readUnsignedShort();
+					pool[poolIndex] = new Assoc((byte) 10, class_index, name_and_type_index);
+					ps.printf("%30d tag(10) method ref %d/%d\n", poolIndex, class_index, name_and_type_index);
+					break;
 
-            // Name and Type
-            case 12:
-                int name_index = in.readUnsignedShort();
-                int descriptor_index = in.readUnsignedShort();
-                pool[poolIndex] = new Assoc(tag, name_index, descriptor_index);
-                ps.printf("%30d tag(12) name and type %d/%d\n", poolIndex,
-                        name_index, descriptor_index);
-                break;
+				case 11 : // Interface and Method ref
+					class_index = in.readUnsignedShort();
+					name_and_type_index = in.readUnsignedShort();
+					pool[poolIndex] = new Assoc((byte) 11, class_index, name_and_type_index);
+					ps.printf("%30d tag(11) interface and method ref %d/%d\n", poolIndex, class_index,
+							name_and_type_index);
+					break;
 
-            default:
-                throw new IllegalArgumentException("Unknown tag: " + tag);
-            }
-        }
+				// Name and Type
+				case 12 :
+					int name_index = in.readUnsignedShort();
+					int descriptor_index = in.readUnsignedShort();
+					pool[poolIndex] = new Assoc(tag, name_index, descriptor_index);
+					ps.printf("%30d tag(12) name and type %d/%d\n", poolIndex, name_index, descriptor_index);
+					break;
 
-        int access = in.readUnsignedShort(); // access
-        printAccess(access);
-        int this_class = in.readUnsignedShort();
-        int super_class = in.readUnsignedShort();
-        ps.printf("%-30s %x %s(#%d)\n", "this_class", access, pool[this_class],
-                this_class);
-        ps.printf("%-30s %s(#%d)\n", "super_class", pool[super_class],
-                super_class);
+				default :
+					throw new IllegalArgumentException("Unknown tag: " + tag);
+			}
+		}
 
-        int interfaces_count = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, "interface count", interfaces_count);
-        for (int i = 0; i < interfaces_count; i++) {
-            int interface_index = in.readUnsignedShort();
-            ps.printf("%-30s interface %s(#%d)", "interface count",
-                    pool[interface_index], interfaces_count);
-        }
+		int access = in.readUnsignedShort(); // access
+		printAccess(access);
+		int this_class = in.readUnsignedShort();
+		int super_class = in.readUnsignedShort();
+		ps.printf("%-30s %x %s(#%d)\n", "this_class", access, pool[this_class], this_class);
+		ps.printf("%-30s %s(#%d)\n", "super_class", pool[super_class], super_class);
 
-        int field_count = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, "field count", field_count);
-        for (int i = 0; i < field_count; i++) {
-            access = in.readUnsignedShort(); // access
-            printAccess(access);
-            int name_index = in.readUnsignedShort();
-            int descriptor_index = in.readUnsignedShort();
-            ps.printf("%-30s %x %s(#%d) %s(#%d)\n", "field def", access,
-                    pool[name_index], name_index, pool[descriptor_index],
-                    descriptor_index);
-            doAttributes(in, "  ");
-        }
+		int interfaces_count = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, "interface count", interfaces_count);
+		for (int i = 0; i < interfaces_count; i++) {
+			int interface_index = in.readUnsignedShort();
+			ps.printf("%-30s interface %s(#%d)", "interface count", pool[interface_index], interfaces_count);
+		}
 
-        int method_count = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, "method count", method_count);
-        for (int i = 0; i < method_count; i++) {
-            int access_flags = in.readUnsignedShort();
-            printAccess(access_flags);
-            int name_index = in.readUnsignedShort();
-            int descriptor_index = in.readUnsignedShort();
-            ps.printf("%-30s %x %s(#%d) %s(#%d)\n", "method def", access_flags,
-                    pool[name_index], name_index, pool[descriptor_index],
-                    descriptor_index);
-            doAttributes(in, "  ");
-        }
+		int field_count = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, "field count", field_count);
+		for (int i = 0; i < field_count; i++) {
+			access = in.readUnsignedShort(); // access
+			printAccess(access);
+			int name_index = in.readUnsignedShort();
+			int descriptor_index = in.readUnsignedShort();
+			ps.printf("%-30s %x %s(#%d) %s(#%d)\n", "field def", access, pool[name_index], name_index,
+					pool[descriptor_index], descriptor_index);
+			doAttributes(in, "  ");
+		}
 
-        doAttributes(in, "");
-        if (in.read() >= 0)
-            ps.printf("Extra bytes follow ...");
-    }
+		int method_count = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, "method count", method_count);
+		for (int i = 0; i < method_count; i++) {
+			int access_flags = in.readUnsignedShort();
+			printAccess(access_flags);
+			int name_index = in.readUnsignedShort();
+			int descriptor_index = in.readUnsignedShort();
+			ps.printf("%-30s %x %s(#%d) %s(#%d)\n", "method def", access_flags, pool[name_index], name_index,
+					pool[descriptor_index], descriptor_index);
+			doAttributes(in, "  ");
+		}
 
-    /**
-     * Called for each attribute in the class, field, or method.
-     * 
-     * @param in
-     *            The stream
-     * @throws IOException
-     */
-    private void doAttributes(DataInputStream in, String indent)
-            throws IOException {
-        int attribute_count = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "attribute count", attribute_count);
-        for (int j = 0; j < attribute_count; j++) {
-            doAttribute(in, indent + j + ": ");
-        }
-    }
+		doAttributes(in, "");
+		if (in.read() >= 0)
+			ps.printf("Extra bytes follow ...");
+	}
 
-    /**
-     * Process a single attribute, if not recognized, skip it.
-     * 
-     * @param in
-     *            the data stream
-     * @throws IOException
-     */
-    private void doAttribute(DataInputStream in, String indent)
-            throws IOException {
-        int attribute_name_index = in.readUnsignedShort();
-        long attribute_length = in.readInt();
-        attribute_length &= 0xFFFF;
-        String attributeName = (String) pool[attribute_name_index];
-        ps.printf("%-30s %s(#%d)\n", indent + "attribute", attributeName,
-                attribute_name_index);
-        if ("RuntimeVisibleAnnotations".equals(attributeName))
-            doAnnotations(in, indent);
-        else if ("SourceFile".equals(attributeName))
-            doSourceFile(in, indent);
-        else if ("Code".equals(attributeName))
-            doCode(in, indent);
-        else if ("LineNumberTable".equals(attributeName))
-            doLineNumberTable(in, indent);
-        else if ("LocalVariableTable".equals(attributeName))
-            doLocalVariableTable(in, indent);
-        else if ("InnerClasses".equals(attributeName))
-            doInnerClasses(in, indent);
-        else if ("Exceptions".equals(attributeName))
-            doExceptions(in, indent);
-        else if ("EnclosingMethod".equals(attributeName))
-            doEnclosingMethod(in, indent);
-        else if ("Signature".equals(attributeName))
-            doSignature(in, indent);
-        else if ("Synthetic".equals(attributeName))
-            ; // Is empty!
-        else if ("Deprecated".equals(attributeName))
-            ; // Is Empty
-        else {
-            ps.printf("%-30s %d\n", indent + "Unknown attribute, skipping",
-                    attribute_length);
-            if (attribute_length > 0x7FFFFFFF) {
-                throw new IllegalArgumentException("Attribute > 2Gb");
-            }
-            byte buffer[] = new byte[(int) attribute_length];
-            in.readFully(buffer);
-            printHex(buffer);
-        }
-    }
+	/**
+	 * Called for each attribute in the class, field, or method.
+	 * 
+	 * @param in
+	 *            The stream
+	 * @throws IOException
+	 */
+	private void doAttributes(DataInputStream in, String indent) throws IOException {
+		int attribute_count = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "attribute count", attribute_count);
+		for (int j = 0; j < attribute_count; j++) {
+			doAttribute(in, indent + j + ": ");
+		}
+	}
 
-    /**
-     * <pre>
-     * Signature_attribute {
-     * 	u2 attribute_name_index;
-     * 	u4 attribute_length;
-     * 	u2 signature_index;
-     * 	}
-     * </pre>
-     * 
-     * @param in
-     * @param indent
-     */
-    void doSignature(DataInputStream in, String indent) throws IOException {
-        int signature_index = in.readUnsignedShort();
-        ps.printf("%-30s %s(#%d)\n", indent + "signature",
-                pool[signature_index], signature_index);
-    }
+	/**
+	 * Process a single attribute, if not recognized, skip it.
+	 * 
+	 * @param in
+	 *            the data stream
+	 * @throws IOException
+	 */
+	private void doAttribute(DataInputStream in, String indent) throws IOException {
+		int attribute_name_index = in.readUnsignedShort();
+		long attribute_length = in.readInt();
+		attribute_length &= 0xFFFF;
+		String attributeName = (String) pool[attribute_name_index];
+		ps.printf("%-30s %s(#%d)\n", indent + "attribute", attributeName, attribute_name_index);
+		if ("RuntimeVisibleAnnotations".equals(attributeName))
+			doAnnotations(in, indent);
+		else if ("SourceFile".equals(attributeName))
+			doSourceFile(in, indent);
+		else if ("Code".equals(attributeName))
+			doCode(in, indent);
+		else if ("LineNumberTable".equals(attributeName))
+			doLineNumberTable(in, indent);
+		else if ("LocalVariableTable".equals(attributeName))
+			doLocalVariableTable(in, indent);
+		else if ("InnerClasses".equals(attributeName))
+			doInnerClasses(in, indent);
+		else if ("Exceptions".equals(attributeName))
+			doExceptions(in, indent);
+		else if ("EnclosingMethod".equals(attributeName))
+			doEnclosingMethod(in, indent);
+		else if ("Signature".equals(attributeName))
+			doSignature(in, indent);
+		else if ("Synthetic".equals(attributeName))
+			; // Is empty!
+		else if ("Deprecated".equals(attributeName))
+			; // Is Empty
+		else {
+			ps.printf("%-30s %d\n", indent + "Unknown attribute, skipping", attribute_length);
+			if (attribute_length > 0x7FFFFFFF) {
+				throw new IllegalArgumentException("Attribute > 2Gb");
+			}
+			byte buffer[] = new byte[(int) attribute_length];
+			in.readFully(buffer);
+			printHex(buffer);
+		}
+	}
 
-    /**
-     * <pre>
-     * EnclosingMethod_attribute {
-     * 	u2 attribute_name_index;
-     * 	u4 attribute_length;
-     * 	u2 class_index
-     * 	u2 method_index;
-     * 	}
-     * 	
-     * </pre>
-     */
-    void doEnclosingMethod(DataInputStream in, String indent)
-            throws IOException {
-        int class_index = in.readUnsignedShort();
-        int method_index = in.readUnsignedShort();
-        ps.printf("%-30s %s(#%d/c) %s\n", //
-        		indent + "enclosing method", //
-                pool[((Integer) pool[class_index]).intValue()], //
-                class_index, //
-                (method_index == 0 ? "<>" : pool[method_index]));
-    }
+	/**
+	 * <pre>
+	 * Signature_attribute {
+	 * 	u2 attribute_name_index;
+	 * 	u4 attribute_length;
+	 * 	u2 signature_index;
+	 * 	}
+	 * </pre>
+	 * 
+	 * @param in
+	 * @param indent
+	 */
+	void doSignature(DataInputStream in, String indent) throws IOException {
+		int signature_index = in.readUnsignedShort();
+		ps.printf("%-30s %s(#%d)\n", indent + "signature", pool[signature_index], signature_index);
+	}
 
-    /**
-     * <pre>
-     *  Exceptions_attribute {
-     * 		u2 attribute_name_index;
-     * 		u4 attribute_length;
-     * 		u2 number_of_exceptions;
-     * 		u2 exception_index_table[number_of_exceptions];
-     * 	}
-     * </pre>
-     * 
-     * @param in
-     * @param indent
-     */
-    private void doExceptions(DataInputStream in, String indent)
-            throws IOException {
-        int number_of_exceptions = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "number of exceptions",
-                number_of_exceptions);
-        StringBuilder sb = new StringBuilder();
-        String del = "";
-        for (int i = 0; i < number_of_exceptions; i++) {
-            int exception_index_table = in.readUnsignedShort();
-            sb.append(del);
-            sb.append(pool[((Integer) pool[exception_index_table])]);
-            sb.append("(#");
-            sb.append(exception_index_table);
-            sb.append("/c)");
-            del = ", ";
-        }
-        ps.printf("%-30s %d: %s\n", indent + "exceptions",
-                number_of_exceptions, sb);
-    }
+	/**
+	 * <pre>
+	 * EnclosingMethod_attribute {
+	 * 	u2 attribute_name_index;
+	 * 	u4 attribute_length;
+	 * 	u2 class_index
+	 * 	u2 method_index;
+	 * 	}
+	 * 
+	 * </pre>
+	 */
+	void doEnclosingMethod(DataInputStream in, String indent) throws IOException {
+		int class_index = in.readUnsignedShort();
+		int method_index = in.readUnsignedShort();
+		ps.printf("%-30s %s(#%d/c) %s\n", //
+				indent + "enclosing method", //
+				pool[((Integer) pool[class_index]).intValue()], //
+				class_index, //
+				(method_index == 0 ? "<>" : pool[method_index]));
+	}
 
-    /**
-     * <pre>
-     * Code_attribute {
-     * 		u2 attribute_name_index;
-     * 		u4 attribute_length;
-     * 		u2 max_stack;
-     * 		u2 max_locals;
-     * 		u4 code_length;
-     * 		u1 code[code_length];
-     * 		u2 exception_table_length;
-     * 		{    	u2 start_pc;
-     * 		      	u2 end_pc;
-     * 		      	u2  handler_pc;
-     * 		      	u2  catch_type;
-     * 		}	exception_table[exception_table_length];
-     * 		u2 attributes_count;
-     * 		attribute_info attributes[attributes_count];
-     * 	}
-     * </pre>
-     * 
-     * @param in
-     * @param pool
-     * @throws IOException
-     */
-    private void doCode(DataInputStream in, String indent) throws IOException {
-        int max_stack = in.readUnsignedShort();
-        int max_locals = in.readUnsignedShort();
-        int code_length = in.readInt();
-        ps.printf(NUM_COLUMN, indent + "max_stack", max_stack);
-        ps.printf(NUM_COLUMN, indent + "max_locals", max_locals);
-        ps.printf(NUM_COLUMN, indent + "code_length", code_length);
-        byte code[] = new byte[code_length];
-        in.readFully(code);
-        printHex(code);
-        int exception_table_length = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "exception_table_length",
-                exception_table_length);
+	/**
+	 * <pre>
+	 *  Exceptions_attribute {
+	 * 		u2 attribute_name_index;
+	 * 		u4 attribute_length;
+	 * 		u2 number_of_exceptions;
+	 * 		u2 exception_index_table[number_of_exceptions];
+	 * 	}
+	 * </pre>
+	 * 
+	 * @param in
+	 * @param indent
+	 */
+	private void doExceptions(DataInputStream in, String indent) throws IOException {
+		int number_of_exceptions = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "number of exceptions", number_of_exceptions);
+		StringBuilder sb = new StringBuilder();
+		String del = "";
+		for (int i = 0; i < number_of_exceptions; i++) {
+			int exception_index_table = in.readUnsignedShort();
+			sb.append(del);
+			sb.append(pool[((Integer) pool[exception_index_table])]);
+			sb.append("(#");
+			sb.append(exception_index_table);
+			sb.append("/c)");
+			del = ", ";
+		}
+		ps.printf("%-30s %d: %s\n", indent + "exceptions", number_of_exceptions, sb);
+	}
 
-        for (int i = 0; i < exception_table_length; i++) {
-            int start_pc = in.readUnsignedShort();
-            int end_pc = in.readUnsignedShort();
-            int handler_pc = in.readUnsignedShort();
-            int catch_type = in.readUnsignedShort();
-            ps.printf("%-30s %d/%d/%d/%d\n", indent + "exception_table",
-                    start_pc, end_pc, handler_pc, catch_type);
-        }
-        doAttributes(in, indent + "  ");
-    }
+	/**
+	 * <pre>
+	 * Code_attribute {
+	 * 		u2 attribute_name_index;
+	 * 		u4 attribute_length;
+	 * 		u2 max_stack;
+	 * 		u2 max_locals;
+	 * 		u4 code_length;
+	 * 		u1 code[code_length];
+	 * 		u2 exception_table_length;
+	 * 		{    	u2 start_pc;
+	 * 		      	u2 end_pc;
+	 * 		      	u2  handler_pc;
+	 * 		      	u2  catch_type;
+	 * 		}	exception_table[exception_table_length];
+	 * 		u2 attributes_count;
+	 * 		attribute_info attributes[attributes_count];
+	 * 	}
+	 * </pre>
+	 * 
+	 * @param in
+	 * @param pool
+	 * @throws IOException
+	 */
+	private void doCode(DataInputStream in, String indent) throws IOException {
+		int max_stack = in.readUnsignedShort();
+		int max_locals = in.readUnsignedShort();
+		int code_length = in.readInt();
+		ps.printf(NUM_COLUMN, indent + "max_stack", max_stack);
+		ps.printf(NUM_COLUMN, indent + "max_locals", max_locals);
+		ps.printf(NUM_COLUMN, indent + "code_length", code_length);
+		byte code[] = new byte[code_length];
+		in.readFully(code);
+		printHex(code);
+		int exception_table_length = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "exception_table_length", exception_table_length);
 
-    /**
-     * We must find Class.forName references ...
-     * 
-     * @param code
-     */
-    protected void printHex(byte[] code) {
-        int index = 0;
-        while (index < code.length) {
-            StringBuilder sb = new StringBuilder();
-            for (int i = 0; i < 16 && index < code.length; i++) {
-                String s = Integer.toHexString((0xFF & code[index++]))
-                        .toUpperCase();
-                if (s.length() == 1)
-                    sb.append("0");
-                sb.append(s);
-                sb.append(" ");
-            }
-            ps.printf(STR_COLUMN, "", sb.toString());
-        }
-    }
+		for (int i = 0; i < exception_table_length; i++) {
+			int start_pc = in.readUnsignedShort();
+			int end_pc = in.readUnsignedShort();
+			int handler_pc = in.readUnsignedShort();
+			int catch_type = in.readUnsignedShort();
+			ps.printf("%-30s %d/%d/%d/%d\n", indent + "exception_table", start_pc, end_pc, handler_pc, catch_type);
+		}
+		doAttributes(in, indent + "  ");
+	}
 
-    private void doSourceFile(DataInputStream in, String indent)
-            throws IOException {
-        int sourcefile_index = in.readUnsignedShort();
-        ps.printf("%-30s %s(#%d)\n", indent + "Source file",
-                pool[sourcefile_index], sourcefile_index);
-    }
+	/**
+	 * We must find Class.forName references ...
+	 * 
+	 * @param code
+	 */
+	protected void printHex(byte[] code) {
+		int index = 0;
+		while (index < code.length) {
+			StringBuilder sb = new StringBuilder();
+			for (int i = 0; i < 16 && index < code.length; i++) {
+				String s = Integer.toHexString((0xFF & code[index++])).toUpperCase();
+				if (s.length() == 1)
+					sb.append("0");
+				sb.append(s);
+				sb.append(" ");
+			}
+			ps.printf(STR_COLUMN, "", sb.toString());
+		}
+	}
 
-    private void doAnnotations(DataInputStream in, String indent)
-            throws IOException {
-        int num_annotations = in.readUnsignedShort(); // # of annotations
-        ps
-                .printf(NUM_COLUMN, indent + "Number of annotations",
-                        num_annotations);
-        for (int a = 0; a < num_annotations; a++) {
-            doAnnotation(in, indent);
-        }
-    }
+	private void doSourceFile(DataInputStream in, String indent) throws IOException {
+		int sourcefile_index = in.readUnsignedShort();
+		ps.printf("%-30s %s(#%d)\n", indent + "Source file", pool[sourcefile_index], sourcefile_index);
+	}
 
-    private void doAnnotation(DataInputStream in, String indent)
-            throws IOException {
-        int type_index = in.readUnsignedShort();
-        ps.printf("%-30s %s(#%d)", indent + "type", pool[type_index],
-                type_index);
-        int num_element_value_pairs = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "num_element_value_pairs",
-                num_element_value_pairs);
-        for (int v = 0; v < num_element_value_pairs; v++) {
-            int element_name_index = in.readUnsignedShort();
-            ps.printf(NUM_COLUMN, indent + "element_name_index",
-                    element_name_index);
-            doElementValue(in, indent);
-        }
-    }
+	private void doAnnotations(DataInputStream in, String indent) throws IOException {
+		int num_annotations = in.readUnsignedShort(); // # of annotations
+		ps.printf(NUM_COLUMN, indent + "Number of annotations", num_annotations);
+		for (int a = 0; a < num_annotations; a++) {
+			doAnnotation(in, indent);
+		}
+	}
 
-    private void doElementValue(DataInputStream in, String indent)
-            throws IOException {
-        int tag = in.readUnsignedByte();
-        switch (tag) {
-        case 'B':
-        case 'C':
-        case 'D':
-        case 'F':
-        case 'I':
-        case 'J':
-        case 'S':
-        case 'Z':
-        case 's':
-            int const_value_index = in.readUnsignedShort();
-            ps.printf("%-30s %c %s(#%d)\n", indent + "element value", tag,
-                    pool[const_value_index], const_value_index);
-            break;
+	private void doAnnotation(DataInputStream in, String indent) throws IOException {
+		int type_index = in.readUnsignedShort();
+		ps.printf("%-30s %s(#%d)", indent + "type", pool[type_index], type_index);
+		int num_element_value_pairs = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "num_element_value_pairs", num_element_value_pairs);
+		for (int v = 0; v < num_element_value_pairs; v++) {
+			int element_name_index = in.readUnsignedShort();
+			ps.printf(NUM_COLUMN, indent + "element_name_index", element_name_index);
+			doElementValue(in, indent);
+		}
+	}
 
-        case 'e':
-            int type_name_index = in.readUnsignedShort();
-            int const_name_index = in.readUnsignedShort();
-            ps.printf("%-30s %c %s(#%d) %s(#%d)\n", indent + "type+const", tag,
-                    pool[type_name_index], type_name_index,
-                    pool[const_name_index], const_name_index);
-            break;
+	private void doElementValue(DataInputStream in, String indent) throws IOException {
+		int tag = in.readUnsignedByte();
+		switch (tag) {
+			case 'B' :
+			case 'C' :
+			case 'D' :
+			case 'F' :
+			case 'I' :
+			case 'J' :
+			case 'S' :
+			case 'Z' :
+			case 's' :
+				int const_value_index = in.readUnsignedShort();
+				ps.printf("%-30s %c %s(#%d)\n", indent + "element value", tag, pool[const_value_index],
+						const_value_index);
+				break;
 
-        case 'c':
-            int class_info_index = in.readUnsignedShort();
-            ps.printf("%-30s %c %s(#%d)\n", indent + "element value", tag,
-                    pool[class_info_index], class_info_index);
-            break;
+			case 'e' :
+				int type_name_index = in.readUnsignedShort();
+				int const_name_index = in.readUnsignedShort();
+				ps.printf("%-30s %c %s(#%d) %s(#%d)\n", indent + "type+const", tag, pool[type_name_index],
+						type_name_index, pool[const_name_index], const_name_index);
+				break;
 
-        case '@':
-            ps.printf("%-30s %c\n", indent + "sub annotation", tag);
-            doAnnotation(in, indent);
-            break;
+			case 'c' :
+				int class_info_index = in.readUnsignedShort();
+				ps.printf("%-30s %c %s(#%d)\n", indent + "element value", tag, pool[class_info_index], class_info_index);
+				break;
 
-        case '[':
-            int num_values = in.readUnsignedShort();
-            ps.printf("%-30s %c num_values=%d\n", indent + "sub element value",
-                    tag, num_values);
-            for (int i = 0; i < num_values; i++) {
-                doElementValue(in, indent);
-            }
-            break;
+			case '@' :
+				ps.printf("%-30s %c\n", indent + "sub annotation", tag);
+				doAnnotation(in, indent);
+				break;
 
-        default:
-            throw new IllegalArgumentException(
-                    "Invalid value for Annotation ElementValue tag " + tag);
-        }
-    }
+			case '[' :
+				int num_values = in.readUnsignedShort();
+				ps.printf("%-30s %c num_values=%d\n", indent + "sub element value", tag, num_values);
+				for (int i = 0; i < num_values; i++) {
+					doElementValue(in, indent);
+				}
+				break;
 
-    /**
-     * <pre>
-     *  LineNumberTable_attribute {
-     * 		u2 attribute_name_index;
-     * 		u4 attribute_length;
-     * 		u2 line_number_table_length;
-     * 		{  u2 start_pc;	     
-     * 		   u2 line_number;	     
-     * 		} line_number_table[line_number_table_length];
-     * 	}
-     * 	
-     * </pre>
-     */
-    void doLineNumberTable(DataInputStream in, String indent)
-            throws IOException {
-        int line_number_table_length = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "line number table length",
-                line_number_table_length);
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < line_number_table_length; i++) {
-            int start_pc = in.readUnsignedShort();
-            int line_number = in.readUnsignedShort();
-            sb.append(start_pc);
-            sb.append("/");
-            sb.append(line_number);
-            sb.append(" ");
-        }
-        ps.printf("%-30s %d: %s\n", indent + "line number table",
-                line_number_table_length, sb);
-    }
+			default :
+				throw new IllegalArgumentException("Invalid value for Annotation ElementValue tag " + tag);
+		}
+	}
 
-    /**
-     * 
-     * <pre>
-     * 	LocalVariableTable_attribute {
-     * 		u2 attribute_name_index;
-     * 		u4 attribute_length;
-     * 		u2 local_variable_table_length;
-     * 		{  u2 start_pc;
-     * 		    u2 length;
-     * 		    u2 name_index;
-     * 		    u2 descriptor_index;
-     * 		    u2 index;
-     * 		} local_variable_table[local_variable_table_length];
-     * 	}	
-     * </pre>
-     */
+	/**
+	 * <pre>
+	 *  LineNumberTable_attribute {
+	 * 		u2 attribute_name_index;
+	 * 		u4 attribute_length;
+	 * 		u2 line_number_table_length;
+	 * 		{  u2 start_pc;	     
+	 * 		   u2 line_number;	     
+	 * 		} line_number_table[line_number_table_length];
+	 * 	}
+	 * 
+	 * </pre>
+	 */
+	void doLineNumberTable(DataInputStream in, String indent) throws IOException {
+		int line_number_table_length = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "line number table length", line_number_table_length);
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < line_number_table_length; i++) {
+			int start_pc = in.readUnsignedShort();
+			int line_number = in.readUnsignedShort();
+			sb.append(start_pc);
+			sb.append("/");
+			sb.append(line_number);
+			sb.append(" ");
+		}
+		ps.printf("%-30s %d: %s\n", indent + "line number table", line_number_table_length, sb);
+	}
 
-    void doLocalVariableTable(DataInputStream in, String indent)
-            throws IOException {
-        int local_variable_table_length = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "local variable table length",
-                local_variable_table_length);
-        for (int i = 0; i < local_variable_table_length; i++) {
-            int start_pc = in.readUnsignedShort();
-            int length = in.readUnsignedShort();
-            int name_index = in.readUnsignedShort();
-            int descriptor_index = in.readUnsignedShort();
-            int index = in.readUnsignedShort();
-            ps.printf("%-30s %d: %d/%d %s(#%d) %s(#%d)\n", indent, index,
-                    start_pc, length, pool[name_index], name_index,
-                    pool[descriptor_index], descriptor_index);
-        }
-    }
+	/**
+	 * <pre>
+	 * 	LocalVariableTable_attribute {
+	 * 		u2 attribute_name_index;
+	 * 		u4 attribute_length;
+	 * 		u2 local_variable_table_length;
+	 * 		{  u2 start_pc;
+	 * 		    u2 length;
+	 * 		    u2 name_index;
+	 * 		    u2 descriptor_index;
+	 * 		    u2 index;
+	 * 		} local_variable_table[local_variable_table_length];
+	 * 	}
+	 * </pre>
+	 */
 
-    /**
-     * <pre>
-     *    InnerClasses_attribute {
-     * 		u2 attribute_name_index;
-     * 		u4 attribute_length;
-     * 		u2 number_of_classes;
-     * 		{  u2 inner_class_info_index;	     
-     * 		   u2 outer_class_info_index;	     
-     * 		   u2 inner_name_index;	     
-     * 		   u2 inner_class_access_flags;	     
-     * 		} classes[number_of_classes];
-     * 	}
-     * </pre>
-     * 
-     */
-    void doInnerClasses(DataInputStream in, String indent) throws IOException {
-        int number_of_classes = in.readUnsignedShort();
-        ps.printf(NUM_COLUMN, indent + "number of classes", number_of_classes);
-        for (int i = 0; i < number_of_classes; i++) {
-            int inner_class_info_index = in.readUnsignedShort();
-            int outer_class_info_index = in.readUnsignedShort();
-            int inner_name_index = in.readUnsignedShort();
-            int inner_class_access_flags = in.readUnsignedShort();
-            printAccess(inner_class_access_flags);
+	void doLocalVariableTable(DataInputStream in, String indent) throws IOException {
+		int local_variable_table_length = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "local variable table length", local_variable_table_length);
+		for (int i = 0; i < local_variable_table_length; i++) {
+			int start_pc = in.readUnsignedShort();
+			int length = in.readUnsignedShort();
+			int name_index = in.readUnsignedShort();
+			int descriptor_index = in.readUnsignedShort();
+			int index = in.readUnsignedShort();
+			ps.printf("%-30s %d: %d/%d %s(#%d) %s(#%d)\n", indent, index, start_pc, length, pool[name_index],
+					name_index, pool[descriptor_index], descriptor_index);
+		}
+	}
 
-            String iname = "<>";
-            String oname = iname;
+	/**
+	 * <pre>
+	 *    InnerClasses_attribute {
+	 * 		u2 attribute_name_index;
+	 * 		u4 attribute_length;
+	 * 		u2 number_of_classes;
+	 * 		{  u2 inner_class_info_index;	     
+	 * 		   u2 outer_class_info_index;	     
+	 * 		   u2 inner_name_index;	     
+	 * 		   u2 inner_class_access_flags;	     
+	 * 		} classes[number_of_classes];
+	 * 	}
+	 * </pre>
+	 */
+	void doInnerClasses(DataInputStream in, String indent) throws IOException {
+		int number_of_classes = in.readUnsignedShort();
+		ps.printf(NUM_COLUMN, indent + "number of classes", number_of_classes);
+		for (int i = 0; i < number_of_classes; i++) {
+			int inner_class_info_index = in.readUnsignedShort();
+			int outer_class_info_index = in.readUnsignedShort();
+			int inner_name_index = in.readUnsignedShort();
+			int inner_class_access_flags = in.readUnsignedShort();
+			printAccess(inner_class_access_flags);
 
-            if (inner_class_info_index != 0)
-                iname = (String) pool[((Integer) pool[inner_class_info_index])
-                        .intValue()];
-            if (outer_class_info_index != 0)
-                oname = (String) pool[((Integer) pool[outer_class_info_index])
-                        .intValue()];
+			String iname = "<>";
+			String oname = iname;
 
-            ps.printf("%-30s %d: %x %s(#%d/c) %s(#%d/c) %s(#%d) \n", indent, i,
-                    inner_class_access_flags, iname, inner_class_info_index,
-                    oname, outer_class_info_index, pool[inner_name_index],
-                    inner_name_index);
-        }
-    }
+			if (inner_class_info_index != 0)
+				iname = (String) pool[((Integer) pool[inner_class_info_index]).intValue()];
+			if (outer_class_info_index != 0)
+				oname = (String) pool[((Integer) pool[outer_class_info_index]).intValue()];
 
+			ps.printf("%-30s %d: %x %s(#%d/c) %s(#%d/c) %s(#%d) \n", indent, i, inner_class_access_flags, iname,
+					inner_class_info_index, oname, outer_class_info_index, pool[inner_name_index], inner_name_index);
+		}
+	}
 
-    void printClassAccess(int mod) {
-        ps.printf("%-30s", "Class Access");
-        if ((ACC_PUBLIC&mod)!= 0)
-            ps.print(" public");
-        if ((ACC_FINAL&mod)!= 0)
-            ps.print(" final");
-        if ((ACC_SUPER&mod)!= 0)
-            ps.print(" super");
-        if ((ACC_INTERFACE&mod)!= 0)
-            ps.print(" interface");
-        if ((ACC_ABSTRACT&mod)!= 0)
-            ps.print(" abstract");
+	void printClassAccess(int mod) {
+		ps.printf("%-30s", "Class Access");
+		if ((ACC_PUBLIC & mod) != 0)
+			ps.print(" public");
+		if ((ACC_FINAL & mod) != 0)
+			ps.print(" final");
+		if ((ACC_SUPER & mod) != 0)
+			ps.print(" super");
+		if ((ACC_INTERFACE & mod) != 0)
+			ps.print(" interface");
+		if ((ACC_ABSTRACT & mod) != 0)
+			ps.print(" abstract");
 
-        ps.println();
-    }
+		ps.println();
+	}
 
-    void printAccess(int mod) {
-        ps.printf("%-30s", "Access");
-        if (Modifier.isStatic(mod))
-            ps.print(" static");
-        if (Modifier.isAbstract(mod))
-            ps.print(" abstract");
-        if (Modifier.isPublic(mod))
-            ps.print(" public");
-        if (Modifier.isFinal(mod))
-            ps.print(" final");
-        if (Modifier.isInterface(mod))
-            ps.print(" interface");
-        if (Modifier.isNative(mod))
-            ps.print(" native");
-        if (Modifier.isPrivate(mod))
-            ps.print(" private");
-        if (Modifier.isProtected(mod))
-            ps.print(" protected");
-        if (Modifier.isStrict(mod))
-            ps.print(" strict");
-        if (Modifier.isSynchronized(mod))
-            ps.print(" synchronized");
-        if (Modifier.isTransient(mod))
-            ps.print(" transient");
-        if (Modifier.isVolatile(mod))
-            ps.print(" volatile");
+	void printAccess(int mod) {
+		ps.printf("%-30s", "Access");
+		if (Modifier.isStatic(mod))
+			ps.print(" static");
+		if (Modifier.isAbstract(mod))
+			ps.print(" abstract");
+		if (Modifier.isPublic(mod))
+			ps.print(" public");
+		if (Modifier.isFinal(mod))
+			ps.print(" final");
+		if (Modifier.isInterface(mod))
+			ps.print(" interface");
+		if (Modifier.isNative(mod))
+			ps.print(" native");
+		if (Modifier.isPrivate(mod))
+			ps.print(" private");
+		if (Modifier.isProtected(mod))
+			ps.print(" protected");
+		if (Modifier.isStrict(mod))
+			ps.print(" strict");
+		if (Modifier.isSynchronized(mod))
+			ps.print(" synchronized");
+		if (Modifier.isTransient(mod))
+			ps.print(" transient");
+		if (Modifier.isVolatile(mod))
+			ps.print(" volatile");
 
-        ps.println();
-    }
+		ps.println();
+	}
 
-    public static void main(String args[]) throws Exception {
-        if (args.length == 0) {
-            System.err.println("clsd <class file>+");
-        }
-        for (int i = 0; i < args.length; i++) {
-            File f = new File(args[i]);
-            if (!f.isFile())
-                System.err.println("File does not exist or is directory " + f);
-            else {
-                ClassDumper cd = new ClassDumper(args[i]);
-                cd.dump(null);
-            }
-        }
-    }
+	public static void main(String args[]) throws Exception {
+		if (args.length == 0) {
+			System.err.println("clsd <class file>+");
+		}
+		for (int i = 0; i < args.length; i++) {
+			File f = new File(args[i]);
+			if (!f.isFile())
+				System.err.println("File does not exist or is directory " + f);
+			else {
+				ClassDumper cd = new ClassDumper(args[i]);
+				cd.dump(null);
+			}
+		}
+	}
 
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/classloaders/URLClassLoaderWrapper.java b/bundleplugin/src/main/java/aQute/libg/classloaders/URLClassLoaderWrapper.java
index 10ddca5..c199a92 100644
--- a/bundleplugin/src/main/java/aQute/libg/classloaders/URLClassLoaderWrapper.java
+++ b/bundleplugin/src/main/java/aQute/libg/classloaders/URLClassLoaderWrapper.java
@@ -4,24 +4,25 @@
 import java.net.*;
 
 public class URLClassLoaderWrapper {
-	final URLClassLoader loader;
-	final Method addURL;
-	
+	final URLClassLoader	loader;
+	final Method			addURL;
+
 	public URLClassLoaderWrapper(ClassLoader loader) throws Exception {
 		this.loader = (URLClassLoader) loader;
 		addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
 		addURL.setAccessible(true);
 	}
-	
-	public void addURL(URL url) throws Exception  {
+
+	public void addURL(URL url) throws Exception {
 		try {
-		addURL.invoke(loader, url);
-		} catch( InvocationTargetException ite) {
+			addURL.invoke(loader, url);
+		}
+		catch (InvocationTargetException ite) {
 			throw (Exception) ite.getTargetException();
 		}
 	}
-	
-	public Class<?> loadClass(String name) throws Exception {
+
+	public Class< ? > loadClass(String name) throws Exception {
 		return loader.loadClass(name);
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/clauses/Clauses.java b/bundleplugin/src/main/java/aQute/libg/clauses/Clauses.java
index 12eba4f..5701bab 100755
--- a/bundleplugin/src/main/java/aQute/libg/clauses/Clauses.java
+++ b/bundleplugin/src/main/java/aQute/libg/clauses/Clauses.java
@@ -5,15 +5,14 @@
 import aQute.libg.log.*;
 import aQute.libg.qtokens.*;
 
-public class Clauses extends LinkedHashMap<String,Map<String,String>>{
+public class Clauses extends LinkedHashMap<String,Map<String,String>> {
 	private static final long	serialVersionUID	= 1L;
-	
+
 	/**
 	 * Standard OSGi header parser. This parser can handle the format clauses
 	 * ::= clause ( ',' clause ) + clause ::= name ( ';' name ) (';' key '='
-	 * value )
-	 * 
-	 * This is mapped to a Map { name => Map { attr|directive => value } }
+	 * value ) This is mapped to a Map { name => Map { attr|directive => value }
+	 * }
 	 * 
 	 * @param value
 	 * @return
@@ -36,9 +35,8 @@
 				String adname = qt.nextToken();
 				if ((del = qt.getSeparator()) != '=') {
 					if (hadAttribute)
-						throw new IllegalArgumentException(
-								"Header contains name field after attribute or directive: "
-										+ adname + " from " + value);
+						throw new IllegalArgumentException("Header contains name field after attribute or directive: "
+								+ adname + " from " + value);
 					aliases.add(adname);
 				} else {
 					String advalue = qt.nextToken();
@@ -51,10 +49,8 @@
 				String packageName = i.next();
 				if (result.containsKey(packageName)) {
 					if (logger != null)
-						logger
-								.warning("Duplicate package name in header: "
-										+ packageName
-										+ ". Multiple package names in one clause not supported in Bnd.");
+						logger.warning("Duplicate package name in header: " + packageName
+								+ ". Multiple package names in one clause not supported in Bnd.");
 				} else
 					result.put(packageName, clause);
 			}
diff --git a/bundleplugin/src/main/java/aQute/libg/clauses/Selector.java b/bundleplugin/src/main/java/aQute/libg/clauses/Selector.java
index eaa806c..a2a9699 100755
--- a/bundleplugin/src/main/java/aQute/libg/clauses/Selector.java
+++ b/bundleplugin/src/main/java/aQute/libg/clauses/Selector.java
@@ -65,18 +65,18 @@
 		StringBuilder sb = new StringBuilder();
 		for (int c = 0; c < string.length(); c++) {
 			switch (string.charAt(c)) {
-			case '.':
-				sb.append("\\.");
-				break;
-			case '*':
-				sb.append(".*");
-				break;
-			case '?':
-				sb.append(".?");
-				break;
-			default:
-				sb.append(string.charAt(c));
-				break;
+				case '.' :
+					sb.append("\\.");
+					break;
+				case '*' :
+					sb.append(".*");
+					break;
+				case '?' :
+					sb.append(".?");
+					break;
+				default :
+					sb.append(string.charAt(c));
+					break;
 			}
 		}
 		string = sb.toString();
@@ -101,17 +101,16 @@
 
 	public static List<Selector> getInstructions(Clauses clauses) {
 		List<Selector> result = new ArrayList<Selector>();
-		for (Map.Entry<String, Map<String, String>> entry : clauses.entrySet()) {
+		for (Map.Entry<String,Map<String,String>> entry : clauses.entrySet()) {
 			Selector instruction = getPattern(entry.getKey());
 			result.add(instruction);
 		}
 		return result;
 	}
-	
-	public static <T> List<T> select(Collection<T> domain,
-			List<Selector> instructions) {
+
+	public static <T> List<T> select(Collection<T> domain, List<Selector> instructions) {
 		List<T> result = new ArrayList<T>();
-		Iterator<T> iterator = domain.iterator(); 
+		Iterator<T> iterator = domain.iterator();
 		value: while (iterator.hasNext()) {
 			T value = iterator.next();
 			for (Selector instruction : instructions) {
@@ -124,6 +123,5 @@
 		}
 		return result;
 	}
-	
 
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/command/Command.java b/bundleplugin/src/main/java/aQute/libg/command/Command.java
index 209be52..3feb702 100644
--- a/bundleplugin/src/main/java/aQute/libg/command/Command.java
+++ b/bundleplugin/src/main/java/aQute/libg/command/Command.java
@@ -12,7 +12,7 @@
 	boolean				trace;
 	Reporter			reporter;
 	List<String>		arguments	= new ArrayList<String>();
-	Map<String, String>	variables	= new LinkedHashMap<String, String>();
+	Map<String,String>	variables	= new LinkedHashMap<String,String>();
 	long				timeout		= 0;
 	File				cwd			= new File("").getAbsoluteFile();
 	static Timer		timer		= new Timer(Command.class.getName(), true);
@@ -24,8 +24,7 @@
 		this.fullCommand = fullCommand;
 	}
 
-	public Command() {
-	}
+	public Command() {}
 
 	public int execute(Appendable stdout, Appendable stderr) throws Exception {
 		return execute((InputStream) null, stdout, stderr);
@@ -44,7 +43,7 @@
 		String args[] = arguments.toArray(new String[arguments.size()]);
 		String vars[] = new String[variables.size()];
 		int i = 0;
-		for (Entry<String, String> s : variables.entrySet()) {
+		for (Entry<String,String> s : variables.entrySet()) {
 			vars[i++] = s.getKey() + "=" + s.getValue();
 		}
 
@@ -53,7 +52,6 @@
 		else
 			process = Runtime.getRuntime().exec(fullCommand, vars.length == 0 ? null : vars, cwd);
 
-		
 		// Make sure the command will not linger when we go
 		Runnable r = new Runnable() {
 			public void run() {
@@ -83,12 +81,12 @@
 				cout.start();
 				Collector cerr = new Collector(err, stderr);
 				cerr.start();
-	
+
 				try {
 					int c = in.read();
 					while (c >= 0) {
 						stdin.write(c);
-						if ( c == '\n')
+						if (c == '\n')
 							stdin.flush();
 						c = in.read();
 					}
@@ -98,13 +96,14 @@
 				}
 				catch (Exception e) {
 					// Who cares?
-				} finally {
+				}
+				finally {
 					stdin.close();
 				}
-				
+
 				if (reporter != null)
 					reporter.trace("exited process");
-				
+
 				cerr.join();
 				cout.join();
 				if (reporter != null)
@@ -120,15 +119,15 @@
 				timer.cancel();
 			Runtime.getRuntime().removeShutdownHook(hook);
 		}
-		
+
 		byte exitValue = (byte) process.waitFor();
 		if (reporter != null)
-			reporter.trace("cmd %s executed with result=%d, result: %s/%s, timedout=%s", arguments, exitValue,
-					stdout, stderr, timedout);
+			reporter.trace("cmd %s executed with result=%d, result: %s/%s, timedout=%s", arguments, exitValue, stdout,
+					stderr, timedout);
 
 		if (timedout)
 			return Integer.MIN_VALUE;
-		
+
 		return exitValue;
 	}
 
@@ -182,7 +181,7 @@
 					c = in.read();
 				}
 			}
-			catch( IOException e) {
+			catch (IOException e) {
 				// We assume the socket is closed
 			}
 			catch (Exception e) {
@@ -191,8 +190,7 @@
 					sb.append(e.toString());
 					sb.append("\n**************************************\n");
 				}
-				catch (IOException e1) {
-				}
+				catch (IOException e1) {}
 				if (reporter != null) {
 					reporter.trace("cmd exec: %s", e);
 				}
@@ -217,7 +215,7 @@
 
 	public void inherit() {
 		ProcessBuilder pb = new ProcessBuilder();
-		for (Entry<String, String> e : pb.environment().entrySet()) {
+		for (Entry<String,String> e : pb.environment().entrySet()) {
 			var(e.getKey(), e.getValue());
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Crypto.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Crypto.java
index ff971e8..22eac45 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Crypto.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Crypto.java
@@ -7,61 +7,57 @@
 import java.util.regex.*;
 
 public class Crypto {
-	static final Pattern	RSA_PRIVATE	= Pattern
-												.compile("\\s*RSA\\.Private\\((\\p{XDigit})+:(\\p{XDigit})+\\)\\s*");
-	static final Pattern	RSA_PUBLIC	= Pattern
-												.compile("\\s*RSA\\.Public\\((\\p{XDigit})+:(\\p{XDigit})+\\)\\s*");
+	static final Pattern	RSA_PRIVATE	= Pattern.compile("\\s*RSA\\.Private\\((\\p{XDigit})+:(\\p{XDigit})+\\)\\s*");
+	static final Pattern	RSA_PUBLIC	= Pattern.compile("\\s*RSA\\.Public\\((\\p{XDigit})+:(\\p{XDigit})+\\)\\s*");
 
 	/**
-	 * 
 	 * @param <T>
 	 * @param spec
 	 * @return
 	 * @throws Exception
 	 */
-	@SuppressWarnings("unchecked") public static <T> T fromString(String spec, Class<T> c) throws Exception {
-		if ( PrivateKey.class.isAssignableFrom(c)) {
-			Matcher m = RSA_PRIVATE.matcher(spec); 
-			if ( m.matches()) {
-				return (T) RSA.createPrivate(  
-						new BigInteger(m.group(1)), new BigInteger(m.group(2)));
+	@SuppressWarnings("unchecked")
+	public static <T> T fromString(String spec, Class<T> c) throws Exception {
+		if (PrivateKey.class.isAssignableFrom(c)) {
+			Matcher m = RSA_PRIVATE.matcher(spec);
+			if (m.matches()) {
+				return (T) RSA.createPrivate(new BigInteger(m.group(1)), new BigInteger(m.group(2)));
 			}
-			throw new IllegalArgumentException("No such private key " + spec );
+			throw new IllegalArgumentException("No such private key " + spec);
 		}
-		
-		if ( PublicKey.class.isAssignableFrom(c)) {
-			Matcher m = RSA_PUBLIC.matcher(spec); 
-			if ( m.matches()) {
-				return (T) RSA.create( new RSAPublicKeySpec( 
-						new BigInteger(m.group(1)), new BigInteger(m.group(2))));
+
+		if (PublicKey.class.isAssignableFrom(c)) {
+			Matcher m = RSA_PUBLIC.matcher(spec);
+			if (m.matches()) {
+				return (T) RSA.create(new RSAPublicKeySpec(new BigInteger(m.group(1)), new BigInteger(m.group(2))));
 			}
-			throw new IllegalArgumentException("No such public key " + spec );			
+			throw new IllegalArgumentException("No such public key " + spec);
 		}
 		return null;
 	}
 
-	public static String toString( Object key ) {
-		if ( key instanceof RSAPrivateKey ) {
+	public static String toString(Object key) {
+		if (key instanceof RSAPrivateKey) {
 			RSAPrivateKey pk = (RSAPrivateKey) key;
 			return "RSA.Private(" + pk.getModulus() + ":" + pk.getPrivateExponent() + ")";
 		}
-		if ( key instanceof RSAPublicKey ) {
+		if (key instanceof RSAPublicKey) {
 			RSAPublicKey pk = (RSAPublicKey) key;
 			return "RSA.Private(" + pk.getModulus() + ":" + pk.getPublicExponent() + ")";
 		}
 		return null;
 	}
 
-
-//	public static <T extends Digest> Signer<T> signer(PrivateKey key, Digester<T> digester) throws NoSuchAlgorithmException {
-//		Signature s = Signature.getInstance(key.getAlgorithm() + "with" + digester.getAlgorithm());
-//		return new Signer<T>(s,digester);
-//	}
+	// public static <T extends Digest> Signer<T> signer(PrivateKey key,
+	// Digester<T> digester) throws NoSuchAlgorithmException {
+	// Signature s = Signature.getInstance(key.getAlgorithm() + "with" +
+	// digester.getAlgorithm());
+	// return new Signer<T>(s,digester);
+	// }
 
 	public static Verifier verifier(PublicKey key, Digest digest) throws NoSuchAlgorithmException {
 		Signature s = Signature.getInstance(key.getAlgorithm() + "with" + digest.getAlgorithm());
-		return new Verifier(s,digest);
+		return new Verifier(s, digest);
 	}
 
-	
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
index 90e7b1a..93d48ad 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Digest.java
@@ -10,30 +10,28 @@
 	protected Digest(byte[] checksum, int width) {
 		this.digest = checksum;
 		if (digest.length != width)
-			throw new IllegalArgumentException("Invalid width for digest: " + digest.length
-					+ " expected " + width);
+			throw new IllegalArgumentException("Invalid width for digest: " + digest.length + " expected " + width);
 	}
 
-
 	public byte[] digest() {
 		return digest;
 	}
 
-	@Override public String toString() {
+	@Override
+	public String toString() {
 		return String.format("%s(d=%s)", getAlgorithm(), Hex.toHexString(digest));
 	}
 
 	public abstract String getAlgorithm();
-	
-	
+
 	public boolean equals(Object other) {
-		if ( !(other instanceof Digest))
+		if (!(other instanceof Digest))
 			return false;
 
 		Digest d = (Digest) other;
 		return Arrays.equals(d.digest, digest);
 	}
-	
+
 	public int hashCode() {
 		return Arrays.hashCode(digest);
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Digester.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Digester.java
index eeb2c8f..2785c3d 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Digester.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Digester.java
@@ -7,41 +7,45 @@
 
 public abstract class Digester<T extends Digest> extends OutputStream {
 	protected MessageDigest	md;
-	OutputStream out[];
-	
-	public Digester(MessageDigest instance, OutputStream ... out) {
+	OutputStream			out[];
+
+	public Digester(MessageDigest instance, OutputStream... out) {
 		md = instance;
 		this.out = out;
 	}
-	
+
 	@Override
-	public void write( byte[] buffer, int offset, int length) throws IOException{
-		md.update(buffer,offset,length);
-		for ( OutputStream o : out ) {
+	public void write(byte[] buffer, int offset, int length) throws IOException {
+		md.update(buffer, offset, length);
+		for (OutputStream o : out) {
 			o.write(buffer, offset, length);
 		}
 	}
+
 	@Override
-	public void write( int b) throws IOException{
+	public void write(int b) throws IOException {
 		md.update((byte) b);
-		for ( OutputStream o : out ) {
+		for (OutputStream o : out) {
 			o.write(b);
 		}
 	}
-	
+
 	public MessageDigest getMessageDigest() throws Exception {
 		return md;
 	}
-	
+
 	public T from(InputStream in) throws Exception {
-		IO.copy(in,this);
+		IO.copy(in, this);
 		return digest();
 	}
-		
-	public void setOutputs(OutputStream ...out) {
+
+	public void setOutputs(OutputStream... out) {
 		this.out = out;
 	}
+
 	public abstract T digest() throws Exception;
-	public abstract T digest( byte [] bytes) throws Exception;
+
+	public abstract T digest(byte[] bytes) throws Exception;
+
 	public abstract String getAlgorithm();
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Key.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Key.java
index 160ec05..f4fc217 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Key.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Key.java
@@ -1,8 +1,6 @@
 package aQute.libg.cryptography;
 
-
 public abstract class Key implements java.security.Key {
 	private static final long	serialVersionUID	= 1L;
 
-
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java b/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
index 84b53ee..05a6bdd 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/MD5.java
@@ -3,32 +3,36 @@
 import java.io.*;
 import java.security.*;
 
-
-
 public class MD5 extends Digest {
-	public final static String ALGORITHM = "MD5";
-	
-	public static Digester<MD5> getDigester(OutputStream ... out) throws Exception {
+	public final static String	ALGORITHM	= "MD5";
+
+	public static Digester<MD5> getDigester(OutputStream... out) throws Exception {
 		return new Digester<MD5>(MessageDigest.getInstance(ALGORITHM), out) {
-			
-			@Override public MD5 digest() throws Exception {
+
+			@Override
+			public MD5 digest() throws Exception {
 				return new MD5(md.digest());
 			}
 
-			@Override public MD5 digest(byte[] bytes) {
+			@Override
+			public MD5 digest(byte[] bytes) {
 				return new MD5(bytes);
 			}
-			@Override public String getAlgorithm() {
+
+			@Override
+			public String getAlgorithm() {
 				return ALGORITHM;
 			}
 		};
 	}
-	
-	
+
 	public MD5(byte[] digest) {
-		super(digest,16);
+		super(digest, 16);
 	}
 
-	@Override public String getAlgorithm() { return ALGORITHM; }
+	@Override
+	public String getAlgorithm() {
+		return ALGORITHM;
+	}
 
 }
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/RSA.java b/bundleplugin/src/main/java/aQute/libg/cryptography/RSA.java
index 61bafb5..c1aa2ee 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/RSA.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/RSA.java
@@ -15,7 +15,8 @@
 	static private KeyFactory getKeyFactory() {
 		try {
 			return KeyFactory.getInstance(ALGORITHM);
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// built in
 		}
 		return null;
@@ -24,20 +25,23 @@
 	public static RSAPrivateKey create(RSAPrivateKeySpec keyspec) throws InvalidKeySpecException {
 		return (RSAPrivateKey) factory.generatePrivate(keyspec);
 	}
+
 	public static RSAPublicKey create(RSAPublicKeySpec keyspec) throws InvalidKeySpecException {
 		return (RSAPublicKey) factory.generatePrivate(keyspec);
 	}
-	
+
 	public static RSAPublicKey createPublic(BigInteger m, BigInteger e) throws InvalidKeySpecException {
-		return create( new RSAPublicKeySpec(m,e));
+		return create(new RSAPublicKeySpec(m, e));
 	}
+
 	public static RSAPrivateKey createPrivate(BigInteger m, BigInteger e) throws InvalidKeySpecException {
-		return create( new RSAPrivateKeySpec(m,e));
+		return create(new RSAPrivateKeySpec(m, e));
 	}
-	
-	public static Pair<RSAPrivateKey, RSAPublicKey> generate() throws NoSuchAlgorithmException {
+
+	public static Pair<RSAPrivateKey,RSAPublicKey> generate() throws NoSuchAlgorithmException {
 		KeyPairGenerator kpg = KeyPairGenerator.getInstance(ALGORITHM);
 		KeyPair keypair = kpg.generateKeyPair();
-		return new Pair<RSAPrivateKey,RSAPublicKey>( (RSAPrivateKey) keypair.getPrivate(), (RSAPublicKey) keypair.getPublic());
+		return new Pair<RSAPrivateKey,RSAPublicKey>((RSAPrivateKey) keypair.getPrivate(),
+				(RSAPublicKey) keypair.getPublic());
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
index a01f112..d0a486c 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA1.java
@@ -3,33 +3,36 @@
 import java.io.*;
 import java.security.*;
 
-
-
 public class SHA1 extends Digest {
-	public final static String ALGORITHM = "SHA1";
-	
-	
-	public static Digester<SHA1> getDigester(OutputStream ... out  ) throws NoSuchAlgorithmException {
+	public final static String	ALGORITHM	= "SHA1";
+
+	public static Digester<SHA1> getDigester(OutputStream... out) throws NoSuchAlgorithmException {
 		MessageDigest md = MessageDigest.getInstance(ALGORITHM);
 		return new Digester<SHA1>(md, out) {
-			@Override public SHA1 digest() throws Exception {
+			@Override
+			public SHA1 digest() throws Exception {
 				return new SHA1(md.digest());
 			}
 
-			@Override public SHA1 digest(byte[] bytes) {
+			@Override
+			public SHA1 digest(byte[] bytes) {
 				return new SHA1(bytes);
 			}
-			@Override public String getAlgorithm() {
+
+			@Override
+			public String getAlgorithm() {
 				return ALGORITHM;
 			}
 		};
 	}
-	
+
 	public SHA1(byte[] b) {
 		super(b, 20);
 	}
 
-
-	@Override public String getAlgorithm() { return ALGORITHM; }
+	@Override
+	public String getAlgorithm() {
+		return ALGORITHM;
+	}
 
 }
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
index 5b25cf3..b6eeacc 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/SHA256.java
@@ -3,33 +3,36 @@
 import java.io.*;
 import java.security.*;
 
-
-
 public class SHA256 extends Digest {
-	public final static String ALGORITHM = "SHA256";
-	
-	
-	public static Digester<SHA256> getDigester(OutputStream ... out  ) throws NoSuchAlgorithmException {
+	public final static String	ALGORITHM	= "SHA256";
+
+	public static Digester<SHA256> getDigester(OutputStream... out) throws NoSuchAlgorithmException {
 		MessageDigest md = MessageDigest.getInstance(ALGORITHM);
 		return new Digester<SHA256>(md, out) {
-			@Override public SHA256 digest() throws Exception {
+			@Override
+			public SHA256 digest() throws Exception {
 				return new SHA256(md.digest());
 			}
 
-			@Override public SHA256 digest(byte[] bytes) {
+			@Override
+			public SHA256 digest(byte[] bytes) {
 				return new SHA256(bytes);
 			}
-			@Override public String getAlgorithm() {
+
+			@Override
+			public String getAlgorithm() {
 				return ALGORITHM;
 			}
 		};
 	}
-	
+
 	public SHA256(byte[] b) {
 		super(b, 32);
 	}
 
-
-	@Override public String getAlgorithm() { return ALGORITHM; }
+	@Override
+	public String getAlgorithm() {
+		return ALGORITHM;
+	}
 
 }
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Signer.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Signer.java
index 5218e2d..977eda6 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Signer.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Signer.java
@@ -5,36 +5,39 @@
 
 public class Signer<D extends Digest> extends OutputStream {
 	Signature	signature;
-	Digester<D> digester;
-	
+	Digester<D>	digester;
+
 	Signer(Signature s, Digester<D> digester) {
 		this.signature = s;
-		this.digester  = digester;
+		this.digester = digester;
 	}
 
-	@Override public void write(byte[] buffer, int offset, int length) throws IOException {
+	@Override
+	public void write(byte[] buffer, int offset, int length) throws IOException {
 		try {
 			signature.update(buffer, offset, length);
 			digester.write(buffer, offset, length);
-		} catch (SignatureException e) {
+		}
+		catch (SignatureException e) {
 			throw new IOException(e.getLocalizedMessage());
 		}
 	}
 
-	@Override public void write(int b) throws IOException {
+	@Override
+	public void write(int b) throws IOException {
 		try {
 			signature.update((byte) b);
 			digester.write(b);
-		} catch (SignatureException e) {
+		}
+		catch (SignatureException e) {
 			throw new IOException(e.getLocalizedMessage());
 		}
 	}
-	
 
 	public Signature signature() throws Exception {
 		return signature;
 	}
-	
+
 	public D digest() throws Exception {
 		return digester.digest();
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/cryptography/Verifier.java b/bundleplugin/src/main/java/aQute/libg/cryptography/Verifier.java
index 5506ece..1005e0a 100644
--- a/bundleplugin/src/main/java/aQute/libg/cryptography/Verifier.java
+++ b/bundleplugin/src/main/java/aQute/libg/cryptography/Verifier.java
@@ -3,30 +3,31 @@
 import java.io.*;
 import java.security.*;
 
-
 public class Verifier extends OutputStream {
-	final Signature signature;
-	final Digest d;
-	
+	final Signature	signature;
+	final Digest	d;
+
 	Verifier(Signature s, Digest d) {
 		this.signature = s;
 		this.d = d;
 	}
-	
+
 	@Override
-	public void write( byte[] buffer, int offset, int length) throws IOException {
+	public void write(byte[] buffer, int offset, int length) throws IOException {
 		try {
 			signature.update(buffer, offset, length);
-		} catch (SignatureException e) {
+		}
+		catch (SignatureException e) {
 			throw new IOException(e.getLocalizedMessage());
 		}
 	}
 
 	@Override
-	public void write( int b) throws IOException {
+	public void write(int b) throws IOException {
 		try {
 			signature.update((byte) b);
-		} catch (SignatureException e) {
+		}
+		catch (SignatureException e) {
 			throw new IOException(e.getLocalizedMessage());
 		}
 	}
@@ -34,5 +35,5 @@
 	public boolean verify() throws Exception {
 		return signature.verify(d.digest());
 	}
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/fileiterator/FileIterator.java b/bundleplugin/src/main/java/aQute/libg/fileiterator/FileIterator.java
index 7cd73a2..2c988e6 100644
--- a/bundleplugin/src/main/java/aQute/libg/fileiterator/FileIterator.java
+++ b/bundleplugin/src/main/java/aQute/libg/fileiterator/FileIterator.java
@@ -4,40 +4,39 @@
 import java.util.*;
 
 public class FileIterator implements Iterator<File> {
-    File         dir;
-    int          n = 0;
-    FileIterator next;
+	File			dir;
+	int				n	= 0;
+	FileIterator	next;
 
-    public FileIterator(File nxt) {
-        assert nxt.isDirectory();
-        this.dir = nxt;
-    }
+	public FileIterator(File nxt) {
+		assert nxt.isDirectory();
+		this.dir = nxt;
+	}
 
-    public boolean hasNext() {
-        if (next != null)
-            return next.hasNext();
+	public boolean hasNext() {
+		if (next != null)
+			return next.hasNext();
 		return n < dir.list().length;
-    }
+	}
 
-    public File next() {
-        if (next != null) {
-            File answer = next.next();
-            if (!next.hasNext())
-                next = null;
-            return answer;
-        }
+	public File next() {
+		if (next != null) {
+			File answer = next.next();
+			if (!next.hasNext())
+				next = null;
+			return answer;
+		}
 		File nxt = dir.listFiles()[n++];
 		if (nxt.isDirectory()) {
-		    next = new FileIterator(nxt);
-		    return nxt;
+			next = new FileIterator(nxt);
+			return nxt;
 		} else if (nxt.isFile()) {
-		    return nxt;
+			return nxt;
 		} else
-		    throw new IllegalStateException("File disappeared");
-    }
+			throw new IllegalStateException("File disappeared");
+	}
 
-    public void remove() {
-        throw new UnsupportedOperationException(
-                "Cannot remove from a file iterator");
-    }
+	public void remove() {
+		throw new UnsupportedOperationException("Cannot remove from a file iterator");
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/filelock/DirectoryLock.java b/bundleplugin/src/main/java/aQute/libg/filelock/DirectoryLock.java
index 6e6b11e..9f82899 100644
--- a/bundleplugin/src/main/java/aQute/libg/filelock/DirectoryLock.java
+++ b/bundleplugin/src/main/java/aQute/libg/filelock/DirectoryLock.java
@@ -3,9 +3,9 @@
 import java.io.*;
 
 public class DirectoryLock {
-	final File						lock;
-	final long						timeout;
-	final public static String LOCKNAME = ".lock";
+	final File					lock;
+	final long					timeout;
+	final public static String	LOCKNAME	= ".lock";
 
 	public DirectoryLock(File directory, long timeout) {
 		this.lock = new File(directory, LOCKNAME);
@@ -13,7 +13,6 @@
 		this.timeout = timeout;
 	}
 
-	
 	public void release() {
 		lock.delete();
 	}
@@ -22,10 +21,10 @@
 		if (lock.mkdir())
 			return;
 
-		long deadline = System.currentTimeMillis()+ timeout;
-		while ( System.currentTimeMillis() < deadline) {
+		long deadline = System.currentTimeMillis() + timeout;
+		while (System.currentTimeMillis() < deadline) {
 			if (lock.mkdir())
-				return;	
+				return;
 			Thread.sleep(50);
 		}
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java b/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java
index a0149bc..e278a74 100644
--- a/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java
+++ b/bundleplugin/src/main/java/aQute/libg/filerepo/FileRepo.java
@@ -39,9 +39,9 @@
 				Matcher m = REPO_FILE.matcher(name);
 				if (!m.matches())
 					return false;
-				if ( versionRange == null)
+				if (versionRange == null)
 					return true;
-				
+
 				Version v = new Version(m.group(2));
 				return versionRange.includes(v);
 			}
@@ -97,10 +97,11 @@
 	}
 
 	public File put(String bsn, Version version) {
-		File dir = new File(root,bsn);
+		File dir = new File(root, bsn);
 		dir.mkdirs();
-		File file = new File(dir, bsn + "-" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro() + ".jar");
+		File file = new File(dir, bsn + "-" + version.getMajor() + "." + version.getMinor() + "." + version.getMicro()
+				+ ".jar");
 		return file;
 	}
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/forker/Forker.java b/bundleplugin/src/main/java/aQute/libg/forker/Forker.java
index 2559fad..3929ca4 100644
--- a/bundleplugin/src/main/java/aQute/libg/forker/Forker.java
+++ b/bundleplugin/src/main/java/aQute/libg/forker/Forker.java
@@ -12,12 +12,11 @@
  * have ran their associated runnable.
  * 
  * @author aqute
- * 
  * @param <T>
  */
 public class Forker<T> {
 	final Executor		executor;
-	final Map<T, Job>	waiting		= new HashMap<T, Job>();
+	final Map<T,Job>	waiting		= new HashMap<T,Job>();
 	final Set<Job>		executing	= new HashSet<Job>();
 	final AtomicBoolean	canceled	= new AtomicBoolean();
 	private int			count;
@@ -48,10 +47,12 @@
 					t = Thread.currentThread();
 				}
 				runnable.run();
-			} catch (Exception e) {
+			}
+			catch (Exception e) {
 				exception = e;
 				e.printStackTrace();
-			} finally {
+			}
+			finally {
 				synchronized (this) {
 					t = null;
 				}
@@ -84,7 +85,6 @@
 
 	/**
 	 * Constructor
-	 * 
 	 */
 	public Forker() {
 		this.executor = Executors.newFixedThreadPool(4);
@@ -101,8 +101,7 @@
 	 * @param runnable
 	 *            the runnable to run
 	 */
-	public synchronized void doWhen(Collection<? extends T> dependencies, T target,
-			Runnable runnable) {
+	public synchronized void doWhen(Collection< ? extends T> dependencies, T target, Runnable runnable) {
 		if (waiting.containsKey(target))
 			throw new IllegalArgumentException("You can only add a target once to the forker");
 
@@ -130,8 +129,7 @@
 		dependencies.removeAll(waiting.keySet());
 		if (dependencies.size() > 0)
 			throw new IllegalArgumentException(
-					"There are dependencies in the jobs that are not present in the targets: "
-							+ dependencies);
+					"There are dependencies in the jobs that are not present in the targets: " + dependencies);
 
 	}
 
@@ -181,8 +179,9 @@
 
 			for (Job job : waiting.values()) {
 				// boolean x =
-					job.dependencies.remove(done.target);
-				//System.err.println( "Removing " + done.target + " from " + job.target + " ?" + x  + " " + job.dependencies.size());
+				job.dependencies.remove(done.target);
+				// System.err.println( "Removing " + done.target + " from " +
+				// job.target + " ?" + x + " " + job.dependencies.size());
 			}
 		}
 		schedule();
diff --git a/bundleplugin/src/main/java/aQute/libg/generics/Create.java b/bundleplugin/src/main/java/aQute/libg/generics/Create.java
index ee708fd..3e071b3 100644
--- a/bundleplugin/src/main/java/aQute/libg/generics/Create.java
+++ b/bundleplugin/src/main/java/aQute/libg/generics/Create.java
@@ -3,52 +3,51 @@
 import java.util.*;
 
 public class Create {
-    
-    public static <K,V>  Map<K, V> map() {
-        return new LinkedHashMap<K,V>();
-    }
 
-    public static <K,V>  Map<K, V> map(Class<K> key, Class<V> value) {
-        return Collections.checkedMap(new LinkedHashMap<K,V>(), key,value);
-    }
+	public static <K, V> Map<K,V> map() {
+		return new LinkedHashMap<K,V>();
+	}
 
-    public static <T>  List<T> list() {
-        return new ArrayList<T>();
-    }
+	public static <K, V> Map<K,V> map(Class<K> key, Class<V> value) {
+		return Collections.checkedMap(new LinkedHashMap<K,V>(), key, value);
+	}
 
-    public static <T>  List<T> list(Class<T> c) {
-        return Collections.checkedList(new ArrayList<T>(),c) ;
-    }
+	public static <T> List<T> list() {
+		return new ArrayList<T>();
+	}
 
-    public static <T>  Set<T> set() {
-        return new HashSet<T>();
-    }
+	public static <T> List<T> list(Class<T> c) {
+		return Collections.checkedList(new ArrayList<T>(), c);
+	}
 
-    public static <T>  Set<T> set(Class<T> c) {
-        return Collections.checkedSet(new HashSet<T>(),c);
-    }
+	public static <T> Set<T> set() {
+		return new HashSet<T>();
+	}
 
-    public static <T>  List<T> list(T[] source) {
-        return new ArrayList<T>(Arrays.asList(source));
-    }
+	public static <T> Set<T> set(Class<T> c) {
+		return Collections.checkedSet(new HashSet<T>(), c);
+	}
 
-    public static <T>  Set<T> set(T[]source) {
-        return new HashSet<T>(Arrays.asList(source));
-    }
+	public static <T> List<T> list(T[] source) {
+		return new ArrayList<T>(Arrays.asList(source));
+	}
 
-    public static <K,V>  Map<K, V> copy(Map<K,V> source) {
-        return new LinkedHashMap<K,V>(source);
-    }
+	public static <T> Set<T> set(T[] source) {
+		return new HashSet<T>(Arrays.asList(source));
+	}
 
-    public static <T>  List<T> copy(List<T> source) {
-        return new ArrayList<T>(source);
-    }
+	public static <K, V> Map<K,V> copy(Map<K,V> source) {
+		return new LinkedHashMap<K,V>(source);
+	}
 
-    public static <T>  Set<T> copy(Collection<T> source) {
-        if ( source == null )
-            return set();
-        return new HashSet<T>(source);
-    }
+	public static <T> List<T> copy(List<T> source) {
+		return new ArrayList<T>(source);
+	}
 
-    
+	public static <T> Set<T> copy(Collection<T> source) {
+		if (source == null)
+			return set();
+		return new HashSet<T>(source);
+	}
+
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/glob/Glob.java b/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
index c4d06a7..b48c147 100644
--- a/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
+++ b/bundleplugin/src/main/java/aQute/libg/glob/Glob.java
@@ -1,22 +1,21 @@
 package aQute.libg.glob;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.regex.*;
 
 public class Glob {
 
-	private final String glob;
-	private final Pattern pattern;
-	
+	private final String	glob;
+	private final Pattern	pattern;
+
 	public Glob(String globString) {
 		this.glob = globString;
 		this.pattern = Pattern.compile(convertGlobToRegEx(globString));
 	}
-	
+
 	public Matcher matcher(CharSequence input) {
 		return pattern.matcher(input);
 	}
-	
+
 	@Override
 	public String toString() {
 		return glob;
@@ -39,70 +38,70 @@
 		int inCurlies = 0;
 		for (char currentChar : line.toCharArray()) {
 			switch (currentChar) {
-			case '*':
-				if (escaping)
-					sb.append("\\*");
-				else
-					sb.append(".*");
-				escaping = false;
-				break;
-			case '?':
-				if (escaping)
-					sb.append("\\?");
-				else
-					sb.append('.');
-				escaping = false;
-				break;
-			case '.':
-			case '(':
-			case ')':
-			case '+':
-			case '|':
-			case '^':
-			case '$':
-			case '@':
-			case '%':
-				sb.append('\\');
-				sb.append(currentChar);
-				escaping = false;
-				break;
-			case '\\':
-				if (escaping) {
-					sb.append("\\\\");
+				case '*' :
+					if (escaping)
+						sb.append("\\*");
+					else
+						sb.append(".*");
 					escaping = false;
-				} else
-					escaping = true;
-				break;
-			case '{':
-				if (escaping) {
-					sb.append("\\{");
-				} else {
-					sb.append('(');
-					inCurlies++;
-				}
-				escaping = false;
-				break;
-			case '}':
-				if (inCurlies > 0 && !escaping) {
-					sb.append(')');
-					inCurlies--;
-				} else if (escaping)
-					sb.append("\\}");
-				else
-					sb.append("}");
-				escaping = false;
-				break;
-			case ',':
-				if (inCurlies > 0 && !escaping) {
-					sb.append('|');
-				} else if (escaping)
-					sb.append("\\,");
-				else
-					sb.append(",");
-				break;
-			default:
-				escaping = false;
-				sb.append(currentChar);
+					break;
+				case '?' :
+					if (escaping)
+						sb.append("\\?");
+					else
+						sb.append('.');
+					escaping = false;
+					break;
+				case '.' :
+				case '(' :
+				case ')' :
+				case '+' :
+				case '|' :
+				case '^' :
+				case '$' :
+				case '@' :
+				case '%' :
+					sb.append('\\');
+					sb.append(currentChar);
+					escaping = false;
+					break;
+				case '\\' :
+					if (escaping) {
+						sb.append("\\\\");
+						escaping = false;
+					} else
+						escaping = true;
+					break;
+				case '{' :
+					if (escaping) {
+						sb.append("\\{");
+					} else {
+						sb.append('(');
+						inCurlies++;
+					}
+					escaping = false;
+					break;
+				case '}' :
+					if (inCurlies > 0 && !escaping) {
+						sb.append(')');
+						inCurlies--;
+					} else if (escaping)
+						sb.append("\\}");
+					else
+						sb.append("}");
+					escaping = false;
+					break;
+				case ',' :
+					if (inCurlies > 0 && !escaping) {
+						sb.append('|');
+					} else if (escaping)
+						sb.append("\\,");
+					else
+						sb.append(",");
+					break;
+				default :
+					escaping = false;
+					sb.append(currentChar);
 			}
 		}
 		return sb.toString();
diff --git a/bundleplugin/src/main/java/aQute/libg/gzip/GZipUtils.java b/bundleplugin/src/main/java/aQute/libg/gzip/GZipUtils.java
index 6606d0e..81c9785 100644
--- a/bundleplugin/src/main/java/aQute/libg/gzip/GZipUtils.java
+++ b/bundleplugin/src/main/java/aQute/libg/gzip/GZipUtils.java
@@ -1,13 +1,10 @@
 package aQute.libg.gzip;
 
-import java.io.BufferedInputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.GZIPInputStream;
+import java.io.*;
+import java.util.zip.*;
 
 public class GZipUtils {
-	
+
 	/**
 	 * Determines whether the specified stream contains gzipped data, by
 	 * checking for the GZIP magic number, and returns a stream capable of
@@ -21,11 +18,11 @@
 			buffered = stream;
 		else
 			buffered = new BufferedInputStream(stream);
-		
+
 		buffered.mark(2);
 		int magic = readUShort(buffered);
 		buffered.reset();
-		
+
 		InputStream result;
 		if (magic == GZIPInputStream.GZIP_MAGIC)
 			result = new GZIPInputStream(buffered);
@@ -34,27 +31,27 @@
 		return result;
 	}
 
-    /*
-     * Reads unsigned short in Intel byte order.
-     */
+	/*
+	 * Reads unsigned short in Intel byte order.
+	 */
 	private static int readUShort(InputStream in) throws IOException {
 		int b = readUByte(in);
 		return (readUByte(in) << 8) | b;
 	}
-    
-    /*
-     * Reads unsigned byte.
-     */
-    private static int readUByte(InputStream in) throws IOException {
-	int b = in.read();
-	if (b == -1) {
-	    throw new EOFException();
+
+	/*
+	 * Reads unsigned byte.
+	 */
+	private static int readUByte(InputStream in) throws IOException {
+		int b = in.read();
+		if (b == -1) {
+			throw new EOFException();
+		}
+		if (b < -1 || b > 255) {
+			// Report on this.in, not argument in; see read{Header, Trailer}.
+			throw new IOException(in.getClass().getName() + ".read() returned value out of range -1..255: " + b);
+		}
+		return b;
 	}
-        if (b < -1 || b > 255) {
-            // Report on this.in, not argument in; see read{Header, Trailer}.
-            throw new IOException(in.getClass().getName() + ".read() returned value out of range -1..255: " + b);
-        }
-	return b;
-    }
 
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/header/Attrs.java b/bundleplugin/src/main/java/aQute/libg/header/Attrs.java
index d11b6d1..8ff65dd 100644
--- a/bundleplugin/src/main/java/aQute/libg/header/Attrs.java
+++ b/bundleplugin/src/main/java/aQute/libg/header/Attrs.java
@@ -6,9 +6,10 @@
 import aQute.lib.collections.*;
 import aQute.libg.version.*;
 
-public class Attrs implements Map<String, String> {
+public class Attrs implements Map<String,String> {
 	public enum Type {
-		STRING(null), LONG(null), VERSION(null), DOUBLE(null), STRINGS(STRING), LONGS(LONG), VERSIONS(VERSION), DOUBLES(DOUBLE);
+		STRING(null), LONG(null), VERSION(null), DOUBLE(null), STRINGS(STRING), LONGS(LONG), VERSIONS(VERSION), DOUBLES(
+				DOUBLE);
 
 		Type	sub;
 
@@ -33,14 +34,15 @@
 	 * ’List<’ scalar ’>’
 	 * </pre>
 	 */
-	static String					EXTENDED	= "[\\-0-9a-zA-Z\\._]+";
-	static String					SCALAR		= "String|Version|Long|Double";
-	static String					LIST		= "List\\s*<\\s*(" + SCALAR + ")\\s*>";
-	public static final Pattern		TYPED		= Pattern.compile("\\s*(" + EXTENDED + ")\\s*:\\s*("+ SCALAR + "|" + LIST + ")\\s*");
+	static String							EXTENDED	= "[\\-0-9a-zA-Z\\._]+";
+	static String							SCALAR		= "String|Version|Long|Double";
+	static String							LIST		= "List\\s*<\\s*(" + SCALAR + ")\\s*>";
+	public static final Pattern				TYPED		= Pattern.compile("\\s*(" + EXTENDED + ")\\s*:\\s*(" + SCALAR
+																+ "|" + LIST + ")\\s*");
 
-	private LinkedHashMap<String, String>	map;
-	private Map<String, Type>		types;
-	static Map<String, String>		EMPTY		= Collections.emptyMap();
+	private LinkedHashMap<String,String>	map;
+	private Map<String,Type>				types;
+	static Map<String,String>				EMPTY		= Collections.emptyMap();
 
 	public Attrs(Attrs... attrs) {
 		for (Attrs a : attrs) {
@@ -62,7 +64,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public boolean containsKey(Object name) {
+	@Deprecated
+	public boolean containsKey(Object name) {
 		assert name instanceof String;
 		if (map == null)
 			return false;
@@ -78,7 +81,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public boolean containsValue(Object value) {
+	@Deprecated
+	public boolean containsValue(Object value) {
 		assert value instanceof String;
 		if (map == null)
 			return false;
@@ -86,7 +90,7 @@
 		return map.containsValue((String) value);
 	}
 
-	public Set<java.util.Map.Entry<String, String>> entrySet() {
+	public Set<java.util.Map.Entry<String,String>> entrySet() {
 		if (map == null)
 			return EMPTY.entrySet();
 
@@ -94,7 +98,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public String get(Object key) {
+	@Deprecated
+	public String get(Object key) {
 		assert key instanceof String;
 		if (map == null)
 			return null;
@@ -129,7 +134,7 @@
 
 	public String put(String key, String value) {
 		if (map == null)
-			map = new LinkedHashMap<String, String>();
+			map = new LinkedHashMap<String,String>();
 
 		Matcher m = TYPED.matcher(key);
 		if (m.matches()) {
@@ -137,28 +142,28 @@
 			String type = m.group(2);
 			Type t = Type.STRING;
 
-			if ( type.startsWith("List")) {
+			if (type.startsWith("List")) {
 				type = m.group(3);
-				if ( "String".equals(type))
+				if ("String".equals(type))
 					t = Type.STRINGS;
-				else if ( "Long".equals(type))
+				else if ("Long".equals(type))
 					t = Type.LONGS;
-				else if ( "Double".equals(type))
+				else if ("Double".equals(type))
 					t = Type.DOUBLES;
-				else if ( "Version".equals(type))
-					t = Type.VERSIONS;				
+				else if ("Version".equals(type))
+					t = Type.VERSIONS;
 			} else {
-				if ( "String".equals(type))
+				if ("String".equals(type))
 					t = Type.STRING;
-				else if ( "Long".equals(type))
+				else if ("Long".equals(type))
 					t = Type.LONG;
-				else if ( "Double".equals(type))
+				else if ("Double".equals(type))
 					t = Type.DOUBLE;
-				else if ( "Version".equals(type))
+				else if ("Version".equals(type))
 					t = Type.VERSION;
 			}
 			if (types == null)
-				types = new LinkedHashMap<String, Type>();
+				types = new LinkedHashMap<String,Type>();
 			types.put(key, t);
 
 			// TODO verify value?
@@ -176,13 +181,14 @@
 		return t;
 	}
 
-	public void putAll(Map<? extends String, ? extends String> map) {
-		for (Map.Entry<? extends String, ? extends String> e : map.entrySet())
+	public void putAll(Map< ? extends String, ? extends String> map) {
+		for (Map.Entry< ? extends String, ? extends String> e : map.entrySet())
 			put(e.getKey(), e.getValue());
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public String remove(Object var0) {
+	@Deprecated
+	public String remove(Object var0) {
 		assert var0 instanceof String;
 		if (map == null)
 			return null;
@@ -221,7 +227,7 @@
 
 	public void append(StringBuilder sb) {
 		String del = "";
-		for (Map.Entry<String, String> e : entrySet()) {
+		for (Map.Entry<String,String> e : entrySet()) {
 			sb.append(del);
 			sb.append(e.getKey());
 			sb.append("=");
@@ -230,11 +236,13 @@
 		}
 	}
 
-	@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();
 	}
 
@@ -275,12 +283,12 @@
 	private Object convert(Type t, String s) {
 		if (t.sub == null) {
 			switch (t) {
-			case STRING:
-				return s;
-			case LONG:
-				return Long.parseLong(s.trim());
-			case VERSION:
-				return Version.parseVersion(s);
+				case STRING :
+					return s;
+				case LONG :
+					return Long.parseLong(s.trim());
+				case VERSION :
+					return Version.parseVersion(s);
 			}
 			return null;
 		}
diff --git a/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java b/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java
index 7b26f6f..6be995a 100755
--- a/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java
+++ b/bundleplugin/src/main/java/aQute/libg/header/OSGiHeader.java
@@ -15,9 +15,8 @@
 	/**
 	 * Standard OSGi header parser. This parser can handle the format clauses
 	 * ::= clause ( ',' clause ) + clause ::= name ( ';' name ) (';' key '='
-	 * value )
-	 * 
-	 * This is mapped to a Map { name => Map { attr|directive => value } }
+	 * value ) This is mapped to a Map { name => Map { attr|directive => value }
+	 * }
 	 * 
 	 * @param value
 	 *            A string
@@ -56,10 +55,8 @@
 					if ((del = qt.getSeparator()) != '=') {
 						if (hadAttribute)
 							if (logger != null) {
-								logger.error("Header contains name field after attribute or directive: "
-										+ adname
-										+ " from "
-										+ value
+								logger.error("Header contains name field after attribute or directive: " + adname
+										+ " from " + value
 										+ ". Name fields must be consecutive, separated by a ';' like a;b;c;x=3;y=4");
 							}
 						if (adname != null && adname.length() > 0)
@@ -68,8 +65,7 @@
 						String advalue = qt.nextToken();
 						if (clause.containsKey(adname)) {
 							if (logger != null && logger.isPedantic())
-								logger.warning("Duplicate attribute/directive name " + adname
-										+ " in " + value
+								logger.warning("Duplicate attribute/directive name " + adname + " in " + value
 										+ ". This attribute/directive will be ignored");
 						}
 						if (advalue == null) {
diff --git a/bundleplugin/src/main/java/aQute/libg/header/Parameters.java b/bundleplugin/src/main/java/aQute/libg/header/Parameters.java
index 96f0d08..f2354c4 100644
--- a/bundleplugin/src/main/java/aQute/libg/header/Parameters.java
+++ b/bundleplugin/src/main/java/aQute/libg/header/Parameters.java
@@ -5,13 +5,12 @@
 import aQute.lib.collections.*;
 import aQute.libg.reporter.*;
 
-public class Parameters implements Map<String, Attrs> {
-	private LinkedHashMap<String, Attrs>	map;
-	static Map<String, Attrs>				EMPTY	= Collections.emptyMap();
-	String									error;
+public class Parameters implements Map<String,Attrs> {
+	private LinkedHashMap<String,Attrs>	map;
+	static Map<String,Attrs>			EMPTY	= Collections.emptyMap();
+	String								error;
 
-	public Parameters() {
-	}
+	public Parameters() {}
 
 	public Parameters(String header) {
 		OSGiHeader.parseHeader(header, null, this);
@@ -33,7 +32,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public boolean containsKey(Object name) {
+	@Deprecated
+	public boolean containsKey(Object name) {
 		assert name instanceof String;
 		if (map == null)
 			return false;
@@ -49,7 +49,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public boolean containsValue(Object value) {
+	@Deprecated
+	public boolean containsValue(Object value) {
 		assert value instanceof Attrs;
 		if (map == null)
 			return false;
@@ -57,7 +58,7 @@
 		return map.containsValue((Attrs) value);
 	}
 
-	public Set<java.util.Map.Entry<String, Attrs>> entrySet() {
+	public Set<java.util.Map.Entry<String,Attrs>> entrySet() {
 		if (map == null)
 			return EMPTY.entrySet();
 
@@ -65,7 +66,8 @@
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public Attrs get(Object key) {
+	@Deprecated
+	public Attrs get(Object key) {
 		assert key instanceof String;
 		if (map == null)
 			return null;
@@ -96,28 +98,30 @@
 		assert value != null;
 
 		if (map == null)
-			map = new LinkedHashMap<String, Attrs>();
+			map = new LinkedHashMap<String,Attrs>();
 
 		return map.put(key, value);
 	}
 
-	public void putAll(Map<? extends String, ? extends Attrs> map) {
+	public void putAll(Map< ? extends String, ? extends Attrs> map) {
 		if (this.map == null) {
 			if (map.isEmpty())
 				return;
-			this.map = new LinkedHashMap<String, Attrs>();
+			this.map = new LinkedHashMap<String,Attrs>();
 		}
 		this.map.putAll(map);
 	}
+
 	public void putAllIfAbsent(Map<String, ? extends Attrs> map) {
-		for(Map.Entry<String, ? extends Attrs> entry : map.entrySet() ) {
-			if ( !containsKey(entry.getKey()))
+		for (Map.Entry<String, ? extends Attrs> entry : map.entrySet()) {
+			if (!containsKey(entry.getKey()))
 				put(entry.getKey(), entry.getValue());
 		}
 	}
 
 	@SuppressWarnings("cast")
-	@Deprecated public Attrs remove(Object var0) {
+	@Deprecated
+	public Attrs remove(Object var0) {
 		assert var0 instanceof String;
 		if (map == null)
 			return null;
@@ -152,7 +156,7 @@
 
 	public void append(StringBuilder sb) {
 		String del = "";
-		for (Map.Entry<String, Attrs> s : entrySet()) {
+		for (Map.Entry<String,Attrs> s : entrySet()) {
 			sb.append(del);
 			sb.append(s.getKey());
 			if (!s.getValue().isEmpty()) {
@@ -168,12 +172,11 @@
 	public boolean equals(Object other) {
 		return super.equals(other);
 	}
-	
+
 	@Deprecated
 	public int hashCode() {
 		return super.hashCode();
 	}
-	
 
 	public boolean isEqual(Parameters other) {
 		if (this == other)
@@ -197,7 +200,7 @@
 		return true;
 	}
 
-	public Map<String,? extends Map<String,String>> asMapMap() {
+	public Map<String, ? extends Map<String,String>> asMapMap() {
 		return this;
 	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/log/Logger.java b/bundleplugin/src/main/java/aQute/libg/log/Logger.java
index bb87707..05d869f 100755
--- a/bundleplugin/src/main/java/aQute/libg/log/Logger.java
+++ b/bundleplugin/src/main/java/aQute/libg/log/Logger.java
@@ -2,15 +2,18 @@
 
 import java.util.*;
 
-
 public interface Logger {
-	void error(String s, Object ... args);
-	void warning(String s, Object ... args);
-	void progress(String s, Object ... args);
-	
+	void error(String s, Object... args);
+
+	void warning(String s, Object... args);
+
+	void progress(String s, Object... args);
+
 	List<String> getWarnings();
+
 	List<String> getErrors();
+
 	List<String> getProgress();
-	
+
 	boolean isPedantic();
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/map/MAP.java b/bundleplugin/src/main/java/aQute/libg/map/MAP.java
index 41c588b..e4776f7 100644
--- a/bundleplugin/src/main/java/aQute/libg/map/MAP.java
+++ b/bundleplugin/src/main/java/aQute/libg/map/MAP.java
@@ -3,42 +3,40 @@
 import java.util.*;
 
 /**
- * Easy way to build a map:
- * 
- * 	Map<String,Integer> s = MAP.$("a",2).$("b",3);
- *
+ * Easy way to build a map: Map<String,Integer> s = MAP.$("a",2).$("b",3);
  */
 public class MAP {
 
-	static public class MAPX<K, V> extends LinkedHashMap<K, V> {
+	static public class MAPX<K, V> extends LinkedHashMap<K,V> {
 		private static final long	serialVersionUID	= 1L;
-		public MAPX<K, V> $(K key, V value) {
+
+		public MAPX<K,V> $(K key, V value) {
 			put(key, value);
 			return this;
 		}
 
-		public MAPX<K, V> $(Map<K,V> all) {
+		public MAPX<K,V> $(Map<K,V> all) {
 			putAll(all);
 			return this;
 		}
+
 		public Hashtable<K,V> asHashtable() {
 			return new Hashtable<K,V>(this);
 		}
 	}
 
-	public static <Kx, Vx> MAPX<Kx, Vx> $(Kx key, Vx value) {
-		MAPX<Kx, Vx> map = new MAPX<Kx, Vx>();
+	public static <Kx, Vx> MAPX<Kx,Vx> $(Kx key, Vx value) {
+		MAPX<Kx,Vx> map = new MAPX<Kx,Vx>();
 		map.put(key, value);
 		return map;
 	}
-	
-	
-	public <K,V> Map<K,V> dictionary(Dictionary<K,V> dict ) {
-		Map<K,V> map = new LinkedHashMap<K, V>();
-		for ( Enumeration<K> e = dict.keys(); e.hasMoreElements(); ) {
+
+	public <K, V> Map<K,V> dictionary(Dictionary<K,V> dict) {
+		Map<K,V> map = new LinkedHashMap<K,V>();
+		for (Enumeration<K> e = dict.keys(); e.hasMoreElements();) {
 			K k = e.nextElement();
 			V v = dict.get(k);
-			map.put(k,v);
+			map.put(k, v);
 		}
 		return map;
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/qtokens/QuotedTokenizer.java b/bundleplugin/src/main/java/aQute/libg/qtokens/QuotedTokenizer.java
index 58ea539..c8dcb41 100755
--- a/bundleplugin/src/main/java/aQute/libg/qtokens/QuotedTokenizer.java
+++ b/bundleplugin/src/main/java/aQute/libg/qtokens/QuotedTokenizer.java
@@ -13,40 +13,41 @@
 	String	peek;
 	char	separator;
 
-	public QuotedTokenizer(String string, String separators, boolean returnTokens ) {
-		if ( string == null )
+	public QuotedTokenizer(String string, String separators, boolean returnTokens) {
+		if (string == null)
 			throw new IllegalArgumentException("string argument must be not null");
 		this.string = string;
 		this.separators = separators;
 		this.returnTokens = returnTokens;
 	}
+
 	public QuotedTokenizer(String string, String separators) {
-		this(string,separators,false);
+		this(string, separators, false);
 	}
 
 	public String nextToken(String separators) {
 		separator = 0;
-		if ( peek != null ) {
+		if (peek != null) {
 			String tmp = peek;
 			peek = null;
 			return tmp;
 		}
-		
-		if ( index == string.length())
+
+		if (index == string.length())
 			return null;
-		
+
 		StringBuilder sb = new StringBuilder();
 
 		while (index < string.length()) {
 			char c = string.charAt(index++);
 
-			if ( Character.isWhitespace(c)) {
-				if ( index == string.length())
+			if (Character.isWhitespace(c)) {
+				if (index == string.length())
 					break;
 				sb.append(c);
 				continue;
 			}
-			
+
 			if (separators.indexOf(c) >= 0) {
 				if (returnTokens)
 					peek = Character.toString(c);
@@ -66,7 +67,7 @@
 			}
 		}
 		String result = sb.toString().trim();
-		if ( result.length()==0 && index==string.length())
+		if (result.length() == 0 && index == string.length())
 			return null;
 		return result;
 	}
@@ -81,8 +82,7 @@
 			c = string.charAt(index++);
 			if (c == quote)
 				break;
-			if (c == '\\' && index < string.length()
-					&& string.charAt(index + 1) == quote)
+			if (c == '\\' && index < string.length() && string.charAt(index + 1) == quote)
 				c = string.charAt(index++);
 			sb.append(c);
 		}
@@ -92,22 +92,24 @@
 		return getTokens(0);
 	}
 
-	private String [] getTokens(int cnt){
+	private String[] getTokens(int cnt) {
 		String token = nextToken();
-		if ( token == null ) 
+		if (token == null)
 			return new String[cnt];
-		
-		String result[] = getTokens(cnt+1);
-		result[cnt]=token;
+
+		String result[] = getTokens(cnt + 1);
+		result[cnt] = token;
 		return result;
 	}
 
-	public char getSeparator() { return separator; }
-	
+	public char getSeparator() {
+		return separator;
+	}
+
 	public List<String> getTokenSet() {
 		List<String> list = Create.list();
 		String token = nextToken();
-		while ( token != null ) {
+		while (token != null) {
 			list.add(token);
 			token = nextToken();
 		}
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/Message.java b/bundleplugin/src/main/java/aQute/libg/reporter/Message.java
new file mode 100644
index 0000000..28386c0
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/Message.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package aQute.libg.reporter;
+
+public @interface Message {
+	String value();
+}
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/Messages.java b/bundleplugin/src/main/java/aQute/libg/reporter/Messages.java
new file mode 100644
index 0000000..504c10a
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/Messages.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package aQute.libg.reporter;
+
+import java.io.*;
+
+public interface Messages {
+	static public class ERROR {}
+
+	static public class WARNING {}
+
+	ERROR NoSuchFile_(File f);
+
+	ERROR Unexpected_Error_(String context, Exception e);
+
+}
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/Reporter.java b/bundleplugin/src/main/java/aQute/libg/reporter/Reporter.java
index c6179af..1ad0c31 100755
--- a/bundleplugin/src/main/java/aQute/libg/reporter/Reporter.java
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/Reporter.java
@@ -2,14 +2,20 @@
 
 import java.util.*;
 
-
 public interface Reporter {
-	void error(String s, Object ... args);
-	void warning(String s, Object ... args);
-	void progress(String s, Object ... args);
-	void trace(String s, Object ... args);
+	void error(String s, Object... args);
+
+	void warning(String s, Object... args);
+
+	void progress(String s, Object... args);
+
+	void trace(String s, Object... args);
+
 	List<String> getWarnings();
+
 	List<String> getErrors();
-	
+
 	boolean isPedantic();
+	
+	boolean isExceptions();
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
index 249b776..676fb1b 100644
--- a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterAdapter.java
@@ -8,7 +8,6 @@
 
 /**
  * Mainly used for testing where reporters are needed.
- * 
  */
 public class ReporterAdapter implements Reporter {
 	final List<String>	errors		= new ArrayList<String>();
@@ -74,7 +73,7 @@
 		errors.add(e);
 		trace("ERROR: %s", e);
 		if (isExceptions() || isTrace())
-			if ( t instanceof InvocationTargetException )
+			if (t instanceof InvocationTargetException)
 				t.getCause().printStackTrace(System.err);
 			else
 				t.printStackTrace(System.err);
@@ -89,14 +88,14 @@
 	public void progress(String s, Object... args) {
 		if (out != null) {
 			out.format(s, args);
-			if ( !s.endsWith("\n"))
+			if (!s.endsWith("\n"))
 				out.format("\n");
 		}
 	}
 
 	public void trace(String s, Object... args) {
 		if (trace && out != null) {
-			out.format("# "+s+"\n", args);
+			out.format("# " + s + "\n", args);
 			out.flush();
 		}
 	}
@@ -172,8 +171,8 @@
 	void report(String title, Collection<String> list, Formatter f) {
 		if (list.isEmpty())
 			return;
-		f.format(title + (list.size() > 1 ? "s" : "")+"\n");
-		int n=0;
+		f.format(title + (list.size() > 1 ? "s" : "") + "\n");
+		int n = 0;
 		for (String s : list) {
 			f.format("%3s. %s\n", n++, s);
 		}
diff --git a/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java
new file mode 100644
index 0000000..8d782cf
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/libg/reporter/ReporterMessages.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package aQute.libg.reporter;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+import aQute.libg.reporter.Messages.ERROR;
+import aQute.libg.reporter.Messages.WARNING;
+
+public class ReporterMessages {
+
+	@SuppressWarnings("unchecked")
+	public static <T> T base(final Reporter reporter, Class<T> messages) {
+		return (T) Proxy.newProxyInstance(messages.getClassLoader(), new Class[] {
+			messages
+		}, new InvocationHandler() {
+
+			public Object invoke(Object target, Method method, Object[] args) throws Throwable {
+				if (reporter.isExceptions()) {
+					for (Object o : args) {
+						if (o instanceof Throwable)
+							((Throwable) o).printStackTrace();
+					}
+				}
+				String format;
+				Message d = method.getAnnotation(Message.class);
+				if (d == null) {
+					String name = method.getName();
+					StringBuilder sb = new StringBuilder();
+					sb.append(name.charAt(0));
+					for (int i = 1; i < name.length(); i++) {
+						char c = name.charAt(i);
+						switch (c) {
+							case '_' :
+								sb.append(" %s, ");
+								break;
+
+							default :
+								if (Character.isUpperCase(c)) {
+									sb.append(" ");
+									c = Character.toLowerCase(c);
+								}
+								sb.append(c);
+						}
+					}
+					format = sb.toString();
+				} else
+					format = d.value();
+
+				try {
+					if (method.getReturnType() == ERROR.class) {
+						reporter.error(format, args);
+					} else if (method.getReturnType() == WARNING.class) {
+						reporter.warning(format, args);
+					} else
+						reporter.trace(format, args);
+				}
+				catch (IllegalFormatException e) {
+					reporter.error("Formatter failed: %s %s %s", method.getName(), format, Arrays.toString(args));
+				}
+				return null;
+			}
+		});
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/ContentFilter.java b/bundleplugin/src/main/java/aQute/libg/sax/ContentFilter.java
index 62ca259..e08f4de 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/ContentFilter.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/ContentFilter.java
@@ -1,8 +1,9 @@
 package aQute.libg.sax;
 
-import org.xml.sax.ContentHandler;
+import org.xml.sax.*;
 
 public interface ContentFilter extends ContentHandler {
 	void setParent(ContentHandler parent);
+
 	ContentHandler getParent();
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/ContentFilterImpl.java b/bundleplugin/src/main/java/aQute/libg/sax/ContentFilterImpl.java
index 7f71568..3bfb6b5 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/ContentFilterImpl.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/ContentFilterImpl.java
@@ -1,17 +1,14 @@
 package aQute.libg.sax;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
+import org.xml.sax.*;
 
 public class ContentFilterImpl implements ContentFilter {
 
-	private ContentHandler parent;
+	private ContentHandler	parent;
 
 	public void setParent(ContentHandler parent) {
 		this.parent = parent;
-		
+
 	}
 
 	public ContentHandler getParent() {
@@ -30,8 +27,7 @@
 		parent.endDocument();
 	}
 
-	public void startPrefixMapping(String prefix, String uri)
-			throws SAXException {
+	public void startPrefixMapping(String prefix, String uri) throws SAXException {
 		parent.startPrefixMapping(prefix, uri);
 	}
 
@@ -39,28 +35,23 @@
 		parent.endPrefixMapping(prefix);
 	}
 
-	public void startElement(String uri, String localName, String qName,
-			Attributes atts) throws SAXException {
+	public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
 		parent.startElement(uri, localName, qName, atts);
 	}
 
-	public void endElement(String uri, String localName, String qName)
-			throws SAXException {
+	public void endElement(String uri, String localName, String qName) throws SAXException {
 		parent.endElement(uri, localName, qName);
 	}
 
-	public void characters(char[] ch, int start, int length)
-			throws SAXException {
+	public void characters(char[] ch, int start, int length) throws SAXException {
 		parent.characters(ch, start, length);
 	}
 
-	public void ignorableWhitespace(char[] ch, int start, int length)
-			throws SAXException {
+	public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
 		parent.ignorableWhitespace(ch, start, length);
 	}
 
-	public void processingInstruction(String target, String data)
-			throws SAXException {
+	public void processingInstruction(String target, String data) throws SAXException {
 		parent.processingInstruction(target, data);
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/SAXElement.java b/bundleplugin/src/main/java/aQute/libg/sax/SAXElement.java
index b7ce35e..0b7e914 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/SAXElement.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/SAXElement.java
@@ -1,16 +1,15 @@
 package aQute.libg.sax;
 
-import org.xml.sax.Attributes;
+import org.xml.sax.*;
 
 public class SAXElement {
 
-	private final String uri;
-	private final String localName;
-	private final String qName;
-	private final Attributes atts;
+	private final String		uri;
+	private final String		localName;
+	private final String		qName;
+	private final Attributes	atts;
 
-	public SAXElement(String uri, String localName, String qName,
-			Attributes atts) {
+	public SAXElement(String uri, String localName, String qName, Attributes atts) {
 		this.uri = uri;
 		this.localName = localName;
 		this.qName = qName;
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/SAXUtil.java b/bundleplugin/src/main/java/aQute/libg/sax/SAXUtil.java
index 87b058e..ab7b470 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/SAXUtil.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/SAXUtil.java
@@ -1,29 +1,28 @@
 package aQute.libg.sax;
 
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.sax.*;
 
-import org.xml.sax.ContentHandler;
-import org.xml.sax.XMLReader;
+import org.xml.sax.*;
 
 public class SAXUtil {
-	
+
 	public static XMLReader buildPipeline(Result output, ContentFilter... filters) throws Exception {
 		SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
 		TransformerHandler handler = factory.newTransformerHandler();
 		handler.setResult(output);
-		
+
 		ContentHandler last = handler;
-		if (filters != null) for (ContentFilter filter : filters) {
-			filter.setParent(last);
-			last = filter;
-		}
+		if (filters != null)
+			for (ContentFilter filter : filters) {
+				filter.setParent(last);
+				last = filter;
+			}
 		XMLReader reader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
 		reader.setContentHandler(last);
-		
+
 		return reader;
 	}
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/filters/ElementSelectionFilter.java b/bundleplugin/src/main/java/aQute/libg/sax/filters/ElementSelectionFilter.java
index 4411db9..3ba7f5a 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/filters/ElementSelectionFilter.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/filters/ElementSelectionFilter.java
@@ -1,17 +1,16 @@
 package aQute.libg.sax.filters;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
+import org.xml.sax.*;
 
-import aQute.libg.sax.ContentFilterImpl;
+import aQute.libg.sax.*;
 
-public abstract class ElementSelectionFilter extends ContentFilterImpl{
-	
-	int depth = 0;
-	int hiddenDepth = -1;
-	
+public abstract class ElementSelectionFilter extends ContentFilterImpl {
+
+	int	depth		= 0;
+	int	hiddenDepth	= -1;
+
 	protected abstract boolean select(int depth, String uri, String localName, String qName, Attributes attribs);
-	
+
 	@Override
 	public final void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
 		if (hiddenDepth < 0) {
@@ -21,29 +20,31 @@
 			else
 				hiddenDepth = 0;
 		} else {
-			hiddenDepth ++;
+			hiddenDepth++;
 		}
 		depth++;
 	}
-	
+
 	@Override
 	public final void endElement(String uri, String localName, String qName) throws SAXException {
 		if (hiddenDepth < 0) {
 			super.endElement(uri, localName, qName);
 		} else {
-			hiddenDepth --;
+			hiddenDepth--;
 		}
-		depth --;
+		depth--;
 	}
-	
+
 	@Override
 	public void characters(char[] ch, int start, int length) throws SAXException {
-		if (hiddenDepth < 0) super.characters(ch, start, length);
+		if (hiddenDepth < 0)
+			super.characters(ch, start, length);
 	}
-	
+
 	@Override
 	public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
-		if (hiddenDepth < 0) super.ignorableWhitespace(ch, start, length);
+		if (hiddenDepth < 0)
+			super.ignorableWhitespace(ch, start, length);
 	}
-	
+
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/sax/filters/MergeContentFilter.java b/bundleplugin/src/main/java/aQute/libg/sax/filters/MergeContentFilter.java
index acf5d12..b0d4df8 100644
--- a/bundleplugin/src/main/java/aQute/libg/sax/filters/MergeContentFilter.java
+++ b/bundleplugin/src/main/java/aQute/libg/sax/filters/MergeContentFilter.java
@@ -1,28 +1,26 @@
 package aQute.libg.sax.filters;
 
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
 
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
+import org.xml.sax.*;
 
-import aQute.libg.sax.ContentFilterImpl;
-import aQute.libg.sax.SAXElement;
+import aQute.libg.sax.*;
 
 public class MergeContentFilter extends ContentFilterImpl {
 
-	private int elementDepth = 0;
-	
-	private final List<SAXElement> rootElements = new LinkedList<SAXElement>();
-	
+	private int						elementDepth	= 0;
+
+	private final List<SAXElement>	rootElements	= new LinkedList<SAXElement>();
+
 	@Override
 	public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
 		if (elementDepth++ == 0) {
 			if (rootElements.isEmpty())
 				super.startElement(uri, localName, qName, atts);
 			else if (!rootElements.get(0).getqName().equals(qName))
-				throw new SAXException(String.format("Documents have inconsistent root element names: first was %s, current is %s.", rootElements.get(0).getqName(), qName));
+				throw new SAXException(String.format(
+						"Documents have inconsistent root element names: first was %s, current is %s.", rootElements
+								.get(0).getqName(), qName));
 			rootElements.add(new SAXElement(uri, localName, qName, atts));
 		} else {
 			super.startElement(uri, localName, qName, atts);
@@ -35,13 +33,13 @@
 			super.endElement(uri, localName, qName);
 		}
 	}
-	
+
 	@Override
 	public void processingInstruction(String target, String data) throws SAXException {
 		if (rootElements.isEmpty())
 			super.processingInstruction(target, data);
 	}
-	
+
 	public void closeRootAndDocument() throws SAXException {
 		if (!rootElements.isEmpty()) {
 			SAXElement root = rootElements.get(0);
@@ -49,7 +47,7 @@
 		}
 		super.endDocument();
 	}
-	
+
 	public List<SAXElement> getRootElements() {
 		return Collections.unmodifiableList(rootElements);
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/sed/Replacer.java b/bundleplugin/src/main/java/aQute/libg/sed/Replacer.java
index fa181f4..3c02aaf 100644
--- a/bundleplugin/src/main/java/aQute/libg/sed/Replacer.java
+++ b/bundleplugin/src/main/java/aQute/libg/sed/Replacer.java
@@ -1,5 +1,5 @@
 package aQute.libg.sed;
 
 public interface Replacer {
-    String process(String line);
+	String process(String line);
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/sed/Sed.java b/bundleplugin/src/main/java/aQute/libg/sed/Sed.java
index 74f4756..4642c92 100644
--- a/bundleplugin/src/main/java/aQute/libg/sed/Sed.java
+++ b/bundleplugin/src/main/java/aQute/libg/sed/Sed.java
@@ -4,96 +4,98 @@
 import java.util.*;
 import java.util.regex.*;
 
+import aQute.lib.io.IO;
+
 public class Sed {
-    final File                 file;
-    final Replacer             macro;
-    File                       output;
-    boolean backup = true;
+	final File					file;
+	final Replacer				macro;
+	File						output;
+	boolean						backup			= true;
 
-    final Map<Pattern, String> replacements = new LinkedHashMap<Pattern, String>();
+	final Map<Pattern,String>	replacements	= new LinkedHashMap<Pattern,String>();
 
-    public Sed(Replacer macro, File file) {
-        assert file.isFile();
-        this.file = file;
-        this.macro = macro;
-    }
-    
-    public Sed(File file) {
-        assert file.isFile();
-        this.file = file;
-        this.macro = null;
-    }
+	public Sed(Replacer macro, File file) {
+		assert file.isFile();
+		this.file = file;
+		this.macro = macro;
+	}
 
-    public void setOutput(File f) {
-        output = f;
-    }
+	public Sed(File file) {
+		assert file.isFile();
+		this.file = file;
+		this.macro = null;
+	}
 
-    public void replace(String pattern, String replacement) {
-        replacements.put(Pattern.compile(pattern), replacement);
-    }
+	public void setOutput(File f) {
+		output = f;
+	}
 
-    public int doIt() throws IOException {
-    	int actions = 0;
-        BufferedReader brdr = new BufferedReader(new InputStreamReader( new FileInputStream(file),"UTF-8"));
-        File out;
-        if (output != null)
-            out = output;
-        else
-            out = new File(file.getAbsolutePath() + ".tmp");
-        PrintWriter pw = new PrintWriter(new OutputStreamWriter( new FileOutputStream(out),"UTF-8"));
-        try {
-            String line;
-            while ((line = brdr.readLine()) != null) {
-                for (Pattern p : replacements.keySet()) {
-                    String replace = replacements.get(p);
-                    Matcher m = p.matcher(line);
+	public void replace(String pattern, String replacement) {
+		replacements.put(Pattern.compile(pattern), replacement);
+	}
 
-                    StringBuffer sb = new StringBuffer();
-                    while (m.find()) {
-                        String tmp = setReferences(m, replace);
-                        if ( macro != null)
-                        	tmp = Matcher.quoteReplacement(macro.process(tmp));
-                        m.appendReplacement(sb, tmp);
-                        actions++;
-                    }
-                    m.appendTail(sb);
+	public int doIt() throws IOException {
+		int actions = 0;
+		BufferedReader brdr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
+		File out;
+		if (output != null)
+			out = output;
+		else
+			out = new File(file.getAbsolutePath() + ".tmp");
+		PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8"));
+		try {
+			String line;
+			while ((line = brdr.readLine()) != null) {
+				for (Pattern p : replacements.keySet()) {
+					String replace = replacements.get(p);
+					Matcher m = p.matcher(line);
 
-                    line = sb.toString();
-                }
-                pw.println(line);
-            }
-            pw.close();
-            if (output == null) {
-            	if ( backup ) {
-                    File bak = new File(file.getAbsolutePath() + ".bak");
-            		file.renameTo(bak);
-            	}
-                out.renameTo(file);
-            }
+					StringBuffer sb = new StringBuffer();
+					while (m.find()) {
+						String tmp = setReferences(m, replace);
+						if (macro != null)
+							tmp = Matcher.quoteReplacement(macro.process(tmp));
+						m.appendReplacement(sb, tmp);
+						actions++;
+					}
+					m.appendTail(sb);
+
+					line = sb.toString();
+				}
+				pw.println(line);
+			}
         } finally {
-            brdr.close();
-            pw.close();
+        	brdr.close();
+			pw.close();
         }
-        return actions;
-    }
+        
+		if (output == null) {
+			if (backup) {
+				File bak = new File(file.getAbsolutePath() + ".bak");
+				IO.rename(file, bak);
+			}
+			IO.rename(out, file);
+		}
+        
+		return actions;
+	}
+    
+	private String setReferences(Matcher m, String replace) {
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < replace.length(); i++) {
+			char c = replace.charAt(i);
+			if (c == '$' && i < replace.length() - 1 && Character.isDigit(replace.charAt(i + 1))) {
+				int n = replace.charAt(i + 1) - '0';
+				if (n <= m.groupCount())
+					sb.append(m.group(n));
+				i++;
+			} else
+				sb.append(c);
+		}
+		return sb.toString();
+	}
 
-    private String setReferences(Matcher m, String replace) {
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < replace.length(); i++) {
-            char c = replace.charAt(i);
-            if (c == '$' && i < replace.length() - 1
-                    && Character.isDigit(replace.charAt(i + 1))) {
-                int n = replace.charAt(i + 1) - '0';
-                if ( n <= m.groupCount() )
-                    sb.append(m.group(n));
-                i++;
-            } else
-                sb.append(c);
-        }
-        return sb.toString();
-    }
-
-    public void setBackup(boolean b) {
-    	this.backup=b;
-    }
+	public void setBackup(boolean b) {
+		this.backup = b;
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java b/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
index 3d05b76..cef8b23 100644
--- a/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
+++ b/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
@@ -15,43 +15,42 @@
 		public Node(T name) {
 			this.name = name;
 		}
-		
+
 		public String toString() {
 			return name + "{" + index + "," + low + "}";
 		}
 	}
 
-	private int				index	= 0;
-	private List<Node>		stack	= new ArrayList<Node>();
+	private int			index	= 0;
+	private List<Node>	stack	= new ArrayList<Node>();
 	private Set<Set<T>>	scc		= new HashSet<Set<T>>();
-	private Node			root	= new Node(null);
+	private Node		root	= new Node(null);
 
-	
-//	   public ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){
-//	       v.index = index;
-//	       v.lowlink = index;
-//	       index++;
-//	       stack.add(0, v);
-//	       for(Edge e : list.getAdjacent(v)){
-//	           Node n = e.to;
-//	           if(n.index == -1){
-//	               tarjan(n, list);
-//	               v.lowlink = Math.min(v.lowlink, n.lowlink);
-//	           }else if(stack.contains(n)){
-//	               v.lowlink = Math.min(v.lowlink, n.index);
-//	           }
-//	       }
-//	       if(v.lowlink == v.index){
-//	           Node n;
-//	           ArrayList<Node> component = new ArrayList<Node>();
-//	           do{
-//	               n = stack.remove(0);
-//	               component.add(n);
-//	           }while(n != v);
-//	           SCC.add(component);
-//	       }
-//	       return SCC;
-//	   }
+	// public ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){
+	// v.index = index;
+	// v.lowlink = index;
+	// index++;
+	// stack.add(0, v);
+	// for(Edge e : list.getAdjacent(v)){
+	// Node n = e.to;
+	// if(n.index == -1){
+	// tarjan(n, list);
+	// v.lowlink = Math.min(v.lowlink, n.lowlink);
+	// }else if(stack.contains(n)){
+	// v.lowlink = Math.min(v.lowlink, n.index);
+	// }
+	// }
+	// if(v.lowlink == v.index){
+	// Node n;
+	// ArrayList<Node> component = new ArrayList<Node>();
+	// do{
+	// n = stack.remove(0);
+	// component.add(n);
+	// }while(n != v);
+	// SCC.add(component);
+	// }
+	// return SCC;
+	// }
 
 	void tarjan(Node v) {
 		v.index = index;
@@ -68,7 +67,7 @@
 			}
 		}
 
-		if (v!=root && v.low == v.index) {
+		if (v != root && v.low == v.index) {
 			Set<T> component = new HashSet<T>();
 			Node n;
 			do {
@@ -80,7 +79,7 @@
 	}
 
 	Set<Set<T>> getResult(Map<T, ? extends Collection<T>> graph) {
-		Map<T, Node> index = new HashMap<T, Node>();
+		Map<T,Node> index = new HashMap<T,Node>();
 
 		for (Map.Entry<T, ? extends Collection<T>> entry : graph.entrySet()) {
 			Node node = getNode(index, entry.getKey());
@@ -92,7 +91,7 @@
 		return scc;
 	}
 
-	private Node getNode(Map<T, Node> index, T key) {
+	private Node getNode(Map<T,Node> index, T key) {
 		Node node = index.get(key);
 		if (node == null) {
 			node = new Node(key);
@@ -101,7 +100,7 @@
 		return node;
 	}
 
-	public static <T> Collection<? extends Collection<T>> tarjan(Map<T, ? extends Collection<T>> graph) {
+	public static <T> Collection< ? extends Collection<T>> tarjan(Map<T, ? extends Collection<T>> graph) {
 		Tarjan<T> tarjan = new Tarjan<T>();
 		return tarjan.getResult(graph);
 	}
diff --git a/bundleplugin/src/main/java/aQute/libg/tuple/Pair.java b/bundleplugin/src/main/java/aQute/libg/tuple/Pair.java
index efb2298..d86d6c8 100644
--- a/bundleplugin/src/main/java/aQute/libg/tuple/Pair.java
+++ b/bundleplugin/src/main/java/aQute/libg/tuple/Pair.java
@@ -1,9 +1,9 @@
 package aQute.libg.tuple;
 
-public class Pair<A,B> {
-	final public A a;
-	final public B b;
-	
+public class Pair<A, B> {
+	final public A	a;
+	final public B	b;
+
 	public Pair(A a, B b) {
 		this.a = a;
 		this.b = b;
diff --git a/bundleplugin/src/main/java/aQute/libg/version/Version.java b/bundleplugin/src/main/java/aQute/libg/version/Version.java
index d326ec4..77d21e4 100755
--- a/bundleplugin/src/main/java/aQute/libg/version/Version.java
+++ b/bundleplugin/src/main/java/aQute/libg/version/Version.java
@@ -3,150 +3,148 @@
 import java.util.regex.*;
 
 public class Version implements Comparable<Version> {
-    final int                   major;
-    final int                   minor;
-    final int                   micro;
-    final String                qualifier;
-    public final static String  VERSION_STRING = "(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.([-_\\da-zA-Z]+))?)?)?";
-    public final static Pattern VERSION        = Pattern
-                                                       .compile(VERSION_STRING);
-    public final static Version LOWEST         = new Version();
-    public final static Version HIGHEST        = new Version(Integer.MAX_VALUE,
-                                                       Integer.MAX_VALUE,
-                                                       Integer.MAX_VALUE,
-                                                       "\uFFFF");
+	final int					major;
+	final int					minor;
+	final int					micro;
+	final String				qualifier;
+	public final static String	VERSION_STRING	= "(\\d+)(\\.(\\d+)(\\.(\\d+)(\\.([-_\\da-zA-Z]+))?)?)?";
+	public final static Pattern	VERSION			= Pattern.compile(VERSION_STRING);
+	public final static Version	LOWEST			= new Version();
+	public final static Version	HIGHEST			= new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
+														"\uFFFF");
 
-    public static final Version	emptyVersion	= LOWEST;
-    public static final Version	ONE	= new Version(1,0,0);
+	public static final Version	emptyVersion	= LOWEST;
+	public static final Version	ONE				= new Version(1, 0, 0);
 
-    public Version() {
-        this(0);
-    }
+	public Version() {
+		this(0);
+	}
 
-    public Version(int major, int minor, int micro, String qualifier) {
-        this.major = major;
-        this.minor = minor;
-        this.micro = micro;
-        this.qualifier = qualifier;
-    }
+	public Version(int major, int minor, int micro, String qualifier) {
+		this.major = major;
+		this.minor = minor;
+		this.micro = micro;
+		this.qualifier = qualifier;
+	}
 
-    public Version(int major, int minor, int micro) {
-        this(major, minor, micro, null);
-    }
+	public Version(int major, int minor, int micro) {
+		this(major, minor, micro, null);
+	}
 
-    public Version(int major, int minor) {
-        this(major, minor, 0, null);
-    }
+	public Version(int major, int minor) {
+		this(major, minor, 0, null);
+	}
 
-    public Version(int major) {
-        this(major, 0, 0, null);
-    }
+	public Version(int major) {
+		this(major, 0, 0, null);
+	}
 
-    public Version(String version) {
-    	version = version.trim();
-        Matcher m = VERSION.matcher(version);
-        if (!m.matches())
-            throw new IllegalArgumentException("Invalid syntax for version: "
-                    + version);
+	public Version(String version) {
+		version = version.trim();
+		Matcher m = VERSION.matcher(version);
+		if (!m.matches())
+			throw new IllegalArgumentException("Invalid syntax for version: " + version);
 
-        major = Integer.parseInt(m.group(1));
-        if (m.group(3) != null)
-            minor = Integer.parseInt(m.group(3));
-        else
-            minor = 0;
+		major = Integer.parseInt(m.group(1));
+		if (m.group(3) != null)
+			minor = Integer.parseInt(m.group(3));
+		else
+			minor = 0;
 
-        if (m.group(5) != null)
-            micro = Integer.parseInt(m.group(5));
-        else
-            micro = 0;
+		if (m.group(5) != null)
+			micro = Integer.parseInt(m.group(5));
+		else
+			micro = 0;
 
-        qualifier = m.group(7);
-    }
+		qualifier = m.group(7);
+	}
 
-    public int getMajor() {
-        return major;
-    }
+	public int getMajor() {
+		return major;
+	}
 
-    public int getMinor() {
-        return minor;
-    }
+	public int getMinor() {
+		return minor;
+	}
 
-    public int getMicro() {
-        return micro;
-    }
+	public int getMicro() {
+		return micro;
+	}
 
-    public String getQualifier() {
-        return qualifier;
-    }
+	public String getQualifier() {
+		return qualifier;
+	}
 
-    public int compareTo(Version other) {
-        if (other == this)
-            return 0;
+	public int compareTo(Version other) {
+		if (other == this)
+			return 0;
 
-        Version o = other;
-        if (major != o.major)
-            return major - o.major;
+		Version o = other;
+		if (major != o.major)
+			return major - o.major;
 
-        if (minor != o.minor)
-            return minor - o.minor;
+		if (minor != o.minor)
+			return minor - o.minor;
 
-        if (micro != o.micro)
-            return micro - o.micro;
+		if (micro != o.micro)
+			return micro - o.micro;
 
-        int c = 0;
-        if (qualifier != null)
-            c = 1;
-        if (o.qualifier != null)
-            c += 2;
+		int c = 0;
+		if (qualifier != null)
+			c = 1;
+		if (o.qualifier != null)
+			c += 2;
 
-        switch (c) {
-        case 0:
-            return 0;
-        case 1:
-            return 1;
-        case 2:
-            return -1;
-        }
-        return qualifier.compareTo(o.qualifier);
-    }
+		switch (c) {
+			case 0 :
+				return 0;
+			case 1 :
+				return 1;
+			case 2 :
+				return -1;
+		}
+		return qualifier.compareTo(o.qualifier);
+	}
 
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
-        sb.append(major);
-        sb.append(".");
-        sb.append(minor);
-        sb.append(".");
-        sb.append(micro);
-        if (qualifier != null) {
-            sb.append(".");
-            sb.append(qualifier);
-        }
-        return sb.toString();
-    }
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append(major);
+		sb.append(".");
+		sb.append(minor);
+		sb.append(".");
+		sb.append(micro);
+		if (qualifier != null) {
+			sb.append(".");
+			sb.append(qualifier);
+		}
+		return sb.toString();
+	}
 
-    public boolean equals(Object ot) {
-        if ( ! (ot instanceof Version))
-            return false;
-        
-        return compareTo((Version)ot) == 0;
-    }
+	public boolean equals(Object ot) {
+		if (!(ot instanceof Version))
+			return false;
 
-    public int hashCode() {
-        return major * 97 ^ minor * 13 ^ micro
-                + (qualifier == null ? 97 : qualifier.hashCode());
-    }
+		return compareTo((Version) ot) == 0;
+	}
 
-    public int get(int i) {
-        switch(i) {
-        case 0 : return major;
-        case 1 : return minor;
-        case 2 : return micro;
-        default:
-            throw new IllegalArgumentException("Version can only get 0 (major), 1 (minor), or 2 (micro)");
-        }
-    }
-    
-    public static Version parseVersion(String version) {
+	public int hashCode() {
+		return major * 97 ^ minor * 13 ^ micro + (qualifier == null ? 97 : qualifier.hashCode());
+	}
+
+	public int get(int i) {
+		switch (i) {
+			case 0 :
+				return major;
+			case 1 :
+				return minor;
+			case 2 :
+				return micro;
+			default :
+				throw new IllegalArgumentException("Version can only get 0 (major), 1 (minor), or 2 (micro)");
+		}
+	}
+
+	public static Version parseVersion(String version) {
 		if (version == null) {
 			return LOWEST;
 		}
@@ -158,9 +156,9 @@
 
 		return new Version(version);
 
-    }
-    
-    public Version getWithoutQualifier() {
-    	return new Version(major,minor,micro);
-    }
+	}
+
+	public Version getWithoutQualifier() {
+		return new Version(major, minor, micro);
+	}
 }
diff --git a/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java b/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java
index 46f9e94..3e00c76 100755
--- a/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java
+++ b/bundleplugin/src/main/java/aQute/libg/version/VersionRange.java
@@ -9,9 +9,8 @@
 	char			start	= '[';
 	char			end		= ']';
 
-	static Pattern	RANGE	= Pattern.compile("(\\(|\\[)\\s*(" +
-									Version.VERSION_STRING + ")\\s*,\\s*(" +
-									Version.VERSION_STRING + ")\\s*(\\)|\\])");
+	static Pattern	RANGE	= Pattern.compile("(\\(|\\[)\\s*(" + Version.VERSION_STRING + ")\\s*,\\s*("
+									+ Version.VERSION_STRING + ")\\s*(\\)|\\])");
 
 	public VersionRange(String string) {
 		string = string.trim();
@@ -24,9 +23,7 @@
 			high = new Version(v2);
 			end = m.group(18).charAt(0);
 			if (low.compareTo(high) > 0)
-				throw new IllegalArgumentException(
-						"Low Range is higher than High Range: " + low + "-" +
-								high);
+				throw new IllegalArgumentException("Low Range is higher than High Range: " + low + "-" + high);
 
 		} else
 			high = low = new Version(string);
@@ -66,8 +63,8 @@
 	}
 
 	public boolean includes(Version v) {
-		if ( !isRange() ) {
-			return low.compareTo(v) <=0;
+		if (!isRange()) {
+			return low.compareTo(v) <= 0;
 		}
 		if (includeLow()) {
 			if (v.compareTo(low) < 0)
@@ -80,17 +77,17 @@
 				return false;
 		} else if (v.compareTo(high) >= 0)
 			return false;
-		
+
 		return true;
 	}
-	
-	public Iterable<Version> filter( final Iterable<Version> versions) {
+
+	public Iterable<Version> filter(final Iterable<Version> versions) {
 		List<Version> list = new ArrayList<Version>();
-		for ( Version v : versions) {
-			if ( includes(v))
+		for (Version v : versions) {
+			if (includes(v))
 				list.add(v);
 		}
 		return list;
 	}
-	
+
 }
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/libg/xslt/Transform.java b/bundleplugin/src/main/java/aQute/libg/xslt/Transform.java
index ea0fcd0..4d5835b 100644
--- a/bundleplugin/src/main/java/aQute/libg/xslt/Transform.java
+++ b/bundleplugin/src/main/java/aQute/libg/xslt/Transform.java
@@ -9,36 +9,35 @@
 import javax.xml.transform.stream.*;
 
 public class Transform {
-    static TransformerFactory transformerFactory = TransformerFactory
-                                                         .newInstance();
+	static TransformerFactory	transformerFactory	= TransformerFactory.newInstance();
 
-    static Map<URL, Templates> cache          = new ConcurrentHashMap<URL, Templates>();
+	static Map<URL,Templates>	cache				= new ConcurrentHashMap<URL,Templates>();
 
-    public static void transform(TransformerFactory transformerFactory, URL xslt, InputStream in, OutputStream out)
-            throws Exception {
-        if ( xslt == null ) 
-            throw new IllegalArgumentException("No source template specified");
-        
-        Templates templates = cache.get(xslt);
-        if (templates == null) {
-            InputStream xsltIn = xslt.openStream();
-            try {
-                templates = transformerFactory
-                        .newTemplates(new StreamSource(xsltIn));
+	public static void transform(TransformerFactory transformerFactory, URL xslt, InputStream in, OutputStream out)
+			throws Exception {
+		if (xslt == null)
+			throw new IllegalArgumentException("No source template specified");
 
-                cache.put(xslt, templates);
-            } finally {
-                in.close();
-            }
-        }
-        Result xmlResult = new StreamResult(out);
-        Source xmlSource = new StreamSource(in);
-        Transformer t = templates.newTransformer();
-        t.transform(xmlSource, xmlResult);
-        out.flush();
-    }
+		Templates templates = cache.get(xslt);
+		if (templates == null) {
+			InputStream xsltIn = xslt.openStream();
+			try {
+				templates = transformerFactory.newTemplates(new StreamSource(xsltIn));
 
-    public static void transform(URL xslt, InputStream in, OutputStream out) throws Exception {
-        transform(transformerFactory,xslt, in, out);
-    }
+				cache.put(xslt, templates);
+			}
+			finally {
+				in.close();
+			}
+		}
+		Result xmlResult = new StreamResult(out);
+		Source xmlSource = new StreamSource(in);
+		Transformer t = templates.newTransformer();
+		t.transform(xmlSource, xmlResult);
+		out.flush();
+	}
+
+	public static void transform(URL xslt, InputStream in, OutputStream out) throws Exception {
+		transform(transformerFactory, xslt, in, out);
+	}
 }
