Possible mistakes in com.sun.javafx.geom.AreaOp

Nir Lisker nlisker at gmail.com
Fri Nov 29 23:12:44 UTC 2024


I came across a potential mistake in the class com.sun.javafx.geom.AreaOp.
It uses raw Vector types and while trying to add generic parameters there
for type safety, I got some conflicts.

In the method AreaOp::calculate, the arguments should be Vector<Curve> and
the return type should also be Vector<Curve>, but it returns a Vector
called 'edges'. 'edges' is passed to the 'addEdges' method that should
take Vector<Edge> and Vector<Curve>. This means that 'edges' is a
Vector<Edge> and not Vector<Curve>. Already a conflict.
Then it is passed to 'pruneEdges', which, if it takes and returns
Vector<Edge>, runs into a conflict with the return type: 'Vector ret' has
Curve added to it. If I try to return Vector<Curve> instead, then in the
'numedges < 2' check the input Vector can't be returned unless it's also
Vector<Curve>, which again causes a conflict in 'calculate'.

There are also 'toArray' calls that seem to not do anything, like in
'resolveLinks' (line 454) and in 'finalizeSubCurves' (429).

Can anyone who knows this part of the code take a look?

- Nir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20241130/ffbf8e89/attachment.htm>


More information about the openjfx-dev mailing list