GeneralPath 1.6 backward compatibility?

Z

zorci

Hi,

as I found, java.awt.GeneralPath is not further backward compatible
from Java 1.6+ since

public final class GeneralPath implements Shape, Cloneable {...} (1.5)
changed to
public final class GeneralPath extends Path2D.Float {...} (1.6)

where Path2D was firstly introduced in 1.6.

Until now, I did not have any problems with java backward
compatibility. After installing Java 1.6 locally I'm not further able
to generate code using GeneralPath for machines <1.6.

Making a local copy of 1.5 compatible GeneralPath is not really
practicable due to the dependencies to many other awt-classes. The only
way I see is to reinstall java 1.5.

What is the reason for that such design?
Are there workarounds?
 
A

Andrew Thompson

as I found, java.awt.GeneralPath is not further backward compatible
from Java 1.6+ since .... ....
Are there workarounds?

Had you tried using -bootclasspath to compile against
a 1.5(or less) rt.jar? That should ensure the correct
bytecodes are written.

Andrew T.
 
T

Thomas Fritsch

as I found, java.awt.GeneralPath is not further backward compatible
from Java 1.6+ since

public final class GeneralPath implements Shape, Cloneable {...} (1.5)
changed to
public final class GeneralPath extends Path2D.Float {...} (1.6)

where Path2D was firstly introduced in 1.6.
In 1.6 Path2D.Float implements Shape and Cloneable.
Therefore I don't see the compatibility problem concerning GeneralPath.
 
Z

zorci

Andrew, thanks for your hint. For development I would need to set the
bootclasspath for eclipse3.2 (auto-build javac, not called with ant)
but I dont know where to set this param. While testing I found that
setting the compiler compliance level to "1.4" seems also to work for
my purpose (level 1.3 didn't).

Thank you anyway!
 
A

Andrew Thompson

...For development I would need to set the
bootclasspath for eclipse3.2 (auto-build javac, not called with ant)
but I dont know where to set this param.

...do you realise how pathetic that sounds?!

Eclipse eats up ant build files, and yet you
are telling me you cannot write an ant script
for building? Cannot find the setting in your
IDE? Cannot change to an IDE where you
...have the control/know what you're doing?

(shrugs) My best suggestion if an IDE 'has you
by the short and curlies' is to dump the IDE.
...While testing I found that
setting the compiler compliance level to "1.4"

What does that translate to? What javac options
are being set there? -source?* -target?*

Seems? You do not sound very convinced.
....also to work for my purpose (level 1.3 didn't).

* But that sort of compromise, has been seen
in the past to be insufficient to guarantee that
code compiled by later JVM's is capable of
being run on earlier ones.

The problem is that although all 'externally
visible' methods and classes might be
compatible with the earlier versions, and
the class format is compatible with the
earlier version, the compiler might use
'shortcuts' available within the later VM,
inside methods designed to run on
earlier versions.

To *guarantee* compatibility with an earlier,
the code *must* be compiled against an rt.jar
of that version.

Andrew T.
 
C

Chris Smith

Andrew Thompson said:
What does that translate to? What javac options
are being set there? -source?* -target?*

None. Eclipse does not use javac. It is approximately equivalent,
though, to setting both -source and -target to 1.4. What zorci doesn't
mention is that right underneath that, there's a check box that lets you
customize further, and there you can set both source and target
compatibility separately. Neither one, though, does what zorci seems to
want, which is to build against an older version of rt.jar.

The way to do that is to first install and configure a 1.5 JRE (Window
-> Preferences, Java -> Installed JREs, then click "Add"). Then right-
click the project, choose "Properties", "Java Build Path", and the
"Libraries" tab. Remove the existing runtime library and then choose
"Add Library" and "JRE System Library". Pick the 1.5 JRE from there.
Simple enough, but you have to know where to look.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top