Latest bnd sync
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1370165 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java
index c490e66..135f96c 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Analyzer.java
@@ -769,6 +769,7 @@
}
}
+ @Override
public void setBase(File file) {
super.setBase(file);
getProperties().put("project.dir", getBase().getAbsolutePath());
@@ -840,6 +841,7 @@
return jar;
}
+ @Override
protected void begin() {
if (inited == false) {
inited = true;
@@ -1466,6 +1468,7 @@
}
}
+ @Override
public void close() {
if (diagnostics) {
PrintStream out = System.err;
@@ -1612,6 +1615,7 @@
classpath.add(jar);
}
+ @Override
public void clear() {
classpath.clear();
}
@@ -2447,7 +2451,10 @@
jar.lastModified() - output.lastModified());
if (!output.exists() || output.lastModified() <= jar.lastModified() || force) {
- output.getParentFile().mkdirs();
+ File op = output.getParentFile();
+ if (!op.exists() && !op.mkdirs()) {
+ throw new IOException("Could not create directory " + op);
+ }
if (source != null && output.getCanonicalPath().equals(source.getCanonicalPath())) {
File bak = new File(source.getParentFile(), source.getName() + ".bak");
if (!source.renameTo(bak)) {
@@ -2545,11 +2552,13 @@
clazz.parseClassFileWithCollector(new ClassDataCollector() {
Clazz.Def member;
+ @Override
public void extendsClass(TypeRef zuper) throws Exception {
if (dest.contains(zuper.getPackageRef()))
xref.add(clazz.getExtends(zuper), zuper);
}
+ @Override
public void implementsInterfaces(TypeRef[] interfaces) throws Exception {
for (TypeRef i : interfaces) {
if (dest.contains(i.getPackageRef()))
@@ -2557,6 +2566,7 @@
}
}
+ @Override
public void referTo(TypeRef to, int modifiers) {
if (to.isJava())
return;
@@ -2570,10 +2580,12 @@
}
+ @Override
public void method(Clazz.MethodDef defined) {
member = defined;
}
+ @Override
public void field(Clazz.FieldDef defined) {
member = defined;
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java
index 37c4cad..0383962 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Annotation.java
@@ -34,6 +34,7 @@
return policy;
}
+ @Override
public String toString() {
return name + ":" + member + ":" + policy + ":" + elements;
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java
index 912bad3..2ee603a 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Builder.java
@@ -238,7 +238,10 @@
f = new File(f, "MANIFEST.MF");
}
f.delete();
- f.getParentFile().mkdirs();
+ File fp = f.getParentFile();
+ if (!fp.exists() && !fp.mkdirs()) {
+ throw new IOException("Could not create directory " + fp);
+ }
OutputStream out = new FileOutputStream(f);
try {
Jar.writeManifest(dot.getManifest(), out);
@@ -281,6 +284,7 @@
/**
* Answer extra packages. In this case we implement conditional package. Any
*/
+ @Override
protected Jar getExtra() throws Exception {
Parameters conditionals = getParameters(CONDITIONAL_PACKAGE);
if (conditionals.isEmpty())
@@ -315,6 +319,7 @@
* the setup. We do not want to cleanup if we are going to verify.
*/
+ @Override
public void analyze() throws Exception {
super.analyze();
cleanupVersion(getImports(), null);
@@ -1078,6 +1083,7 @@
sourcePath.add(cp);
}
+ @Override
public void close() {
super.close();
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java b/bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java
index 2d711ad..67f9b4a 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/BundleId.java
@@ -24,10 +24,12 @@
return Verifier.isVersion(version) && Verifier.isBsn(bsn);
}
+ @Override
public boolean equals(Object o) {
return this == o || ((o instanceof BundleId) && compareTo((BundleId) o) == 0);
}
+ @Override
public int hashCode() {
return bsn.hashCode() ^ version.hashCode();
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
index e03865a..1a325e6 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Clazz.java
@@ -251,11 +251,13 @@
this.descriptor = analyzer.getDescriptor(descriptor);
}
+ @Override
public String getName() {
return name;
}
+ @Override
public TypeRef getType() {
return descriptor.getType();
}
@@ -290,6 +292,7 @@
return objectDescriptorToFQN(returnType);
}
+ @Override
public TypeRef[] getPrototype() {
return null;
}
@@ -297,6 +300,7 @@
return signature;
}
+ @Override
public String toString() {
return name;
}
@@ -311,6 +315,7 @@
return name.equals("<init>") || name.equals("<clinit>");
}
+ @Override
public TypeRef[] getPrototype() {
return descriptor.getPrototype();
}
@@ -335,16 +340,18 @@
}
+ @Override
public String getName() {
if (interf)
return "<implements>";
- else
- return "<extends>";
+ return "<extends>";
}
+ @Override
public TypeRef getType() {
return type;
}
+ @Override
public TypeRef[] getPrototype() {
return null;
}
@@ -1527,6 +1534,7 @@
return clazz.is(query, instr, analyzer);
}
+ @Override
public String toString() {
return className.getFQN();
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java
index d38f416..1b10348 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/CombinedResource.java
@@ -10,6 +10,7 @@
@Override
public void write(final OutputStream out) throws IOException, Exception {
OutputStream unclosable = new FilterOutputStream(out) {
+ @Override
public void close() {
// Ignore
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java
index b435b27..683f96d 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Descriptors.java
@@ -95,6 +95,7 @@
return java;
}
+ @Override
public String toString() {
return fqn;
}
@@ -111,11 +112,13 @@
return fqn.compareTo(other.fqn);
}
+ @Override
public boolean equals(Object o) {
assert o instanceof PackageRef;
return o == this;
}
+ @Override
public int hashCode() {
return super.hashCode();
}
@@ -207,6 +210,7 @@
return packageRef.isJava();
}
+ @Override
public String toString() {
return fqn;
}
@@ -215,6 +219,7 @@
return fqn.equals("java.lang.Object");
}
+ @Override
public boolean equals(Object other) {
assert other instanceof TypeRef;
return this == other;
@@ -268,6 +273,7 @@
return component.getClassRef();
}
+ @Override
public boolean equals(Object other) {
if (other == null || other.getClass() != getClass())
return false;
@@ -287,6 +293,7 @@
return component.isJava();
}
+ @Override
public String toString() {
return component.toString() + "[]";
}
@@ -457,6 +464,7 @@
return prototype;
}
+ @Override
public boolean equals(Object other) {
if (other == null || other.getClass() != getClass())
return false;
@@ -464,10 +472,12 @@
return Arrays.equals(prototype, ((Descriptor) other).prototype) && type == ((Descriptor) other).type;
}
+ @Override
public int hashCode() {
return prototype == null ? type.hashCode() : type.hashCode() ^ Arrays.hashCode(prototype);
}
+ @Override
public String toString() {
return descriptor;
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java
index 0aad605..ae3c449 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/EmbeddedResource.java
@@ -23,6 +23,7 @@
out.write(data);
}
+ @Override
public String toString() {
return ":" + data.length + ":";
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java
index cd18cf5..66635d1 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/FileResource.java
@@ -19,6 +19,7 @@
traverse(jar, directory.getAbsolutePath().length(), directory, doNotCopy);
}
+ @Override
public String toString() {
return ":" + file.getName() + ":";
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java
index a660169..d350c8a 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Instruction.java
@@ -145,6 +145,7 @@
return input;
}
+ @Override
public String toString() {
return input;
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java
index bfb7e28..b157f88 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Instructions.java
@@ -145,6 +145,7 @@
return map.values();
}
+ @Override
public String toString() {
return map == null ? "{}" : map.toString();
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java
index 11c0dab..93c55a1 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Jar.java
@@ -97,6 +97,7 @@
this.name = name;
}
+ @Override
public String toString() {
return "Jar:" + name;
}
@@ -768,14 +769,19 @@
public void expand(File dir) throws Exception {
check();
dir = dir.getAbsoluteFile();
- dir.mkdirs();
+ if (!dir.exists() && !dir.mkdirs()) {
+ throw new IOException("Could not create directory " + dir);
+ }
if (!dir.isDirectory()) {
throw new IllegalArgumentException("Not a dir: " + dir.getAbsolutePath());
}
for (Map.Entry<String,Resource> entry : getResources().entrySet()) {
File f = getFile(dir, entry.getKey());
- f.getParentFile().mkdirs();
+ File fp = f.getParentFile();
+ if (!fp.exists() && !fp.mkdirs()) {
+ throw new IOException("Could not create directory " + fp);
+ }
IO.copy(entry.getValue().openInputStream(), f);
}
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java
index 2fb5c54..1734fc9 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/JarResource.java
@@ -10,10 +10,12 @@
this.jar = jar;
}
+ @Override
public long lastModified() {
return jar.lastModified();
}
+ @Override
public void write(OutputStream out) throws Exception {
try {
jar.write(out);
@@ -28,6 +30,7 @@
return jar;
}
+ @Override
public String toString() {
return ":" + jar.getName() + ":";
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
index 20cc4a4..d706596 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Macro.java
@@ -895,6 +895,7 @@
return previous.contains(key);
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
String del = "[";
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java
index 53a92da..a7f6290 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Packages.java
@@ -179,6 +179,7 @@
return getByFQN(s) != null;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
append(sb);
@@ -219,11 +220,13 @@
return deflt;
}
+ @Override
@Deprecated
public boolean equals(Object other) {
return super.equals(other);
}
+ @Override
@Deprecated
public int hashCode() {
return super.hashCode();
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java
index a1b5095..c1f847c 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/PreprocessResource.java
@@ -13,6 +13,7 @@
setExtra(resource.getExtra());
}
+ @Override
protected byte[] getBytes() throws Exception {
ByteArrayOutputStream bout = new ByteArrayOutputStream(2000);
OutputStreamWriter osw = new OutputStreamWriter(bout, Constants.DEFAULT_CHARSET);
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java
index b153cb9..5958a9d 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Processor.java
@@ -127,12 +127,10 @@
try {
if (p.isFailOk())
return p.warning(string, args);
- else {
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
- return location(s);
- }
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
}
finally {
p.signal();
@@ -160,13 +158,11 @@
if (p.isFailOk()) {
return p.warning(string + ": " + t, args);
}
- else {
- p.errors.add("Exception: " + t.getMessage());
- String s = formatArrays(string, args == null ? new Object[0] : args);
- if (!p.errors.contains(s))
- p.errors.add(s);
- return location(s);
- }
+ p.errors.add("Exception: " + t.getMessage());
+ String s = formatArrays(string, args == null ? new Object[0] : args);
+ if (!p.errors.contains(s))
+ p.errors.add(s);
+ return location(s);
}
finally {
p.signal();
@@ -408,6 +404,7 @@
return plugin;
}
+ @Override
public boolean isFailOk() {
String v = getProperty(Analyzer.FAIL_OK, null);
return v != null && v.equalsIgnoreCase("true");
@@ -1184,6 +1181,7 @@
super.addURL(url);
}
+ @Override
public Class< ? > loadClass(String name) throws NoClassDefFoundError {
try {
Class< ? > c = super.loadClass(name);
@@ -1581,6 +1579,7 @@
* Printout of the status of this processor for toString()
*/
+ @Override
public String toString() {
try {
StringBuilder sb = new StringBuilder();
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java
index 2cd2375..5d47067 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/URLResource.java
@@ -18,6 +18,7 @@
return url.openStream();
}
+ @Override
public String toString() {
return ":" + url.getPath() + ":";
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java b/bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java
index eac2f6f..b5bd72c 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/Verifier.java
@@ -47,6 +47,7 @@
this.target = target;
}
+ @Override
public String toString() {
return name + "(" + target + ")";
}
@@ -814,6 +815,7 @@
return true;
}
+ @Override
public String getProperty(String key, String deflt) {
if (properties == null)
return deflt;
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java
index 494c678..ed72c41 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/WriteResource.java
@@ -10,6 +10,7 @@
PipedInputStream pin = new PipedInputStream();
final PipedOutputStream pout = new PipedOutputStream(pin);
Thread t = new Thread() {
+ @Override
public void run() {
try {
write(pout);
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java b/bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java
index edf6a68..1101945 100755
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/ZipResource.java
@@ -24,6 +24,7 @@
return zip.getInputStream(entry);
}
+ @Override
public String toString() {
return ":" + zip.getName() + "(" + entry.getName() + "):";
}
diff --git a/bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java b/bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java
index b8c7836..f12e7c8 100644
--- a/bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java
+++ b/bundleplugin/src/main/java/aQute/bnd/osgi/resource/Filters.java
@@ -2,7 +2,6 @@
import org.osgi.framework.namespace.*;
-import aQute.bnd.osgi.*;
import aQute.bnd.version.*;
import aQute.libg.filters.*;