Sync with latest bnd code for testing purposes
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1354104 13f79535-47bb-0310-9956-ffa450edef68
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 <= fSizeMultiplier <= 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 (>= 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, 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 (>= 0; use 0 for no
+ * minimum)
+ * @param maxSize
+ * the maximum gap size to allocate (>= 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 <= maxGapFactor <= 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>();
}