lundi 27 janvier 2014

You put because it is not there topic




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
(E-Mail Removed)d





Aucun commentaire:

Enregistrer un commentaire