Assertions can be enabled/disabled programatically ?

Discussion in 'Java' started by Razvan, Sep 27, 2004.

  1. Razvan

    Razvan Guest

    Hi !





    Is it possible to enable/disable assertions from a program while it
    is running ? It seems that the function

    setClassAssertionStatus(String className, boolean enabled);

    from the class ClassLoader is doing that.

    Did anybody used such a technique ? Please give me an example where
    enabling/disabling assertions on the fly is useful.




    Regards,
    Razvan
    Razvan, Sep 27, 2004
    #1
    1. Advertising

  2. Razvan

    Paul Lutus Guest

    Razvan wrote:

    > Hi !
    >
    >
    >
    >
    >
    > Is it possible to enable/disable assertions from a program while it
    > is running ? It seems that the function
    >
    > setClassAssertionStatus(String className, boolean enabled);
    >
    > from the class ClassLoader is doing that.
    >
    > Did anybody used such a technique ? Please give me an example where
    > enabling/disabling assertions on the fly is useful.


    Well, obviously, to shield yourself from the ire of your users. Another
    reason is to speed up a program after testing is completed.

    --
    Paul Lutus
    http://www.arachnoid.com
    Paul Lutus, Sep 27, 2004
    #2
    1. Advertising

  3. Razvan

    Razvan Guest

    Paul Lutus <> wrote in message news:<>...
    > Razvan wrote:
    >
    > > Hi !
    > >
    > >
    > >
    > >
    > >
    > > Is it possible to enable/disable assertions from a program while it
    > > is running ? It seems that the function
    > >
    > > setClassAssertionStatus(String className, boolean enabled);
    > >
    > > from the class ClassLoader is doing that.
    > >
    > > Did anybody used such a technique ? Please give me an example where
    > > enabling/disabling assertions on the fly is useful.

    >
    > Well, obviously, to shield yourself from the ire of your users. Another
    > reason is to speed up a program after testing is completed.


    Shield ... ?! What do you mean ?

    If you want to speed up the program after testing then you
    will run the program AS USUAL: with assertions disabled. No tricks
    needed here.

    Have you actually used this technique in practice ? If the
    user bothers to specify the flag -ea it must have a good reason to do
    so ! It is not a good idea to write programs with 'personality' (eg
    that do what they want).
    Razvan, Sep 28, 2004
    #3
  4. Razvan

    Razvan Guest

    (Razvan) wrote in message news:<>...
    > Hi !
    >
    >
    >
    >
    >
    > Is it possible to enable/disable assertions from a program while it
    > is running ? It seems that the function
    >
    > setClassAssertionStatus(String className, boolean enabled);
    >
    > from the class ClassLoader is doing that.
    >
    > Did anybody used such a technique ? Please give me an example where
    > enabling/disabling assertions on the fly is useful.
    >
    >
    >
    >
    > Regards,
    > Razvan




    No other brave soul has ever tried this ? :))
    Razvan, Sep 30, 2004
    #4
  5. Razvan

    javakid Guest

    javakid, Oct 20, 2004
    #5
    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. Simon Brown
    Replies:
    1
    Views:
    4,330
    DWinter
    Aug 8, 2003
  2. Dennis Johansson
    Replies:
    1
    Views:
    490
    Dennis Johansson
    Aug 21, 2003
  3. Gabor
    Replies:
    3
    Views:
    600
    Jacob Yang [MSFT]
    Aug 26, 2003
  4. =?Utf-8?B?QmluIFNvbmcsIE1DUA==?=
    Replies:
    2
    Views:
    6,465
    rick74
    May 27, 2008
  5. Anks
    Replies:
    2
    Views:
    92
    BootNic
    Aug 6, 2005
Loading...

Share This Page