Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #26763
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: another error with @Override with another code |
| Date | 2013-12-07 08:44 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <l7v8o6$c74$1@dont-email.me> (permalink) |
| References | (3 earlier) <796271a4-11a0-402c-85ff-0f91556c8e7a@googlegroups.com> <06afa354-5858-4359-9e29-6f2b1846e628@googlegroups.com> <l7su1k$njq$1@dont-email.me> <33f33be7-61be-411f-9dee-704118dfb44f@googlegroups.com> <l7ubif$bom$1@dont-email.me> |
On 12/7/2013 12:26 AM, John B. Matthews wrote:
>[...]
> I see no error on the platform cited up-thread. You may have
> adventitious classes in the classpath. Start with a clean build; failing
> that, scrutinize your IDE's cache and your platform's java.ext.dirs.
"Adventitious classes" seems to me the most likely cause.
To expand and (I hope) explain:
Things like `int' and `throw' are built in to the Java
compiler, but names like `Runnable' and `MyClass' are not:
They are merely names, whose definitions need to be found
somewhere. When javac encounters `implements Runnable' it
doesn't somehow know you mean `implements java.lang.Runnable',
but must deduce your intent by searching for a suitable
definition of `Runnable'.
The problem (probably) is that javac when javac searches
for `Override', it finds some other `Override' before it finds
`java.lang.Override'. John B. Matthews already diagnosed one
of your other problems; in that one, you had an actual class
named `Override'. Well, if the file with that `Override' class
is in the same package as the file you're trying to compile,
javac will find that `Override' class -- and since the `Override'
class is not an `Annotation' (a special kind of `interface'),
it complains.
Try any of these:
1) Move all your other *.java files out of the current
directory and away to a desert island where javac won't find
them, then try compiling.
2) Rename your `Override' class to `Overturn' (you may
also need to rename the containing file), then try compiling.
3) Change `@Override' to `@java.lang.Override', then try
compiling.
4) Add `import java.lang.Override;' at the start of the
troublesome source, then try compiling.
If I'm right, any of these will fix your problem. In the
future, try to avoid reusing names already defined by Java's
class library -- especially those in the java and java.lang
packages, which are automatically visible to all compilations.
There are no reserved names (or almost no reserved names) in
Java, but you're just begging for trouble if you redefine them.
--
Eric Sosman
esosman@comcast-dot-net.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
@override annotation not working correctly javac version _ 1.7.0_25 Y HA <yuriha@gmail.com> - 2013-12-05 14:42 -0800
Re: @override annotation not working correctly javac version _ 1.7.0_25 Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-12-05 18:25 -0500
Re: @override annotation not working correctly javac version _ 1.7.0_25 Y HA <yuriha@gmail.com> - 2013-12-05 16:13 -0800
Re: @override annotation not working correctly javac version _ 1.7.0_25 Y HA <yuriha@gmail.com> - 2013-12-05 17:00 -0800
Re: @override annotation not working correctly javac version _ 1.7.0_25 Y HA <yuriha@gmail.com> - 2013-12-05 17:03 -0800
Re: @override annotation not working correctly javac version _ 1.7.0_25 Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-12-05 20:42 -0500
Re: @override annotation not working correctly javac version _ 1.7.0_25 Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-12-07 19:15 +0000
Re: @override annotation not working correctly javac version _ 1.7.0_25 "John B. Matthews" <nospam@nospam.invalid> - 2013-12-05 21:49 -0500
Use of @Override when implementing interfaces (was: @override annotation not working...) Fredrik Jonson <fredrik@jonson.org> - 2013-12-06 07:01 +0000
Re: Use of @Override when implementing interfaces Silvio <silvio@internet.com> - 2013-12-06 09:10 +0100
Re: Use of @Override when implementing interfaces Y HA <yuriha@gmail.com> - 2013-12-06 07:08 -0800
another error with @Override with another code Y HA <yuriha@gmail.com> - 2013-12-06 07:25 -0800
Re: another error with @Override with another code "John B. Matthews" <nospam@nospam.invalid> - 2013-12-06 11:29 -0500
Re: another error with @Override with another code Y HA <yuriha@gmail.com> - 2013-12-06 09:21 -0800
Re: another error with @Override with another code "John B. Matthews" <nospam@nospam.invalid> - 2013-12-07 00:26 -0500
Re: another error with @Override with another code Knute Johnson <september@knutejohnson.com> - 2013-12-06 21:57 -0800
Re: another error with @Override with another code Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-12-07 08:44 -0500
Re: another error with @Override with another code "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-12-07 11:12 +0000
Re: Use of @Override when implementing interfaces Stanimir Stamenkov <s7an10@netscape.net> - 2013-12-07 16:32 +0200
Re: Use of @Override when implementing interfaces Y HA <yuriha@gmail.com> - 2013-12-08 12:02 -0800
Re: Use of @Override when implementing interfaces Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-12-08 21:27 +0000
Re: Use of @Override when implementing interfaces Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-12-08 23:43 +0000
Re: Use of @Override when implementing interfaces Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-12-08 16:45 -0500
Re: Use of @Override when implementing interfaces Jeff Higgins <jeff@invalid.invalid> - 2013-12-06 09:51 -0500
Re: Use of @Override when implementing interfaces leif.roar@invalid.com (Leif Roar Moldskred) - 2013-12-06 09:36 -0600
Re: Use of @Override when implementing interfaces Y HA <yuriha@gmail.com> - 2013-12-06 07:41 -0800
Re: Use of @Override when implementing interfaces markspace <markspace@nospam.nospam> - 2013-12-06 08:18 -0800
Re: Use of @Override when implementing interfaces v_borchert@despammed.com (Volker Borchert) - 2013-12-07 07:14 +0000
Re: Use of @Override when implementing interfaces Wayne <nospam@all.invalid> - 2013-12-07 04:46 -0500
Re: Use of @Override when implementing interfaces v_borchert@despammed.com (Volker Borchert) - 2013-12-07 10:54 +0000
Re: Use of @Override when implementing interfaces Fredrik Jonson <fredrik@jonson.org> - 2013-12-09 12:59 +0000
Re: Use of @Override when implementing interfaces Arne Vajhøj <arne@vajhoej.dk> - 2013-12-09 21:06 -0500
Re: Use of @Override when implementing interfaces "John B. Matthews" <nospam@nospam.invalid> - 2013-12-11 00:55 -0500
csiph-web