[ nice-Bugs-986885 ] byte/int in List add
"SourceForge.net" <[email protected]> Wed, 14 Jul 2004 01:33:26 -0700
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #986885, was opened at 2004-07-07 23:11
Message generated for change (Comment added) made by bonniot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=986885&group_id=12788
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Isaac Gouy (igouy)
>Assigned to: Daniel Bonniot (bonniot)
Summary: byte/int in List add
Initial Comment:
class Shape {}
<T|T<:Shape> void addS(List<T> s){
s.add(0, new Shape());
}
I:\pls\Nice\Test>nicec --sourcepath .. -a t.jar Test
nice.lang: parsing
Test: parsing
Test: typechecking
I:\pls\Nice\Test\..\Test\Test.nice: line 4, column 6:
No possible call for add.
Arguments: (nice.lang.List<T>, nice.lang.byte, Test.Shape)
Possibilities:
nice.lang.void add(java.util.Calendar, nice.lang.int,
nice.lang.int)
<T> nice.lang.void add(nice.lang.List<T>, int, T)
Nice compiler version 0.9.8 (build 2004.07.02, 18:42:24
UTC)
----------------------------------------------------------------------
>Comment By: Daniel Bonniot (bonniot)
Date: 2004-07-14 10:33
Message:
Logged In: YES
user_id=88952
No, the compiler is correct. s is a list of T, where T can
be any subclass of Shape. Suppose there is a subclass
Rectangle of Shape. Then s might be a List<Rectangle>.
Therefore it is indeed invalid to try to add a Shape in s,
because a Shape is not a Rectangle.
Note that if there was no subclass of Shape, then this would
be valid, and indeed the compiler will accept the code if
you declare Shape as a final class.
What is the situation that motivated you to write this method?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=986885&group_id=12788
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com