You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Markus Wiederkehr <ma...@gmail.com> on 2008/11/12 00:24:19 UTC
[mime4j] Retrotranslator for Java 5
I am trying to use the Retrotranslator Maven plugin to create a JRE
1.4 compatible version of Mime4j after the source code has been
migrated to Java 5. The byte-code translation seems to work and the
resulting class files are version 48 (1.4). So far so good..
But my patch currently uses an enum and this is where the problem
begins. A Java 5 enum implicitly extends java.lang.Enum which is not
present in Java 1.4. But according to the documentation
Retrotranslator should be able to replace java.lang.Enum with its own
version. It should even be possible to embed this replaced version in
the resulting jar file.
I played around with various parameters (e.g.
backport=net.sf.retrotranslator.runtime, verify=true, embed=true, ...)
but it just does not seem to work..
Can anyone help me out with this?
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: [mime4j] Retrotranslator for Java 5
Posted by Stefano Bagnara <ap...@bago.org>.
Markus Wiederkehr ha scritto:
> On Wed, Nov 12, 2008 at 11:37 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
>> Do we care about 1.4 compatibility at all give the results of the poll? What
>> is the reason for maintaining a 1.4 compatible version?
>
> Personally I don't care about 1.4 and I don't believe many users will, too.
Same here. But..
Keep in mind that the poll was about JAMES Server and not mime4j. JAMES
Server runs in its own JVM so it is easy for most users to simply use
java5/6/7 to run james even if they have older infrastructures. On the
other side mime4j is a low level library, and may live in different
applications. E.g: people could use it to add mime parsing to some
platform having embedded java support... Please note that I don't know
what are the java versions supported by such devices and what is the
market share of that stuff.. but I think this make a difference between
james server and mime4j.
> On the other hand the new patch I just attached to MIME4J-85 gives us
> Java 1.4 compatibility at a very low price. The only compromise is
> that o.a.j.m.m.Mode is no longer a true Java 5 enum. But the good old
> typesafe enum pattern behaves very much the same.
>
> I believe that now we have a Java 5 source code and a Java 1.4
> compatible jar not much can stand in the way of applying this patch.
Make sense!
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: [mime4j] Retrotranslator for Java 5
Posted by Markus Wiederkehr <ma...@gmail.com>.
On Wed, Nov 12, 2008 at 11:37 PM, Oleg Kalnichevski <ol...@apache.org> wrote:
> Do we care about 1.4 compatibility at all give the results of the poll? What
> is the reason for maintaining a 1.4 compatible version?
Personally I don't care about 1.4 and I don't believe many users will, too.
On the other hand the new patch I just attached to MIME4J-85 gives us
Java 1.4 compatibility at a very low price. The only compromise is
that o.a.j.m.m.Mode is no longer a true Java 5 enum. But the good old
typesafe enum pattern behaves very much the same.
I believe that now we have a Java 5 source code and a Java 1.4
compatible jar not much can stand in the way of applying this patch.
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: [mime4j] Retrotranslator for Java 5
Posted by Oleg Kalnichevski <ol...@apache.org>.
Stefano Bagnara wrote:
> Markus Wiederkehr ha scritto:
>> I am trying to use the Retrotranslator Maven plugin to create a JRE
>> 1.4 compatible version of Mime4j after the source code has been
>> migrated to Java 5. The byte-code translation seems to work and the
>> resulting class files are version 48 (1.4). So far so good..
>>
>> But my patch currently uses an enum and this is where the problem
>> begins. A Java 5 enum implicitly extends java.lang.Enum which is not
>> present in Java 1.4. But according to the documentation
>> Retrotranslator should be able to replace java.lang.Enum with its own
>> version. It should even be possible to embed this replaced version in
>> the resulting jar file.
>
> I don't remember if I ever had an Enum in my past usage of
> retrotranslator but IIRC it was replacing java5 classes automatically.
>
>> I played around with various parameters (e.g.
>> backport=net.sf.retrotranslator.runtime, verify=true, embed=true, ...)
>> but it just does not seem to work..
>>
>> Can anyone help me out with this?
>
> What pom snippet did you add for retrotranslating and what version of
> the plugin(and retrotranslator itself) are you using?
>
> Stefano
>
Markus, Stefano, et al
Do we care about 1.4 compatibility at all give the results of the poll?
What is the reason for maintaining a 1.4 compatible version?
Oleg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: [mime4j] Retrotranslator for Java 5
Posted by Markus Wiederkehr <ma...@gmail.com>.
On Wed, Nov 12, 2008 at 10:21 AM, Stefano Bagnara <ap...@bago.org> wrote:
> What pom snippet did you add for retrotranslating and what version of
> the plugin(and retrotranslator itself) are you using?
In my local repository I have retrotranslator 1.2.4 and
retrotranslator-maven-plugin 1.0-alpha-4.
I have tried both goals translate and translate-project with various
configurations. It's no use to post them all here. But here's the
basic configuration without any special parameters:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>retrotranslator-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>translate</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>
${project.build.outputDirectory}
</directory>
<includes>
<include>**/*.class</include>
</includes>
</fileset>
</filesets>
<destdir>
${project.build.outputDirectory}-java14
</destdir>
</configuration>
</execution>
</executions>
</plugin>
Add it to your pom.xml after applying my patch from MIME4J-85..
Then run "mvn clean process-classes"..
Now the translated classes should be under target/classes-java14. Now try:
$ file org/apache/james/mime4j/message/Mode.class
org/apache/james/mime4j/message/Mode.class: compiled Java class data,
version 48.0
$ javap org.apache.james.mime4j.message.Mode
Compiled from "Mode.java"
public final class org.apache.james.mime4j.message.Mode extends java.lang.Enum{
public static final org.apache.james.mime4j.message.Mode STRICT_IGNORE;
public static final org.apache.james.mime4j.message.Mode STRICT_ERROR;
public static final org.apache.james.mime4j.message.Mode LENIENT;
static java.lang.Class class$org$apache$james$mime4j$message$Mode;
public static org.apache.james.mime4j.message.Mode[] values();
public static org.apache.james.mime4j.message.Mode
valueOf(java.lang.String);
static {};
}
Markus
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: [mime4j] Retrotranslator for Java 5
Posted by Stefano Bagnara <ap...@bago.org>.
Markus Wiederkehr ha scritto:
> I am trying to use the Retrotranslator Maven plugin to create a JRE
> 1.4 compatible version of Mime4j after the source code has been
> migrated to Java 5. The byte-code translation seems to work and the
> resulting class files are version 48 (1.4). So far so good..
>
> But my patch currently uses an enum and this is where the problem
> begins. A Java 5 enum implicitly extends java.lang.Enum which is not
> present in Java 1.4. But according to the documentation
> Retrotranslator should be able to replace java.lang.Enum with its own
> version. It should even be possible to embed this replaced version in
> the resulting jar file.
I don't remember if I ever had an Enum in my past usage of
retrotranslator but IIRC it was replacing java5 classes automatically.
> I played around with various parameters (e.g.
> backport=net.sf.retrotranslator.runtime, verify=true, embed=true, ...)
> but it just does not seem to work..
>
> Can anyone help me out with this?
What pom snippet did you add for retrotranslating and what version of
the plugin(and retrotranslator itself) are you using?
Stefano
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org