Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36772
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Eclipse |
| Date | 2017-06-29 21:31 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <oj3rik$c6a$1@dont-email.me> (permalink) |
| References | (3 earlier) <1b033cbe-4bc2-497f-9c93-e6e90b75f39b@googlegroups.com> <oj3cof$rbp$1@dont-email.me> <7dff7a25-5881-4ecb-a937-ab076082dfcd@googlegroups.com> <oj3ik3$c4n$1@dont-email.me> <6238fdf1-4903-43cd-bc84-088730d15903@googlegroups.com> |
On Thu, 29 Jun 2017 12:55:26 -0700, Eric Douglas wrote: > On Thursday, June 29, 2017 at 3:02:15 PM UTC-4, Martin Gregorie wrote: >> Err, not really. An Interface defines a set of methods that must all be >> defined by an Interface but is not a Class anbd I think thats what is >> making Eclipse spit. >> >> I think you need to declare the various classes that implement >> MyCustomInterface into subclasses of an (abstract?) superclass that >> extends JContainer which, at a quick glance, inherits the methods you >> mention from Container and Component. >> >> > That is the problem. These are all Component, as the focusGained() > refers to them, or JComponent but they're different components. They > are already subclasses of the various components (JTextField, JTextArea, > JComboBox, JSpinner) so they can't subclass an abstract class so they > have to use the interface. The ArrayList has to refer to it's elements > with the interface or else I'd have to declare it as > ArrayList<JComponent> and assume we're only adding objects to it which > implement the interface, and every time I want to call an interface > method on an object in the array I have to cast the object. Unless I'm > missing something? Like I said you can't just define both ways as > ArrayList<JComponent implements MyCustomInterface>, I tried that. Understood. What does your MyCustomInterface contribute to making it easier to handle the different types of objects? Would it help to do something like declaring a MyClass that extends Component and implements MyCustomInterface and that is passed the JTextField, etc as constructor argument? At least this should avoid your casting problem. Apart from that all I can suggest is that, after double checking that your classes compile correctly when javac is run either manually of via ant outside the Eclipse environment, you ask the Eclipse project why this has started to happen in this version and/or file a bug against Eclipse. Filing bugs is very much in the FOSS ethos - IMO you should regard the work involved in posting good, well documented bug reports as your contribution to the Eclipse project. Put another way, users of commercial software pay cash: FOSS users pay by testing, reporting bugs and making sensible enhancement suggestions. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-28 07:57 -0700
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-28 09:04 -0700
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-28 12:07 -0700
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-29 06:05 -0700
Re: Eclipse Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-29 09:32 -0400
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-29 06:42 -0700
Re: Eclipse Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-29 09:47 -0400
Re: Eclipse Andreas Leitgeb <avl@logic.at> - 2017-06-30 14:47 +0000
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 08:22 -0700
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 06:19 -0700
Re: Eclipse Andreas Leitgeb <avl@logic.at> - 2017-07-13 09:29 +0000
Re: Eclipse Martin Gregorie <martin@address-in-sig.invalid> - 2017-06-29 17:18 +0000
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-29 11:08 -0700
Re: Eclipse Martin Gregorie <martin@address-in-sig.invalid> - 2017-06-29 18:58 +0000
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-29 12:55 -0700
Re: Eclipse Martin Gregorie <martin@address-in-sig.invalid> - 2017-06-29 21:31 +0000
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-30 04:55 -0700
Re: Eclipse Martin Gregorie <martin@address-in-sig.invalid> - 2017-06-30 13:02 +0000
Re: Eclipse Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-29 16:34 -0400
Re: Eclipse Eric Douglas <e.d.programmer@gmail.com> - 2017-06-29 13:49 -0700
Re: Eclipse Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-29 18:16 -0400
Re: Eclipse Arne Vajhøj <arne@vajhoej.dk> - 2017-07-02 11:56 -0400
csiph-web