Skip to content

Add unchecked warnings failures for src#311

Merged
jimmyjames merged 2 commits intomasterfrom
unchecked-warnings
Nov 2, 2020
Merged

Add unchecked warnings failures for src#311
jimmyjames merged 2 commits intomasterfrom
unchecked-warnings

Conversation

@jimmyjames
Copy link
Copy Markdown
Contributor

@jimmyjames jimmyjames commented Oct 29, 2020

Changes

This is primarily a tech debt and future preparedness PR

APIException currently performs an unsafe (in compiler terms) cast of the error description to a Map<String, Object>. Functionally, this shouldn't be an issue since a ClassCastException would only come from a change in the error schema, which shouldn't happen.

However, it does cause an unchecked cast warning, which we should typically not have or suppress as needed. This change does the following:

  • Updates APIException to only create a PasswordStrengthErrorParser if the error description is a map (currently it would fail with a runtime exception if not a string)
  • Suppresses the unchecked exception when casting the error description to Map<String, Object>
  • Adds tests to cover this change and the obtainExceptionMessage behavior in general
  • Moves the compiler options to compileJava and compileTestJava
  • Adds the -Xlint:unchecked compiler flag for src (not for tests)

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

  • This change adds test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@jimmyjames jimmyjames added this to the v1-Next milestone Oct 29, 2020
@jimmyjames jimmyjames requested a review from a team as a code owner October 29, 2020 00:01
Copy link
Copy Markdown
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two small comments

@jimmyjames jimmyjames requested a review from lbalmaceda October 30, 2020 18:29
@jimmyjames jimmyjames merged commit 2fa6fbb into master Nov 2, 2020
@jimmyjames jimmyjames modified the milestones: v1-Next, 1.24.0 Nov 2, 2020
@jimmyjames jimmyjames mentioned this pull request Nov 2, 2020
3 tasks
@evansims evansims deleted the unchecked-warnings branch July 5, 2022 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants