Classes compatibility

Discussion in 'Java' started by Maxim Geraskyn, Feb 8, 2005.

  1. Hi there,

    Simple example.

    a.jar includes A class
    b.jar includes B class inherited from A

    If I add new methods/fields to A class and recreate a.jar, will
    b.jar still normally work with old fields/methods of A
    ( so b.jar sees new version of a.jar but compiled with old one)

    Are there well-defined compatibility rules about it ?

    Thanks in advance,

    Maxim
    Maxim Geraskyn, Feb 8, 2005
    #1
    1. Advertising

  2. Maxim Geraskyn wrote:
    > Hi there,
    >
    > Simple example.
    >
    > a.jar includes A class
    > b.jar includes B class inherited from A
    >
    > If I add new methods/fields to A class and recreate a.jar, will
    > b.jar still normally work with old fields/methods of A
    > ( so b.jar sees new version of a.jar but compiled with old one)
    >
    > Are there well-defined compatibility rules about it ?


    check out the specs:

    "Changing the direct superclass or the set of direct superinterfaces of
    a class type will not break compatibility with pre-existing binaries,
    provided that the total set of superclasses or superinterfaces,
    respectively, of the class type loses no members."

    from this url:

    http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html#44994
    Andrea Desole, Feb 8, 2005
    #2
    1. Advertising

  3. Andrea

    > check out the specs:


    Many, many, many thanks !
    How could I miss it !

    Maxim
    Maxim Geraskyn, Feb 8, 2005
    #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. David

    Classes within classes

    David, Jul 21, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    4,927
    David
    Jul 22, 2005
  2. lonelyplanet999
    Replies:
    1
    Views:
    2,200
    VisionSet
    Nov 13, 2003
  3. Carfield Yim
    Replies:
    1
    Views:
    1,397
    Andrew Thompson
    May 31, 2004
  4. Razvan
    Replies:
    11
    Views:
    895
    Andrew Thompson
    Jul 17, 2004
  5. Razvan
    Replies:
    5
    Views:
    11,280
    Dale King
    Jul 27, 2004
Loading...

Share This Page