Menu

#9 Removing constants can be OK

open
None
5
2004-06-02
2004-05-26
No

Clirr objects when a static final constant is removed
from a class. However, this is permitted if the type of
the constant is primitive or a String.

See commons-collections 3.0-HEAD ReferenceMap

Discussion

  • Lars Kühne

    Lars Kühne - 2004-06-02
    • assigned_to: nobody --> lkuehne
     
  • Lars Kühne

    Lars Kühne - 2004-06-02

    Logged In: YES
    user_id=401384

    You mean that compile time constants are inlined into the
    client code and removing them will not affect compiled clients?

    Which constant in ReferenceMap do you mean?

     
  • Stephen Colebourne

    Logged In: YES
    user_id=408725

    The JLS says that primitive and String constants must be
    inlined at compile time (IIRC, always worth checking...)
    Object based constants are not inlined, so should cause the
    error in clirr if moved.

    Thus although ReferenceMap.HARD, .WEAK and .SOFT have
    been deleted, this causes no binary incompatibility (they are
    int constants). (The constants can be removed completely
    without binary incompatibility - in this case, they actually
    moved to a superclass)

     
  • Lars Kühne

    Lars Kühne - 2004-09-05

    Logged In: YES
    user_id=401384

    Clirr 0.4 differentiates between binary and source
    compatibility ("bc" and "sc").
    Removing a field that is a compile time constant is marked
    as a bc warning and a sc error.

    Not closing this request because I think we are not handling
    "moved to superclass" correctly.

     

Log in to post a comment.