Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15215
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: It doesn't like 'super' where ever I put it. |
| Date | 2012-06-11 19:53 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jr60e0$25m$1@dont-email.me> (permalink) |
| References | (3 earlier) <a3k7vfF3k1U1@mid.individual.net> <constructor-20120610205100@ram.dialup.fu-berlin.de> <a3mqqdFq23U1@mid.individual.net> <a3n43dF3fbU2@mid.individual.net> <a3naocFkvmU1@mid.individual.net> |
On 6/11/2012 6:45 PM, Gavino wrote:
> "Robert Klemme" <shortcutter@googlemail.com> wrote in message
> news:a3n43dF3fbU2@mid.individual.net...
> On 11.06.2012 20:13, Gavino wrote:
>>> It can't because the superclass (JFrame) does not have a constructor without
>>> arguments.
>
>> Also wrong.
>
>> http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html#JFrame()
>
> My apologies.
> I don't know where I got that erroneous idea from, but somehow I've been carrying it
> around in my head for the last 12 years.
> I should have checked the JavaDocs instead of relying on badly remembered information.
>
> Now I'm equally confused about the wording of the error message.
You are not the only confused person. It might just be clumsy
wording:
Constructor must call super() or this() before return in
method CalcFrame1.<init>()V [...]
certainly seems to be complaining about a constructor: That's the first
word of the message, and <init> is what one usually sees when a message
tries to mention the "name" of a (nameless) constructor.
The message *seems* to be saying: "The constructor fails to call
super() or this() when it ought to." Instead, what I think it means
is "The super() or this() call should be in a constructor, not in a
method (where it makes no sense)."
One must, however, cut the compiler a certain amount of slack.
There's a built-in ambiguity about diagnosing "the" error in erroneous
source. All the compiler knows for sure is that the source is wrong;
to explain "how" it is wrong, the compiler must guess at what it tried
(and failed) to express. That is, there are many possible compilable
programs at smaller and larger "edit distances" from the incorrect code
at hand, and the compiler has no way to know which was intended. To
describe "the error," the compiler must choose one (or a small family)
of those nearby candidates and describe how the offered code differs.
But it's all guesswork -- even a compilable program may not be what was
intended (that's why we debug...).
The practical lesson is not to take error messages too literally.
Very often the message will highlight the difficulty well enough to
prompt you to a facepalm and a fix. But when the message seems at an
inexplicable tangent to what you think is going on, the best approach
may be to reinterpret "Operand of binary % must be a duodecimal dingle"
as "Something's wrong," and read no more into it than that.
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 06:27 -0700
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 13:49 +0000
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 07:08 -0700
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-10 11:34 -0400
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 12:58 -0700
Re: It doesn't like 'super' where ever I put it. markspace <-@.> - 2012-06-10 13:43 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-11 21:01 -0700
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 15:44 +0000
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-10 20:39 +0200
Re: It doesn't like 'super' where ever I put it. "Gavino" <invalid@invalid.invalid> - 2012-06-11 20:13 +0200
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-11 22:51 +0200
Re: It doesn't like 'super' where ever I put it. "Gavino" <invalid@invalid.invalid> - 2012-06-12 00:45 +0200
Re: It doesn't like 'super' where ever I put it. Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-11 22:53 +0000
Re: It doesn't like 'super' where ever I put it. Lew <lewbloch@gmail.com> - 2012-06-11 16:42 -0700
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-11 19:53 -0400
Re: It doesn't like 'super' where ever I put it. Lew <lewbloch@gmail.com> - 2012-06-11 17:38 -0700
Re: It doesn't like 'super' where ever I put it. "John B. Matthews" <nospam@nospam.invalid> - 2012-06-11 23:14 -0400
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-12 18:21 +0200
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-11 22:50 +0200
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-10 09:59 -0400
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 08:02 -0600
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 07:20 -0700
Re: It doesn't like 'super' where ever I put it. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-10 09:49 -0500
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:15 -0700
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 10:26 -0600
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 11:24 -0600
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 11:38 -0600
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 18:17 +0000
Re: It doesn't like 'super' where ever I put it. Lew <noone@lewscanon.com> - 2012-06-10 12:26 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:17 -0700
Re: It doesn't like 'super' where ever I put it. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-10 11:54 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:24 -0700
Re: It doesn't like 'super' where ever I put it. Lew <noone@lewscanon.com> - 2012-06-10 13:56 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-11 20:55 -0700
Re: It doesn't like 'super' where ever I put it. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-11 16:41 -0700
csiph-web