Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Java puzzler Date: Thu, 12 May 2011 19:26:20 -0700 Organization: A noiseless patient Spider Lines: 41 Message-ID: References: <4db69c13-878f-4806-adb2-a3c5adb1c48c@glegroupsg2000goo.googlegroups.com> <-8mdnSRPEIdA21HQnZ2dnUVZ_j2dnZ2d@earthlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 13 May 2011 02:26:26 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="IPG0uhtItDWol02AtwWFWQ"; logging-data="26378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+MqBthpIv15ip4hR2k9ngu3pE/uGiiM4=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:ghzGdBD2cOqxLMMfb84qqFj6vds= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4036 On 5/12/2011 6:18 PM, Patricia Shanahan wrote: > and add rules for deciding when to do overflow detection. > What I envision is only to only add the deciding in the compiler, not at run time. I'm not talking about setting a mode per thread or application. I only want to affect what byte codes get generated at compile time. Everything already compiled or compiled with existing options retains its current semantics. For example, if I do something like this public int encryptAndCount( byte[] buffer ) { @strictint // assume this turns on overflow checking int i = 0; int count = 0; while( buffer[i] != 0 ) { // assume null terminated count++; encrypt( buffer, i ); } return count; } and encrypt is something like this: public class Encrypt { private static byte rand; public static void encrypt( byte[] buffer, int i offset ) { rand += 42; // world's worst encryption buffer[offset] ^= rand; } } the method encryptAndCount has overflow detection, but that does not "flow into" the method encrypt. They are distinct compilation units, and in this case I immagine that "@strictint" only applies to one method at a time anyway. So it all depends on the byte codes, not threads or program flow, and doesn't happen dynamically at run time.