-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
1.2.1, 1.3.1
-
None
-
Fix Understood
-
generic
-
generic
It would be nice if there was a mechanism to transform one Shape and
return another Shape of the same or a related class so that the
transformed Shape could maintain certain type-specific capabilities.
The Shape interface currently provides no such method and should not
be extended at this time to include one for two reasons. First, it
would break backwards compatibility with any objects that implement
the current version of the Shape interface. Second, it would be too
restrictive to expect all implementers of Shape objects to be able to
perform this operation. The built-in Ellipse2D is an example of an
object that cannot return a useful value from such a method because
it cannot represent a rotated version of itself.
The AffineTransform object can only return a generic Shape object if it
transforms a Shape since it cannot know the implementation details of
all possible objects that implement the Shape interface.
The easiest way to add this capability would be to create a new interface
that extends the current Shape interface and provides this capability as
an option for Shape objects which can easily perform this operation.
return another Shape of the same or a related class so that the
transformed Shape could maintain certain type-specific capabilities.
The Shape interface currently provides no such method and should not
be extended at this time to include one for two reasons. First, it
would break backwards compatibility with any objects that implement
the current version of the Shape interface. Second, it would be too
restrictive to expect all implementers of Shape objects to be able to
perform this operation. The built-in Ellipse2D is an example of an
object that cannot return a useful value from such a method because
it cannot represent a rotated version of itself.
The AffineTransform object can only return a generic Shape object if it
transforms a Shape since it cannot know the implementation details of
all possible objects that implement the Shape interface.
The easiest way to add this capability would be to create a new interface
that extends the current Shape interface and provides this capability as
an option for Shape objects which can easily perform this operation.
- duplicates
-
JDK-4429599 AffineTransform.createTransformedShape destroys type information
-
- Closed
-