Giter Site home page Giter Site logo

Improve overall type safety about nbt HOT 2 CLOSED

querz avatar querz commented on June 12, 2024
Improve overall type safety

from nbt.

Comments (2)

Marcono1234 avatar Marcono1234 commented on June 12, 2024

Currently a deserialized list (empty or not) can be cast to any typed list due to only the typeID being set. It would probably be good to add lookup functionality to TagFactory. This way the respective class could be retrieved for the typeID.

Additionally it would allow setting the typeID based on the class when the list is constructed and not having to wait for the first element. At this point it might even be worth it removing the typeID field completely and only retrieving it from the TagFactory when needed, performing all type checks only with the type class.

from nbt.

Querz avatar Querz commented on June 12, 2024

The typeID has been removed and the ListTag's type is only defined by a type class now.
TagFactory now has additional lookup functionality to get type ids from classes, classes from type ids and factory functions to create new instances of Tags from type ids.

All the new changes are available in release 3.0.

from nbt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.