diff --git a/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java b/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
index cd98036..4d0f5b9 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileInstallRepo.java
@@ -1,7 +1,6 @@
 package aQute.lib.deployer;
 
 import java.io.*;
-import java.net.*;
 import java.util.*;
 import java.util.jar.*;
 import java.util.regex.*;
@@ -79,8 +78,8 @@
 		if (dirty) {
 			dirty = false;
 			return true;
-		} else
-			return false;
+		}
+		return false;
 	}
 
 	@Override
@@ -102,48 +101,4 @@
 		}
 		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;
-
-		//
-		// 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);
-
-				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 cfc69f3..4be5ec8 100644
--- a/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
+++ b/bundleplugin/src/main/java/aQute/lib/deployer/FileRepo.java
@@ -56,7 +56,7 @@
 	 * Get a list of URLs to bundles that are constrained by the bsn and
 	 * versionRange.
 	 */
-	public File[] get(String bsn, String versionRange) throws Exception {
+	private File[] get(String bsn, String versionRange) throws Exception {
 		init();
 
 		// If the version is set to project, we assume it is not
@@ -259,8 +259,8 @@
 		if (dirty) {
 			dirty = false;
 			return true;
-		} else
-			return false;
+		}
+		return false;
 	}
 
 	public String getName() {
@@ -276,8 +276,7 @@
 		File version = new File(bsns, bsn + "-" + v.getMajor() + "." + v.getMinor() + "." + v.getMicro() + ".jar");
 		if (version.exists())
 			return new Jar(version);
-		else
-			return null;
+		return null;
 	}
 
 	public File get(String bsn, String version, Strategy strategy, Map<String,String> properties) throws Exception {
@@ -295,11 +294,9 @@
 			File file = IO.getFile(root, bsn + "/" + bsn + "-" + version + ".jar");
 			if (file.isFile())
 				return file;
-			else {
-				file = IO.getFile(root, bsn + "/" + bsn + "-" + version + ".lib");
-				if (file.isFile())
-					return file;
-			}
+			file = IO.getFile(root, bsn + "/" + bsn + "-" + version + ".lib");
+			if (file.isFile())
+				return file;
 			return null;
 
 		}
diff --git a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
index a5185e4..c36727f 100644
--- a/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
+++ b/bundleplugin/src/main/java/aQute/lib/getopt/CommandLine.java
@@ -308,7 +308,7 @@
 	 * Provide a help text.
 	 */
 
-	public void help(Formatter f, Object target, String cmd, Class< ? extends Options> specification) {
+	public void help(Formatter f, @SuppressWarnings("unused") 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);
diff --git a/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java b/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
index 1eb83ac..7e3b35e 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/ArrayHandler.java
@@ -7,7 +7,7 @@
 public class ArrayHandler extends Handler {
 	Type	componentType;
 
-	ArrayHandler(Class< ? > rawClass, Type componentType) {
+	ArrayHandler(@SuppressWarnings("unused") Class< ? > rawClass, Type componentType) {
 		this.componentType = componentType;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java b/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
index 3d00cdc..23605bf 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/CharacterHandler.java
@@ -8,7 +8,7 @@
 	@Override
 	void encode(Encoder app, Object object, Map<Object,Type> visited) throws Exception {
 		Character c = (Character) object;
-		int v = (int) c.charValue();
+		int v = c.charValue();
 		app.append(v + "");
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java b/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
index 0ebfc62..aacbb0a 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/CollectionHandler.java
@@ -48,7 +48,6 @@
 		app.append("]");
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	Object decodeArray(Decoder r) throws Exception {
 		Collection<Object> c = (Collection<Object>) rawClass.newInstance();
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
index 703331d..09b6a7f 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Decoder.java
@@ -67,7 +67,6 @@
 		return digest.digest();
 	}
 
-	@SuppressWarnings("unchecked")
 	public <T> T get(Class<T> clazz) throws Exception {
 		return (T) codec.decode(clazz, this);
 	}
@@ -80,7 +79,6 @@
 		return codec.decode(null, this);
 	}
 
-	@SuppressWarnings("unchecked")
 	public <T> T get(TypeReference<T> ref) throws Exception {
 		return (T) codec.decode(ref.getType(), this);
 	}
diff --git a/bundleplugin/src/main/java/aQute/lib/json/Handler.java b/bundleplugin/src/main/java/aQute/lib/json/Handler.java
index f002f50..c5e8b17 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/Handler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/Handler.java
@@ -7,23 +7,23 @@
 abstract class Handler {
 	abstract void encode(Encoder app, Object object, Map<Object,Type> visited) throws IOException, Exception;
 
-	Object decodeObject(Decoder isr) throws Exception {
+	Object decodeObject(@SuppressWarnings("unused") Decoder isr) throws Exception {
 		throw new UnsupportedOperationException("Cannot be mapped to object " + this);
 	}
 
-	Object decodeArray(Decoder isr) throws Exception {
+	Object decodeArray(@SuppressWarnings("unused") Decoder isr) throws Exception {
 		throw new UnsupportedOperationException("Cannot be mapped to array " + this);
 	}
 
-	Object decode(String s) throws Exception {
+	Object decode(@SuppressWarnings("unused") String s) throws Exception {
 		throw new UnsupportedOperationException("Cannot be mapped to string " + this);
 	}
 
-	Object decode(Number s) throws Exception {
+	Object decode(@SuppressWarnings("unused") Number s) throws Exception {
 		throw new UnsupportedOperationException("Cannot be mapped to number " + this);
 	}
 
-	Object decode(boolean s) {
+	Object decode(@SuppressWarnings("unused") boolean s) {
 		throw new UnsupportedOperationException("Cannot be mapped to boolean " + this);
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java b/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
index 4a12c02..349737a 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/MapHandler.java
@@ -49,7 +49,6 @@
 		app.append("}");
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	Object decodeObject(Decoder r) throws Exception {
 		assert r.current() == '{';
diff --git a/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java b/bundleplugin/src/main/java/aQute/lib/json/ObjectHandler.java
index 50aaac0..9b297b7 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(@SuppressWarnings("unused") JSONCodec codec, Class< ? > c) throws Exception {
 		rawClass = c;
 		fields = c.getFields();
 
@@ -74,7 +74,6 @@
 		app.append("}");
 	}
 
-	@SuppressWarnings("unchecked")
 	@Override
 	Object decodeObject(Decoder r) throws Exception {
 		assert r.current() == '{';
diff --git a/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java b/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
index 8ebfee2..0971826 100644
--- a/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
+++ b/bundleplugin/src/main/java/aQute/lib/json/StringHandler.java
@@ -103,7 +103,7 @@
 	 * @return
 	 * @throws Exception
 	 */
-	private Object collect(Decoder isr, char close) throws Exception {
+	private Object collect(Decoder isr, @SuppressWarnings("unused") char close) throws Exception {
 		boolean instring = false;
 		int level = 1;
 		StringBuilder sb = new StringBuilder();
diff --git a/bundleplugin/src/main/java/aQute/lib/justif/Justif.java b/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
index 841d009..26319e8 100644
--- a/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
+++ b/bundleplugin/src/main/java/aQute/lib/justif/Justif.java
@@ -5,7 +5,7 @@
 public class Justif {
 	int[]	tabs;
 
-	public Justif(int width, int... tabs) {
+	public Justif(@SuppressWarnings("unused") int width, int... tabs) {
 		this.tabs = tabs;
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java b/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
index 3c0c9b2..4f26d94 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Analyzer.java
@@ -47,7 +47,7 @@
 
 public class Analyzer extends Processor {
 	private final SortedSet<Clazz.JAVA>				ees						= new TreeSet<Clazz.JAVA>();
-	static Manifest									bndInfo;
+	static Properties								bndInfo;
 
 	// Bundle parameters
 	private Jar										dot;
@@ -139,7 +139,7 @@
 				for (String dir : current.getDirectories().keySet()) {
 					PackageRef packageRef = getPackageRef(dir);
 					Resource resource = current.getResource(dir + "/packageinfo");
-					setPackageInfo(packageRef, resource, classpathExports);
+					getExportVersionsFromPackageInfo(packageRef, resource, classpathExports);
 				}
 			}
 
@@ -149,6 +149,7 @@
 			if (s != null) {
 				activator = getTypeRefFromFQN(s);
 				referTo(activator);
+				trace("activator %s %s", s, activator);
 			}
 
 			// Execute any plugins
@@ -560,7 +561,7 @@
 		return value.trim();
 	}
 
-	public String _bsn(String args[]) {
+	public String _bsn(@SuppressWarnings("unused") String args[]) {
 		return getBsn();
 	}
 
@@ -643,11 +644,11 @@
 	 * @return version or unknown.
 	 */
 	public String getBndVersion() {
-		return getBndInfo("Bundle-Version", "<unknown>");
+		return getBndInfo("version", "<unknown>");
 	}
 
 	public long getBndLastModified() {
-		String time = getBndInfo("Bnd-LastModified", "0");
+		String time = getBndInfo("lastmodified", "0");
 		try {
 			return Long.parseLong(time);
 		}
@@ -660,13 +661,25 @@
 	public String getBndInfo(String key, String defaultValue) {
 		if (bndInfo == null) {
 			try {
-				bndInfo = new Manifest(getClass().getResourceAsStream("META-INF/MANIFEST.MF"));
+				Properties bndInfoLocal = new Properties();
+				URL url = Analyzer.class.getResource("bnd.info");
+				if (url != null) {
+					InputStream in = url.openStream();
+					try {
+						bndInfoLocal.load(in);
+					}
+					finally {
+						in.close();
+					}
+				}
+				bndInfo = bndInfoLocal;
 			}
 			catch (Exception e) {
+				e.printStackTrace();
 				return defaultValue;
 			}
 		}
-		String value = bndInfo.getMainAttributes().getValue(key);
+		String value = bndInfo.getProperty(key);
 		if (value == null)
 			return defaultValue;
 		return value;
@@ -1345,38 +1358,43 @@
 	 * @param value
 	 * @throws Exception
 	 */
-	void setPackageInfo(PackageRef packageRef, Resource r, Packages classpathExports) throws Exception {
+	void getExportVersionsFromPackageInfo(PackageRef packageRef, Resource r, Packages classpathExports) throws Exception {
 		if (r == null)
 			return;
 
 		Properties p = new Properties();
-		InputStream in = r.openInputStream();
 		try {
-			p.load(in);
-		}
-		finally {
-			in.close();
-		}
-		Attrs map = classpathExports.get(packageRef);
-		if (map == null) {
-			classpathExports.put(packageRef, map = new Attrs());
-		}
-		for (Enumeration<String> t = (Enumeration<String>) p.propertyNames(); t.hasMoreElements();) {
-			String key = t.nextElement();
-			String value = map.get(key);
-			if (value == null) {
-				value = p.getProperty(key);
-
-				// Messy, to allow directives we need to
-				// allow the value to start with a ':' since we cannot
-				// encode this in a property name
-
-				if (value.startsWith(":")) {
-					key = key + ":";
-					value = value.substring(1);
-				}
-				map.put(key, value);
+			InputStream in = r.openInputStream();
+			try {
+				p.load(in);
 			}
+			finally {
+				in.close();
+			}
+			Attrs map = classpathExports.get(packageRef);
+			if (map == null) {
+				classpathExports.put(packageRef, map = new Attrs());
+			}
+			for (Enumeration<String> t = (Enumeration<String>) p.propertyNames(); t.hasMoreElements();) {
+				String key = t.nextElement();
+				String value = map.get(key);
+				if (value == null) {
+					value = p.getProperty(key);
+
+					// Messy, to allow directives we need to
+					// allow the value to start with a ':' since we cannot
+					// encode this in a property name
+
+					if (value.startsWith(":")) {
+						key = key + ":";
+						value = value.substring(1);
+					}
+					map.put(key, value);
+				}
+			}
+		}
+		catch (Exception e) {
+			msgs.NoSuchFile_(r);
 		}
 	}
 
@@ -1628,7 +1646,7 @@
 						// to overlap
 						if (!packageRef.isMetaData()) {
 							Resource pinfo = jar.getResource(prefix + packageRef.getPath() + "/packageinfo");
-							setPackageInfo(packageRef, pinfo, classpathExports);
+							getExportVersionsFromPackageInfo(packageRef, pinfo, classpathExports);
 						}
 					}
 				}
@@ -1677,7 +1695,7 @@
 							contained.put(packageRef);
 							if (!packageRef.isMetaData()) {
 								Resource pinfo = jar.getResource(prefix + packageRef.getPath() + "/packageinfo");
-								setPackageInfo(packageRef, pinfo, classpathExports);
+								getExportVersionsFromPackageInfo(packageRef, pinfo, classpathExports);
 							}
 						}
 						if (info != null)
@@ -1903,39 +1921,12 @@
 	final static String	DEFAULT_PROVIDER_POLICY	= "${range;[==,=+)}";
 	final static String	DEFAULT_CONSUMER_POLICY	= "${range;[==,+)}";
 
-	@SuppressWarnings("deprecation")
 	public String getVersionPolicy(boolean implemented) {
 		if (implemented) {
-			String s = getProperty(PROVIDER_POLICY);
-			if (s != null)
-				return s;
-
-			s = getProperty(VERSIONPOLICY_IMPL);
-			if (s != null)
-				return s;
-
-			return getProperty(VERSIONPOLICY, DEFAULT_PROVIDER_POLICY);
+			return getProperty(PROVIDER_POLICY, DEFAULT_PROVIDER_POLICY);
 		}
-		String s = getProperty(CONSUMER_POLICY);
-		if (s != null)
-			return s;
 
-		s = getProperty(VERSIONPOLICY_USES);
-		if (s != null)
-			return s;
-
-		return getProperty(VERSIONPOLICY, DEFAULT_CONSUMER_POLICY);
-
-		// String vp = implemented ? getProperty(VERSIONPOLICY_IMPL) :
-		// getProperty(VERSIONPOLICY_USES);
-		//
-		// if (vp != null)
-		// return vp;
-		//
-		// if (implemented)
-		// return getProperty(VERSIONPOLICY_IMPL, "{$range;[==,=+}");
-		// else
-		// return getProperty(VERSIONPOLICY, "${range;[==,+)}");
+		return getProperty(CONSUMER_POLICY, DEFAULT_CONSUMER_POLICY);
 	}
 
 	/**
@@ -2303,7 +2294,7 @@
 		return ees.first();
 	}
 
-	public String _ee(String args[]) {
+	public String _ee(@SuppressWarnings("unused") String args[]) {
 		return getLowestEE().getEE();
 	}
 
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
index b44118a..f49d6e3 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Builder.java
@@ -247,7 +247,7 @@
 		changedFile(f);
 	}
 
-	protected void changedFile(File f) {}
+	protected void changedFile(@SuppressWarnings("unused") File f) {}
 
 	/**
 	 * Sign the jar file. -sign : <alias> [ ';' 'password:=' <password> ] [ ';'
@@ -256,7 +256,7 @@
 	 * @return
 	 */
 
-	void sign(Jar jar) throws Exception {
+	void sign(@SuppressWarnings("unused") Jar jar) throws Exception {
 		String signing = getProperty("-sign");
 		if (signing == null)
 			return;
@@ -283,6 +283,7 @@
 		Parameters conditionals = getParameters(CONDITIONAL_PACKAGE);
 		if (conditionals.isEmpty())
 			return null;
+		trace("do Conditional Package %s", conditionals);
 		Instructions instructions = new Instructions(conditionals);
 
 		Collection<PackageRef> referred = instructions.select(getReferred().keySet(), false);
@@ -294,7 +295,10 @@
 			for (Jar cpe : getClasspath()) {
 				Map<String,Resource> map = cpe.getDirectories().get(pref.getPath());
 				if (map != null) {
-					jar.addDirectory(map, false);
+					copy(jar, cpe, pref.getPath(), false);
+// Now use copy so that bnd.info is processed, next line should be 
+// removed in the future TODO
+//					jar.addDirectory(map, false);
 					break;
 				}
 			}
@@ -429,7 +433,7 @@
 		return sourcePath;
 	}
 
-	private void doVerify(Jar dot) throws Exception {
+	private void doVerify(@SuppressWarnings("unused") Jar dot) throws Exception {
 		Verifier verifier = new Verifier(this);
 		// Give the verifier the benefit of our analysis
 		// prevents parsing the files twice
@@ -608,8 +612,18 @@
 	 * @param overwriteResource
 	 */
 	private void copy(Jar dest, Jar srce, String path, boolean overwrite) {
+		trace("copy d=" + dest + " s=" + srce +" p="+ path);
 		dest.copy(srce, path, overwrite);
-
+		
+		// bnd.info sources must be preprocessed
+		String bndInfoPath = path + "/bnd.info";
+		Resource r = dest.getResource(bndInfoPath);
+		if ( r != null && !(r instanceof PreprocessResource)) {
+			trace("preprocessing bnd.info");
+			PreprocessResource pp = new PreprocessResource(this, r);
+			dest.putResource(bndInfoPath, pp);
+		}
+		
 		if (hasSources()) {
 			String srcPath = "OSGI-OPT/src/" + path;
 			Map<String,Resource> srcContents = srce.getDirectories().get(srcPath);
@@ -926,7 +940,7 @@
 		}
 	}
 
-	private void noSuchFile(Jar jar, String clause, Map<String,String> extra, String source, String destinationPath)
+	private void noSuchFile(Jar jar, @SuppressWarnings("unused") String clause, Map<String,String> extra, String source, String destinationPath)
 			throws Exception {
 		Jar src = getJarFromName(source, "Include-Resource " + source);
 		if (src != null) {
@@ -1398,7 +1412,7 @@
 	 * @throws Exception
 	 */
 
-	public void doDiff(Jar dot) throws Exception {
+	public void doDiff(@SuppressWarnings("unused") Jar dot) throws Exception {
 		Parameters diffs = parseHeader(getProperty("-diff"));
 		if (diffs.isEmpty())
 			return;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java b/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
index 7c3d759..04a8406 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/ClassDataCollector.java
@@ -3,30 +3,30 @@
 import aQute.lib.osgi.Descriptors.TypeRef;
 
 public class ClassDataCollector {
-	public void classBegin(int access, TypeRef name) {}
+	public void classBegin(@SuppressWarnings("unused") int access, @SuppressWarnings("unused") TypeRef name) {}
 
 	public boolean classStart(int access, TypeRef className) {
 		classBegin(access, className);
 		return true;
 	}
 
-	public void extendsClass(TypeRef zuper) throws Exception {}
+	public void extendsClass(@SuppressWarnings("unused") TypeRef zuper) throws Exception {}
 
-	public void implementsInterfaces(TypeRef[] interfaces) throws Exception {}
+	public void implementsInterfaces(@SuppressWarnings("unused") TypeRef[] interfaces) throws Exception {}
 
-	public void addReference(TypeRef ref) {}
+	public void addReference(@SuppressWarnings("unused") TypeRef ref) {}
 
-	public void annotation(Annotation annotation) {}
+	public void annotation(@SuppressWarnings("unused") Annotation annotation) {}
 
-	public void parameter(int p) {}
+	public void parameter(@SuppressWarnings("unused") int p) {}
 
-	public void method(Clazz.MethodDef defined) {}
+	public void method(@SuppressWarnings("unused") Clazz.MethodDef defined) {}
 
-	public void field(Clazz.FieldDef defined) {}
+	public void field(@SuppressWarnings("unused") Clazz.FieldDef defined) {}
 
-	public void reference(Clazz.MethodDef referenced) {}
+	public void reference(@SuppressWarnings("unused") Clazz.MethodDef referenced) {}
 
-	public void reference(Clazz.FieldDef referenced) {}
+	public void reference(@SuppressWarnings("unused") Clazz.FieldDef referenced) {}
 
 	public void classEnd() throws Exception {}
 
@@ -61,21 +61,24 @@
 	 *            The access flags
 	 * @throws Exception
 	 */
-	public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, int innerClassAccessFlags)
+	public void innerClass(TypeRef innerClass, TypeRef outerClass, String innerName, @SuppressWarnings("unused") int innerClassAccessFlags)
 			throws Exception {}
 
-	public void signature(String signature) {}
+	public void signature(@SuppressWarnings("unused") String signature) {}
 
-	public void constant(Object object) {}
+	public void constant(@SuppressWarnings("unused") Object object) {}
 
 	public void memberEnd() {}
 
-	public void version(int minor, int major) {
+	public void version(@SuppressWarnings("unused") int minor, @SuppressWarnings("unused") int major) {
 		// TODO Auto-generated method stub
 
 	}
 
-	public void referenceMethod(int access, TypeRef className, String method, String descriptor) {
+	public void referenceMethod(@SuppressWarnings("unused")
+	int access, @SuppressWarnings("unused")
+	TypeRef className, @SuppressWarnings("unused")
+	String method, @SuppressWarnings("unused") 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 d54b084..87ce8a5 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Clazz.java
@@ -69,7 +69,7 @@
 			return major >= J2SE5.major;
 		}
 
-		public static JAVA getJava(int major, int minor) {
+		public static JAVA getJava(int major, @SuppressWarnings("unused") int minor) {
 			for (JAVA j : JAVA.values()) {
 				if (j.major == major)
 					return j;
@@ -629,7 +629,7 @@
 			pool[poolIndex] = intPool[poolIndex];
 	}
 
-	protected void pool(Object[] pool, int[] intPool) {}
+	protected void pool(@SuppressWarnings("unused") Object[] pool, @SuppressWarnings("unused") int[] intPool) {}
 
 	/**
 	 * @param in
@@ -1127,8 +1127,7 @@
 		}
 		if (collect)
 			return new Annotation(name, elements, member, policy);
-		else
-			return null;
+		return null;
 	}
 
 	private Object doElementValue(DataInputStream in, ElementType member, RetentionPolicy policy, boolean collect)
@@ -1572,8 +1571,7 @@
 	public int getAccess() {
 		if (innerAccess == -1)
 			return accessx;
-		else
-			return innerAccess;
+		return innerAccess;
 	}
 
 	public TypeRef getClassName() {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
index 0fa43fe..eefc1e2 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/CommandResource.java
@@ -48,7 +48,7 @@
 				cmd.var("PATH", path);
 				domain.trace("PATH: %s", path);
 			}
-			OutputStreamWriter osw = new OutputStreamWriter(out);
+			OutputStreamWriter osw = new OutputStreamWriter(out, "UTF-8");
 			int result = cmd.execute(command, stdout, errors);
 			osw.append(stdout);
 			osw.flush();
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
index df0bbf0..7454087 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Constants.java
@@ -52,6 +52,11 @@
 	String							CREATED_BY									= "Created-By";
 	String							TOOL										= "Tool";
 	String							TESTCASES									= "Test-Cases";
+        /**
+         * @deprecated Use {@link Constants#TESTCASES}.
+         */
+        @Deprecated
+        String                                                  TESTSUITES                                                                      = "Test-Suites";
 	String							SIGNATURE_TEST								= "-signaturetest";
 
 	String							headers[]									= {
@@ -90,8 +95,6 @@
 	String							NOEXTRAHEADERS								= "-noextraheaders";
 	String							NOMANIFEST									= "-nomanifest";
 	String							NOUSES										= "-nouses";
-	@Deprecated
-	String							NOPE										= "-nope";
 	String							NOBUNDLES									= "-nobundles";
 	String							PEDANTIC									= "-pedantic";
 	String							PLUGIN										= "-plugin";
@@ -106,6 +109,7 @@
 	String							RUNPROPERTIES								= "-runproperties";
 	String							RUNSYSTEMPACKAGES							= "-runsystempackages";
 	String							RUNBUNDLES									= "-runbundles";
+	String							RUNREPOS									= "-runrepos";
 	String							RUNPATH										= "-runpath";
 	String							RUNSTORAGE									= "-runstorage";
 	String							RUNBUILDS									= "-runbuilds";
@@ -126,14 +130,8 @@
 	String							TESTCONTINUOUS								= "-testcontinuous";
 	String							UNDERTEST									= "-undertest";
 	String							VERBOSE										= "-verbose";
-	@Deprecated
-	String							VERSIONPOLICY_IMPL							= "-versionpolicy-impl";
-	@Deprecated
-	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";
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
index c92de90..bfb80bb 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instruction.java
@@ -88,8 +88,8 @@
 							sb.append("(\\..*)?");
 							wildcards = true;
 							break loop;
-						} else
-							sb.append("\\.");
+						}
+						sb.append("\\.");
 
 						break;
 					case '*' :
@@ -130,8 +130,7 @@
 
 		if (literal)
 			return match.equals(value);
-		else
-			return getMatcher(value).matches();
+		return getMatcher(value).matches();
 	}
 
 	public boolean isNegated() {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
index 679c374..6ac56dd 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Instructions.java
@@ -48,7 +48,7 @@
 		if (map == null)
 			return false;
 
-		return map.containsKey((Instruction) name);
+		return map.containsKey(name);
 	}
 
 	public boolean containsValue(Attrs value) {
@@ -64,7 +64,7 @@
 		if (map == null)
 			return false;
 
-		return map.containsValue((Attrs) value);
+		return map.containsValue(value);
 	}
 
 	public Set<java.util.Map.Entry<Instruction,Attrs>> entrySet() {
@@ -80,7 +80,7 @@
 		if (map == null)
 			return null;
 
-		return map.get((Instruction) key);
+		return map.get(key);
 	}
 
 	public Attrs get(Instruction key) {
@@ -109,11 +109,11 @@
 	}
 
 	public void putAll(Map< ? extends Instruction, ? extends Attrs> map) {
-		if (this.map == null)
+		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);
 	}
 
@@ -123,7 +123,7 @@
 		if (map == null)
 			return null;
 
-		return map.remove((Instruction) var0);
+		return map.remove(var0);
 	}
 
 	public Attrs remove(Instruction var0) {
@@ -212,8 +212,7 @@
 			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 032a7d1..76a4b0d 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Jar.java
@@ -78,11 +78,9 @@
 		String name = f.getName();
 		if (name.equals("bin") || name.equals("src"))
 			return f.getParentFile().getName();
-		else {
-			if (name.endsWith(".jar"))
-				name = name.substring(0, name.length() - 4);
-			return name;
-		}
+		if (name.endsWith(".jar"))
+			name = name.substring(0, name.length() - 4);
+		return name;
 	}
 
 	public Jar(String string, InputStream resourceAsStream) throws IOException {
@@ -455,7 +453,7 @@
 
 			for (Map.Entry< ? , ? > entry : org.getAttributes(name).entrySet()) {
 				String nice = clean((String) entry.getValue());
-				attrs.put((Attributes.Name) entry.getKey(), nice);
+				attrs.put(entry.getKey(), nice);
 			}
 		}
 		return result;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java b/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
index 36c16dd..3e109d6 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Macro.java
@@ -190,8 +190,7 @@
 			Processor parent = source.start.getParent();
 			if (parent != null)
 				return parent.getProperty(varname);
-			else
-				return null;
+			return null;
 		}
 
 		Processor rover = domain;
@@ -262,11 +261,11 @@
 		return Processor.join(set, ",");
 	}
 
-	public String _pathseparator(String args[]) {
+	public String _pathseparator(@SuppressWarnings("unused") String args[]) {
 		return File.pathSeparator;
 	}
 
-	public String _separator(String args[]) {
+	public String _separator(@SuppressWarnings("unused") String args[]) {
 		return File.separator;
 	}
 
@@ -331,11 +330,10 @@
 
 		if (args.length > 3)
 			return args[3];
-		else
-			return "";
+		return "";
 	}
 
-	public String _now(String args[]) {
+	public String _now(@SuppressWarnings("unused") String args[]) {
 		return new Date().toString();
 	}
 
@@ -476,19 +474,18 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${dir;...}");
 			return null;
-		} else {
-			String del = "";
-			StringBuilder sb = new StringBuilder();
-			for (int i = 1; i < args.length; i++) {
-				File f = domain.getFile(args[i]);
-				if (f.exists() && f.getParentFile().exists()) {
-					sb.append(del);
-					sb.append(f.getParentFile().getAbsolutePath());
-					del = ",";
-				}
-			}
-			return sb.toString();
 		}
+		String del = "";
+		StringBuilder sb = new StringBuilder();
+		for (int i = 1; i < args.length; i++) {
+			File f = domain.getFile(args[i]);
+			if (f.exists() && f.getParentFile().exists()) {
+				sb.append(del);
+				sb.append(f.getParentFile().getAbsolutePath());
+				del = ",";
+			}
+		}
+		return sb.toString();
 
 	}
 
@@ -496,19 +493,18 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${basename;...}");
 			return null;
-		} else {
-			String del = "";
-			StringBuilder sb = new StringBuilder();
-			for (int i = 1; i < args.length; i++) {
-				File f = domain.getFile(args[i]);
-				if (f.exists() && f.getParentFile().exists()) {
-					sb.append(del);
-					sb.append(f.getName());
-					del = ",";
-				}
-			}
-			return sb.toString();
 		}
+		String del = "";
+		StringBuilder sb = new StringBuilder();
+		for (int i = 1; i < args.length; i++) {
+			File f = domain.getFile(args[i]);
+			if (f.exists() && f.getParentFile().exists()) {
+				sb.append(del);
+				sb.append(f.getName());
+				del = ",";
+			}
+		}
+		return sb.toString();
 
 	}
 
@@ -516,14 +512,13 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${isfile;...}");
 			return null;
-		} else {
-			boolean isfile = true;
-			for (int i = 1; i < args.length; i++) {
-				File f = new File(args[i]).getAbsoluteFile();
-				isfile &= f.isFile();
-			}
-			return isfile ? "true" : "false";
 		}
+		boolean isfile = true;
+		for (int i = 1; i < args.length; i++) {
+			File f = new File(args[i]).getAbsoluteFile();
+			isfile &= f.isFile();
+		}
+		return isfile ? "true" : "false";
 
 	}
 
@@ -531,14 +526,13 @@
 		if (args.length < 2) {
 			domain.warning("Need at least one file name for ${isdir;...}");
 			return null;
-		} else {
-			boolean isdir = true;
-			for (int i = 1; i < args.length; i++) {
-				File f = new File(args[i]).getAbsoluteFile();
-				isdir &= f.isDirectory();
-			}
-			return isdir ? "true" : "false";
 		}
+		boolean isdir = true;
+		for (int i = 1; i < args.length; i++) {
+			File f = new File(args[i]).getAbsoluteFile();
+			isdir &= f.isDirectory();
+		}
+		return isdir ? "true" : "false";
 
 	}
 
@@ -611,7 +605,7 @@
 		return Processor.join(result, ",");
 	}
 
-	public String _currenttime(String args[]) {
+	public String _currenttime(@SuppressWarnings("unused") String args[]) {
 		return Long.toString(System.currentTimeMillis());
 	}
 
@@ -849,7 +843,7 @@
 		}
 	}
 
-	public static void verifyCommand(String args[], String help, Pattern[] patterns, int low, int high) {
+	public static void verifyCommand(String args[], @SuppressWarnings("unused") String help, Pattern[] patterns, int low, int high) {
 		String message = "";
 		if (args.length > high) {
 			message = "too many arguments";
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java b/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
index fae4597..64e4a4e 100644
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Packages.java
@@ -35,7 +35,7 @@
 		if (map == null)
 			return false;
 
-		return map.containsKey((PackageRef) name);
+		return map.containsKey(name);
 	}
 
 	public boolean containsValue(Attrs value) {
@@ -51,7 +51,7 @@
 		if (map == null)
 			return false;
 
-		return map.containsValue((Attrs) value);
+		return map.containsValue(value);
 	}
 
 	public Set<java.util.Map.Entry<PackageRef,Attrs>> entrySet() {
@@ -67,7 +67,7 @@
 		if (map == null)
 			return null;
 
-		return map.get((PackageRef) key);
+		return map.get(key);
 	}
 
 	public Attrs get(PackageRef key) {
@@ -106,11 +106,11 @@
 	}
 
 	public void putAll(Map< ? extends PackageRef, ? extends Attrs> map) {
-		if (this.map == null)
+		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);
 	}
 
@@ -127,7 +127,7 @@
 		if (map == null)
 			return null;
 
-		return map.remove((PackageRef) var0);
+		return map.remove(var0);
 	}
 
 	public Attrs remove(PackageRef var0) {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
index d7179d6..608e9a0 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Processor.java
@@ -58,9 +58,9 @@
 		properties = new Properties(parent);
 	}
 
-	public Processor(Processor parent) {
-		this(parent.properties);
-		this.parent = parent;
+	public Processor(Processor child) {
+		this(child.properties);
+		this.parent = child;
 	}
 
 	public void setParent(Processor processor) {
@@ -77,8 +77,7 @@
 	public Processor getTop() {
 		if (parent == null)
 			return this;
-		else
-			return parent.getTop();
+		return parent.getTop();
 	}
 
 	public void getInfo(Reporter processor, String prefix) {
@@ -111,8 +110,7 @@
 		Processor p = current.get();
 		if (p == null)
 			return this;
-		else
-			return p;
+		return p;
 	}
 
 	public void warning(String string, Object... args) {
@@ -338,7 +336,7 @@
 				key = removeDuplicateMarker(key);
 
 				try {
-					Class< ? > c = (Class< ? >) loader.loadClass(key);
+					Class< ? > c = loader.loadClass(key);
 					Object plugin = c.newInstance();
 					customize(plugin, entry.getValue());
 					list.add(plugin);
@@ -453,7 +451,7 @@
 		toBeClosed.clear();
 	}
 
-	public String _basedir(String args[]) {
+	public String _basedir(@SuppressWarnings("unused") String args[]) {
 		if (base == null)
 			throw new IllegalArgumentException("No base dir set");
 
@@ -859,7 +857,7 @@
 		return printClauses(exports, false);
 	}
 
-	public static String printClauses(Map< ? , ? extends Map< ? , ? >> exports, boolean checkMultipleVersions)
+	public static String printClauses(Map< ? , ? extends Map< ? , ? >> exports, @SuppressWarnings("unused") boolean checkMultipleVersions)
 			throws IOException {
 		StringBuilder sb = new StringBuilder();
 		String del = "";
@@ -919,8 +917,7 @@
 	public Macro getReplacer() {
 		if (replacer == null)
 			return replacer = new Macro(this, getMacroDomains());
-		else
-			return replacer;
+		return replacer;
 	}
 
 	/**
@@ -961,7 +958,7 @@
 		return result;
 	}
 
-	public boolean updateModified(long time, String reason) {
+	public boolean updateModified(long time, @SuppressWarnings("unused") String reason) {
 		if (time > lastModified) {
 			lastModified = time;
 			return true;
@@ -1127,8 +1124,7 @@
 	public String normalize(String f) {
 		if (f.startsWith(base.getAbsolutePath() + "/"))
 			return f.substring(base.getAbsolutePath().length() + 1);
-		else
-			return f;
+		return f;
 	}
 
 	public String normalize(File f) {
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java b/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
index 27026ae..2759049 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/Verifier.java
@@ -42,7 +42,7 @@
 		String	name;
 		int		target;
 
-		EE(String name, int source, int target) {
+		EE(String name, @SuppressWarnings("unused") int source, int target) {
 			this.name = name;
 			this.target = target;
 		}
@@ -488,7 +488,7 @@
 		}
 	}
 
-	private void verifyType(Attrs.Type type, String string) {
+	private void verifyType(@SuppressWarnings("unused") Attrs.Type type, @SuppressWarnings("unused") String string) {
 
 	}
 
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 2244fd2..cb511e7 100755
--- a/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/eclipse/EclipseClasspath.java
@@ -50,7 +50,7 @@
 	 * @throws IOException
 	 */
 
-	public EclipseClasspath(Reporter reporter, File workspace, File project, int options) throws Exception {
+	public EclipseClasspath(Reporter reporter, File workspace, File project, @SuppressWarnings("unused") int options) throws Exception {
 		this.project = project.getCanonicalFile();
 		this.workspace = workspace.getCanonicalFile();
 		this.reporter = reporter;
@@ -184,8 +184,8 @@
 				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);
+			}
+			reporter.error("Can't find replacement variable for: " + path);
 		} else
 			reporter.error("Cant split variable path: " + path);
 		return null;
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReq.java b/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReq.java
new file mode 100644
index 0000000..3f07825
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReq.java
@@ -0,0 +1,97 @@
+package aQute.lib.osgi.resource;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
+
+class CapReq implements Capability, Requirement {
+	
+	static enum MODE { Capability, Requirement }
+	
+	private final MODE mode;
+	private final String	namespace;
+	private final Resource	resource;
+	private final Map<String,String>	directives;
+	private final Map<String,Object>	attributes;
+
+	CapReq(MODE mode, String namespace, Resource resource, Map<String, String> directives, Map<String, Object> attributes) {
+		this.mode = mode;
+		this.namespace = namespace;
+		this.resource = resource;
+		this.directives = new HashMap<String,String>(directives);
+		this.attributes = new HashMap<String,Object>(attributes);
+	}
+
+	public String getNamespace() {
+		return namespace;
+	}
+
+	public Map<String,String> getDirectives() {
+		return Collections.unmodifiableMap(directives);
+	}
+
+	public Map<String,Object> getAttributes() {
+		return Collections.unmodifiableMap(attributes);
+	}
+
+	public Resource getResource() {
+		return resource;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((attributes == null) ? 0 : attributes.hashCode());
+		result = prime * result + ((directives == null) ? 0 : directives.hashCode());
+		result = prime * result + ((mode == null) ? 0 : mode.hashCode());
+		result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+		result = prime * result + ((resource == null) ? 0 : resource.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CapReq other = (CapReq) obj;
+		if (attributes == null) {
+			if (other.attributes != null)
+				return false;
+		} else if (!attributes.equals(other.attributes))
+			return false;
+		if (directives == null) {
+			if (other.directives != null)
+				return false;
+		} else if (!directives.equals(other.directives))
+			return false;
+		if (mode != other.mode)
+			return false;
+		if (namespace == null) {
+			if (other.namespace != null)
+				return false;
+		} else if (!namespace.equals(other.namespace))
+			return false;
+		if (resource == null) {
+			if (other.resource != null)
+				return false;
+		} else if (!resource.equals(other.resource))
+			return false;
+		return true;
+	}
+
+	@Override
+	public String toString() {
+		return mode + " [namespace=" + namespace + ", resource=" + System.identityHashCode(resource) + ", directives="
+				+ directives + ", attributes=" + attributes + "]";
+	}
+
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReqBuilder.java b/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReqBuilder.java
new file mode 100644
index 0000000..654c7de
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/CapReqBuilder.java
@@ -0,0 +1,74 @@
+package aQute.lib.osgi.resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Namespace;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
+
+import aQute.lib.osgi.resource.CapReq.MODE;
+import aQute.libg.filters.AndFilter;
+import aQute.libg.filters.Filter;
+import aQute.libg.filters.SimpleFilter;
+import aQute.libg.version.VersionRange;
+
+public class CapReqBuilder {
+
+	private final String				namespace;
+	private Resource					resource;
+	private final Map<String,Object>	attributes	= new HashMap<String,Object>();
+	private final Map<String,String>	directives	= new HashMap<String,String>();
+
+	public CapReqBuilder(String namespace) {
+		this.namespace = namespace;
+	}
+	
+	public String getNamespace() {
+		return namespace;
+	}
+	
+	public CapReqBuilder setResource(Resource resource) {
+		this.resource = resource;
+		return this;
+	}
+
+	public CapReqBuilder addAttribute(String name, Object value) {
+		attributes.put(name, value);
+		return this;
+	}
+
+	public CapReqBuilder addDirective(String name, String value) {
+		directives.put(name, value);
+		return this;
+	}
+	
+	public Capability buildCapability() {
+		// TODO check the thrown exception
+		if (resource == null) throw new IllegalStateException("Cannot build Capability with null Resource.");
+		return new CapReq(MODE.Capability, namespace, resource, directives, attributes);
+	}
+	
+	public Requirement buildRequirement() {
+		// TODO check the thrown exception
+		if (resource == null) throw new IllegalStateException("Cannot build Requirement with null Resource.");
+		return new CapReq(MODE.Requirement, namespace, resource, directives, attributes);
+	}
+
+	public Requirement buildSyntheticRequirement() {
+		return new CapReq(MODE.Requirement, namespace, null, directives, attributes);
+	}
+	
+	public static final CapReqBuilder createPackageRequirement(String pkgName, VersionRange range) {
+		Filter filter;
+		SimpleFilter pkgNameFilter = new SimpleFilter(PackageNamespace.PACKAGE_NAMESPACE, pkgName);
+		if (range != null)
+			filter = new AndFilter().addChild(pkgNameFilter).addChild(Filters.fromVersionRange(range));
+		else
+			filter = pkgNameFilter;
+		
+		return new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString());
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/Filters.java b/bundleplugin/src/main/java/aQute/lib/osgi/resource/Filters.java
new file mode 100644
index 0000000..20af48d
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/Filters.java
@@ -0,0 +1,42 @@
+package aQute.lib.osgi.resource;
+
+import aQute.libg.filters.AndFilter;
+import aQute.libg.filters.Filter;
+import aQute.libg.filters.NotFilter;
+import aQute.libg.filters.Operator;
+import aQute.libg.filters.SimpleFilter;
+import aQute.libg.version.VersionRange;
+
+public class Filters {
+	
+	public static Filter fromVersionRange(VersionRange range) {
+		return fromVersionRange(range, "version");
+	}
+	
+	public static Filter fromVersionRange(VersionRange range, @SuppressWarnings("unused") String versionAttr) {
+		if (range == null)
+			return null;
+		
+		Filter left;
+		if (range.includeLow())
+			left = new SimpleFilter("version", Operator.GreaterThanOrEqual, range.getLow().toString());
+		else
+			left = new NotFilter(new SimpleFilter("version", Operator.LessThanOrEqual, range.getLow().toString()));
+		
+		Filter right;
+		if (!range.isRange())
+			right = null;
+		else if (range.includeHigh())
+			right = new SimpleFilter("version", Operator.LessThanOrEqual, range.getHigh().toString());
+		else
+			right = new NotFilter(new SimpleFilter("version", Operator.GreaterThanOrEqual, range.getHigh().toString()));
+		
+		Filter result;
+		if (right != null)
+			result = new AndFilter().addChild(left).addChild(right);
+		else
+			result = left;
+		
+		return result;
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceBuilder.java b/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceBuilder.java
new file mode 100644
index 0000000..cd9b982
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceBuilder.java
@@ -0,0 +1,48 @@
+package aQute.lib.osgi.resource;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
+
+public class ResourceBuilder {
+
+	private final ResourceImpl		resource		= new ResourceImpl();
+	private final List<Capability>	capabilities	= new LinkedList<Capability>();
+	private final List<Requirement>	requirements	= new LinkedList<Requirement>();
+
+	private boolean					built			= false;
+
+	public ResourceBuilder addCapability(CapReqBuilder builder) {
+		if (built)
+			throw new IllegalStateException("Resource already built");
+
+		Capability cap = builder.setResource(resource).buildCapability();
+		capabilities.add(cap);
+
+		return this;
+	}
+
+	public ResourceBuilder addRequirement(CapReqBuilder builder) {
+		if (built)
+			throw new IllegalStateException("Resource already built");
+
+		Requirement req = builder.setResource(resource).buildRequirement();
+		requirements.add(req);
+
+		return this;
+	}
+
+	public Resource build() {
+		if (built)
+			throw new IllegalStateException("Resource already built");
+		built = true;
+
+		resource.setCapabilities(capabilities);
+		resource.setRequirements(requirements);
+		return resource;
+	}
+
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceImpl.java b/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceImpl.java
new file mode 100644
index 0000000..3fa6218
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/ResourceImpl.java
@@ -0,0 +1,67 @@
+package aQute.lib.osgi.resource;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
+
+class ResourceImpl implements Resource {
+
+	private List<Capability>				allCapabilities;
+	private Map<String,List<Capability>>	capabilityMap;
+
+	private List<Requirement>				allRequirements;
+	private Map<String,List<Requirement>>	requirementMap;
+
+	void setCapabilities(List<Capability> capabilities) {
+		allCapabilities = capabilities;
+
+		capabilityMap = new HashMap<String,List<Capability>>();
+		for (Capability capability : capabilities) {
+			List<Capability> list = capabilityMap.get(capability.getNamespace());
+			if (list == null) {
+				list = new LinkedList<Capability>();
+				capabilityMap.put(capability.getNamespace(), list);
+			}
+			list.add(capability);
+		}
+	}
+
+	public List<Capability> getCapabilities(String namespace) {
+		return namespace == null ? allCapabilities : capabilityMap.get(namespace);
+	}
+
+	void setRequirements(List<Requirement> requirements) {
+		allRequirements = requirements;
+
+		requirementMap = new HashMap<String,List<Requirement>>();
+		for (Requirement requirement : requirements) {
+			List<Requirement> list = requirementMap.get(requirement.getNamespace());
+			if (list == null) {
+				list = new LinkedList<Requirement>();
+				requirementMap.put(requirement.getNamespace(), list);
+			}
+			list.add(requirement);
+		}
+	}
+
+	public List<Requirement> getRequirements(String namespace) {
+		return namespace == null ? allRequirements : requirementMap.get(namespace);
+	}
+
+	@Override
+	public String toString() {
+		StringBuilder builder = new StringBuilder();
+		builder.append("ResourceImpl [caps=");
+		builder.append(allCapabilities);
+		builder.append(", reqs=");
+		builder.append(allRequirements);
+		builder.append("]");
+		return builder.toString();
+	}
+
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/osgi/resource/packageinfo b/bundleplugin/src/main/java/aQute/lib/osgi/resource/packageinfo
new file mode 100644
index 0000000..a4f1546
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/osgi/resource/packageinfo
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/BadLocationException.java b/bundleplugin/src/main/java/aQute/lib/properties/BadLocationException.java
new file mode 100644
index 0000000..2d9207d
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/BadLocationException.java
@@ -0,0 +1,14 @@
+package aQute.lib.properties;
+
+public class BadLocationException extends Exception {
+
+	private static final long	serialVersionUID	= 1L;
+
+	public BadLocationException() {
+		super();
+	}
+
+	public BadLocationException(String var0) {
+		super(var0);
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/CopyOnWriteTextStore.java b/bundleplugin/src/main/java/aQute/lib/properties/CopyOnWriteTextStore.java
new file mode 100644
index 0000000..77bb9f6
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/CopyOnWriteTextStore.java
@@ -0,0 +1,147 @@
+package aQute.lib.properties;
+
+/**
+ * Copy-on-write <code>ITextStore</code> wrapper.
+ * <p>
+ * This implementation uses an unmodifiable text store for the initial content.
+ * Upon first modification attempt, the unmodifiable store is replaced with a
+ * modifiable instance which must be supplied in the constructor.
+ * </p>
+ * <p>
+ * This class is not intended to be subclassed.
+ * </p>
+ * 
+ * @since 3.2
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class CopyOnWriteTextStore implements ITextStore {
+
+	/**
+	 * An unmodifiable String based text store. It is not possible to modify the
+	 * content other than using {@link #set}. Trying to {@link #replace} a text
+	 * range will throw an <code>UnsupportedOperationException</code>.
+	 */
+	private static class StringTextStore implements ITextStore {
+
+		/** Represents the content of this text store. */
+		private String	fText	= "";	//$NON-NLS-1$
+
+		/**
+		 * Create an empty text store.
+		 */
+		private StringTextStore() {
+			super();
+		}
+
+		/**
+		 * Create a text store with initial content.
+		 * 
+		 * @param text
+		 *            the initial content
+		 */
+		private StringTextStore(String text) {
+			super();
+			set(text);
+		}
+
+		/*
+		 * @see org.eclipse.jface.text.ITextStore#get(int)
+		 */
+		public char get(int offset) {
+			return fText.charAt(offset);
+		}
+
+		/*
+		 * @see org.eclipse.jface.text.ITextStore#get(int, int)
+		 */
+		public String get(int offset, int length) {
+			return fText.substring(offset, offset + length);
+		}
+
+		/*
+		 * @see org.eclipse.jface.text.ITextStore#getLength()
+		 */
+		public int getLength() {
+			return fText.length();
+		}
+
+		/*
+		 * @see org.eclipse.jface.text.ITextStore#replace(int, int,
+		 * java.lang.String)
+		 */
+		public void replace(int offset, int length, String text) {
+			// modification not supported
+			throw new UnsupportedOperationException();
+		}
+
+		/*
+		 * @see org.eclipse.jface.text.ITextStore#set(java.lang.String)
+		 */
+		public void set(String text) {
+			fText = text != null ? text : ""; //$NON-NLS-1$
+		}
+
+	}
+
+	/** The underlying "real" text store */
+	protected ITextStore		fTextStore	= new StringTextStore();
+
+	/** A modifiable <code>ITextStore</code> instance */
+	private final ITextStore	fModifiableTextStore;
+
+	/**
+	 * Creates an empty text store. The given text store will be used upon first
+	 * modification attempt.
+	 * 
+	 * @param modifiableTextStore
+	 *            a modifiable <code>ITextStore</code> instance, may not be
+	 *            <code>null</code>
+	 */
+	public CopyOnWriteTextStore(ITextStore modifiableTextStore) {
+		fTextStore = new StringTextStore();
+		fModifiableTextStore = modifiableTextStore;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#get(int)
+	 */
+	public char get(int offset) {
+		return fTextStore.get(offset);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#get(int, int)
+	 */
+	public String get(int offset, int length) {
+		return fTextStore.get(offset, length);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#getLength()
+	 */
+	public int getLength() {
+		return fTextStore.getLength();
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#replace(int, int,
+	 * java.lang.String)
+	 */
+	public void replace(int offset, int length, String text) {
+		if (fTextStore != fModifiableTextStore) {
+			String content = fTextStore.get(0, fTextStore.getLength());
+			fTextStore = fModifiableTextStore;
+			fTextStore.set(content);
+		}
+		fTextStore.replace(offset, length, text);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#set(java.lang.String)
+	 */
+	public void set(String text) {
+		fTextStore = new StringTextStore(text);
+		fModifiableTextStore.set(""); //$NON-NLS-1$
+	}
+
+}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/Document.java b/bundleplugin/src/main/java/aQute/lib/properties/Document.java
new file mode 100644
index 0000000..4df75a6
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/Document.java
@@ -0,0 +1,59 @@
+package aQute.lib.properties;
+
+public class Document implements IDocument {
+
+	public final static String[]	DELIMITERS	= {
+			"\r", "\n", "\r\n"
+												};
+
+	private LineTracker				lineTracker	= new LineTracker();
+	private ITextStore				textStore	= new CopyOnWriteTextStore(new GapTextStore());
+
+	public Document(String text) {
+		setText(text);
+	}
+
+	public int getNumberOfLines() {
+		return lineTracker.getNumberOfLines();
+	}
+
+	public IRegion getLineInformation(int line) throws BadLocationException {
+		return lineTracker.getLineInformation(line);
+	}
+
+	public String get(int offset, int length) throws BadLocationException {
+		return textStore.get(offset, length);
+	}
+
+	public String getLineDelimiter(int line) throws BadLocationException {
+		return lineTracker.getLineDelimiter(line);
+	}
+
+	public int getLength() {
+		return textStore.getLength();
+	}
+
+	public void replace(int offset, int length, String text) throws BadLocationException {
+		textStore.replace(offset, length, text);
+		lineTracker.set(get());
+	}
+
+	public char getChar(int pos) {
+		return textStore.get(pos);
+	}
+
+	public void setText(String text) {
+		textStore.set(text);
+		lineTracker.set(text);
+	}
+
+	public String get() {
+		return textStore.get(0, textStore.getLength());
+	}
+
+	protected static class DelimiterInfo {
+		public int		delimiterIndex;
+		public int		delimiterLength;
+		public String	delimiter;
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/GapTextStore.java b/bundleplugin/src/main/java/aQute/lib/properties/GapTextStore.java
new file mode 100644
index 0000000..7c4a043
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/GapTextStore.java
@@ -0,0 +1,419 @@
+package aQute.lib.properties;
+
+/**
+ * Implements a gap managing text store. The gap text store relies on the
+ * assumption that consecutive changes to a document are co-located. The start
+ * of the gap is always moved to the location of the last change.
+ * <p>
+ * <strong>Performance:</strong> Typing-style changes perform in constant time
+ * unless re-allocation becomes necessary. Generally, a change that does not
+ * cause re-allocation will cause at most one
+ * {@linkplain System#arraycopy(Object, int, Object, int, int) arraycopy}
+ * operation of a length of about <var>d</var>, where <var>d</var> is the
+ * distance from the previous change. Let <var>a(x)</var> be the algorithmic
+ * performance of an <code>arraycopy</code> operation of the length
+ * <var>x</var>, then such a change then performs in <i>O(a(x))</i>,
+ * {@linkplain #get(int, int) get(int, <var>length</var>)} performs in
+ * <i>O(a(length))</i>, {@link #get(int)} in <i>O(1)</i>.
+ * <p>
+ * How frequently the array needs re-allocation is controlled by the constructor
+ * parameters.
+ * </p>
+ * <p>
+ * This class is not intended to be subclassed.
+ * </p>
+ * 
+ * @see CopyOnWriteTextStore for a copy-on-write text store wrapper
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public class GapTextStore implements ITextStore {
+	/**
+	 * The minimum gap size allocated when re-allocation occurs.
+	 * 
+	 * @since 3.3
+	 */
+	private final int	fMinGapSize;
+	/**
+	 * The maximum gap size allocated when re-allocation occurs.
+	 * 
+	 * @since 3.3
+	 */
+	private final int	fMaxGapSize;
+	/**
+	 * The multiplier to compute the array size from the content length
+	 * (1&nbsp;&lt;=&nbsp;fSizeMultiplier&nbsp;&lt;=&nbsp;2).
+	 * 
+	 * @since 3.3
+	 */
+	private final float	fSizeMultiplier;
+
+	/** The store's content */
+	private char[]		fContent	= new char[0];
+	/** Starting index of the gap */
+	private int			fGapStart	= 0;
+	/** End index of the gap */
+	private int			fGapEnd		= 0;
+	/**
+	 * The current high water mark. If a change would cause the gap to grow
+	 * larger than this, the array is re-allocated.
+	 * 
+	 * @since 3.3
+	 */
+	private int			fThreshold	= 0;
+
+	/**
+	 * Creates a new empty text store using the specified low and high
+	 * watermarks.
+	 * 
+	 * @param lowWatermark
+	 *            unused - at the lower bound, the array is only resized when
+	 *            the content does not fit
+	 * @param highWatermark
+	 *            if the gap is ever larger than this, it will automatically be
+	 *            shrunken (&gt;=&nbsp;0)
+	 * @deprecated use {@link GapTextStore#GapTextStore(int, int, float)}
+	 *             instead
+	 */
+	public GapTextStore(int lowWatermark, int highWatermark) {
+		/*
+		 * Legacy constructor. The API contract states that highWatermark is the
+		 * upper bound for the gap size. Albeit this contract was not previously
+		 * adhered to, it is now: The allocated gap size is fixed at half the
+		 * highWatermark. Since the threshold is always twice the allocated gap
+		 * size, the gap will never grow larger than highWatermark. Previously,
+		 * the gap size was initialized to highWatermark, causing re-allocation
+		 * if the content length shrunk right after allocation. The fixed gap
+		 * size is now only half of the previous value, circumventing that
+		 * problem (there was no API contract specifying the initial gap size).
+		 * The previous implementation did not allow the gap size to become
+		 * smaller than lowWatermark, which doesn't make any sense: that area of
+		 * the gap was simply never ever used.
+		 */
+		this(highWatermark / 2, highWatermark / 2, 0f);
+	}
+
+	/**
+	 * Equivalent to {@linkplain GapTextStore#GapTextStore(int, int, float) new
+	 * GapTextStore(256, 4096, 0.1f)}.
+	 * 
+	 * @since 3.3
+	 */
+	public GapTextStore() {
+		this(256, 4096, 0.1f);
+	}
+
+	/**
+	 * Creates an empty text store that uses re-allocation thresholds relative
+	 * to the content length. Re-allocation is controlled by the
+	 * <em>gap factor</em>, which is the quotient of the gap size and the array
+	 * size. Re-allocation occurs if a change causes the gap factor to go
+	 * outside <code>[0,&nbsp;maxGapFactor]</code>. When re-allocation occurs,
+	 * the array is sized such that the gap factor is
+	 * <code>0.5 * maxGapFactor</code>. The gap size computed in this manner is
+	 * bounded by the <code>minSize</code> and <code>maxSize</code> parameters.
+	 * <p>
+	 * A <code>maxGapFactor</code> of <code>0</code> creates a text store that
+	 * never has a gap at all (if <code>minSize</code> is 0); a
+	 * <code>maxGapFactor</code> of <code>1</code> creates a text store that
+	 * doubles its size with every re-allocation and that never shrinks.
+	 * </p>
+	 * <p>
+	 * The <code>minSize</code> and <code>maxSize</code> parameters are absolute
+	 * bounds to the allocated gap size. Use <code>minSize</code> to avoid
+	 * frequent re-allocation for small documents. Use <code>maxSize</code> to
+	 * avoid a huge gap being allocated for large documents.
+	 * </p>
+	 * 
+	 * @param minSize
+	 *            the minimum gap size to allocate (&gt;=&nbsp;0; use 0 for no
+	 *            minimum)
+	 * @param maxSize
+	 *            the maximum gap size to allocate (&gt;=&nbsp;minSize; use
+	 *            {@link Integer#MAX_VALUE} for no maximum)
+	 * @param maxGapFactor
+	 *            is the maximum fraction of the array that is occupied by the
+	 *            gap (
+	 *            <code>0&nbsp;&lt;=&nbsp;maxGapFactor&nbsp;&lt;=&nbsp;1</code>)
+	 * @since 3.3
+	 */
+	public GapTextStore(int minSize, int maxSize, float maxGapFactor) {
+		fMinGapSize = minSize;
+		fMaxGapSize = maxSize;
+		fSizeMultiplier = 1 / (1 - maxGapFactor / 2);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#get(int)
+	 */
+	public final char get(int offset) {
+		if (offset < fGapStart)
+			return fContent[offset];
+
+		return fContent[offset + gapSize()];
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#get(int, int)
+	 */
+	public final String get(int offset, int length) {
+		if (fGapStart <= offset)
+			return new String(fContent, offset + gapSize(), length);
+
+		final int end = offset + length;
+
+		if (end <= fGapStart)
+			return new String(fContent, offset, length);
+
+		StringBuffer buf = new StringBuffer(length);
+		buf.append(fContent, offset, fGapStart - offset);
+		buf.append(fContent, fGapEnd, end - fGapStart);
+		return buf.toString();
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#getLength()
+	 */
+	public final int getLength() {
+		return fContent.length - gapSize();
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#set(java.lang.String)
+	 */
+	public final void set(String text) {
+		/*
+		 * Moves the gap to the end of the content. There is no sensible
+		 * prediction of where the next change will occur, but at least the next
+		 * change will not trigger re-allocation. This is especially important
+		 * when using the GapTextStore within a CopyOnWriteTextStore, where the
+		 * GTS is only initialized right before a modification.
+		 */
+		replace(0, getLength(), text);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ITextStore#replace(int, int,
+	 * java.lang.String)
+	 */
+	public final void replace(int offset, int length, String text) {
+		if (text == null) {
+			adjustGap(offset, length, 0);
+		} else {
+			int textLength = text.length();
+			adjustGap(offset, length, textLength);
+			if (textLength != 0)
+				text.getChars(0, textLength, fContent, offset);
+		}
+	}
+
+	/**
+	 * Moves the gap to <code>offset + add</code>, moving any content after
+	 * <code>offset + remove</code> behind the gap. The gap size is kept between
+	 * 0 and {@link #fThreshold}, leading to re-allocation if needed. The
+	 * content between <code>offset</code> and <code>offset + add</code> is
+	 * undefined after this operation.
+	 * 
+	 * @param offset
+	 *            the offset at which a change happens
+	 * @param remove
+	 *            the number of character which are removed or overwritten at
+	 *            <code>offset</code>
+	 * @param add
+	 *            the number of character which are inserted or overwriting at
+	 *            <code>offset</code>
+	 */
+	private void adjustGap(int offset, int remove, int add) {
+		final int oldGapSize = gapSize();
+		final int newGapSize = oldGapSize - add + remove;
+		final boolean reuseArray = 0 <= newGapSize && newGapSize <= fThreshold;
+
+		final int newGapStart = offset + add;
+		final int newGapEnd;
+
+		if (reuseArray)
+			newGapEnd = moveGap(offset, remove, oldGapSize, newGapSize, newGapStart);
+		else
+			newGapEnd = reallocate(offset, remove, oldGapSize, newGapSize, newGapStart);
+
+		fGapStart = newGapStart;
+		fGapEnd = newGapEnd;
+	}
+
+	/**
+	 * Moves the gap to <code>newGapStart</code>.
+	 * 
+	 * @param offset
+	 *            the change offset
+	 * @param remove
+	 *            the number of removed / overwritten characters
+	 * @param oldGapSize
+	 *            the old gap size
+	 * @param newGapSize
+	 *            the gap size after the change
+	 * @param newGapStart
+	 *            the offset in the array to move the gap to
+	 * @return the new gap end
+	 * @since 3.3
+	 */
+	private int moveGap(int offset, int remove, int oldGapSize, int newGapSize, int newGapStart) {
+		/*
+		 * No re-allocation necessary. The area between the change offset and
+		 * gap can be copied in at most one operation. Don't copy parts that
+		 * will be overwritten anyway.
+		 */
+		final int newGapEnd = newGapStart + newGapSize;
+		if (offset < fGapStart) {
+			int afterRemove = offset + remove;
+			if (afterRemove < fGapStart) {
+				final int betweenSize = fGapStart - afterRemove;
+				arrayCopy(afterRemove, fContent, newGapEnd, betweenSize);
+			}
+			// otherwise, only the gap gets enlarged
+		} else {
+			final int offsetShifted = offset + oldGapSize;
+			final int betweenSize = offsetShifted - fGapEnd; // in the typing
+																// case,
+																// betweenSize
+																// is 0
+			arrayCopy(fGapEnd, fContent, fGapStart, betweenSize);
+		}
+		return newGapEnd;
+	}
+
+	/**
+	 * Reallocates a new array and copies the data from the previous one.
+	 * 
+	 * @param offset
+	 *            the change offset
+	 * @param remove
+	 *            the number of removed / overwritten characters
+	 * @param oldGapSize
+	 *            the old gap size
+	 * @param newGapSize
+	 *            the gap size after the change if no re-allocation would occur
+	 *            (can be negative)
+	 * @param newGapStart
+	 *            the offset in the array to move the gap to
+	 * @return the new gap end
+	 * @since 3.3
+	 */
+	private int reallocate(int offset, int remove, final int oldGapSize, int newGapSize, final int newGapStart) {
+		// the new content length (without any gap)
+		final int newLength = fContent.length - newGapSize;
+		// the new array size based on the gap factor
+		int newArraySize = (int) (newLength * fSizeMultiplier);
+		newGapSize = newArraySize - newLength;
+
+		// bound the gap size within min/max
+		if (newGapSize < fMinGapSize) {
+			newGapSize = fMinGapSize;
+			newArraySize = newLength + newGapSize;
+		} else if (newGapSize > fMaxGapSize) {
+			newGapSize = fMaxGapSize;
+			newArraySize = newLength + newGapSize;
+		}
+
+		// the upper threshold is always twice the gapsize
+		fThreshold = newGapSize * 2;
+		final char[] newContent = allocate(newArraySize);
+		final int newGapEnd = newGapStart + newGapSize;
+
+		/*
+		 * Re-allocation: The old content can be copied in at most 3 operations
+		 * to the newly allocated array. Either one of change offset and the gap
+		 * may come first. - unchanged area before the change offset / gap -
+		 * area between the change offset and the gap (either one may be first)
+		 * - rest area after the change offset / after the gap
+		 */
+		if (offset < fGapStart) {
+			// change comes before gap
+			arrayCopy(0, newContent, 0, offset);
+			int afterRemove = offset + remove;
+			if (afterRemove < fGapStart) {
+				// removal is completely before the gap
+				final int betweenSize = fGapStart - afterRemove;
+				arrayCopy(afterRemove, newContent, newGapEnd, betweenSize);
+				final int restSize = fContent.length - fGapEnd;
+				arrayCopy(fGapEnd, newContent, newGapEnd + betweenSize, restSize);
+			} else {
+				// removal encompasses the gap
+				afterRemove += oldGapSize;
+				final int restSize = fContent.length - afterRemove;
+				arrayCopy(afterRemove, newContent, newGapEnd, restSize);
+			}
+		} else {
+			// gap comes before change
+			arrayCopy(0, newContent, 0, fGapStart);
+			final int offsetShifted = offset + oldGapSize;
+			final int betweenSize = offsetShifted - fGapEnd;
+			arrayCopy(fGapEnd, newContent, fGapStart, betweenSize);
+			final int afterRemove = offsetShifted + remove;
+			final int restSize = fContent.length - afterRemove;
+			arrayCopy(afterRemove, newContent, newGapEnd, restSize);
+		}
+
+		fContent = newContent;
+		return newGapEnd;
+	}
+
+	/**
+	 * Allocates a new <code>char[size]</code>.
+	 * 
+	 * @param size
+	 *            the length of the new array.
+	 * @return a newly allocated char array
+	 * @since 3.3
+	 */
+	private char[] allocate(int size) {
+		return new char[size];
+	}
+
+	/*
+	 * Executes System.arraycopy if length != 0. A length < 0 cannot happen ->
+	 * don't hide coding errors by checking for negative lengths.
+	 * @since 3.3
+	 */
+	private void arrayCopy(int srcPos, char[] dest, int destPos, int length) {
+		if (length != 0)
+			System.arraycopy(fContent, srcPos, dest, destPos, length);
+	}
+
+	/**
+	 * Returns the gap size.
+	 * 
+	 * @return the gap size
+	 * @since 3.3
+	 */
+	private int gapSize() {
+		return fGapEnd - fGapStart;
+	}
+
+	/**
+	 * Returns a copy of the content of this text store. For internal use only.
+	 * 
+	 * @return a copy of the content of this text store
+	 */
+	protected String getContentAsString() {
+		return new String(fContent);
+	}
+
+	/**
+	 * Returns the start index of the gap managed by this text store. For
+	 * internal use only.
+	 * 
+	 * @return the start index of the gap managed by this text store
+	 */
+	protected int getGapStartIndex() {
+		return fGapStart;
+	}
+
+	/**
+	 * Returns the end index of the gap managed by this text store. For internal
+	 * use only.
+	 * 
+	 * @return the end index of the gap managed by this text store
+	 */
+	protected int getGapEndIndex() {
+		return fGapEnd;
+	}
+}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/IDocument.java b/bundleplugin/src/main/java/aQute/lib/properties/IDocument.java
new file mode 100644
index 0000000..aba541f
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/IDocument.java
@@ -0,0 +1,21 @@
+package aQute.lib.properties;
+
+public interface IDocument {
+
+	int getNumberOfLines();
+
+	IRegion getLineInformation(int lineNum) throws BadLocationException;
+
+	String get();
+
+	String get(int offset, int length) throws BadLocationException;
+
+	String getLineDelimiter(int line) throws BadLocationException;
+
+	int getLength();
+
+	void replace(int offset, int length, String data) throws BadLocationException;
+
+	char getChar(int offset) throws BadLocationException;
+
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/IRegion.java b/bundleplugin/src/main/java/aQute/lib/properties/IRegion.java
new file mode 100644
index 0000000..70230e7
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/IRegion.java
@@ -0,0 +1,8 @@
+package aQute.lib.properties;
+
+public interface IRegion {
+
+	int getLength();
+
+	int getOffset();
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/ITextStore.java b/bundleplugin/src/main/java/aQute/lib/properties/ITextStore.java
new file mode 100644
index 0000000..f4cf2c7
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/ITextStore.java
@@ -0,0 +1,65 @@
+package aQute.lib.properties;
+
+/**
+ * Interface for storing and managing text.
+ * <p>
+ * Provides access to the stored text and allows to manipulate it.
+ * </p>
+ * <p>
+ * Clients may implement this interface or use
+ * {@link org.eclipse.jface.text.GapTextStore} or
+ * {@link org.eclipse.jface.text.CopyOnWriteTextStore}.
+ * </p>
+ */
+public interface ITextStore {
+
+	/**
+	 * Returns the character at the specified offset.
+	 * 
+	 * @param offset
+	 *            the offset in this text store
+	 * @return the character at this offset
+	 */
+	char get(int offset);
+
+	/**
+	 * Returns the text of the specified character range.
+	 * 
+	 * @param offset
+	 *            the offset of the range
+	 * @param length
+	 *            the length of the range
+	 * @return the text of the range
+	 */
+	String get(int offset, int length);
+
+	/**
+	 * Returns number of characters stored in this text store.
+	 * 
+	 * @return the number of characters stored in this text store
+	 */
+	int getLength();
+
+	/**
+	 * Replaces the specified character range with the given text.
+	 * <code>replace(getLength(), 0, "some text")</code> is a valid call and
+	 * appends text to the end of the text store.
+	 * 
+	 * @param offset
+	 *            the offset of the range to be replaced
+	 * @param length
+	 *            the number of characters to be replaced
+	 * @param text
+	 *            the substitution text
+	 */
+	void replace(int offset, int length, String text);
+
+	/**
+	 * Replace the content of the text store with the given text. Convenience
+	 * method for <code>replace(0, getLength(), text</code>.
+	 * 
+	 * @param text
+	 *            the new content of the text store
+	 */
+	void set(String text);
+}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/Line.java b/bundleplugin/src/main/java/aQute/lib/properties/Line.java
new file mode 100644
index 0000000..8d07ce1
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/Line.java
@@ -0,0 +1,60 @@
+package aQute.lib.properties;
+
+/**
+ * Describes a line as a particular number of characters beginning at a
+ * particular offset, consisting of a particular number of characters, and being
+ * closed with a particular line delimiter.
+ */
+final class Line implements IRegion {
+
+	/** The offset of the line */
+	public int			offset;
+	/** The length of the line */
+	public int			length;
+	/** The delimiter of this line */
+	public final String	delimiter;
+
+	/**
+	 * Creates a new Line.
+	 * 
+	 * @param offset
+	 *            the offset of the line
+	 * @param end
+	 *            the last including character offset of the line
+	 * @param delimiter
+	 *            the line's delimiter
+	 */
+	public Line(int offset, int end, String delimiter) {
+		this.offset = offset;
+		this.length = (end - offset) + 1;
+		this.delimiter = delimiter;
+	}
+
+	/**
+	 * Creates a new Line.
+	 * 
+	 * @param offset
+	 *            the offset of the line
+	 * @param length
+	 *            the length of the line
+	 */
+	public Line(int offset, int length) {
+		this.offset = offset;
+		this.length = length;
+		this.delimiter = null;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.IRegion#getOffset()
+	 */
+	public int getOffset() {
+		return offset;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.IRegion#getLength()
+	 */
+	public int getLength() {
+		return length;
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/LineTracker.java b/bundleplugin/src/main/java/aQute/lib/properties/LineTracker.java
new file mode 100644
index 0000000..a3c3adf
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/LineTracker.java
@@ -0,0 +1,382 @@
+package aQute.lib.properties;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import aQute.lib.properties.Document.DelimiterInfo;
+
+public class LineTracker {
+
+	/** The line information */
+	private final List<Line>	fLines	= new ArrayList<Line>();
+	/** The length of the tracked text */
+	private int					fTextLength;
+
+	/**
+	 * Creates a new line tracker.
+	 */
+	protected LineTracker() {}
+
+	/**
+	 * Binary search for the line at a given offset.
+	 * 
+	 * @param offset
+	 *            the offset whose line should be found
+	 * @return the line of the offset
+	 */
+	private int findLine(int offset) {
+
+		if (fLines.size() == 0)
+			return -1;
+
+		int left = 0;
+		int right = fLines.size() - 1;
+		int mid = 0;
+		Line line = null;
+
+		while (left < right) {
+
+			mid = (left + right) / 2;
+
+			line = fLines.get(mid);
+			if (offset < line.offset) {
+				if (left == mid)
+					right = left;
+				else
+					right = mid - 1;
+			} else if (offset > line.offset) {
+				if (right == mid)
+					left = right;
+				else
+					left = mid + 1;
+			} else if (offset == line.offset) {
+				left = right = mid;
+			}
+		}
+
+		line = fLines.get(left);
+		if (line.offset > offset)
+			--left;
+		return left;
+	}
+
+	/**
+	 * Returns the number of lines covered by the specified text range.
+	 * 
+	 * @param startLine
+	 *            the line where the text range starts
+	 * @param offset
+	 *            the start offset of the text range
+	 * @param length
+	 *            the length of the text range
+	 * @return the number of lines covered by this text range
+	 * @exception BadLocationException
+	 *                if range is undefined in this tracker
+	 */
+	private int getNumberOfLines(int startLine, int offset, int length) throws BadLocationException {
+
+		if (length == 0)
+			return 1;
+
+		int target = offset + length;
+
+		Line l = fLines.get(startLine);
+
+		if (l.delimiter == null)
+			return 1;
+
+		if (l.offset + l.length > target)
+			return 1;
+
+		if (l.offset + l.length == target)
+			return 2;
+
+		return getLineNumberOfOffset(target) - startLine + 1;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineLength(int)
+	 */
+	public final int getLineLength(int line) throws BadLocationException {
+		int lines = fLines.size();
+
+		if (line < 0 || line > lines)
+			throw new BadLocationException();
+
+		if (lines == 0 || lines == line)
+			return 0;
+
+		Line l = fLines.get(line);
+		return l.length;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineNumberOfOffset(int)
+	 */
+	public final int getLineNumberOfOffset(int position) throws BadLocationException {
+		if (position < 0 || position > fTextLength)
+			throw new BadLocationException();
+
+		if (position == fTextLength) {
+
+			int lastLine = fLines.size() - 1;
+			if (lastLine < 0)
+				return 0;
+
+			Line l = fLines.get(lastLine);
+			return (l.delimiter != null ? lastLine + 1 : lastLine);
+		}
+
+		return findLine(position);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineInformationOfOffset(int)
+	 */
+	public final IRegion getLineInformationOfOffset(int position) throws BadLocationException {
+		if (position > fTextLength)
+			throw new BadLocationException();
+
+		if (position == fTextLength) {
+			int size = fLines.size();
+			if (size == 0)
+				return new Region(0, 0);
+			Line l = fLines.get(size - 1);
+			return (l.delimiter != null ? new Line(fTextLength, 0) : new Line(fTextLength - l.length, l.length));
+		}
+
+		return getLineInformation(findLine(position));
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineInformation(int)
+	 */
+	public final IRegion getLineInformation(int line) throws BadLocationException {
+		int lines = fLines.size();
+
+		if (line < 0 || line > lines)
+			throw new BadLocationException();
+
+		if (lines == 0)
+			return new Line(0, 0);
+
+		if (line == lines) {
+			Line l = fLines.get(line - 1);
+			return new Line(l.offset + l.length, 0);
+		}
+
+		Line l = fLines.get(line);
+		return (l.delimiter != null ? new Line(l.offset, l.length - l.delimiter.length()) : l);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineOffset(int)
+	 */
+	public final int getLineOffset(int line) throws BadLocationException {
+		int lines = fLines.size();
+
+		if (line < 0 || line > lines)
+			throw new BadLocationException();
+
+		if (lines == 0)
+			return 0;
+
+		if (line == lines) {
+			Line l = fLines.get(line - 1);
+			if (l.delimiter != null)
+				return l.offset + l.length;
+			throw new BadLocationException();
+		}
+
+		Line l = fLines.get(line);
+		return l.offset;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getNumberOfLines()
+	 */
+	public final int getNumberOfLines() {
+		int lines = fLines.size();
+
+		if (lines == 0)
+			return 1;
+
+		Line l = fLines.get(lines - 1);
+		return (l.delimiter != null ? lines + 1 : lines);
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getNumberOfLines(int, int)
+	 */
+	public final int getNumberOfLines(int position, int length) throws BadLocationException {
+
+		if (position < 0 || position + length > fTextLength)
+			throw new BadLocationException();
+
+		if (length == 0) // optimization
+			return 1;
+
+		return getNumberOfLines(getLineNumberOfOffset(position), position, length);
+	}
+
+	/*
+	 * @see
+	 * org.eclipse.jface.text.ILineTracker#computeNumberOfLines(java.lang.String
+	 * )
+	 */
+	public final int computeNumberOfLines(String text) {
+		int count = 0;
+		int start = 0;
+		DelimiterInfo delimiterInfo = nextDelimiterInfo(text, start);
+		while (delimiterInfo != null && delimiterInfo.delimiterIndex > -1) {
+			++count;
+			start = delimiterInfo.delimiterIndex + delimiterInfo.delimiterLength;
+			delimiterInfo = nextDelimiterInfo(text, start);
+		}
+		return count;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#getLineDelimiter(int)
+	 */
+	public final String getLineDelimiter(int line) throws BadLocationException {
+		int lines = fLines.size();
+
+		if (line < 0 || line > lines)
+			throw new BadLocationException();
+
+		if (lines == 0)
+			return null;
+
+		if (line == lines)
+			return null;
+
+		Line l = fLines.get(line);
+		return l.delimiter;
+	}
+
+	/**
+	 * Returns the information about the first delimiter found in the given text
+	 * starting at the given offset.
+	 * 
+	 * @param text
+	 *            the text to be searched
+	 * @param offset
+	 *            the offset in the given text
+	 * @return the information of the first found delimiter or <code>null</code>
+	 */
+	protected DelimiterInfo nextDelimiterInfo(String text, int offset) {
+
+		char ch;
+		int length = text.length();
+		for (int i = offset; i < length; i++) {
+
+			ch = text.charAt(i);
+			if (ch == '\r') {
+
+				if (i + 1 < length) {
+					if (text.charAt(i + 1) == '\n') {
+						DelimiterInfo fDelimiterInfo = new DelimiterInfo();
+						fDelimiterInfo.delimiter = Document.DELIMITERS[2];
+						fDelimiterInfo.delimiterIndex = i;
+						fDelimiterInfo.delimiterLength = 2;
+						return fDelimiterInfo;
+					}
+				}
+				DelimiterInfo fDelimiterInfo = new DelimiterInfo();
+				fDelimiterInfo.delimiter = Document.DELIMITERS[0];
+				fDelimiterInfo.delimiterIndex = i;
+				fDelimiterInfo.delimiterLength = 1;
+				return fDelimiterInfo;
+
+			} else if (ch == '\n') {
+				DelimiterInfo fDelimiterInfo = new DelimiterInfo();
+				fDelimiterInfo.delimiter = Document.DELIMITERS[1];
+				fDelimiterInfo.delimiterIndex = i;
+				fDelimiterInfo.delimiterLength = 1;
+				return fDelimiterInfo;
+			}
+		}
+
+		return null;
+	}
+
+	/**
+	 * Creates the line structure for the given text. Newly created lines are
+	 * inserted into the line structure starting at the given position. Returns
+	 * the number of newly created lines.
+	 * 
+	 * @param text
+	 *            the text for which to create a line structure
+	 * @param insertPosition
+	 *            the position at which the newly created lines are inserted
+	 *            into the tracker's line structure
+	 * @param offset
+	 *            the offset of all newly created lines
+	 * @return the number of newly created lines
+	 */
+	private int createLines(String text, int insertPosition, int offset) {
+
+		int count = 0;
+		int start = 0;
+		DelimiterInfo delimiterInfo = nextDelimiterInfo(text, 0);
+
+		while (delimiterInfo != null && delimiterInfo.delimiterIndex > -1) {
+
+			int index = delimiterInfo.delimiterIndex + (delimiterInfo.delimiterLength - 1);
+
+			if (insertPosition + count >= fLines.size())
+				fLines.add(new Line(offset + start, offset + index, delimiterInfo.delimiter));
+			else
+				fLines.add(insertPosition + count, new Line(offset + start, offset + index, delimiterInfo.delimiter));
+
+			++count;
+			start = index + 1;
+			delimiterInfo = nextDelimiterInfo(text, start);
+		}
+
+		if (start < text.length()) {
+			if (insertPosition + count < fLines.size()) {
+				// there is a line below the current
+				Line l = fLines.get(insertPosition + count);
+				int delta = text.length() - start;
+				l.offset -= delta;
+				l.length += delta;
+			} else {
+				fLines.add(new Line(offset + start, offset + text.length() - 1, null));
+				++count;
+			}
+		}
+
+		return count;
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#replace(int, int,
+	 * java.lang.String)
+	 */
+	public final void replace(@SuppressWarnings("unused") int position, @SuppressWarnings("unused") int length, @SuppressWarnings("unused") String text) throws BadLocationException {
+		throw new UnsupportedOperationException();
+	}
+
+	/*
+	 * @see org.eclipse.jface.text.ILineTracker#set(java.lang.String)
+	 */
+	public final void set(String text) {
+		fLines.clear();
+		if (text != null) {
+			fTextLength = text.length();
+			createLines(text, 0, 0);
+		}
+	}
+
+	/**
+	 * Returns the internal data structure, a {@link List} of {@link Line}s.
+	 * Used only by {@link TreeLineTracker#TreeLineTracker(ListLineTracker)}.
+	 * 
+	 * @return the internal list of lines.
+	 */
+	final List<Line> getLines() {
+		return fLines;
+	}
+}
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/LineType.java b/bundleplugin/src/main/java/aQute/lib/properties/LineType.java
new file mode 100644
index 0000000..69eda5f
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/LineType.java
@@ -0,0 +1,5 @@
+package aQute.lib.properties;
+
+public enum LineType {
+	blank, comment, entry, eof
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/PropertiesLineReader.java b/bundleplugin/src/main/java/aQute/lib/properties/PropertiesLineReader.java
new file mode 100644
index 0000000..c3ea14b
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/PropertiesLineReader.java
@@ -0,0 +1,125 @@
+package aQute.lib.properties;
+
+import static aQute.lib.properties.LineType.*;
+
+public class PropertiesLineReader {
+
+	private final IDocument	document;
+	private final int		lineCount;
+
+	private int				lineNum		= 0;
+
+	private IRegion			lastRegion	= null;
+	private String			lastKey		= null;
+	private String			lastValue	= null;
+
+	public PropertiesLineReader(IDocument document) {
+		this.document = document;
+		this.lineCount = document.getNumberOfLines();
+	}
+
+	public PropertiesLineReader(String data) {
+		this(new Document(data));
+	}
+
+	public LineType next() throws Exception {
+		int index = 0;
+		char[] chars = null;
+
+		StringBuilder keyData = new StringBuilder();
+		StringBuilder valueData = new StringBuilder();
+		StringBuilder currentBuffer = keyData;
+
+		boolean started = false;
+
+		mainLoop: while (true) {
+			if (chars == null)
+				chars = grabLine(false);
+			if (chars == null)
+				return eof;
+
+			if (index >= chars.length)
+				break;
+
+			char c = chars[index];
+			if (c == '\\') {
+				index++;
+				if (index == chars.length) {
+					chars = grabLine(true);
+					index = 0;
+					if (chars == null || chars.length == 0)
+						break; // The last line ended with a backslash
+				}
+				currentBuffer.append(chars[index]);
+				index++;
+				continue mainLoop;
+			}
+
+			if (c == '=' || c == ':')
+				currentBuffer = valueData;
+
+			if (!started && (c == '#' || c == '!'))
+				return comment;
+
+			if (Character.isWhitespace(c)) {
+				if (started) {
+					// whitespace ends the key
+					currentBuffer = valueData;
+				}
+			} else {
+				started = true;
+				currentBuffer.append(c);
+			}
+
+			index++;
+		}
+
+		if (!started)
+			return blank;
+
+		lastKey = keyData.toString();
+		return entry;
+	}
+
+	private char[] grabLine(boolean continued) throws BadLocationException {
+		if (lineNum >= lineCount) {
+			lastRegion = null;
+			return null;
+		}
+
+		IRegion lineInfo = document.getLineInformation(lineNum);
+		char[] chars = document.get(lineInfo.getOffset(), lineInfo.getLength()).toCharArray();
+
+		if (continued) {
+			int length = lastRegion.getLength();
+			length += document.getLineDelimiter(lineNum - 1).length();
+			length += lineInfo.getLength();
+			lastRegion = new Region(lastRegion.getOffset(), length);
+		} else {
+			lastRegion = lineInfo;
+		}
+
+		lineNum++;
+		return chars;
+	}
+
+	public IRegion region() {
+		if (lastRegion == null)
+			throw new IllegalStateException("Last region not available: either before start or after end of document.");
+		return lastRegion;
+	}
+
+	public String key() {
+		if (lastKey == null)
+			throw new IllegalStateException(
+					"Last key not available: either before state or after end of document, or last line type was not 'entry'.");
+		return lastKey;
+	}
+
+	public String value() {
+		if (lastValue == null)
+			throw new IllegalStateException(
+					"Last value not available: either before state or after end of document, or last line type was not 'entry'.");
+		return lastValue;
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/Region.java b/bundleplugin/src/main/java/aQute/lib/properties/Region.java
new file mode 100644
index 0000000..abf567c
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/Region.java
@@ -0,0 +1,20 @@
+package aQute.lib.properties;
+
+public class Region implements IRegion {
+
+	private final int	length;
+	private final int	offset;
+
+	public Region(int length, int offset) {
+		this.length = length;
+		this.offset = offset;
+	}
+
+	public int getLength() {
+		return length;
+	}
+
+	public int getOffset() {
+		return offset;
+	}
+}
diff --git a/bundleplugin/src/main/java/aQute/lib/properties/packageinfo b/bundleplugin/src/main/java/aQute/lib/properties/packageinfo
new file mode 100644
index 0000000..a4f1546
--- /dev/null
+++ b/bundleplugin/src/main/java/aQute/lib/properties/packageinfo
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file
diff --git a/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java b/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
index 64abf3c..dc17eb1 100644
--- a/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
+++ b/bundleplugin/src/main/java/aQute/lib/spring/XMLTypeProcessor.java
@@ -16,7 +16,7 @@
 		return false;
 	}
 
-	protected List<XMLType> getTypes(Analyzer analyzer) throws Exception {
+	protected List<XMLType> getTypes(@SuppressWarnings("unused") Analyzer analyzer) throws Exception {
 		return new ArrayList<XMLType>();
 	}
 
