[Fwd: Retrotranslator patch]

Johannes Schneider <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
Hmm, didn't work the last time, so I try again.


Regards,

Johannes Schneider

-------- Original Message --------
Subject: Retrotranslator patch
Date: Wed, 05 Sep 2007 22:58:45 +0200
From: Johannes Schneider <[email protected]>
To: [email protected]

Hi,

I have created a small patch that adds support for Retrotranslator.

To use the patch, it is also necessary to add three jars from
Retrotranslator to a directory called "retrotranslator".
They can be downloaded here:
http://sourceforge.net/project/showfiles.php?group_id=153566&package_id=170323&release_id=518639


I hope the Generics discussion regains momentum....


Regards,

Johannes Schneider

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
Retrotranslator.patch (text/x-patch, 9.3 KB)
--- build.xml	(revision 1.54)
+++ build.xml	Wed Sep 05 22:34:26 CEST 2007
@@ -4,7 +4,7 @@
 For instructions on how to build JDOM, please view the README.txt file.
 -->
 
-<project default="package" basedir=".">
+<project default="retrotranslate" basedir=".">
 
   <!-- =================================================================== -->
   <!-- Initialization target                                               -->
@@ -30,6 +30,7 @@
 
     <property name="Name" value="JDOM"/>
     <property name="name" value="jdom"/>
+    <property name="java5suffix" value="-5"/>
     <property name="version" value="1.0.1"/>
     <property name="version.impl" value="${version}"/>
     <property name="version.spec" value="1.0"/>
@@ -50,6 +51,7 @@
     <property name="build.dir" value="./build"/>
     <property name="build.src" value="./build/src"/>
     <property name="build.dest" value="./build/classes"/>
+    <property name="build.dest1.4" value="./build/classes-1.4"/>
     <property name="build.javadocs" value="./build/apidocs"/>
 
     <property name="dist.root" value="./dist"/>
@@ -68,6 +70,7 @@
     <property name="parser.jar"         value="${lib.dir}/xerces.jar"/>
     <property name="jdom-core"          value="${build.dest}"/>
     <property name="jaxen.lib.dir"      value="${lib.dir}"/>
+    <property name="retrotranslator.jar"      location="./retrotranslater/retrotranslator-transformer-1.2.2.jar"/>
 
     <!-- Compilation class path -->
     <path id="compile.class.path">
@@ -130,6 +133,7 @@
     <!-- create directories -->
     <mkdir dir="${build.src}"/>
     <mkdir dir="${build.dest}"/>
+    <mkdir dir="${build.dest1.4}"/>
 
     <!-- copy src files -->
     <copy todir="${build.src}"
@@ -220,13 +224,44 @@
                 <include name="LICENSE.txt"/>
           </fileset>
     </copy>
-    <jar jarfile="${build.dir}/${name}.jar"
+    <jar jarfile="${build.dir}/${name}${java5suffix}.jar"
          basedir="${build.dest}"
          excludes="META-INF/MANIFEST.MF"
          manifest="${build.dest}/META-INF/MANIFEST.MF"/>
   </target>
 
   <!-- =================================================================== -->
+  <!-- Creates the jar for 1.4 java                                        -->
+  <!-- =================================================================== -->
+  <!--retrotranslator.jar-->
+  <target name="retrotranslate" depends="package">
+    <path id="classpath">
+      <fileset dir="retrotranslater" includes="**/*.jar" />
+    </path>
+    <taskdef name="retrotranslator" classpathref="classpath"
+             classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
+
+    <retrotranslator destdir="${build.dest1.4}" verify="false">
+      <fileset dir="${build.dest}" includes="**/*.class"/>
+      <!--<classpath location="${java14_home}/jre/lib/rt.jar" />-->
+      <classpath refid="classpath" />
+    </retrotranslator>
+
+    <copy todir="${build.dest1.4}/META-INF"
+          filtering="yes">
+          <fileset dir="${package.dir}/META-INF"/>
+          <fileset dir=".">
+                <include name="LICENSE.txt"/>
+          </fileset>
+    </copy>
+
+    <jar jarfile="${build.dir}/${name}.jar"
+         basedir="${build.dest1.4}"
+         excludes="META-INF/MANIFEST.MF"
+         manifest="${build.dest1.4}/META-INF/MANIFEST.MF"/>
+  </target>
+
+  <!-- =================================================================== -->
   <!-- Creates the API documentation                                       -->
   <!-- =================================================================== -->
   <target name="javadoc" depends="prepare-src"
--- src/java/org/jdom/Element.java	(revision 1.156)
+++ src/java/org/jdom/Element.java	Wed Sep 05 22:44:52 CEST 2007
@@ -376,7 +376,7 @@
      * @return                     a List of the additional namespace
      *                             declarations
      */
-    public List getAdditionalNamespaces() {
+    public List<? extends Namespace> getAdditionalNamespaces() {
         // Not having the returned list be live allows us to avoid creating a
         // new list object when XMLOutputter calls this method on an element
         // with an empty list.
@@ -657,7 +657,7 @@
      *         <code>{@link CDATA}</code>, and
      *         <code>{@link EntityRef}</code> objects.
      */
-    public List getContent() {
+    public List<? extends Content> getContent() {
         return content;
     }
 
@@ -673,7 +673,7 @@
      * @param filter <code>Filter</code> to apply
      * @return <code>List</code> - filtered Element content
      */
-    public List getContent(final Filter filter) {
+    public List<? extends Content> getContent(final Filter filter) {
         return content.getView(filter);
     }
 
@@ -682,7 +682,7 @@
      *
      * @return list of the old children detached from this parent
      */
-    public List removeContent() {
+    public List<? extends Content> removeContent() {
         final List old = new ArrayList(content);
         content.clear();
         return old;
@@ -694,7 +694,7 @@
      * @param filter filter to select which content to remove
      * @return list of the old children detached from this parent
      */
-    public List removeContent(final Filter filter) {
+    public List<? extends Content> removeContent(final Filter filter) {
         final List old = new ArrayList();
         final Iterator iter = content.getView(filter).iterator();
         while (iter.hasNext()) {
@@ -740,7 +740,7 @@
      * @throws IllegalAddException if the List contains objects of
      *         illegal types or with existing parentage.
      */
-    public Element setContent(final Collection newContent) {
+    public Element setContent(final Collection<? extends Content> newContent) {
         content.clearAndSet(newContent);
         return this;
     }
@@ -781,7 +781,7 @@
      * @throws IndexOutOfBoundsException if index is negative or greater
      *         than the current number of children.
      */
-    public Element setContent(final int index, final Collection newContent) {
+    public Element setContent(final int index, final Collection<? extends Content> newContent) {
         content.remove(index);
         content.addAll(index, newContent);
         return this;
@@ -823,7 +823,7 @@
      * @throws IllegalAddException if any item in the collection
      *         already has a parent or is of an inappropriate type.
      */
-    public Element addContent(final Collection newContent) {
+    public Element addContent(final Collection<? extends Content> newContent) {
         content.addAll(newContent);
         return this;
     }
@@ -857,12 +857,12 @@
      * @throws IllegalAddException if any item in the collection
      *         already has a parent or is of an inappropriate type.
      */
-    public Element addContent(final int index, final Collection newContent) {
+    public Element addContent(final int index, final Collection<? extends Content> newContent) {
         content.addAll(index, newContent);
         return this;
     }
 
-    public List cloneContent() {
+    public List<? extends Content> cloneContent() {
         final int size = getContentSize();
         final List list = new ArrayList(size);
         for (int i = 0; i < size; i++) {
@@ -952,7 +952,7 @@
      *
      * @return attributes for the element
      */
-    public List getAttributes() {
+    public List<? extends Attribute> getAttributes() {
         return attributes;
     }
 
@@ -1091,7 +1091,7 @@
      *         or if any of the <code>Attribute</code> objects have
      *         conflicting namespace prefixes.
      */
-    public Element setAttributes(final Collection newAttributes) {
+    public Element setAttributes(final Collection<? extends Attribute> newAttributes) {
         attributes.clearAndSet(newAttributes);
         return this;
     }
@@ -1344,7 +1344,7 @@
      *
      * @return an iterator to walk descendants
      */
-    public Iterator getDescendants() {
+    public Iterator<? extends Content> getDescendants() {
         return new DescendantIterator(this);
     }
 
@@ -1357,7 +1357,7 @@
      * @param filter filter to select which descendants to see
      * @return an iterator to walk descendants within a filter
      */
-    public Iterator getDescendants(final Filter filter) {
+    public Iterator<? extends Content> getDescendants(final Filter filter) {
         final Iterator iterator = new DescendantIterator(this);
         return new FilterIterator(iterator, filter);
     }
@@ -1395,7 +1395,7 @@
      *
      * @return list of child <code>Element</code> objects for this element
      */
-    public List getChildren() {
+    public List<? extends Element> getChildren() {
         return content.getView(new ElementFilter());
     }
 
@@ -1415,7 +1415,7 @@
      * @param name local name for the children to match
      * @return all matching child elements
      */
-    public List getChildren(final String name) {
+    public List<? extends Element> getChildren(final String name) {
         return getChildren(name, Namespace.NO_NAMESPACE);
     }
 
@@ -1436,7 +1436,7 @@
      * @param ns <code>Namespace</code> to search within
      * @return all matching child elements
      */
-    public List getChildren(final String name, final Namespace ns) {
+    public List<? extends Element> getChildren(final String name, final Namespace ns) {
         return content.getView(new ElementFilter(name, ns));
     }
smime.p7s (application/x-pkcs7-signature, 3.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.