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

Bug #190 Enum with abstract method #191

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

robert-bor
Copy link
Contributor

Since a later version of Java, when you call getCanonicalName on an enum with abstract methods, it will return a null value. This messes up several routines in BeanMapper.

The method to get the canonical name has been abstracted into a utility class that can deal with the null value by calling a fallback function that looks up the canonical name of the superclass. This solves the problem at hand.

All methods that directly call getCanonicalName now call the utility class instead.

Copy link

codecov bot commented Nov 9, 2023

Codecov Report

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

Project coverage is 87.76%. Comparing base (806b09d) to head (eaa8105).

Files Patch % Lines
...n/java/io/beanmapper/utils/CanonicalClassName.java 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #191      +/-   ##
============================================
+ Coverage     87.73%   87.76%   +0.03%     
- Complexity      992      995       +3     
============================================
  Files           108      109       +1     
  Lines          2193     2199       +6     
  Branches        249      248       -1     
============================================
+ Hits           1924     1930       +6     
- Misses          175      176       +1     
+ Partials         94       93       -1     

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

@robert-bor robert-bor force-pushed the bug-190-enum-with-abstract-method branch from 081d86b to a946cc5 Compare November 9, 2023 20:07
Copy link
Contributor

@marcus-talbot42 marcus-talbot42 left a comment

Choose a reason for hiding this comment

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

Just some formatting issues, looks good otherwise.

@marcus-talbot42 marcus-talbot42 force-pushed the bug-190-enum-with-abstract-method branch from 6ec567a to 3f0fc44 Compare March 27, 2024 08:22
Since a later version of Java, when you call getCanonicalName on
an enum with abstract methods, it will return a null value. This
messes up several routines in BeanMapper.

The method to get the canonical name has been abstracted into a
utility class that can deal with the null value by calling a
fallback function that looks up the canonical name of the superclass.
This solves the problem at hand.

All methods that directly call getCanonicalName now call the utility
class instead.
@marcus-talbot42 marcus-talbot42 force-pushed the bug-190-enum-with-abstract-method branch from 3f0fc44 to eaa8105 Compare March 27, 2024 08:25
@marcus-talbot42 marcus-talbot42 merged commit 66672e2 into master Mar 27, 2024
3 of 4 checks passed
@marcus-talbot42 marcus-talbot42 deleted the bug-190-enum-with-abstract-method branch March 27, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants