replace assert by throw new AssertionError

Tom Ball Tom.Ball at Sun.COM
Tue Oct 2 20:25:27 PDT 2007


The javac that is part of the Open JDK *is* the compiler that Sun's Java 
group created.  AFAIK, all Sun javac work is open source now, so Jon was 
asking the Java compiler community both inside and outside Sun for 
design feedback (like he should now).  I responded with a Glassfish 
comment not because that team should unilaterally decide an open source 
community question, but because they are just one of many appserver 
teams using javac within and outside of Sun and so a useful data point 
(and, Glassfish is open-source, too).

I don't know of any Open JDK effort to develop a Java compiler from 
scratch.  Do you?  If so, please share the details with the other alias 
members.

Tom

navroop singh wrote:
> Hey guys
>  
> Are you part of the sun JAVA group or Open JDK( developing own javac 
> from ground up) ?
>  
>  
> Thanks
> 
>  
> On 10/2/07, *Jonathan Gibbons* <Jonathan.Gibbons at sun.com 
> <mailto:Jonathan.Gibbons at sun.com>> wrote:
> 
>     Team,
> 
>     javac currently contains assertion statements, and goes out of its way
>     to ensure assertions are enabled.
>     As such, it would seem better to replace "assert cond: expr" with "if
>     (!cond) throw new AssertionError(expr)".
>     Then we could remove the code from all the places where we force
>     assertions to be enabled for javac.
>     Does anyone have comments, especially any reasons why this would *not*
>     be a good idea?
> 
>     -- Jon
> 
> 
> 
> 
> -- 
> thanks
> navroop singh




More information about the compiler-dev mailing list