Mysterious Generics

Some months ago, I've created a simple generics example, which compiled
fine with 1.5.0rc, but not with 1.5.0fcs:

public interface IEntry<_D_ extends IDirectory, F extends IFile> {
String getName();
D getParent();
}

public interface IDirectory<_D_ extends IDirectory, F extends
IFile> extends IEntry<_D_, F> {
Collection getSubDirectories(); Collection<_f_>]]> getFiles();
}

public interface IFile<_D_ extends IDirectory, F extends IFile>
extends IEntry<_D_, F> {
}


The compiler complains about the "Collection]]>
getSubDirectories();"-line in IDirectory:

type parameter D is not within its bound


Does somebody knows, how to fix it? Maybe I'm blind and don't see the
obvious. Thanks in advance.

Tom

6 comments

Tom, I really don't see compiler error in your code. Are you sure you use the fcs version?

Eugene.

0

Thanks for looking into this issue.

I really don't see compiler error in your code.


Same with me :)

Are you sure you use the fcs version?


"java -version" executed in the SDK's bin directory returns

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

I believe, this is the final version.

Tom

0

Hello, Thomas!
You wrote on Wed, 03 Nov 2004 21:50:22 +0100:

As for me, the compiler complains abaut "_F_" for collection :)
But, it so very strange, i'm can compile those three classes separately. If
i compile only IDerectory - all file, i got error only if i make entire
project.

I fix it by follow:

> extends IEntry<_d_ _f_> {
    Collection<_d_> getSubDirectories();
    Collection<_f_> getFiles();
}
]]>


Thanks!
--
Alexey Efimov, Java Developer
Tops-BI
http://www.topsbi.ru


0


Does the file have a package? I've seen some strange bug reports in generics
due to the classes being in the default package.

Just opening my big mouth, without having yet written a single line with
generics :)


0

Yes, I've tried it with a package statement. I just did not mention it
to make the example as short as possible.

Tom

0

Hello, Thomas!
You wrote on Wed, 03 Nov 2004 21:50:22 +0100:

Compilation result defferent on Pallada and Irida but in the save version of
JDK...
It seems to 'some precompiling processes in Irida'?

Thanks!
--
Alexey Efimov, Java Developer
Tops-BI
http://www.topsbi.ru


0

Please sign in to leave a comment.