Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument exceptions2 #476

Draft
wants to merge 28 commits into
base: dev/dev
Choose a base branch
from
Draft

Argument exceptions2 #476

wants to merge 28 commits into from

Commits on Aug 17, 2023

  1. Remake argument-exceptions branch

    Add API to use custom error handling when Argument parsing fails
    
    See #370 for the basis of these changes
    
    New changes here:
    
    - Arguments can only have an ArgumentParseExceptionHandler attached if they implement ArgumentParseExceptionArgument
    - The substitute value from ArgumentParseExceptionHandler doesn't have to be returned directly
    - ExceptionInformation can be provided by arguments
    - New NMS method to extract translation keys from CommandSyntaxExceptions
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    da16444 View commit details
    Browse the repository at this point in the history
  2. Create InitialParseExceptionParser because TriFunction was being weird

    I'm not really sure why this build failed (https://github.com/JorelAli/CommandAPI/actions/runs/5707823776/job/15468200688), but it is definitely TriFunctions fault >:)
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    bb78f3e View commit details
    Browse the repository at this point in the history
  3. Fix implementation of NMS_Common#extractTranslationKey for pre 1.19

    Also, some tweaks to the annotations on implementations for NMS#registerCustomArgumentType
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    10cd400 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    17543b6 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7191cd9 View commit details
    Browse the repository at this point in the history
  6. Address some SonarCloud code smells on argument-exceptions2

    Remove obsolete unused type parameter T from InitialParseExceptionParser
    
    Change test classes to default package visibility
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    a1bf7b2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e6d987b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ba7c67e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    05d01f3 View commit details
    Browse the repository at this point in the history
  10. Fix InitialParseExceptionHandlingArgumentType accidentally being na…

    …med `Internal`ParseExceptionHandlingArgumentType
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    a426196 View commit details
    Browse the repository at this point in the history
  11. Create InitialParseExceptionNumberArgument to share ExceptionInformat…

    …ion logic among Arguments that return numbers
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    c1ff4d3 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    11a24b8 View commit details
    Browse the repository at this point in the history
  13. Move parse exception related classes in `dev.jorel.commandapi.argumen…

    …ts` to `dev.jorel.commandapi.arguments.parseexceptions`
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    62587ec View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    1974b30 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e2b8e99 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    149d4d7 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0fac123 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e3f65d3 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    5861f00 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    ae0fac4 View commit details
    Browse the repository at this point in the history
  21. Fix javadocs in InitialParseExceptionNumberArgument that refer to `in…

    …t` rather than `number`
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    5a1a16e View commit details
    Browse the repository at this point in the history
  22. Add tests for InitialParseExceptionNumberArguments usage

    Split each Argument in ArgumentPrimitiveTests into their own classes (Boolean, Double, Float, Integer, Long)
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    c41f567 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    d18e3d4 View commit details
    Browse the repository at this point in the history
  24. Add InitialParseExceptionContextVerifier and `ArgumentParseExceptio…

    …nContextVerifier` so that ArgumentTests classes can test both types of exceptions
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    f9ff517 View commit details
    Browse the repository at this point in the history
  25. Add assertCorrectContext method to ArgumentParseExceptionContextVer…

    …ifier and InitialParseExceptionContextVerifier to handle shared checking logic on InitialParseExceptionContext and ArgumentParseExceptionContext objects
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    412a0ef View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    f7cc6d8 View commit details
    Browse the repository at this point in the history
  27. Add initialParseExceptionTestWithListTextArgument

    Also some test javadocs tweaks
    willkroboth committed Aug 17, 2023
    Configuration menu
    Copy the full SHA
    3c72dde View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2023

  1. Change exceptionHandlers maps to WeakHashMaps

    I couldn't get the maps to clear while tests were running, but I tried this on a real server and it seemed to work. Commands do need to keep reference their arguments for the parsing step, but if a command is unregistered, its arguments will be removed from the `exceptionHandlers` maps automatically.
    willkroboth committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    8d40f57 View commit details
    Browse the repository at this point in the history