This page is no longer maintained — Please continue to the home page at www.scala-lang.org

disabling assertion in Scala build

4 replies
Erik Engbrecht
Joined: 2008-12-19,
User offline. Last seen 3 years 18 weeks ago.
Is there a way to disable assertions when building the Scala distribution w/o modifying the build.xml file?

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: disabling assertion in Scala build

On Sun, Feb 01, 2009 at 10:15:08AM -0500, Erik Engbrecht wrote:
> Is there a way to disable assertions when building the Scala distribution
> w/o modifying the build.xml file?

Assuming -Xdisable-assertions works as advertised,

ant -Dscalac.args=-Xdisable-assertions

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: disabling assertion in Scala build

On Sun, Feb 01, 2009 at 10:15:08AM -0500, Erik Engbrecht wrote:
> Is there a way to disable assertions when building the Scala distribution
> w/o modifying the build.xml file?

Interestingly, the build fails with assertions disabled. This appears to be related to internal use of exceptions
to handle some XML logic, but since you shouldn't be able to catch a failed assertion and assertion disabling only
disables the throwing of AssertionErrors, I'm not yet sure how this can be.

Here's how it fails, in quick.lib:

[scalacfork] Compiling 405 files to /scala/trunk/build/quick/classes/library
[scalacfork] /scala/trunk/src/library/scala/xml/persistent/CachedFileStorage.scala:94: error: in XML literal: in XML content, please use '}}' to express '}'
[scalacfork] val storageNode = { nodes.toList }
[scalacfork] ^
[scalacfork] /scala/trunk/src/library/scala/xml/persistent/CachedFileStorage.scala:94: error: I encountered a '}' where I didn't expect one, maybe this tag isn't closed <
[scalacfork] val storageNode = { nodes.toList }
[scalacfork] ^
[scalacfork] two errors found

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: disabling assertion in Scala build

My mistake, you can catch errors, you're just not supposed to. In that case there are a couple dozen places in the
compiler which catch Throwable, and the XML parser at least appears to use Exceptions for non-fatal control flow,
and I think these might be interacting poorly.

DRMacIver
Joined: 2008-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: disabling assertion in Scala build
On Sun, Feb 1, 2009 at 6:20 PM, Paul Phillips <paulp [at] improving [dot] org> wrote:
and I think these might be interacting poorly.

Mr Phillips, you show a nearly British level of skill in the art of understatement...

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland