sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Desruisseaux (JIRA)" <>
Subject [jira] [Closed] (SIS-296) Consider defining Angle as a subclass of java.lang.Number
Date Tue, 02 May 2017 15:05:04 GMT


Martin Desruisseaux closed SIS-296.
    Resolution: Won't Fix

{{Angle}} extends {{Object}} since SIS 0.3; changing that would be a risk of breaking existing
code. Furthermore a search shows that extending {{Number}} would save only one {{instanceof}}
check in the whole SIS 0.8 code base. The cost would be to "pollute" {{Angle}} API with new
methods like {{doubleValue()}}, {{intValue()}}, _etc._ where the unit (degrees or radians)
is not obvious from the method signature. The units could still be specified in the javadoc,
but developers seeing the angle only as a {{Number}} would not see that unit of measurement.

> Consider defining Angle as a subclass of java.lang.Number
> ---------------------------------------------------------
>                 Key: SIS-296
>                 URL:
>             Project: Spatial Information Systems
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 0.6, 0.7
>            Reporter: Martin Desruisseaux
>            Assignee: Martin Desruisseaux
>            Priority: Minor
>             Fix For: 0.8
>         Attachments: Angle.patch
> {{org.apache.sis.measure.Angle}} was intentionally defined as *not* extending {{java.lang.Number}}.
In a previous library this was causing confusion. But a few tests suggest that this is not
causing confusion anymore with Apache SIS design. Considering {{Angle}} as a kind of {{Number}}
may help to reduce the amount of {{instanceof}} checks in code that are only interested in
the numerical value.

This message was sent by Atlassian JIRA

View raw message