Update to upstream version 4.1
This commit is contained in:
parent
c53430de97
commit
695e146ea1
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ xbean-3.7.tar.xz
|
|||||||
/xbean-3.13-source-release.zip
|
/xbean-3.13-source-release.zip
|
||||||
/xbean-3.16-source-release.zip
|
/xbean-3.16-source-release.zip
|
||||||
/xbean-3.17-source-release.zip
|
/xbean-3.17-source-release.zip
|
||||||
|
/xbean-4.1-source-release.zip
|
||||||
|
401
0001-Unshade-ASM.patch
Normal file
401
0001-Unshade-ASM.patch
Normal file
@ -0,0 +1,401 @@
|
|||||||
|
From 8d151d56250e13e5bdc21bc0df1e2f334010f268 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Fri, 21 Nov 2014 09:39:00 +0100
|
||||||
|
Subject: [PATCH 1/4] Unshade ASM
|
||||||
|
|
||||||
|
---
|
||||||
|
pom.xml | 23 ------------
|
||||||
|
xbean-finder/pom.xml | 5 ---
|
||||||
|
.../org/apache/xbean/finder/AbstractFinder.java | 30 ++++++++-------
|
||||||
|
.../org/apache/xbean/finder/AnnotationFinder.java | 43 +++++++++++-----------
|
||||||
|
xbean-reflect/pom.xml | 13 -------
|
||||||
|
.../xbean/recipe/AsmParameterNameLoader.java | 6 ++-
|
||||||
|
.../org/apache/xbean/recipe/ReflectionUtil.java | 8 +---
|
||||||
|
.../xbean/recipe/XbeanAsmParameterNameLoader.java | 18 +++++----
|
||||||
|
8 files changed, 53 insertions(+), 93 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pom.xml b/pom.xml
|
||||||
|
index dd4d7ee..0c17645 100644
|
||||||
|
--- a/pom.xml
|
||||||
|
+++ b/pom.xml
|
||||||
|
@@ -217,26 +217,6 @@
|
||||||
|
<artifactId>xbean-telnet</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm-shaded</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm5-shaded</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm-util</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-finder-shaded</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- </dependency>
|
||||||
|
|
||||||
|
<!-- external dependencies -->
|
||||||
|
|
||||||
|
@@ -412,7 +392,6 @@
|
||||||
|
<module>xbean-classloader</module>
|
||||||
|
<module>xbean-classpath</module>
|
||||||
|
<module>xbean-bundleutils</module>
|
||||||
|
- <module>xbean-asm-util</module>
|
||||||
|
<module>xbean-finder</module>
|
||||||
|
<module>xbean-naming</module>
|
||||||
|
<module>xbean-reflect</module>
|
||||||
|
@@ -420,8 +399,6 @@
|
||||||
|
<module>xbean-spring</module>
|
||||||
|
<module>xbean-telnet</module>
|
||||||
|
<module>maven-xbean-plugin</module>
|
||||||
|
- <module>xbean-asm5-shaded</module>
|
||||||
|
- <module>xbean-finder-shaded</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
diff --git a/xbean-finder/pom.xml b/xbean-finder/pom.xml
|
||||||
|
index 6048ac3..4f20b5f 100644
|
||||||
|
--- a/xbean-finder/pom.xml
|
||||||
|
+++ b/xbean-finder/pom.xml
|
||||||
|
@@ -58,11 +58,6 @@
|
||||||
|
<version>4.3.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm-util</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- </dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
diff --git a/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java b/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
|
||||||
|
index 8beb72b..164a490 100644
|
||||||
|
--- a/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
|
||||||
|
+++ b/xbean-finder/src/main/java/org/apache/xbean/finder/AbstractFinder.java
|
||||||
|
@@ -34,10 +34,10 @@ import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
-import org.apache.xbean.asm5.original.commons.EmptyVisitor;
|
||||||
|
import org.apache.xbean.finder.util.SingleLinkedList;
|
||||||
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
+import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.FieldVisitor;
|
||||||
|
import org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@@ -908,15 +908,17 @@ public abstract class AbstractFinder implements IAnnotationFinder {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- public class InfoBuildingVisitor extends EmptyVisitor {
|
||||||
|
+ public class InfoBuildingVisitor extends ClassVisitor {
|
||||||
|
private Info info;
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
public InfoBuildingVisitor(String path) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public InfoBuildingVisitor(Info info) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -949,7 +951,7 @@ public abstract class AbstractFinder implements IAnnotationFinder {
|
||||||
|
AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
info.getAnnotations().add(annotationInfo);
|
||||||
|
getAnnotationInfos(annotationInfo.getName()).add(info);
|
||||||
|
- return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
|
||||||
|
+ return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -957,7 +959,7 @@ public abstract class AbstractFinder implements IAnnotationFinder {
|
||||||
|
ClassInfo classInfo = ((ClassInfo) info);
|
||||||
|
FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc);
|
||||||
|
classInfo.getFields().add(fieldInfo);
|
||||||
|
- return new InfoBuildingVisitor(fieldInfo).fieldVisitor();
|
||||||
|
+ return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -965,16 +967,16 @@ public abstract class AbstractFinder implements IAnnotationFinder {
|
||||||
|
ClassInfo classInfo = ((ClassInfo) info);
|
||||||
|
MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
|
||||||
|
classInfo.getMethods().add(methodInfo);
|
||||||
|
- return new InfoBuildingVisitor(methodInfo).methodVisitor();
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) {
|
||||||
|
- MethodInfo methodInfo = ((MethodInfo) info);
|
||||||
|
- List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
|
||||||
|
- AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
- annotationInfos.add(annotationInfo);
|
||||||
|
- return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
|
||||||
|
+ return new MethodVisitor(Opcodes.ASM5) {
|
||||||
|
+ @Override
|
||||||
|
+ public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) {
|
||||||
|
+ MethodInfo methodInfo = ((MethodInfo) info);
|
||||||
|
+ List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
|
||||||
|
+ AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
+ annotationInfos.add(annotationInfo);
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java b/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
|
||||||
|
index ea96d78..48b2262 100644
|
||||||
|
--- a/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
|
||||||
|
+++ b/xbean-finder/src/main/java/org/apache/xbean/finder/AnnotationFinder.java
|
||||||
|
@@ -20,13 +20,13 @@
|
||||||
|
|
||||||
|
package org.apache.xbean.finder;
|
||||||
|
|
||||||
|
-import org.apache.xbean.asm5.original.commons.EmptyVisitor;
|
||||||
|
import org.apache.xbean.finder.archive.Archive;
|
||||||
|
import org.apache.xbean.finder.util.Classes;
|
||||||
|
import org.apache.xbean.finder.util.SingleLinkedList;
|
||||||
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
|
import org.objectweb.asm.Attribute;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
+import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.FieldVisitor;
|
||||||
|
import org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@@ -1755,13 +1755,15 @@ public class AnnotationFinder implements IAnnotationFinder {
|
||||||
|
initAnnotationInfos(annotationInfo.getName()).add(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
- public class InfoBuildingVisitor extends EmptyVisitor {
|
||||||
|
+ public class InfoBuildingVisitor extends ClassVisitor {
|
||||||
|
private Info info;
|
||||||
|
|
||||||
|
public InfoBuildingVisitor() {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public InfoBuildingVisitor(Info info) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1809,7 +1811,7 @@ public class AnnotationFinder implements IAnnotationFinder {
|
||||||
|
AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
info.getAnnotations().add(annotationInfo);
|
||||||
|
index(annotationInfo, info);
|
||||||
|
- return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
|
||||||
|
+ return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -1817,32 +1819,31 @@ public class AnnotationFinder implements IAnnotationFinder {
|
||||||
|
ClassInfo classInfo = ((ClassInfo) info);
|
||||||
|
FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc);
|
||||||
|
classInfo.getFields().add(fieldInfo);
|
||||||
|
- return new InfoBuildingVisitor(fieldInfo).fieldVisitor();
|
||||||
|
+ return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||||
|
ClassInfo classInfo = ((ClassInfo) info);
|
||||||
|
- MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
|
||||||
|
+ final MethodInfo methodInfo = new MethodInfo(classInfo, name, desc);
|
||||||
|
|
||||||
|
classInfo.getMethods().add(methodInfo);
|
||||||
|
- return new InfoBuildingVisitor(methodInfo).methodVisitor();
|
||||||
|
+ return new MethodVisitor(Opcodes.ASM5) {
|
||||||
|
+ @Override
|
||||||
|
+ public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) {
|
||||||
|
+ List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
|
||||||
|
+ AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
+ annotationInfos.add(annotationInfo);
|
||||||
|
+
|
||||||
|
+ ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param);
|
||||||
|
+ methodInfo.getParameters().add(parameterInfo);
|
||||||
|
+ index(annotationInfo, parameterInfo);
|
||||||
|
+
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ };
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public AnnotationVisitor visitMethodParameterAnnotation(int param, String desc, boolean visible) {
|
||||||
|
- MethodInfo methodInfo = ((MethodInfo) info);
|
||||||
|
- List<AnnotationInfo> annotationInfos = methodInfo.getParameterAnnotations(param);
|
||||||
|
- AnnotationInfo annotationInfo = new AnnotationInfo(desc);
|
||||||
|
- annotationInfos.add(annotationInfo);
|
||||||
|
-
|
||||||
|
- ParameterInfo parameterInfo = new ParameterInfo(methodInfo, param);
|
||||||
|
- methodInfo.getParameters().add(parameterInfo);
|
||||||
|
- index(annotationInfo, parameterInfo);
|
||||||
|
-
|
||||||
|
- return new InfoBuildingVisitor(annotationInfo).annotationVisitor();
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GenericAwareInfoBuildingVisitor extends SignatureVisitor {
|
||||||
|
@@ -2007,4 +2008,4 @@ public class AnnotationFinder implements IAnnotationFinder {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-}
|
||||||
|
\ No newline at end of file
|
||||||
|
+}
|
||||||
|
diff --git a/xbean-reflect/pom.xml b/xbean-reflect/pom.xml
|
||||||
|
index e9e51c7..0b80389 100644
|
||||||
|
--- a/xbean-reflect/pom.xml
|
||||||
|
+++ b/xbean-reflect/pom.xml
|
||||||
|
@@ -47,19 +47,6 @@
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm-util</artifactId>
|
||||||
|
- <scope>provided</scope>
|
||||||
|
- <optional>true</optional>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
- <groupId>org.apache.xbean</groupId>
|
||||||
|
- <artifactId>xbean-asm5-shaded</artifactId>
|
||||||
|
- <version>${project.version}</version>
|
||||||
|
- <scope>provided</scope>
|
||||||
|
- <optional>true</optional>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>1.2.12</version>
|
||||||
|
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
|
||||||
|
index 6859cad..f513b77 100644
|
||||||
|
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
|
||||||
|
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/AsmParameterNameLoader.java
|
||||||
|
@@ -17,8 +17,8 @@
|
||||||
|
*/
|
||||||
|
package org.apache.xbean.recipe;
|
||||||
|
|
||||||
|
-import org.apache.xbean.asm5.original.commons.EmptyVisitor;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
+import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.Label;
|
||||||
|
import org.objectweb.asm.MethodVisitor;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@@ -211,7 +211,7 @@ public class AsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static class AllParameterNamesDiscoveringVisitor extends EmptyVisitor {
|
||||||
|
+ private static class AllParameterNamesDiscoveringVisitor extends ClassVisitor {
|
||||||
|
private final Map<Constructor,List<String>> constructorParameters = new HashMap<Constructor,List<String>>();
|
||||||
|
private final Map<Method,List<String>> methodParameters = new HashMap<Method,List<String>>();
|
||||||
|
private final Map<String,Exception> exceptions = new HashMap<String,Exception>();
|
||||||
|
@@ -220,6 +220,7 @@ public class AsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
private final Map<String,Constructor> constructorMap = new HashMap<String,Constructor>();
|
||||||
|
|
||||||
|
public AllParameterNamesDiscoveringVisitor(Class type, String methodName) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.methodName = methodName;
|
||||||
|
|
||||||
|
List<Method> methods = new ArrayList<Method>(Arrays.asList(type.getMethods()));
|
||||||
|
@@ -232,6 +233,7 @@ public class AsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
public AllParameterNamesDiscoveringVisitor(Class type) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.methodName = "<init>";
|
||||||
|
|
||||||
|
List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors()));
|
||||||
|
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java
|
||||||
|
index 84ded16..39dfd58 100644
|
||||||
|
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java
|
||||||
|
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/ReflectionUtil.java
|
||||||
|
@@ -41,13 +41,7 @@ public final class ReflectionUtil {
|
||||||
|
private static ParameterNameLoader parameterNamesLoader;
|
||||||
|
|
||||||
|
static {
|
||||||
|
- if (isClassAvailable("org.apache.xbean.asm5.ClassReader")) {
|
||||||
|
- parameterNamesLoader = new XbeanAsmParameterNameLoader();
|
||||||
|
- } else if (isClassAvailable("org.objectweb.asm.ClassReader")) {
|
||||||
|
- parameterNamesLoader = new AsmParameterNameLoader();
|
||||||
|
- } else if (isClassAvailable("org.apache.xbean.asm.ClassReader") || isClassAvailable("org.apache.xbean.asm4.ClassReader")) {
|
||||||
|
- throw new RuntimeException("Your xbean-asm-shade is too old, please upgrade to xbean-asm5-shade");
|
||||||
|
- }
|
||||||
|
+ parameterNamesLoader = new XbeanAsmParameterNameLoader();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ReflectionUtil() {
|
||||||
|
diff --git a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||||
|
index 4a89c44..6242dd3 100644
|
||||||
|
--- a/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||||
|
+++ b/xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java
|
||||||
|
@@ -17,12 +17,12 @@
|
||||||
|
*/
|
||||||
|
package org.apache.xbean.recipe;
|
||||||
|
|
||||||
|
-import org.apache.xbean.asm5.shade.commons.EmptyVisitor;
|
||||||
|
-import org.apache.xbean.asm5.ClassReader;
|
||||||
|
-import org.apache.xbean.asm5.Label;
|
||||||
|
-import org.apache.xbean.asm5.MethodVisitor;
|
||||||
|
-import org.apache.xbean.asm5.Opcodes;
|
||||||
|
-import org.apache.xbean.asm5.Type;
|
||||||
|
+import org.objectweb.asm.ClassReader;
|
||||||
|
+import org.objectweb.asm.ClassVisitor;
|
||||||
|
+import org.objectweb.asm.Label;
|
||||||
|
+import org.objectweb.asm.MethodVisitor;
|
||||||
|
+import org.objectweb.asm.Opcodes;
|
||||||
|
+import org.objectweb.asm.Type;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
@@ -211,7 +211,7 @@ public class XbeanAsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static class AllParameterNamesDiscoveringVisitor extends EmptyVisitor {
|
||||||
|
+ private static class AllParameterNamesDiscoveringVisitor extends ClassVisitor {
|
||||||
|
private final Map<Constructor,List<String>> constructorParameters = new HashMap<Constructor,List<String>>();
|
||||||
|
private final Map<Method,List<String>> methodParameters = new HashMap<Method,List<String>>();
|
||||||
|
private final Map<String,Exception> exceptions = new HashMap<String,Exception>();
|
||||||
|
@@ -220,6 +220,7 @@ public class XbeanAsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
private final Map<String,Constructor> constructorMap = new HashMap<String,Constructor>();
|
||||||
|
|
||||||
|
public AllParameterNamesDiscoveringVisitor(Class type, String methodName) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.methodName = methodName;
|
||||||
|
|
||||||
|
List<Method> methods = new ArrayList<Method>(Arrays.asList(type.getMethods()));
|
||||||
|
@@ -232,6 +233,7 @@ public class XbeanAsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
public AllParameterNamesDiscoveringVisitor(Class type) {
|
||||||
|
+ super(Opcodes.ASM5);
|
||||||
|
this.methodName = "<init>";
|
||||||
|
|
||||||
|
List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors()));
|
||||||
|
@@ -312,4 +314,4 @@ public class XbeanAsmParameterNameLoader implements ParameterNameLoader {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-}
|
||||||
|
\ No newline at end of file
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
62
0002-Port-to-Eclipse-Luna-OSGi.patch
Normal file
62
0002-Port-to-Eclipse-Luna-OSGi.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From e310ab2bb5e5b34472a0fc6e368082897f140afa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Fri, 21 Nov 2014 10:05:05 +0100
|
||||||
|
Subject: [PATCH 2/4] Port to Eclipse Luna OSGi
|
||||||
|
|
||||||
|
---
|
||||||
|
xbean-bundleutils/pom.xml | 8 +-------
|
||||||
|
.../apache/xbean/osgi/bundle/util/DelegatingBundleContext.java | 10 ++++++++++
|
||||||
|
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/xbean-bundleutils/pom.xml b/xbean-bundleutils/pom.xml
|
||||||
|
index 015f97d..6dcad55 100644
|
||||||
|
--- a/xbean-bundleutils/pom.xml
|
||||||
|
+++ b/xbean-bundleutils/pom.xml
|
||||||
|
@@ -35,15 +35,9 @@
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
- <groupId>org.osgi</groupId>
|
||||||
|
- <artifactId>org.osgi.core</artifactId>
|
||||||
|
- <version>4.3.1</version>
|
||||||
|
- <scope>provided</scope>
|
||||||
|
- </dependency>
|
||||||
|
- <dependency>
|
||||||
|
<groupId>org.eclipse</groupId>
|
||||||
|
<artifactId>osgi</artifactId>
|
||||||
|
- <version>3.6.0.v20100517</version>
|
||||||
|
+ <version>3.10.0-v20140606-1445</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
diff --git a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||||
|
index f4e876d..ea353ef 100644
|
||||||
|
--- a/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||||
|
+++ b/xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java
|
||||||
|
@@ -31,7 +31,9 @@ import org.osgi.framework.BundleListener;
|
||||||
|
import org.osgi.framework.Filter;
|
||||||
|
import org.osgi.framework.FrameworkListener;
|
||||||
|
import org.osgi.framework.InvalidSyntaxException;
|
||||||
|
+import org.osgi.framework.ServiceFactory;
|
||||||
|
import org.osgi.framework.ServiceListener;
|
||||||
|
+import org.osgi.framework.ServiceObjects;
|
||||||
|
import org.osgi.framework.ServiceReference;
|
||||||
|
import org.osgi.framework.ServiceRegistration;
|
||||||
|
|
||||||
|
@@ -153,5 +155,13 @@ public class DelegatingBundleContext implements BundleContext {
|
||||||
|
public Bundle getBundle(String location) {
|
||||||
|
return bundleContext.getBundle(location);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
|
||||||
|
+ return bundleContext.getServiceObjects(reference);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, ServiceFactory<S> factory, Dictionary<String, ?> properties) {
|
||||||
|
+ return bundleContext.registerService(clazz, factory, properties);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
655
0003-Port-to-QDox-2.0.patch
Normal file
655
0003-Port-to-QDox-2.0.patch
Normal file
@ -0,0 +1,655 @@
|
|||||||
|
From 0e20f1b48db827a457800c6f96bc413feeee115f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Fri, 21 Nov 2014 10:51:38 +0100
|
||||||
|
Subject: [PATCH 3/4] Port to QDox 2.0
|
||||||
|
|
||||||
|
---
|
||||||
|
pom.xml | 2 +-
|
||||||
|
.../blueprint/generator/QdoxMappingLoader.java | 144 ++++++++++++---------
|
||||||
|
.../xbean/spring/generator/QdoxMappingLoader.java | 144 ++++++++++++---------
|
||||||
|
3 files changed, 163 insertions(+), 127 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pom.xml b/pom.xml
|
||||||
|
index 0c17645..36bb2da 100644
|
||||||
|
--- a/pom.xml
|
||||||
|
+++ b/pom.xml
|
||||||
|
@@ -277,7 +277,7 @@
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.thoughtworks.qdox</groupId>
|
||||||
|
<artifactId>qdox</artifactId>
|
||||||
|
- <version>1.6.3</version>
|
||||||
|
+ <version>2.0-M2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
diff --git a/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java b/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||||
|
index 6635937..e17fd08 100644
|
||||||
|
--- a/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||||
|
+++ b/xbean-blueprint/src/main/java/org/apache/xbean/blueprint/generator/QdoxMappingLoader.java
|
||||||
|
@@ -20,6 +20,7 @@ import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
+import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
@@ -31,14 +32,17 @@ import java.util.TreeSet;
|
||||||
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
|
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||||
|
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||||
|
import com.thoughtworks.qdox.model.BeanProperty;
|
||||||
|
import com.thoughtworks.qdox.model.DocletTag;
|
||||||
|
import com.thoughtworks.qdox.model.JavaClass;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaConstructor;
|
||||||
|
import com.thoughtworks.qdox.model.JavaMethod;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaModel;
|
||||||
|
import com.thoughtworks.qdox.model.JavaParameter;
|
||||||
|
import com.thoughtworks.qdox.model.JavaSource;
|
||||||
|
-import com.thoughtworks.qdox.model.Type;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaType;
|
||||||
|
+
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
@@ -62,7 +66,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
private final String defaultNamespace;
|
||||||
|
private final File[] srcDirs;
|
||||||
|
private final String[] excludedClasses;
|
||||||
|
- private Type collectionType;
|
||||||
|
+ private JavaClass collectionType;
|
||||||
|
|
||||||
|
public QdoxMappingLoader(String defaultNamespace, File[] srcDirs, String[] excludedClasses) {
|
||||||
|
this.defaultNamespace = defaultNamespace;
|
||||||
|
@@ -79,7 +83,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<NamespaceMapping> loadNamespaces() throws IOException {
|
||||||
|
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||||
|
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||||
|
|
||||||
|
log.debug("Source directories: ");
|
||||||
|
|
||||||
|
@@ -92,11 +96,11 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
getSourceFiles(sourceDirectory, excludedClasses, builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
- collectionType = builder.getClassByName("java.util.Collection").asType();
|
||||||
|
+ collectionType = builder.getClassByName("java.util.Collection");
|
||||||
|
return loadNamespaces(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private Set<NamespaceMapping> loadNamespaces(JavaDocBuilder builder) {
|
||||||
|
+ private Set<NamespaceMapping> loadNamespaces(JavaProjectBuilder builder) {
|
||||||
|
// load all of the elements
|
||||||
|
List<ElementMapping> elements = loadElements(builder);
|
||||||
|
|
||||||
|
@@ -131,14 +135,14 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return Collections.unmodifiableSet(namespaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private List<ElementMapping> loadElements(JavaDocBuilder builder) {
|
||||||
|
- JavaSource[] javaSources = builder.getSources();
|
||||||
|
+ private List<ElementMapping> loadElements(JavaProjectBuilder builder) {
|
||||||
|
+ Collection<JavaSource> javaSources = builder.getSources();
|
||||||
|
List<ElementMapping> elements = new ArrayList<ElementMapping>();
|
||||||
|
for (JavaSource javaSource : javaSources) {
|
||||||
|
- if (javaSource.getClasses().length == 0) {
|
||||||
|
+ if (javaSource.getClasses().isEmpty()) {
|
||||||
|
log.info("No Java Classes defined in: " + javaSource.getURL());
|
||||||
|
} else {
|
||||||
|
- JavaClass[] classes = javaSource.getClasses();
|
||||||
|
+ Collection<JavaClass> classes = javaSource.getClasses();
|
||||||
|
for (JavaClass javaClass : classes) {
|
||||||
|
ElementMapping element = loadElement(builder, javaClass);
|
||||||
|
if (element != null && !javaClass.isAbstract()) {
|
||||||
|
@@ -152,7 +156,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private ElementMapping loadElement(JavaDocBuilder builder, JavaClass javaClass) {
|
||||||
|
+ private ElementMapping loadElement(JavaProjectBuilder builder, JavaClass javaClass) {
|
||||||
|
DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
|
||||||
|
if (xbeanTag == null) {
|
||||||
|
return null;
|
||||||
|
@@ -176,7 +180,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
Map<String, AttributeMapping> attributesByPropertyName = new HashMap<String, AttributeMapping>();
|
||||||
|
|
||||||
|
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||||
|
- BeanProperty[] beanProperties = jClass.getBeanProperties();
|
||||||
|
+ Collection<BeanProperty> beanProperties = jClass.getBeanProperties();
|
||||||
|
for (BeanProperty beanProperty : beanProperties) {
|
||||||
|
// we only care about properties with a setter
|
||||||
|
if (beanProperty.getMutator() != null) {
|
||||||
|
@@ -219,9 +223,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
String destroyMethod = null;
|
||||||
|
String factoryMethod = null;
|
||||||
|
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||||
|
- JavaMethod[] methods = javaClass.getMethods();
|
||||||
|
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||||
|
for (JavaMethod method : methods) {
|
||||||
|
- if (method.isPublic() && !method.isConstructor()) {
|
||||||
|
+ if (method.isPublic()) {
|
||||||
|
if (initMethod == null && method.getTagByName(INIT_METHOD_ANNOTATION) != null) {
|
||||||
|
initMethod = method.getName();
|
||||||
|
}
|
||||||
|
@@ -237,22 +241,43 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
List<List<ParameterMapping>> constructorArgs = new ArrayList<List<ParameterMapping>>();
|
||||||
|
- JavaMethod[] methods = javaClass.getMethods();
|
||||||
|
- for (JavaMethod method : methods) {
|
||||||
|
- JavaParameter[] parameters = method.getParameters();
|
||||||
|
- if (isValidConstructor(factoryMethod, method, parameters)) {
|
||||||
|
- List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.length);
|
||||||
|
- for (JavaParameter parameter : parameters) {
|
||||||
|
- AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
- if (attributeMapping == null) {
|
||||||
|
- attributeMapping = loadParameter(parameter);
|
||||||
|
-
|
||||||
|
- attributes.add(attributeMapping);
|
||||||
|
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ if (factoryMethod == null) {
|
||||||
|
+ Collection<JavaConstructor> constructors = javaClass.getConstructors();
|
||||||
|
+ for (JavaConstructor constructor : constructors) {
|
||||||
|
+ Collection<JavaParameter> parameters = constructor.getParameters();
|
||||||
|
+ if (constructor.isPublic() && parameters.size() > 0) {
|
||||||
|
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||||
|
+ for (JavaParameter parameter : parameters) {
|
||||||
|
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
+ if (attributeMapping == null) {
|
||||||
|
+ attributeMapping = loadParameter(parameter, constructor);
|
||||||
|
+
|
||||||
|
+ attributes.add(attributeMapping);
|
||||||
|
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ }
|
||||||
|
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
}
|
||||||
|
- args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||||
|
+ for (JavaMethod method : methods) {
|
||||||
|
+ Collection<JavaParameter> parameters = method.getParameters();
|
||||||
|
+ if (method.isPublic() && parameters.size() > 0 && method.getName().equals(factoryMethod)) {
|
||||||
|
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||||
|
+ for (JavaParameter parameter : parameters) {
|
||||||
|
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
+ if (attributeMapping == null) {
|
||||||
|
+ attributeMapping = loadParameter(parameter, method);
|
||||||
|
+
|
||||||
|
+ attributes.add(attributeMapping);
|
||||||
|
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ }
|
||||||
|
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
+ }
|
||||||
|
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
}
|
||||||
|
- constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -303,7 +328,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
interfaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private List<String> getFullyQualifiedNames(JavaClass[] implementedInterfaces) {
|
||||||
|
+ private List<String> getFullyQualifiedNames(Collection<JavaClass> implementedInterfaces) {
|
||||||
|
ArrayList<String> l = new ArrayList<String>();
|
||||||
|
for (JavaClass implementedInterface : implementedInterfaces) {
|
||||||
|
l.add(implementedInterface.getFullyQualifiedName());
|
||||||
|
@@ -395,19 +420,19 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return defaultDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private AttributeMapping loadParameter(JavaParameter parameter) {
|
||||||
|
+ private AttributeMapping loadParameter(JavaParameter parameter, JavaModel methodOrConstructor) {
|
||||||
|
String parameterName = parameter.getName();
|
||||||
|
String parameterDescription = getParameterDescription(parameter);
|
||||||
|
|
||||||
|
// first attempt to load the attribute from the java beans accessor methods
|
||||||
|
- JavaClass javaClass = parameter.getParentMethod().getParentClass();
|
||||||
|
+ JavaClass javaClass = parameter.getParentClass();
|
||||||
|
BeanProperty beanProperty = javaClass.getBeanProperty(parameterName);
|
||||||
|
if (beanProperty != null) {
|
||||||
|
AttributeMapping attributeMapping = loadAttribute(beanProperty, parameterDescription);
|
||||||
|
// if the attribute mapping is null, the property was tagged as hidden and this is an error
|
||||||
|
if (attributeMapping == null) {
|
||||||
|
throw new InvalidModelException("Hidden property usage: " +
|
||||||
|
- "The construction method " + toMethodLocator(parameter.getParentMethod()) +
|
||||||
|
+ "The construction method " + toMethodLocator(parameter.getParentClass(), methodOrConstructor) +
|
||||||
|
" can not use a hidded property " + parameterName);
|
||||||
|
}
|
||||||
|
return attributeMapping;
|
||||||
|
@@ -426,9 +451,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
|
||||||
|
private String getParameterDescription(JavaParameter parameter) {
|
||||||
|
String parameterName = parameter.getName();
|
||||||
|
- DocletTag[] tags = parameter.getParentMethod().getTagsByName("param");
|
||||||
|
+ Collection<DocletTag> tags = parameter.getTagsByName("param");
|
||||||
|
for (DocletTag tag : tags) {
|
||||||
|
- if (tag.getParameters()[0].equals(parameterName)) {
|
||||||
|
+ if (tag.getParameters().get(0).equals(parameterName)) {
|
||||||
|
String parameterDescription = tag.getValue().trim();
|
||||||
|
if (parameterDescription.startsWith(parameterName)) {
|
||||||
|
parameterDescription = parameterDescription.substring(parameterName.length()).trim();
|
||||||
|
@@ -439,18 +464,6 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private boolean isValidConstructor(String factoryMethod, JavaMethod method, JavaParameter[] parameters) {
|
||||||
|
- if (!method.isPublic() || parameters.length == 0) {
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (factoryMethod == null) {
|
||||||
|
- return method.isConstructor();
|
||||||
|
- } else {
|
||||||
|
- return method.getName().equals(factoryMethod);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
private static String getProperty(DocletTag propertyTag, String propertyName) {
|
||||||
|
return getProperty(propertyTag, propertyName, null);
|
||||||
|
}
|
||||||
|
@@ -477,14 +490,17 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private org.apache.xbean.blueprint.generator.Type toMappingType(Type type, String nestedType) {
|
||||||
|
+ private org.apache.xbean.blueprint.generator.Type toMappingType(JavaType type, String nestedType) {
|
||||||
|
try {
|
||||||
|
- if (type.isArray()) {
|
||||||
|
- return org.apache.xbean.blueprint.generator.Type.newArrayType(type.getValue(), type.getDimensions());
|
||||||
|
- } else if (type.isA(collectionType)) {
|
||||||
|
- if (nestedType == null) nestedType = "java.lang.Object";
|
||||||
|
- return org.apache.xbean.blueprint.generator.Type.newCollectionType(type.getValue(),
|
||||||
|
- org.apache.xbean.blueprint.generator.Type.newSimpleType(nestedType));
|
||||||
|
+ if (type instanceof JavaClass) {
|
||||||
|
+ JavaClass clazz = (JavaClass)type;
|
||||||
|
+ if (clazz.isArray()) {
|
||||||
|
+ return org.apache.xbean.blueprint.generator.Type.newArrayType(type.getValue(), clazz.getDimensions());
|
||||||
|
+ } else if (clazz.isA(collectionType)) {
|
||||||
|
+ if (nestedType == null) nestedType = "java.lang.Object";
|
||||||
|
+ return org.apache.xbean.blueprint.generator.Type.newCollectionType(type.getValue(),
|
||||||
|
+ org.apache.xbean.blueprint.generator.Type.newSimpleType(nestedType));
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.debug("Could not load type mapping", t);
|
||||||
|
@@ -492,26 +508,28 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return org.apache.xbean.blueprint.generator.Type.newSimpleType(type.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static String toMethodLocator(JavaMethod method) {
|
||||||
|
+ private static String toMethodLocator(JavaClass parentClass, JavaModel methodOrConstructor) {
|
||||||
|
+ JavaMethod method = methodOrConstructor instanceof JavaMethod ? (JavaMethod) methodOrConstructor : null;
|
||||||
|
+ JavaConstructor constructor = methodOrConstructor instanceof JavaConstructor ? (JavaConstructor) methodOrConstructor : null;
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
- buf.append(method.getParentClass().getFullyQualifiedName());
|
||||||
|
- if (!method.isConstructor()) {
|
||||||
|
+ buf.append(parentClass.getFullyQualifiedName());
|
||||||
|
+ if (method != null) {
|
||||||
|
buf.append(".").append(method.getName());
|
||||||
|
}
|
||||||
|
buf.append("(");
|
||||||
|
- JavaParameter[] parameters = method.getParameters();
|
||||||
|
- for (int i = 0; i < parameters.length; i++) {
|
||||||
|
- JavaParameter parameter = parameters[i];
|
||||||
|
+ List<JavaParameter> parameters = method != null ? method.getParameters() : constructor.getParameters();
|
||||||
|
+ for (int i = 0; i < parameters.size(); i++) {
|
||||||
|
+ JavaParameter parameter = parameters.get(i);
|
||||||
|
if (i > 0) {
|
||||||
|
buf.append(", ");
|
||||||
|
}
|
||||||
|
buf.append(parameter.getName());
|
||||||
|
}
|
||||||
|
- buf.append(") : ").append(method.getLineNumber());
|
||||||
|
+ buf.append(") : ").append(method != null ? method.getLineNumber() : constructor.getLineNumber());
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void getSourceFiles(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void getSourceFiles(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
if (base.isDirectory()) {
|
||||||
|
listAllFileNames(base, "", excludedClasses, builder);
|
||||||
|
} else {
|
||||||
|
@@ -519,7 +537,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
if (!base.canRead() || !base.isDirectory()) {
|
||||||
|
throw new IllegalArgumentException(base.getAbsolutePath());
|
||||||
|
}
|
||||||
|
@@ -536,7 +554,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void listAllJarEntries(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void listAllJarEntries(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
JarFile jarFile = new JarFile(base);
|
||||||
|
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements(); ) {
|
||||||
|
JarEntry entry = (JarEntry) entries.nextElement();
|
||||||
|
diff --git a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||||
|
index 94bd7a1..ae55819 100644
|
||||||
|
--- a/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||||
|
+++ b/xbean-spring/src/main/java/org/apache/xbean/spring/generator/QdoxMappingLoader.java
|
||||||
|
@@ -20,6 +20,7 @@ import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
+import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
@@ -31,14 +32,17 @@ import java.util.TreeSet;
|
||||||
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
|
-import com.thoughtworks.qdox.JavaDocBuilder;
|
||||||
|
+import com.thoughtworks.qdox.JavaProjectBuilder;
|
||||||
|
import com.thoughtworks.qdox.model.BeanProperty;
|
||||||
|
import com.thoughtworks.qdox.model.DocletTag;
|
||||||
|
import com.thoughtworks.qdox.model.JavaClass;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaConstructor;
|
||||||
|
import com.thoughtworks.qdox.model.JavaMethod;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaModel;
|
||||||
|
import com.thoughtworks.qdox.model.JavaParameter;
|
||||||
|
import com.thoughtworks.qdox.model.JavaSource;
|
||||||
|
-import com.thoughtworks.qdox.model.Type;
|
||||||
|
+import com.thoughtworks.qdox.model.JavaType;
|
||||||
|
+
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
@@ -62,7 +66,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
private final String defaultNamespace;
|
||||||
|
private final File[] srcDirs;
|
||||||
|
private final String[] excludedClasses;
|
||||||
|
- private Type collectionType;
|
||||||
|
+ private JavaClass collectionType;
|
||||||
|
|
||||||
|
public QdoxMappingLoader(String defaultNamespace, File[] srcDirs, String[] excludedClasses) {
|
||||||
|
this.defaultNamespace = defaultNamespace;
|
||||||
|
@@ -79,7 +83,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<NamespaceMapping> loadNamespaces() throws IOException {
|
||||||
|
- JavaDocBuilder builder = new JavaDocBuilder();
|
||||||
|
+ JavaProjectBuilder builder = new JavaProjectBuilder();
|
||||||
|
|
||||||
|
log.debug("Source directories: ");
|
||||||
|
|
||||||
|
@@ -92,11 +96,11 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
getSourceFiles(sourceDirectory, excludedClasses, builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
- collectionType = builder.getClassByName("java.util.Collection").asType();
|
||||||
|
+ collectionType = builder.getClassByName("java.util.Collection");
|
||||||
|
return loadNamespaces(builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private Set<NamespaceMapping> loadNamespaces(JavaDocBuilder builder) {
|
||||||
|
+ private Set<NamespaceMapping> loadNamespaces(JavaProjectBuilder builder) {
|
||||||
|
// load all of the elements
|
||||||
|
List<ElementMapping> elements = loadElements(builder);
|
||||||
|
|
||||||
|
@@ -131,14 +135,14 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return Collections.unmodifiableSet(namespaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private List<ElementMapping> loadElements(JavaDocBuilder builder) {
|
||||||
|
- JavaSource[] javaSources = builder.getSources();
|
||||||
|
+ private List<ElementMapping> loadElements(JavaProjectBuilder builder) {
|
||||||
|
+ Collection<JavaSource> javaSources = builder.getSources();
|
||||||
|
List<ElementMapping> elements = new ArrayList<ElementMapping>();
|
||||||
|
for (JavaSource javaSource : javaSources) {
|
||||||
|
- if (javaSource.getClasses().length == 0) {
|
||||||
|
+ if (javaSource.getClasses().isEmpty()) {
|
||||||
|
log.info("No Java Classes defined in: " + javaSource.getURL());
|
||||||
|
} else {
|
||||||
|
- JavaClass[] classes = javaSource.getClasses();
|
||||||
|
+ Collection<JavaClass> classes = javaSource.getClasses();
|
||||||
|
for (JavaClass javaClass : classes) {
|
||||||
|
ElementMapping element = loadElement(builder, javaClass);
|
||||||
|
if (element != null && !javaClass.isAbstract()) {
|
||||||
|
@@ -152,7 +156,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return elements;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private ElementMapping loadElement(JavaDocBuilder builder, JavaClass javaClass) {
|
||||||
|
+ private ElementMapping loadElement(JavaProjectBuilder builder, JavaClass javaClass) {
|
||||||
|
DocletTag xbeanTag = javaClass.getTagByName(XBEAN_ANNOTATION);
|
||||||
|
if (xbeanTag == null) {
|
||||||
|
return null;
|
||||||
|
@@ -176,7 +180,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
Map<String, AttributeMapping> attributesByPropertyName = new HashMap<String, AttributeMapping>();
|
||||||
|
|
||||||
|
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||||
|
- BeanProperty[] beanProperties = jClass.getBeanProperties();
|
||||||
|
+ Collection<BeanProperty> beanProperties = jClass.getBeanProperties();
|
||||||
|
for (BeanProperty beanProperty : beanProperties) {
|
||||||
|
// we only care about properties with a setter
|
||||||
|
if (beanProperty.getMutator() != null) {
|
||||||
|
@@ -219,9 +223,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
String destroyMethod = null;
|
||||||
|
String factoryMethod = null;
|
||||||
|
for (JavaClass jClass = javaClass; jClass != null; jClass = jClass.getSuperJavaClass()) {
|
||||||
|
- JavaMethod[] methods = javaClass.getMethods();
|
||||||
|
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||||
|
for (JavaMethod method : methods) {
|
||||||
|
- if (method.isPublic() && !method.isConstructor()) {
|
||||||
|
+ if (method.isPublic()) {
|
||||||
|
if (initMethod == null && method.getTagByName(INIT_METHOD_ANNOTATION) != null) {
|
||||||
|
initMethod = method.getName();
|
||||||
|
}
|
||||||
|
@@ -237,22 +241,43 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
|
||||||
|
List<List<ParameterMapping>> constructorArgs = new ArrayList<List<ParameterMapping>>();
|
||||||
|
- JavaMethod[] methods = javaClass.getMethods();
|
||||||
|
- for (JavaMethod method : methods) {
|
||||||
|
- JavaParameter[] parameters = method.getParameters();
|
||||||
|
- if (isValidConstructor(factoryMethod, method, parameters)) {
|
||||||
|
- List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.length);
|
||||||
|
- for (JavaParameter parameter : parameters) {
|
||||||
|
- AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
- if (attributeMapping == null) {
|
||||||
|
- attributeMapping = loadParameter(parameter);
|
||||||
|
-
|
||||||
|
- attributes.add(attributeMapping);
|
||||||
|
- attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ if (factoryMethod == null) {
|
||||||
|
+ Collection<JavaConstructor> constructors = javaClass.getConstructors();
|
||||||
|
+ for (JavaConstructor constructor : constructors) {
|
||||||
|
+ Collection<JavaParameter> parameters = constructor.getParameters();
|
||||||
|
+ if (constructor.isPublic() && parameters.size() > 0) {
|
||||||
|
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||||
|
+ for (JavaParameter parameter : parameters) {
|
||||||
|
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
+ if (attributeMapping == null) {
|
||||||
|
+ attributeMapping = loadParameter(parameter, constructor);
|
||||||
|
+
|
||||||
|
+ attributes.add(attributeMapping);
|
||||||
|
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ }
|
||||||
|
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
}
|
||||||
|
- args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ Collection<JavaMethod> methods = javaClass.getMethods();
|
||||||
|
+ for (JavaMethod method : methods) {
|
||||||
|
+ Collection<JavaParameter> parameters = method.getParameters();
|
||||||
|
+ if (method.isPublic() && parameters.size() > 0 && method.getName().equals(factoryMethod)) {
|
||||||
|
+ List<ParameterMapping> args = new ArrayList<ParameterMapping>(parameters.size());
|
||||||
|
+ for (JavaParameter parameter : parameters) {
|
||||||
|
+ AttributeMapping attributeMapping = attributesByPropertyName.get(parameter.getName());
|
||||||
|
+ if (attributeMapping == null) {
|
||||||
|
+ attributeMapping = loadParameter(parameter, method);
|
||||||
|
+
|
||||||
|
+ attributes.add(attributeMapping);
|
||||||
|
+ attributesByPropertyName.put(attributeMapping.getPropertyName(), attributeMapping);
|
||||||
|
+ }
|
||||||
|
+ args.add(new ParameterMapping(attributeMapping.getPropertyName(), toMappingType(parameter.getType(), null)));
|
||||||
|
+ }
|
||||||
|
+ constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
}
|
||||||
|
- constructorArgs.add(Collections.unmodifiableList(args));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -303,7 +328,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
interfaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private List<String> getFullyQualifiedNames(JavaClass[] implementedInterfaces) {
|
||||||
|
+ private List<String> getFullyQualifiedNames(Collection<JavaClass> implementedInterfaces) {
|
||||||
|
ArrayList<String> l = new ArrayList<String>();
|
||||||
|
for (JavaClass implementedInterface : implementedInterfaces) {
|
||||||
|
l.add(implementedInterface.getFullyQualifiedName());
|
||||||
|
@@ -395,19 +420,19 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return defaultDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private AttributeMapping loadParameter(JavaParameter parameter) {
|
||||||
|
+ private AttributeMapping loadParameter(JavaParameter parameter, JavaModel methodOrConstructor) {
|
||||||
|
String parameterName = parameter.getName();
|
||||||
|
String parameterDescription = getParameterDescription(parameter);
|
||||||
|
|
||||||
|
// first attempt to load the attribute from the java beans accessor methods
|
||||||
|
- JavaClass javaClass = parameter.getParentMethod().getParentClass();
|
||||||
|
+ JavaClass javaClass = parameter.getParentClass();
|
||||||
|
BeanProperty beanProperty = javaClass.getBeanProperty(parameterName);
|
||||||
|
if (beanProperty != null) {
|
||||||
|
AttributeMapping attributeMapping = loadAttribute(beanProperty, parameterDescription);
|
||||||
|
// if the attribute mapping is null, the property was tagged as hidden and this is an error
|
||||||
|
if (attributeMapping == null) {
|
||||||
|
throw new InvalidModelException("Hidden property usage: " +
|
||||||
|
- "The construction method " + toMethodLocator(parameter.getParentMethod()) +
|
||||||
|
+ "The construction method " + toMethodLocator(parameter.getParentClass(), methodOrConstructor) +
|
||||||
|
" can not use a hidded property " + parameterName);
|
||||||
|
}
|
||||||
|
return attributeMapping;
|
||||||
|
@@ -426,9 +451,9 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
|
||||||
|
private String getParameterDescription(JavaParameter parameter) {
|
||||||
|
String parameterName = parameter.getName();
|
||||||
|
- DocletTag[] tags = parameter.getParentMethod().getTagsByName("param");
|
||||||
|
+ Collection<DocletTag> tags = parameter.getTagsByName("param");
|
||||||
|
for (DocletTag tag : tags) {
|
||||||
|
- if (tag.getParameters()[0].equals(parameterName)) {
|
||||||
|
+ if (tag.getParameters().get(0).equals(parameterName)) {
|
||||||
|
String parameterDescription = tag.getValue().trim();
|
||||||
|
if (parameterDescription.startsWith(parameterName)) {
|
||||||
|
parameterDescription = parameterDescription.substring(parameterName.length()).trim();
|
||||||
|
@@ -439,18 +464,6 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private boolean isValidConstructor(String factoryMethod, JavaMethod method, JavaParameter[] parameters) {
|
||||||
|
- if (!method.isPublic() || parameters.length == 0) {
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (factoryMethod == null) {
|
||||||
|
- return method.isConstructor();
|
||||||
|
- } else {
|
||||||
|
- return method.getName().equals(factoryMethod);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
private static String getProperty(DocletTag propertyTag, String propertyName) {
|
||||||
|
return getProperty(propertyTag, propertyName, null);
|
||||||
|
}
|
||||||
|
@@ -477,14 +490,17 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private org.apache.xbean.spring.generator.Type toMappingType(Type type, String nestedType) {
|
||||||
|
+ private org.apache.xbean.spring.generator.Type toMappingType(JavaType type, String nestedType) {
|
||||||
|
try {
|
||||||
|
- if (type.isArray()) {
|
||||||
|
- return org.apache.xbean.spring.generator.Type.newArrayType(type.getValue(), type.getDimensions());
|
||||||
|
- } else if (type.isA(collectionType)) {
|
||||||
|
- if (nestedType == null) nestedType = "java.lang.Object";
|
||||||
|
- return org.apache.xbean.spring.generator.Type.newCollectionType(type.getValue(),
|
||||||
|
- org.apache.xbean.spring.generator.Type.newSimpleType(nestedType));
|
||||||
|
+ if (type instanceof JavaClass) {
|
||||||
|
+ JavaClass clazz = (JavaClass)type;
|
||||||
|
+ if (clazz.isArray()) {
|
||||||
|
+ return org.apache.xbean.spring.generator.Type.newArrayType(type.getValue(), clazz.getDimensions());
|
||||||
|
+ } else if (clazz.isA(collectionType)) {
|
||||||
|
+ if (nestedType == null) nestedType = "java.lang.Object";
|
||||||
|
+ return org.apache.xbean.spring.generator.Type.newCollectionType(type.getValue(),
|
||||||
|
+ org.apache.xbean.spring.generator.Type.newSimpleType(nestedType));
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
log.debug("Could not load type mapping", t);
|
||||||
|
@@ -492,26 +508,28 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
return org.apache.xbean.spring.generator.Type.newSimpleType(type.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static String toMethodLocator(JavaMethod method) {
|
||||||
|
+ private static String toMethodLocator(JavaClass parentClass, JavaModel methodOrConstructor) {
|
||||||
|
+ JavaMethod method = methodOrConstructor instanceof JavaMethod ? (JavaMethod) methodOrConstructor : null;
|
||||||
|
+ JavaConstructor constructor = methodOrConstructor instanceof JavaConstructor ? (JavaConstructor) methodOrConstructor : null;
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
- buf.append(method.getParentClass().getFullyQualifiedName());
|
||||||
|
- if (!method.isConstructor()) {
|
||||||
|
+ buf.append(parentClass.getFullyQualifiedName());
|
||||||
|
+ if (method != null) {
|
||||||
|
buf.append(".").append(method.getName());
|
||||||
|
}
|
||||||
|
buf.append("(");
|
||||||
|
- JavaParameter[] parameters = method.getParameters();
|
||||||
|
- for (int i = 0; i < parameters.length; i++) {
|
||||||
|
- JavaParameter parameter = parameters[i];
|
||||||
|
+ List<JavaParameter> parameters = method != null ? method.getParameters() : constructor.getParameters();
|
||||||
|
+ for (int i = 0; i < parameters.size(); i++) {
|
||||||
|
+ JavaParameter parameter = parameters.get(i);
|
||||||
|
if (i > 0) {
|
||||||
|
buf.append(", ");
|
||||||
|
}
|
||||||
|
buf.append(parameter.getName());
|
||||||
|
}
|
||||||
|
- buf.append(") : ").append(method.getLineNumber());
|
||||||
|
+ buf.append(") : ").append(method != null ? method.getLineNumber() : constructor.getLineNumber());
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void getSourceFiles(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void getSourceFiles(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
if (base.isDirectory()) {
|
||||||
|
listAllFileNames(base, "", excludedClasses, builder);
|
||||||
|
} else {
|
||||||
|
@@ -519,7 +537,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void listAllFileNames(File base, String prefix, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
if (!base.canRead() || !base.isDirectory()) {
|
||||||
|
throw new IllegalArgumentException(base.getAbsolutePath());
|
||||||
|
}
|
||||||
|
@@ -536,7 +554,7 @@ public class QdoxMappingLoader implements MappingLoader {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void listAllJarEntries(File base, String[] excludedClasses, JavaDocBuilder builder) throws IOException {
|
||||||
|
+ private static void listAllJarEntries(File base, String[] excludedClasses, JavaProjectBuilder builder) throws IOException {
|
||||||
|
JarFile jarFile = new JarFile(base);
|
||||||
|
for (Enumeration entries = jarFile.entries(); entries.hasMoreElements(); ) {
|
||||||
|
JarEntry entry = (JarEntry) entries.nextElement();
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
65
0004-Port-to-Groovy-2.3.7.patch
Normal file
65
0004-Port-to-Groovy-2.3.7.patch
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
From dbf7384e63d75bd33a919d6dfbfb1a75630acdae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
||||||
|
Date: Fri, 21 Nov 2014 11:43:56 +0100
|
||||||
|
Subject: [PATCH 4/4] Port to Groovy 2.3.7
|
||||||
|
|
||||||
|
---
|
||||||
|
pom.xml | 4 ++--
|
||||||
|
xbean-telnet/pom.xml | 2 +-
|
||||||
|
xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java | 4 +++-
|
||||||
|
3 files changed, 6 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pom.xml b/pom.xml
|
||||||
|
index 36bb2da..e483eb0 100644
|
||||||
|
--- a/pom.xml
|
||||||
|
+++ b/pom.xml
|
||||||
|
@@ -245,9 +245,9 @@
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
- <groupId>groovy</groupId>
|
||||||
|
+ <groupId>org.codehaus.groovy</groupId>
|
||||||
|
<artifactId>groovy</artifactId>
|
||||||
|
- <version>1.0-jsr-03</version>
|
||||||
|
+ <version>2.3.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
diff --git a/xbean-telnet/pom.xml b/xbean-telnet/pom.xml
|
||||||
|
index 1f26170..f6db40e 100644
|
||||||
|
--- a/xbean-telnet/pom.xml
|
||||||
|
+++ b/xbean-telnet/pom.xml
|
||||||
|
@@ -36,7 +36,7 @@
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
- <groupId>groovy</groupId>
|
||||||
|
+ <groupId>org.codehaus.groovy</groupId>
|
||||||
|
<artifactId>groovy</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
diff --git a/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java b/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java
|
||||||
|
index 2ccb8eb..b7208fe 100755
|
||||||
|
--- a/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java
|
||||||
|
+++ b/xbean-telnet/src/main/java/org/apache/xbean/command/GroovySh.java
|
||||||
|
@@ -17,6 +17,8 @@
|
||||||
|
package org.apache.xbean.command;
|
||||||
|
|
||||||
|
import groovy.lang.GroovyShell;
|
||||||
|
+import groovy.lang.GroovySystem;
|
||||||
|
+
|
||||||
|
import org.codehaus.groovy.runtime.InvokerHelper;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
@@ -33,7 +35,7 @@ public class GroovySh implements Command {
|
||||||
|
public int main(String[] args, InputStream in, PrintStream out) {
|
||||||
|
GroovyShell shell = new GroovyShell();
|
||||||
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||||
|
- String version = InvokerHelper.getVersion();
|
||||||
|
+ String version = GroovySystem.getVersion();
|
||||||
|
out.println("Lets get Groovy!");
|
||||||
|
out.println("================");
|
||||||
|
out.println("Version: " + version + " JVM: " + System.getProperty("java.vm.version"));
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
5b30546ef2478d31c787079072bf9def xbean-3.17-source-release.zip
|
6f10769b1109646edea129263e4fd7f4 xbean-4.1-source-release.zip
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
--- xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java~ 2014-04-14 13:00:42.025851035 +0200
|
|
||||||
+++ xbean-reflect/src/main/java/org/apache/xbean/recipe/XbeanAsmParameterNameLoader.java 2014-04-14 13:01:13.794418041 +0200
|
|
||||||
@@ -17,12 +17,12 @@
|
|
||||||
*/
|
|
||||||
package org.apache.xbean.recipe;
|
|
||||||
|
|
||||||
-import org.apache.xbean.asm5.shade.commons.EmptyVisitor;
|
|
||||||
-import org.apache.xbean.asm5.ClassReader;
|
|
||||||
-import org.apache.xbean.asm5.Label;
|
|
||||||
-import org.apache.xbean.asm5.MethodVisitor;
|
|
||||||
-import org.apache.xbean.asm5.Opcodes;
|
|
||||||
-import org.apache.xbean.asm5.Type;
|
|
||||||
+import org.objectweb.asm.ClassReader;
|
|
||||||
+import org.objectweb.asm.ClassVisitor;
|
|
||||||
+import org.objectweb.asm.Label;
|
|
||||||
+import org.objectweb.asm.MethodVisitor;
|
|
||||||
+import org.objectweb.asm.Opcodes;
|
|
||||||
+import org.objectweb.asm.Type;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
@@ -211,7 +211,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static class AllParameterNamesDiscoveringVisitor extends EmptyVisitor {
|
|
||||||
+ private static class AllParameterNamesDiscoveringVisitor extends ClassVisitor {
|
|
||||||
private final Map<Constructor,List<String>> constructorParameters = new HashMap<Constructor,List<String>>();
|
|
||||||
private final Map<Method,List<String>> methodParameters = new HashMap<Method,List<String>>();
|
|
||||||
private final Map<String,Exception> exceptions = new HashMap<String,Exception>();
|
|
||||||
@@ -220,6 +220,7 @@
|
|
||||||
private final Map<String,Constructor> constructorMap = new HashMap<String,Constructor>();
|
|
||||||
|
|
||||||
public AllParameterNamesDiscoveringVisitor(Class type, String methodName) {
|
|
||||||
+ super(Opcodes.ASM4);
|
|
||||||
this.methodName = methodName;
|
|
||||||
|
|
||||||
List<Method> methods = new ArrayList<Method>(Arrays.asList(type.getMethods()));
|
|
||||||
@@ -232,6 +233,7 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
public AllParameterNamesDiscoveringVisitor(Class type) {
|
|
||||||
+ super(Opcodes.ASM4);
|
|
||||||
this.methodName = "<init>";
|
|
||||||
|
|
||||||
List<Constructor> constructors = new ArrayList<Constructor>(Arrays.asList(type.getConstructors()));
|
|
@ -1,16 +0,0 @@
|
|||||||
--- xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java~ 2014-04-14 13:39:32.316688191 +0200
|
|
||||||
+++ xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/DelegatingBundleContext.java 2014-04-14 13:39:41.973106769 +0200
|
|
||||||
@@ -153,5 +153,13 @@
|
|
||||||
public Bundle getBundle(String location) {
|
|
||||||
return bundleContext.getBundle(location);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public <S> org.osgi.framework.ServiceObjects<S> getServiceObjects(ServiceReference<S> reference) {
|
|
||||||
+ return bundleContext.getServiceObjects(reference);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public <S> ServiceRegistration<S> registerService(Class<S> clazz, org.osgi.framework.ServiceFactory<S> factory, Dictionary<String, ?> properties) {
|
|
||||||
+ return bundleContext.registerService(clazz, factory, properties);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
}
|
|
50
xbean.depmap
50
xbean.depmap
@ -1,50 +0,0 @@
|
|||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<maven>
|
|
||||||
<groupId>org.osgi</groupId>
|
|
||||||
<artifactId>org.osgi.core</artifactId>
|
|
||||||
<version>4.2.0</version>
|
|
||||||
</maven>
|
|
||||||
<jpp>
|
|
||||||
<groupId>JPP/felix</groupId>
|
|
||||||
<artifactId>org.osgi.core</artifactId>
|
|
||||||
<version>1.2.0</version>
|
|
||||||
</jpp>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<maven>
|
|
||||||
<groupId>asm</groupId>
|
|
||||||
<artifactId>asm-commons</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
</maven>
|
|
||||||
<jpp>
|
|
||||||
<groupId>JPP/objectweb-asm</groupId>
|
|
||||||
<artifactId>asm-commons</artifactId>
|
|
||||||
<version>3.2</version>
|
|
||||||
</jpp>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<maven>
|
|
||||||
<groupId>asm</groupId>
|
|
||||||
<artifactId>asm</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
</maven>
|
|
||||||
<jpp>
|
|
||||||
<groupId>JPP/objectweb-asm</groupId>
|
|
||||||
<artifactId>asm</artifactId>
|
|
||||||
<version>3.2</version>
|
|
||||||
</jpp>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<maven>
|
|
||||||
<groupId>asm</groupId>
|
|
||||||
<artifactId>asm-tree</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
</maven>
|
|
||||||
<jpp>
|
|
||||||
<groupId>JPP/objectweb-asm</groupId>
|
|
||||||
<artifactId>asm-tree</artifactId>
|
|
||||||
<version>3.2</version>
|
|
||||||
</jpp>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
48
xbean.spec
48
xbean.spec
@ -6,21 +6,21 @@
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
Name: xbean
|
Name: xbean
|
||||||
Version: 3.17
|
Version: 4.1
|
||||||
BuildArch: noarch
|
Release: 1%{?dist}
|
||||||
|
|
||||||
Release: 2%{?dist}
|
|
||||||
Summary: Java plugin based web server
|
Summary: Java plugin based web server
|
||||||
|
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
URL: http://geronimo.apache.org/xbean/
|
URL: http://geronimo.apache.org/xbean/
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
Source0: http://repo2.maven.org/maven2/org/apache/%{name}/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
Source0: http://repo2.maven.org/maven2/org/apache/%{name}/%{name}/%{version}/%{name}-%{version}-source-release.zip
|
||||||
|
|
||||||
# Fix dependency on xbean-asm4-shaded to original objectweb-asm
|
# Fix dependency on xbean-asm4-shaded to original objectweb-asm
|
||||||
Patch0: %{name}-asm4-unshade.patch
|
Patch0: 0001-Unshade-ASM.patch
|
||||||
# Compatibility with Eclipse Luna (rhbz#1087461)
|
# Compatibility with Eclipse Luna (rhbz#1087461)
|
||||||
Patch1: %{name}-luna.patch
|
Patch1: 0002-Port-to-Eclipse-Luna-OSGi.patch
|
||||||
|
Patch2: 0003-Port-to-QDox-2.0.patch
|
||||||
|
Patch3: 0004-Port-to-Groovy-2.3.7.patch
|
||||||
|
|
||||||
BuildRequires: java-devel
|
BuildRequires: java-devel
|
||||||
BuildRequires: apache-commons-beanutils
|
BuildRequires: apache-commons-beanutils
|
||||||
@ -48,7 +48,8 @@ BuildRequires: felix-framework
|
|||||||
%if %{with spring}
|
%if %{with spring}
|
||||||
BuildRequires: apache-commons-jexl
|
BuildRequires: apache-commons-jexl
|
||||||
BuildRequires: aries-blueprint
|
BuildRequires: aries-blueprint
|
||||||
# test deps BuildRequires: cglib
|
# test deps
|
||||||
|
BuildRequires: cglib
|
||||||
BuildRequires: felix-osgi-compendium
|
BuildRequires: felix-osgi-compendium
|
||||||
BuildRequires: felix-osgi-core
|
BuildRequires: felix-osgi-core
|
||||||
BuildRequires: geronimo-annotation
|
BuildRequires: geronimo-annotation
|
||||||
@ -115,17 +116,15 @@ This package provides %{summary}.
|
|||||||
# build failing on this due to doxia-sitetools problems
|
# build failing on this due to doxia-sitetools problems
|
||||||
rm src/site/site.xml
|
rm src/site/site.xml
|
||||||
|
|
||||||
%patch0
|
%patch0 -p1
|
||||||
%patch1
|
%if %{with equinox}
|
||||||
|
%patch1 -p1
|
||||||
|
%endif
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
|
||||||
%pom_remove_parent
|
%pom_remove_parent
|
||||||
%pom_remove_dep mx4j:mx4j
|
%pom_remove_dep mx4j:mx4j
|
||||||
%pom_remove_dep :xbean-asm5-shaded xbean-reflect
|
|
||||||
|
|
||||||
# These aren't needed for now
|
|
||||||
%pom_disable_module xbean-asm5-shaded
|
|
||||||
%pom_disable_module xbean-finder-shaded
|
|
||||||
%pom_disable_module xbean-telnet
|
|
||||||
|
|
||||||
# Prevent modules depending on springframework from building.
|
# Prevent modules depending on springframework from building.
|
||||||
%if %{without spring}
|
%if %{without spring}
|
||||||
@ -142,13 +141,10 @@ rm src/site/site.xml
|
|||||||
# blueprint FTBFS, disable for now
|
# blueprint FTBFS, disable for now
|
||||||
%pom_disable_module xbean-blueprint
|
%pom_disable_module xbean-blueprint
|
||||||
|
|
||||||
# Replace generic OSGi dependencies with either Equinox or Felix
|
%if %{without equinox}
|
||||||
%pom_remove_dep :org.osgi.core xbean-bundleutils
|
# Replace Eclipse Equinox OSGi dependency with Apeche Felix
|
||||||
%pom_remove_dep org.eclipse:osgi xbean-bundleutils
|
|
||||||
%if %{with equinox}
|
|
||||||
%pom_add_dep org.eclipse.osgi:org.eclipse.osgi xbean-bundleutils
|
|
||||||
%else
|
|
||||||
rm -rf xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/
|
rm -rf xbean-bundleutils/src/main/java/org/apache/xbean/osgi/bundle/util/equinox/
|
||||||
|
%pom_remove_dep org.eclipse:osgi xbean-bundleutils
|
||||||
%pom_add_dep org.apache.felix:org.apache.felix.framework xbean-bundleutils
|
%pom_add_dep org.apache.felix:org.apache.felix.framework xbean-bundleutils
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -162,11 +158,6 @@ rm src/site/site.xml
|
|||||||
sed -i "s|<Private-Package>|<!--Private-Package>|" xbean-blueprint/pom.xml
|
sed -i "s|<Private-Package>|<!--Private-Package>|" xbean-blueprint/pom.xml
|
||||||
sed -i "s|</Private-Package>|</Private-Package-->|" xbean-blueprint/pom.xml
|
sed -i "s|</Private-Package>|</Private-Package-->|" xbean-blueprint/pom.xml
|
||||||
|
|
||||||
# Fix ant groupId
|
|
||||||
find -name pom.xml -exec sed -i "s|<groupId>ant</groupId>|<groupId>org.apache.ant</groupId>|" {} \;
|
|
||||||
# Fix cglib artifactId
|
|
||||||
find -name pom.xml -exec sed -i "s|<artifactId>cglib-nodep</artifactId>|<artifactId>cglib</artifactId>|" {} \;
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%mvn_build -f
|
%mvn_build -f
|
||||||
|
|
||||||
@ -197,6 +188,9 @@ find -name pom.xml -exec sed -i "s|<artifactId>cglib-nodep</artifactId>|<artifac
|
|||||||
%doc LICENSE NOTICE
|
%doc LICENSE NOTICE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 21 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.1-1
|
||||||
|
- Update to upstream version 4.1
|
||||||
|
|
||||||
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.17-2
|
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.17-2
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user