Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: You put because it is not there Date: Mon, 27 Jan 2014 18:13:47 -0500 Organization: A noiseless patient Spider Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 27 Jan 2014 23:13:45 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="12442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+aZ8RwJS49ioLyoNhvMWs+" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: Cancel-Lock: sha1:xLkUWGEQoGeQwIoa3m9dX6aVLmQ= Xref: csiph.com comp.lang.java.programmer:27412 On 1/27/2014 5:49 PM, Stefan Ram wrote: > Sometimes, it is surprising what error messages Java > implementations give: > > Main.java:3: error: '.class' expected > { if( true )int x; }} > ^ > Does the implementation really expects to see > »if( true )int .class« or »if( true ).class«? The former. That's what it said; why should you disbelieve what it says about its own expectations? ;-) Was its expectation reasonable? I think so, because given the prefix `if ( true ) int' I can imagine no other continuation than `. class' that could be part of a valid parse, as in `if (true) int.class.getClassLoader();'. Can you think of any other valid continuations? -- Eric Sosman esosman@comcast-dot-net.invalid