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

Bean and error message improvements #485

Merged
merged 24 commits into from
Mar 29, 2024
Merged

Conversation

MateuszKubuszok
Copy link
Member

@MateuszKubuszok MateuszKubuszok commented Mar 25, 2024

The goal of this PR is housekeeping things related to error messages:

  • better suggestions for cases requiring .enableMethodAccessors
  • better suggestions for cases requiring .enableInhertedAccessors
  • providing errors informing about field name or subtype match ambiguity
  • removing some cases of name conflict by considering only setName(..): Unit as setters and allowing e.g. setName(...): this.type setters as opt-in

TODO:

  • improve error messages:
    • better ambiguous error messages
    • better error messages suggesting bean getters/setters
    • better error messages suggesting accessors
    • error messages suggesting inherited methods
  • create ambiguous field names error message
    • there should be NO ambiguity if user provided explicit matching via override that came out so difficult do do it right and it generated so many weird cases that for now I decided to now deal with it at all - any ambiguity -> error or custom name comparator
    • that includes withFieldRenamed this came out to be impossible, so instead w provided a better error message
  • create flag enableNonUnitSetters
    • create flag and its parser
    • create config entry for flag
    • read and store Setter returned type
    • use flag and returned type to steer the logic
  • tests:
    • test error messages for var name + setter name ambiguity in target (?)
      • fix behavior mismatch between Scala 2 and 3 - vars in constructor Scala 2 code treates as accessors and Scala 3 as constructor vals, now both are treating them as constructor vals when it comes to extracting values
    • test error messages for fields which are ambiguous after providing custom comparators
    • test non-unit setters
    • test error messages for subtype names which are ambiguous after providing custom comparators
    • test error messages for Java enums names which are ambiguous after providing custom
      • fix behavior mismatch between Scala 2 and 3 - Java enums values in Scala 2 has all the same type so they generated the same fresh term names from their type
  • mkdocs
    • non-unit setters
    • fields ambiguity resolution
    • subtype ambiguity resolution
    • breaking changes in setter resolution
    • update failed derivation messages in docs
  • scaladocs

@MateuszKubuszok MateuszKubuszok added this to the 1.0.0-RC milestone Mar 25, 2024
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 96.33028% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 91.84%. Comparing base (1dc69eb) to head (a702482).

Files Patch % Lines
...er/rules/TransformProductToProductRuleModule.scala 91.48% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #485      +/-   ##
==========================================
+ Coverage   90.02%   91.84%   +1.81%     
==========================================
  Files         125      100      -25     
  Lines        4663     2354    -2309     
  Branches      393      228     -165     
==========================================
- Hits         4198     2162    -2036     
+ Misses        465      192     -273     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MateuszKubuszok MateuszKubuszok linked an issue Mar 29, 2024 that may be closed by this pull request
7 tasks
@MateuszKubuszok MateuszKubuszok marked this pull request as ready for review March 29, 2024 21:25
@MateuszKubuszok MateuszKubuszok merged commit 3bb4126 into master Mar 29, 2024
23 checks passed
@MateuszKubuszok MateuszKubuszok deleted the bean-support-improvements branch March 29, 2024 21:36
@MateuszKubuszok MateuszKubuszok added the breaking change Change resulting in compilation errors of code that used to be considered correct, or linking errors label Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Change resulting in compilation errors of code that used to be considered correct, or linking errors
Projects
None yet
1 participant