That is different, because "assert false;" will make javac angry - it simply 
refuses to compile this (some error like unreachable statement blabla). When I 
implemented this test for the first time, this was the only way to get this 
running, copied from some code example on the net (I think it was the assertion 
guide shipped with Java 1.4).

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Dawid Weiss (Commented) (JIRA) [mailto:[email protected]]
> Sent: Tuesday, October 25, 2011 7:21 PM
> To: [email protected]
> Subject: [jira] [Commented] (LUCENE-3506) tests for verifying that assertions
> are enabled do nothing since they ignore AssertionError
> 
> 
>     [ https://issues.apache.org/jira/browse/LUCENE-
> 3506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-
> tabpanel&focusedCommentId=13135247#comment-13135247 ]
> 
> Dawid Weiss commented on LUCENE-3506:
> -------------------------------------
> 
> Err... how is this different:
> {code}
> assert Boolean.FALSE.booleanValue();
> {code}
> from
> {code}
> assert false;
> {code}
> 
> Is there any compile-time code elimination? I ask specifically because I've
> implemented a dedicated validator for this purpose in RandomizedRunner
> here:
> 
> https://github.com/carrotsearch/randomizedtesting/blob/master/runner/src/m
> ain/java/com/carrotsearch/randomizedtesting/validators/EnsureAssertionsEna
> bled.java
> 
> and this seems to work just fine (checked with and without -ea).
> 
> > tests for verifying that assertions are enabled do nothing since they
> > ignore AssertionError
> > ----------------------------------------------------------------------
> > ---------------------
> >
> >                 Key: LUCENE-3506
> >                 URL: https://issues.apache.org/jira/browse/LUCENE-3506
> >             Project: Lucene - Java
> >          Issue Type: Bug
> >          Components: general/test
> >            Reporter: Doron Cohen
> >            Assignee: Doron Cohen
> >            Priority: Minor
> >         Attachments: LUCENE-3506.patch, LUCENE-3506.patch
> >
> >
> > Follow-up from LUCENE-3501
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators:
> https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
> For more information on JIRA, see: http://www.atlassian.com/software/jira
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected] For additional
> commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to