Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

help with generics
Hello,
I try to model the following structure:
A DomainModel has several Concepts as sons and
a Concept has several Categories as sons and
a Category may also have Categories as sons.
I modeled it like that:

public abstract class DomainModelElement<C extends DomainModelElement>
implements DomainModelTokens {
protected Vector<C> children = new Vector<C>();
..
public class DomainModel extends DomainModelElement<Concept> {
..
public class Concept extends DomainModelElement<Category> {
..
public class Category extends DomainModelElement<Category> {
..

So I pass the child type to the element, so I can use generic
implementations
of the methods for accessing the children. When I compile everything
works fine
until the compiler see the Category class. It says:

Bound mismatch: The type Category is not a valid substitute for the
bounded parameter <C extends DomainModelElement> of the type
DomainModelElement<C>	Category.java

although Category is a subclass of DomainModelElement<C>.
Can anybody help?

Thanks beforehand,
David Kensche

Report this thread to moderator Post Follow-up to this message
Old Post
David
09-29-04 04:03 PM


Re: help with generics
"David" <david.kensche@post.rwth-aachen.de> wrote in message
news:e0f4e8a2.0409290432.1853ea7a@posting.google.com...
> ...
> public abstract class DomainModelElement<C extends DomainModelElement>
> implements DomainModelTokens {
>   protected Vector<C> children = new Vector<C>();
> ..
> public class DomainModel extends DomainModelElement<Concept> {
> ..
> public class Concept extends DomainModelElement<Category> {
> ..
> public class Category extends DomainModelElement<Category> {
> ..
> ...
>
> Bound mismatch: The type Category is not a valid substitute for the
> bounded parameter <C extends DomainModelElement> of the type
> DomainModelElement<C> Category.java

What version of Java are you using? This seems to work fine
in 1.5.0 rc.



Report this thread to moderator Post Follow-up to this message
Old Post
Larry Barowski
09-30-04 01:09 AM


Re: help with generics
> What version of Java are you using? This seems to work fine
> in 1.5.0 rc.
Hi,
I am using jdk1.5.0. Don't know what rc stands for but
this should be the same, shouldn't it?


David

Report this thread to moderator Post Follow-up to this message
Old Post
David
09-30-04 04:37 PM


Re: help with generics
david.kensche@post.rwth-aachen.de (David) writes:

> I am using jdk1.5.0. Don't know what rc stands for but
> this should be the same, shouldn't it?

RC = release candidate, which was the last version available before
the now-available final release.

Report this thread to moderator Post Follow-up to this message
Old Post
Tor Iver Wilhelmsen
09-30-04 04:37 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:44 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.