mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
WW-1349 S2 for J4 - Add missing files to "backport" folder. Add retrotranslator-runtime-1.0.8.jar
git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@447127 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
Retrotranslator: a Java bytecode transformer that translates Java classes
|
||||
compiled with JDK 5.0 into classes that can be run on JVM 1.4.
|
||||
|
||||
Copyright (c) 2005, 2006 Taras Puchko
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,549 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Retrotranslator</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table border="0" width="98%">
|
||||
<tr>
|
||||
<td><h2>Retrotranslator</h2></td>
|
||||
<td width="125" align="left"><a href="http://sourceforge.net"><img
|
||||
src="http://sflogo.sourceforge.net/sflogo.php?group_id=153566&type=2"
|
||||
width="125" height="37" border="0" alt="SourceForge.net Logo"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>Contents</h4>
|
||||
<ol>
|
||||
<li><a href="#what">What is Retrotranslator?</a></li>
|
||||
<li><a href="#features">What Java 5 features are supported?</a></li>
|
||||
<li><a href="#commandline">How to use Retrotranslator from a command line?</a></li>
|
||||
<li><a href="#ant">How to use Retrotranslator from Apache Ant or Maven?</a></li>
|
||||
<li><a href="#idea">How to use Retrotranslator from IntelliJ IDEA?</a></li>
|
||||
<li><a href="#jit">How to use Just-in-Time Retrotranslator?</a></li>
|
||||
<li><a href="#supported">What Java 5 classes and methods are supported?</a></li>
|
||||
<li><a href="#extension">How to write an extension for Retrotranslator?</a></li>
|
||||
<li><a href="#limitations">What are the limitations?</a></li>
|
||||
<li><a href="#alternative">Alternative tools</a></li>
|
||||
<li><a href="#contact">Contact</a></li>
|
||||
<li><a href="#license">License</a></li>
|
||||
</ol>
|
||||
|
||||
<h4><a name="what">What is Retrotranslator?</a></h4>
|
||||
<a href="http://sourceforge.net/projects/retrotranslator">Retrotranslator</a> is a Java bytecode transformer
|
||||
that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4.
|
||||
It is a free, open-source tool based on the <a href="http://asm.objectweb.org/">ASM bytecode manipulation framework</a>
|
||||
and concurrency utilities
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php">backported to Java 1.4</a>.
|
||||
|
||||
<h4><a name="features">What Java 5 features are supported?</a></h4>
|
||||
<ul>
|
||||
<li>Generics (generic types)</li>
|
||||
<li>Annotations (metadata)</li>
|
||||
<li>Reflection on generics and annotations</li>
|
||||
<li>Typesafe enums (enumerated types)</li>
|
||||
<li>Autoboxing/unboxing</li>
|
||||
<li>Enhanced for loop (for-each loop)</li>
|
||||
<li>Varargs (variable arguments)</li>
|
||||
<li>Covariant return types</li>
|
||||
<li>Static import</li>
|
||||
<li>Concurrency utilities</li>
|
||||
<li>Collections framework enhancements</li>
|
||||
</ul>
|
||||
|
||||
<h4><a name="commandline">How to use Retrotranslator from a command line?</a></h4>
|
||||
<ol>
|
||||
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=153566">Download</a>
|
||||
and unzip the binary distribution file <code>Retrotranslator-<i>n.n.n</i>-bin.zip</code>,
|
||||
where <i>n.n.n</i> is the latest Retrotranslator release number.
|
||||
</li>
|
||||
<li>
|
||||
Compile your classes with JDK 5.0 and put them into some directory, e.g. <code>myclasses</code>.
|
||||
</li>
|
||||
<li>
|
||||
Go to the unzipped directory <code>Retrotranslator-<i>n.n.n</i>-bin</code> and execute:<br>
|
||||
<code>java -jar retrotranslator-transformer-<i>n.n.n</i>.jar -srcdir myclasses</code>
|
||||
</li>
|
||||
<li>
|
||||
If you use Java 5 API put <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent.jar</code> into the classpath of your application.
|
||||
</li>
|
||||
<li>
|
||||
Run or debug the application as usual on any JVM 1.4, preferably JRE 1.4.2.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>The full command line syntax:<br>
|
||||
<code>java -jar retrotranslator-transformer-<i>n.n.n</i>.jar <options></code>
|
||||
<br>or<br>
|
||||
<code>java -cp retrotranslator-transformer-<i>n.n.n</i>.jar net.sf.retrotranslator.transformer.Retrotranslator <options></code></p>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr><th>Option</th><th>Description</th><th>Default</th></tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcdir</code></td>
|
||||
<td>Directory with classes compiled using JDK 5.0 (may be specified several times).</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcjar</code></td>
|
||||
<td>JAR file with classes compiled using JDK 5.0 (may be specified several times).</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-destdir</code></td>
|
||||
<td>Directory to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-destjar</code></td>
|
||||
<td>JAR file to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-stripsign</code></td>
|
||||
<td>Asks the translator to strip signature (generics) information.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-verbose</code></td>
|
||||
<td>Asks the translator for verbose output.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-lazy</code></td>
|
||||
<td>Asks the translator to transform only Java 5 classes.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-advanced</code></td>
|
||||
<td>Allows to override Java 1.4 methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-verify</code></td>
|
||||
<td>Asks the translator for warnings when references to unknown classes, methods, or fields are found.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-classpath</code></td>
|
||||
<td>The classpath to use for verification including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent.jar</code>.</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-srcmask</code></td>
|
||||
<td>Files to translate (either bytecode or UTF-8 text) , e.g. "<code>*.class;*.tld</code>".
|
||||
Only three special characters are supported: "<code>*?;</code>".</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap><code>-retainapi</code></td>
|
||||
<td>Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
|
||||
References introduced by a compiler will also remain unchanged,
|
||||
like the use of <code>java.lang.StringBuilder</code> for string concatenation
|
||||
or the implicit <code>valueOf</code> method call for autoboxing.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
For example, if you have a Java 5 application <code>myapplication5.jar</code> you can use the following command
|
||||
to produce <code>myapplication4.jar</code> that will run on J2SE 1.4 and is independent of Retrotranslator,
|
||||
since required classes are added to the translated application with a different package name:
|
||||
</p>
|
||||
<p>
|
||||
<code>java -jar retrotranslator-transformer-<i>n.n.n</i>.jar
|
||||
-srcjar myapplication5.jar -destjar myapplication4.jar -embed com.mycompany.internal</code><br>
|
||||
</p>
|
||||
|
||||
<h4><a name="ant">How to use Retrotranslator from Apache Ant or Maven?</a></h4>
|
||||
|
||||
<p>The distribution contains an integrated <a href="http://ant.apache.org/">Apache Ant</a> task
|
||||
<code>net.sf.retrotranslator.transformer.RetrotranslatorTask</code>. It has the following syntax:</p>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr><th>Attribute</th><th>Description</th><th>Default</th></tr>
|
||||
<tr>
|
||||
<td><code>srcdir</code></td>
|
||||
<td>Directory with classes compiled using JDK 5.0.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>srcjar</code></td>
|
||||
<td>JAR file with classes compiled using JDK 5.0.</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>destdir</code></td>
|
||||
<td>Directory to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>destjar</code></td>
|
||||
<td>JAR file to place classes compatible with J2SE 1.4.</td>
|
||||
<td>Location of sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>stripsign</code></td>
|
||||
<td>Asks the translator to strip signature (generics) information.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>verbose</code></td>
|
||||
<td>Asks the translator for verbose output.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>lazy</code></td>
|
||||
<td>Asks the translator to transform only Java 5 classes.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>advanced</code></td>
|
||||
<td>Allows to override Java 1.4 methods for better Java 5 compatibility.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>verify</code></td>
|
||||
<td>Asks the translator for warnings when references to unknown classes, methods, or fields are found.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>classpath</code></td>
|
||||
<td>The classpath to use for verification including <code>rt.jar</code>, <code>jce.jar</code>,
|
||||
<code>jsse.jar</code> (from JRE 1.4), <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code>,
|
||||
and <code>backport-util-concurrent.jar</code>.
|
||||
</td>
|
||||
<td>Current classpath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>srcmask</code></td>
|
||||
<td>Files to translate (either bytecode or UTF-8 text) , e.g. "<code>*.class;*.tld</code>".
|
||||
Only three special characters are supported: "<code>*?;</code>".</td>
|
||||
<td>*.class</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>embed</code></td>
|
||||
<td>Package name for a private copy of <code>retrotranslator-runtime-<i>n.n.n</i>.jar</code> and
|
||||
<code>backport-util-concurrent.jar</code> to be put into <code>-destdir</code> or <code>-destjar</code>.
|
||||
This makes your application independent of other versions of Retrotranslator present in the classpath.
|
||||
</td>
|
||||
<td>-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>retainapi</code></td>
|
||||
<td>Asks the translator to modify classes for JVM 1.4 compatibility but keep use of Java 5 API.
|
||||
References introduced by a compiler will also remain unchanged,
|
||||
like the use of <code>java.lang.StringBuilder</code> for string concatenation
|
||||
or the implicit <code>valueOf</code> method call for autoboxing.</td>
|
||||
<td>Off</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>failonwarning</code></td>
|
||||
<td>Indicates whether the build will fail when there are verification warnings.</td>
|
||||
<td>On</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
You may use nested <code>src</code> elements to specify source directories or JAR files, and nested
|
||||
<code>classpath</code> elements to specify classpath for verification. For example:
|
||||
</p>
|
||||
<pre>
|
||||
<path id="classpath">
|
||||
<fileset dir="lib" includes="**/*.jar"/>
|
||||
</path>
|
||||
<taskdef name="retrotranslator" classpathref="classpath"
|
||||
classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" />
|
||||
<retrotranslator destdir="build/classes14" verify="true">
|
||||
<src path="build/classes15"/>
|
||||
<classpath location="${java14_home}/jre/lib/rt.jar"/>
|
||||
<classpath refid="classpath"/>
|
||||
</retrotranslator>
|
||||
</pre>
|
||||
<p>
|
||||
For <a href="http://maven.apache.org/">Maven</a> there is a
|
||||
<a href="http://mojo.codehaus.org/retrotranslator-maven-plugin/">Retrotranslator plugin</a>
|
||||
from the <a href="http://mojo.codehaus.org/">Mojo Project</a>.
|
||||
</p>
|
||||
<h4><a name="idea">How to use Retrotranslator from IntelliJ IDEA?</a></h4>
|
||||
<p>
|
||||
To automatically translate and verify classes compiled by <a href="http://www.jetbrains.com/idea/">IntelliJ IDEA</a>
|
||||
you may <a href="http://plugins.intellij.net/plugin/?id=145">download a plugin</a>
|
||||
that generates classes compatible with 1.4 virtual machines from your Java 5 source code.
|
||||
</p>
|
||||
|
||||
<h4><a name="jit">How to use Just-in-Time Retrotranslator?</a></h4>
|
||||
|
||||
<p>
|
||||
JIT Retrotranslator is able to translate at runtime Java classes loaded with any classloader.
|
||||
It works on J2SE 1.4 from Sun, IBM, BEA, and Apple, but does nothing on J2SE 5.0 and other platforms.
|
||||
However translation at runtime consumes additional memory and processing resources and it will not
|
||||
work if your classes make use of Java 5 API but were compiled with "<code>-target 1.4</code>".
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
If you want to run a JAR file with the JIT, execute:<br>
|
||||
<code>java -cp retrotranslator-transformer-<i>n.n.n</i>.jar
|
||||
net.sf.retrotranslator.transformer.JITRetrotranslator -jar <jarfile> [<args...>]</code>
|
||||
</li>
|
||||
<li>
|
||||
When the first option does not work or if you just want to run a class from your classpath, execute:<br>
|
||||
<code>java -cp retrotranslator-transformer-<i>n.n.n</i>.jar:<classpath>
|
||||
net.sf.retrotranslator.transformer.JITRetrotranslator <class> [<args...>]</code>
|
||||
</li>
|
||||
<li>
|
||||
Alternatively you may simply call <code>JITRetrotranslator.install()</code> from some JVM 1.4 compatible class
|
||||
before Java 5 classes are loaded.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h4><a name="supported">What Java 5 classes and methods are supported?</a></h4>
|
||||
<table border="1" cellspacing="0" cellpadding="5">
|
||||
<tr><th>Package</th><th>Class</th><th>Methods and fields</th><th>Compatibility notes</th></tr>
|
||||
<tr><td><code>java.lang.annotation</code></td><td>* (all classes)</td><td>* (all methods)</td><td> </td></tr>
|
||||
<tr><td><code>java.util.concurrent,<br>java.util.concurrent.atomic,<br>java.util.concurrent.locks</code></td>
|
||||
<td>almost all classes</td><td>almost all methods</td>
|
||||
<td>
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php"> Backport of JSR 166</a><br>
|
||||
<code>Condition.awaitNanos(long)</code> method is supported but with
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/edu/emory/mathcs/backport/java/util/concurrent/helpers/Utils.html#awaitNanos(edu.emory.mathcs.backport.java.util.concurrent.locks.Condition, long)">
|
||||
very little</a> accuracy guarantees.
|
||||
</td></tr>
|
||||
<tr><td rowspan="6"><code>java.io</code></td><td><code>Closeable</code></td><td><code>*</code></td><td>
|
||||
<code>new Closeable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Flushable</code></td><td><code>*</code></td><td>
|
||||
<code>new Flushable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>PrintStream</code></td><td>
|
||||
<code>append(CharSequence), append(CharSequence, int, int), append(char)</code>
|
||||
</td><td> </td></tr>
|
||||
<tr><td><code>PrintWriter</code></td><td>
|
||||
<code>PrintWriter(File), PrintWriter(File, String), PrintWriter(String), PrintWriter(String, String)</code>
|
||||
</td><td> </td></tr>
|
||||
<tr><td><code>Reader</code></td><td><code>read(CharBuffer)</code></td><td> </td></tr>
|
||||
<tr><td><code>Writer</code></td><td>
|
||||
<code>append(CharSequence), append(CharSequence, int, int), append(char)</code>
|
||||
</td><td> </td></tr>
|
||||
<tr><td rowspan="24"><code>java.lang</code></td><td><code>Appendable</code></td><td>*
|
||||
</td><td>
|
||||
<code>new Appendable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Boolean</code></td><td><code>parseBoolean(String), compareTo(Boolean)</code></td><td> </td></tr>
|
||||
<tr><td><code>Byte</code></td><td><code>valueOf(byte)</code></td><td> </td></tr>
|
||||
<tr><td><code>Character</code></td><td><code>valueOf(char)</code></td><td> </td></tr>
|
||||
<tr><td><code>Class</code></td><td>* (21 new methods)</td><td>
|
||||
<code>Class.getMethod(String, Class...)</code> and <code>Class.getDeclaredMethod(String, Class...)</code> are
|
||||
intercepted in advanced mode to better support generics and covariant return types on several JVM implementations.
|
||||
</td></tr>
|
||||
<tr><td><code>Deprecated</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Double</code></td><td><code>valueOf(double)</code></td><td> </td></tr>
|
||||
<tr><td><code>Enum</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Float</code></td><td><code>valueOf(float)</code></td><td> </td></tr>
|
||||
<tr><td><code>IllegalArgumentException</code></td><td><code>IllegalArgumentException(String, Throwable),<br>
|
||||
IllegalArgumentException(Throwable)</code></td><td> </td></tr>
|
||||
<tr><td><code>IllegalStateException</code></td><td><code>IllegalStateException(String, Throwable),<br>
|
||||
IllegalStateException(Throwable)</code></td><td> </td></tr>
|
||||
<tr><td><code>Integer</code></td><td><code>valueOf(int)</code></td><td> </td></tr>
|
||||
<tr><td><code>Iterable</code></td><td>*</td><td>
|
||||
<code>new Iterable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Long</code></td><td><code>valueOf(long)</code></td><td> </td></tr>
|
||||
<tr><td><code>Package</code></td><td>* (4 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Readable</code></td><td>*</td><td>
|
||||
<code>new Readable[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Short</code></td><td><code>valueOf(short)</code></td><td> </td></tr>
|
||||
<tr><td><code>String</code></td><td><code>contains(CharSequence),<br> contentEquals(CharSequence),<br>
|
||||
replace(CharSequence, CharSequence)</code></td><td> </td></tr>
|
||||
<tr><td><code>StringBuffer</code></td><td><code>
|
||||
StringBuffer(CharSequence), append(CharSequence), append(CharSequence, int, int),
|
||||
insert(int, CharSequence), insert(int, CharSequence, int, int)
|
||||
</code></td><td> </td></tr>
|
||||
<tr><td><code>StringBuilder</code></td><td>
|
||||
All methods supported in <code>StringBuffer</code>
|
||||
</td><td><code>StringBuilder</code> is replaced with <code>StringBuffer</code></td></tr>
|
||||
<tr><td><code>SuppressWarnings</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>System</code></td><td><code>nanoTime(), clearProperty(String)</code></td><td>
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php"> Backport of JSR 166</a><br>
|
||||
<code>System.nanoTime()</code> method precision
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/edu/emory/mathcs/backport/java/util/concurrent/helpers/Utils.html#nanoTime()">
|
||||
may vary</a> on different platforms.
|
||||
</td></tr>
|
||||
<tr><td><code>Thread</code></td><td><code>getStackTrace(), getId()
|
||||
</code></td><td><code>Thread.getStackTrace()</code> returns non-empty stack trace only for the current thread;<br>
|
||||
<code>Thread.getId()</code> does not reflect the order in which threads are created.</td></tr>
|
||||
<tr><td><code>TypeNotPresentException</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td rowspan="12"><code>java.lang.reflect</code></td><td><code>AnnotatedElement</code></td><td>*</td><td>
|
||||
<code>new AnnotatedElement[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Constructor</code></td><td>* (11 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Field</code></td><td>* (8 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>GenericArrayType</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>GenericDeclaration</code></td><td>*</td><td>
|
||||
<code>new GenericDeclaration[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>GenericSignatureFormatError</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>MalformedParameterizedTypeException</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Method</code></td><td>* (14 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>ParameterizedType</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Type</code></td><td>*</td><td>
|
||||
<code>new Type[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>TypeVariable</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>WildcardType</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td ><code>java.math</code></td><td><code>BigDecimal</code></td><td>
|
||||
<code>BigDecimal(int), BigDecimal(long), ZERO, ONE, TEN, divideAndRemainder(BigDecimal),
|
||||
divideToIntegralValue(BigDecimal), pow(int), remainder(BigDecimal), toPlainString(), valueOf(double),
|
||||
valueOf(long)</code></td><td><code>BigDecimal.setScale(int, int)</code> supports negative scales in advanced mode.</td></tr>
|
||||
|
||||
<tr><td ><code>java.rmi.server</code></td><td><code>RemoteObjectInvocationHandler</code></td>
|
||||
<td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td><code>java.util.nio</code></td><td><code>CharBuffer</code></td><td>
|
||||
<code>append(CharSequence), append(CharSequence, int, int), append(char), read(CharBuffer)</code>
|
||||
</td><td> </td></tr>
|
||||
|
||||
<tr><td rowspan="9"><code>java.util</code></td><td><code>AbstractQueue</code></td><td>*</td><td>
|
||||
</td></tr>
|
||||
<tr><td><code>Arrays</code></td><td>* (21 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>Collections</code></td><td>* (13 new methods)</td><td>
|
||||
<a href="http://dcl.mathcs.emory.edu/util/backport-util-concurrent/index.php"> Backport of JSR 166</a>
|
||||
</td></tr>
|
||||
<tr><td><code>EnumMap</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>EnumSet</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>LinkedList</code></td><td>* (5 new methods)</td><td> </td></tr>
|
||||
<tr><td><code>PriorityQueue</code></td><td>*</td><td> </td></tr>
|
||||
<tr><td><code>Queue</code></td><td>*</td><td>
|
||||
<code>new Queue[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>UUID</code></td><td>*</td><td> </td></tr>
|
||||
|
||||
<tr><td rowspan="3"><code>java.util.regex</code></td><td><code>Matcher</code></td><td>
|
||||
<code>quoteReplacement(String), toMatchResult()</code></td><td> </td></tr>
|
||||
<tr><td><code>MatchResult</code></td><td>*</td><td>
|
||||
<code>new MatchResult[...]</code> is replaced with <code>new Object[...]</code>
|
||||
</td></tr>
|
||||
<tr><td><code>Pattern</code></td><td><code>quote(String)</code></td><td> </td></tr>
|
||||
</table>
|
||||
|
||||
<h4><a name="extension">How to write an extension for Retrotranslator?</a></h4>
|
||||
|
||||
<p>
|
||||
Since most backported classes are discovered by Retrotranslator at translation time,
|
||||
you may write an extension and simply put it into the Retrotranslator classpath to make it work.
|
||||
For example, all references to
|
||||
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/EnumSet.html"><code>java.util.EnumSet</code></a>
|
||||
are replaced with references to
|
||||
<a href="http://cvs.sourceforge.net/viewcvs.py/retrotranslator/Retrotranslator/src/net/sf/retrotranslator/runtime/java/util/EnumSet_.java?view=markup">
|
||||
<code>net.sf.retrotranslator.runtime.java.util.EnumSet<b>_</b></code></a> (trailing underscore) if the latter can be found.
|
||||
But if you replace a whole class that exists in J2SE 1.4 you may encounter interoperability issues with other libraries.
|
||||
So, for example, support for Java 5 fields, methods, and constructors of
|
||||
<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html"><code>java.math.BigDecimal</code></a> is placed into
|
||||
|
||||
<a href="http://cvs.sourceforge.net/viewcvs.py/retrotranslator/Retrotranslator/src/net/sf/retrotranslator/runtime/java/math/_BigDecimal.java?view=markup">
|
||||
<code>net.sf.retrotranslator.runtime.java.math.<b>_</b>BigDecimal</code></a> (leading underscore):
|
||||
</p>
|
||||
<ul>
|
||||
<li>For a static field there is a public static field with the same name and type.</li>
|
||||
<li>For a static method there is a public static method with the same signature.</li>
|
||||
<li>For an instance method there is a public static method with the same signature
|
||||
but with an additional first parameter representing an instance.</li>
|
||||
<li>For a constructor there is a public static <code>convertConstructorArguments</code> method that
|
||||
accepts constructor's arguments an returns an argument for a Java 1.4 constuctor.</li>
|
||||
</ul>
|
||||
<p>
|
||||
However, if the backported methods require access
|
||||
to non-public methods or fields of the instance, they cannot be fully handled by Retrotranslator.
|
||||
While you can use reflection to access any data, translated code generally should not depend on security settings.
|
||||
For example, it is impossible to write an implementation for methods <code>getSource()</code>
|
||||
and <code>setSource()</code> of <code>java.beans.PropertyEditorSupport</code> that will work in any environment.
|
||||
Also this approach cannot be used to replace instance field references.
|
||||
</p>
|
||||
<p>
|
||||
If you have written an extension that does not contain copyrighted code, you may send
|
||||
a <a href="http://sourceforge.net/tracker/?group_id=153566&atid=788281">patch</a>
|
||||
under the <a href="#license">Retrotranslator license</a>.
|
||||
</p>
|
||||
|
||||
<h4><a name="limitations">What are the limitations?</a></h4>
|
||||
|
||||
<p>
|
||||
Basically, only classes, methods, and fields listed <a href="#supported">above</a> should work, and other features,
|
||||
like formatted input/output, are not supported. Known issues:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Reflection-based tools may be unable to discover additional classes and methods introduced in Java 5 when running on JRE 1.4.</li>
|
||||
<li>Translated code running on JRE 5.0 may be incompatible with other Java 5 code when Java 5 API is used.</li>
|
||||
<li>Reflection on generics and metadata may return incomplete information for dynamically generated classes.</li>
|
||||
<li>Access modifiers and constants inlined by a compiler are ignored during the verification.</li>
|
||||
<li>Upcasting may help to translate invocations of inherited methods introduced in Java 5: <br>
|
||||
<code> ((Writer) new FileWriter("file.tmp")).append("Hello").close();</code></li>
|
||||
<li>Serialized objects produced by translated code may be incompatible with JRE 5.0.</li>
|
||||
</ul>
|
||||
|
||||
<h4><a name="alternative">Alternative tools</a></h4>
|
||||
<ul>
|
||||
<li><a href="http://retroweaver.sourceforge.net/">Retroweaver</a>
|
||||
- a Java bytecode weaver that enables you to take advantage
|
||||
of the new 1.5 language features in your source code,
|
||||
while still retaining compatibility with 1.4 virtual machines.</li>
|
||||
<li><a href="http://tinyurl.com/r8xba">Declawer</a>
|
||||
- a customized Java compiler which reduces 1.5 Generics to equivalent 1.4 syntax.</li>
|
||||
</ul>
|
||||
|
||||
<h4><a name="contact">Contact</a></h4>
|
||||
<ul>
|
||||
<li><a href="http://retrotranslator.sourceforge.net/">Latest documentation</a></li>
|
||||
<li><a href="http://sourceforge.net/forum/forum.php?forum_id=513539">Open discussion</a></li>
|
||||
<li><a href="http://sourceforge.net/forum/forum.php?forum_id=513540">Help</a></li>
|
||||
<li><a href="http://sourceforge.net/tracker/?group_id=153566&atid=788279">Bugs</a></li>
|
||||
<li><a href="http://sourceforge.net/tracker/?group_id=153566&atid=788282">Feature requests</a></li>
|
||||
<li><a href="http://sourceforge.net/users/tarasp/">Author</a></li>
|
||||
</ul>
|
||||
|
||||
<h4><a name="license">License</a></h4>
|
||||
<pre>
|
||||
Retrotranslator: a Java bytecode transformer that translates Java classes
|
||||
compiled with JDK 5.0 into classes that can be run on JVM 1.4.
|
||||
|
||||
Copyright (c) 2005, 2006 Taras Puchko
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-core-2.0.0.jar -destjar struts2-core-j4-2.0.0.jar
|
||||
java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-api-2.0.0.jar -destjar struts2-api-j4-2.0.0.jar
|
||||
java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/struts2-extras-2.0.0.jar -destjar struts2-extras-j4-2.0.0.jar
|
||||
java -jar retrotranslator-transformer-1.0.8.jar -srcjar ../lib/xwork-2.0-SNAPSHOT.jar -destjar xwork-j4-2.0-SNAPSHOT.jar
|
||||
Reference in New Issue
Block a user