Enabling/disabling asserts in interface default methods

Jan Lahoda jan.lahoda at oracle.com
Tue Oct 8 12:32:51 PDT 2013


(Noted by Jon Gibbons and discussed with Alex Buckley.)

JLS for Java SE 7, 14.10 (The assert Statement) is talking about 
top-level classes:

   An assert statement that is executed after its class has completed
   initialization is enabled if and only if the host system has
   determined that the top level class that lexically contains the
   assert statement enables assertions.

Looking at JSR335-0.6.3, there appears to be no update to this. As 
interface methods may contain code now, they may also contain the assert 
statement. So it might be good to update the spec to also cover 
interfaces in addition to classes.

Jan


More information about the lambda-spec-comments mailing list