You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Dawid Weiss <da...@cs.put.poznan.pl> on 2011/10/25 19:34:24 UTC
Re: (LUCENE-3506) tests for verifying that assertions are enabled do
nothing since they ignore AssertionError
Ok, thanks Uwe. Must have been a javac problem then because I compiled
it fine with Maven (javac is the default if I'm not mistaken).
Dawid
On Tue, Oct 25, 2011 at 7:28 PM, Uwe Schindler (Commented) (JIRA)
<ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/LUCENE-3506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13135256#comment-13135256 ]
>
> Uwe Schindler commented on LUCENE-3506:
> ---------------------------------------
>
> It may no longer apply to Java 6 javac, but when I implemented this test for the first time (was Java 4 or Java 5) the "assert false;" made javac angry - it simply refused to compile this (some error like unreachable statement blabla). 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).
>
>> 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: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
Re: (LUCENE-3506) tests for verifying that assertions are enabled do
nothing since they ignore AssertionError
Posted by Dawid Weiss <da...@cs.put.poznan.pl>.
> I don't remember exactly what happened, but it appeared to me as a safe way to not make any optimizer/javac/... get angry.
I think I know what happened: that had to be a bug in javac because
any code around the assertion is still physically reachable (assert is
after all implemented as a compound if/ throw clause). As for Version
-- constants propagation at compile time can be problematic, but it is
documented well in that Lucene snippet, everything's fine, didn't have
problems understanding that particular piece. Thanks,
Dawid
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
RE: (LUCENE-3506) tests for verifying that assertions are enabled do nothing since they ignore AssertionError
Posted by Uwe Schindler <uw...@thetaphi.de>.
I don't remember exactly what happened, but it appeared to me as a safe way to not make any optimizer/javac/... get angry.
We have some other javac (not hotspot!) hack in the Version class:
// this method prevents inlining the final version constant in compiled classes,
// see: http://www.javaworld.com/community/node/3400
private static String ident(final String s) {
return s.toString();
}
public static final String LUCENE_MAIN_VERSION = ident("4.0");
The comment tells you why this is done like that. Looks stupid, but helps :-)
-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de
> -----Original Message-----
> From: dawid.weiss@gmail.com [mailto:dawid.weiss@gmail.com] On Behalf Of
> Dawid Weiss
> Sent: Tuesday, October 25, 2011 7:34 PM
> To: dev@lucene.apache.org
> Subject: Re: (LUCENE-3506) tests for verifying that assertions are enabled do
> nothing since they ignore AssertionError
>
> Ok, thanks Uwe. Must have been a javac problem then because I compiled it
> fine with Maven (javac is the default if I'm not mistaken).
>
> Dawid
>
> On Tue, Oct 25, 2011 at 7:28 PM, Uwe Schindler (Commented) (JIRA)
> <ji...@apache.org> wrote:
> >
> > [
> > https://issues.apache.org/jira/browse/LUCENE-3506?page=com.atlassian.j
> > ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=131
> > 35256#comment-13135256 ]
> >
> > Uwe Schindler commented on LUCENE-3506:
> > ---------------------------------------
> >
> > It may no longer apply to Java 6 javac, but when I implemented this test for
> the first time (was Java 4 or Java 5) the "assert false;" made javac angry - it
> simply refused to compile this (some error like unreachable statement blabla).
> 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).
> >
> >> 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.js
> > pa For more information on JIRA, see:
> > http://www.atlassian.com/software/jira
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For
> > additional commands, e-mail: dev-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional
> commands, e-mail: dev-help@lucene.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org