Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Check generic signatures #163

Closed
jodastephen opened this issue Dec 11, 2012 · 14 comments
Closed

Check generic signatures #163

jodastephen opened this issue Dec 11, 2012 · 14 comments
Milestone

Comments

@jodastephen
Copy link
Member

Ensure that the generics used are correct. This is specifically focussed on extends/super.

For example, the Chrono static comparators should perhaps use extends.

@jodastephen
Copy link
Member Author

I've examined the generics on the temporal classes twice now. It isn't possible to enhance their generics without making a terrible mess. Because Java doesn't have the Self-type generic, or the notional of parameter self-type generic where the class is final, and because LocalDate extends ChronoLocalDate, it is more or less impossible to go further than we have. This is unfortunate, but there you go.

The call remains open to check ? extends and ? super.

@jodastephen
Copy link
Member Author

TemporalUnit <R extends Temporal> long between(R dateTime1, R dateTime2); has no effect on callers. It doesn't do what I'd like it to do. Needs to be ungenerified.

@RogerRiggs
Copy link
Contributor

It should insist that the parameters are of the same/compatible types.
What is it not doing?

@jodastephen
Copy link
Member Author

This compiles, rather than being a compile error:

 Instant i = ...
 ZonedDateTime z = ...
 between(i, z)

@RichardWarburton
Copy link
Contributor

It only insists that they have a common supertype that subclasses temporal
I think.

@RogerRiggs
Copy link
Contributor

It makes sense to remove the generics, they are more useful in the case where the return type is related to the parameters.

@RogerRiggs
Copy link
Contributor

The generics should be removed from Chronology.getAvailableChronologies(). The raw types are just as useful.

@jodastephen
Copy link
Member Author

I don't think we should have raw types in API signatures. I would have thought there was a JDK/Oracle policy against it.

@ijuma
Copy link

ijuma commented Feb 3, 2013

It would be very odd for a brand new API to have raw types in API signatures in my opinion.

@RichardWarburton
Copy link
Contributor

Quite a few people compile with warnings switched on for raw types, this
would generate a lot of warnings for me. Perhaps a simple ? wildcard would
be a better solution if you're leaving generics in.

@jodastephen
Copy link
Member Author

Remove some pointless generics - http://hg.openjdk.java.net/threeten/threeten/jdk/rev/e5a10d4e6149

@jodastephen
Copy link
Member Author

Chronology returns raw types for ChronoLocalDate which needs fixing.

@RogerRiggs
Copy link
Contributor

@RogerRiggs
Copy link
Contributor

Nothing more to do on this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants