Skip to content

Remove usage of Object throughout repository #47

@iFergal

Description

@iFergal

In too many places in the repository, Object is used in place of actual types. Having to inspect the type and then Cast the object is error prone and doesn't make for a very nice library. With actual specified types it would be easier to use and document.

#53 covers removing Object from an API calls. The scope of this ticket is to remove the unnecessary use of Object elsewhere.

Note: There are some places where Object has to be used, because we are genuinely dealing with an interface that accepts some JSON structure that isn't known ahead of time.

However, there are other cases where code was ported from TypeScript but not handled correctly - for example:

    private void _processThold(Object thold) {
        if (thold instanceof Integer) {
            _processUnweighted((Integer) thold);
        } else {
            List<List<Fraction>> weightedThold = (List<List<Fraction>>) thold;
            _processWeighted(weightedThold);
        }
    }

For this, we can just use overloaded functions.

private void _processThold(Integer thold);
private void _processThold(List<List<Fraction>>) thold);

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions