Oops! Integer.compare

Discussion in 'Java' started by Roedy Green, May 25, 2012.

  1. Roedy Green

    Roedy Green Guest

    I was doing some subtraction in sort Comparators, when I noticed a
    method Integer.compare that would handle the nice cases properly.

    I thought to myself, I wonder why I never noticed that before. (Turns
    out it was introduced in 1.7).

    The catch was though that Jet stopped working.

    Why?

    Jet only supports up to Java 1.6.

    When I compile with switches to generate Java 1.6 code, it is happy to
    use new 1.7 code from the library. It then generates class files and
    jars marked as legit 1.6 code. Ouch!

    The official way to do this is to find old rt.jars to generate old
    code. Is that the best way to catch these errors?
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    I would be quite surprised if the NSA (National Security Agency)
    did not have a computer program to scan bits of shredded
    documents and electronically put them back together like a giant
    jigsaw puzzle. This suggests you cannot just shred, you must also burn.
    ..
    Roedy Green, May 25, 2012
    #1
    1. Advertising

  2. Roedy Green

    Lew Guest

    Roedy Green wrote:
    > I was doing some subtraction in sort Comparators, when I noticed a
    > method Integer.compare that would handle the nice cases properly.
    >
    > I thought to myself, I wonder why I never noticed that before. (Turns
    > out it was introduced in 1.7).
    >
    > The catch was though that Jet stopped working.
    >
    > Why?
    >
    > Jet only supports up to Java 1.6.
    >
    > When I compile with switches to generate Java 1.6 code, it is happy to
    > use new 1.7 code from the library. It then generates class files and
    > jars marked as legit 1.6 code. Ouch!
    >
    > The official way to do this is to find old rt.jars to generate old
    > code. Is that the best way to catch these errors?


    Yes. You use Java 6 boot JARs in the "-bootclasspath" argument to "javac".

    --
    Lew
    Lew, May 25, 2012
    #2
    1. Advertising

  3. On 2012-05-25 19:00:28 +0000, Roedy Green said:

    > I was doing some subtraction in sort Comparators, when I noticed a
    > method Integer.compare that would handle the nice cases properly.
    >
    > I thought to myself, I wonder why I never noticed that before. (Turns
    > out it was introduced in 1.7).
    >
    > The catch was though that Jet stopped working.
    >
    > Why?
    >
    > Jet only supports up to Java 1.6.
    >
    > When I compile with switches to generate Java 1.6 code, it is happy to
    > use new 1.7 code from the library. It then generates class files and
    > jars marked as legit 1.6 code. Ouch!
    >
    > The official way to do this is to find old rt.jars to generate old
    > code. Is that the best way to catch these errors?


    It's usually easier to keep a complete JDK installation around for the
    oldest runtime version you want to support, and compile your code with
    that JDK. That takes care of language and bytecode compatibility (the
    default -source and -target versions for a given version of the JDK are
    exactly the version of the JDK itself) as well as library compatibility
    (the JDK uses its version's runtime library to find symbols by default).

    Sun, and now Oracle, try fairly hard to ensure forward source and
    binary compatibility, so you can still run your compiled code on newer
    runtimes if you like.

    -o
    Owen Jacobson, May 30, 2012
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Riken

    OOPS concepts

    Riken, Jul 15, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    17,275
    bmundy
    Aug 6, 2003
  2. Anandraj

    OOPS in .NET

    Anandraj, Aug 4, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    18,005
    Terry
    Aug 29, 2003
  3. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Oops.. how can I rebuild a RESX file?

    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    8,054
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=
    Feb 2, 2005
  4. Replies:
    2
    Views:
    397
    Joerg Jooss
    Aug 21, 2005
  5. oaksong

    oops...changed the SA password

    oaksong, Nov 2, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    564
    oaksong
    Nov 3, 2005
Loading...

Share This Page