[Maintenance]: Clean up Token class

Open
#6,059 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
53/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
game-dev

Research direction

Locate the Token class and inspect the listed members and their usages before changing anything. Check how imageAssetMap is initialized and whether compatibility callers rely on the deprecated fields; the issue does not name tests, so find and run the relevant Token tests. Done means the unused members are removed, the image field preserves the null-key value, and existing behavior remains covered.

Written by the indexing model from the issue text.

Description

code-maintenance
Describe the problem

There's a bunch of unused (or slightly used) stuff in the Token class that could use some cleaning up.

The improvement you'd like to see

The following unused code is removed from the Token class:

  • #NAME_COMPARATOR
  • #hasMacros()
  • #toTransferData()
  • #getStatePropertyNames()

These fields that are ultimately unused are deprecated but retained to avoid backwards compatibility issues:

  • #lastX
  • #lastY
  • #currentImageAsset

These structural changes are be made:

  • #imageAssetMap is replaced with a simple field MD5Key image (only the null key was ever used). For backwards compatibility, initialize the new #image field with imageAsssetMap.get(null).

Finally, there are various bits of logic that could be replaced with simpler alternatives.

Expected Benefits

It will be easier to follow what is going on in the Token class, with the tiniest of performance improvements as well.

Additional Context

No response

Dominant language
Java
Stars
927
Forks
286
Avg merge
3d 17h
Merged PRs (30d)
94

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RPTools/maptool

All issues in RPTools/maptool

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.