Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27413 > unrolled thread
| Started by | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| First post | 2014-01-27 21:32 -0800 |
| Last post | 2014-01-28 08:36 -0400 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: You put because it is not there Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-01-27 21:32 -0800
Re: You put because it is not there Arved Sandstrom <asandstrom2@eastlink.ca> - 2014-01-28 08:36 -0400
| From | Kevin McMurtrie <mcmurtrie@pixelmemory.us> |
|---|---|
| Date | 2014-01-27 21:32 -0800 |
| Subject | Re: You put because it is not there |
| Message-ID | <mcmurtrie-A8FF22.21325427012014@c-61-68-245-199.per.connect.net.au> |
In article <error-message-20140127232916@ram.dialup.fu-berlin.de>,
ram@zedat.fu-berlin.de (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 complete source code was:
>
> public final class Main
> { public static void main( final java.lang.String[] args )
> { if( true )int x; }}
Eclipse's suggestions turned that into:
if (true) assert int.class != null;
I didn't know primitives had a synthetic class field. I tried it and
found that int.class is a shortcut for Integer.TYPE.
> You also can get the error message text »'.class' expected«
> with the following programs:
>
> public final class Main
> { public static void main( final java.lang.String[] args )
> { java.lang.System.out.println( args.len[] ); }}
>
> public final class Main
> { public static void main( final java.lang.String[] args )
> { java.lang.System.out.println( args.length[] ); }}
>
> public final class Main
> { public static void main( final java.lang.String[] args )
> { java.lang.System.out.println( int ); }}
>
> (The subject of this message is an automatic translation of
> a German idiom that I wanted to use as a subject for this
> post. The translation, however, does not express the sense
> of the German idiom, nor does it have any sense at all.
> However, it fits the topic of the contents, because it
> demonstrates once again that automatic translation systems
> have problems understanding what humans write, just as the
> Java implementation does. The first error message should be
> more like: »Statement expected.« [»int x;« is a block
> statement, but not a statement.])
[toc] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom2@eastlink.ca> |
|---|---|
| Date | 2014-01-28 08:36 -0400 |
| Message-ID | <0vNFu.291714$WT.111712@fx32.iad> |
| In reply to | #27413 |
On 01/28/2014 01:32 AM, Kevin McMurtrie wrote:
> In article <error-message-20140127232916@ram.dialup.fu-berlin.de>,
> ram@zedat.fu-berlin.de (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 complete source code was:
>>
>> public final class Main
>> { public static void main( final java.lang.String[] args )
>> { if( true )int x; }}
>
> Eclipse's suggestions turned that into:
> if (true) assert int.class != null;
>
> I didn't know primitives had a synthetic class field. I tried it and
> found that int.class is a shortcut for Integer.TYPE.
>
[ SNIP ]
FWIW I didn't know this either. I also had to quickly fire up a quick
test program to try it out. :-) Learn something new every day.
AHS
--
When a true genius appears, you can know him by this sign:
that all the dunces are in a confederacy against him.
-- Jonathan Swift
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web