Skip to content

Change the way the properties are collected using the Class.getMethod…#3135

Closed
amodolo wants to merge 2 commits intoassertj:mainfrom
amodolo:fix/3125_comparing_properties_include_interfaces
Closed

Change the way the properties are collected using the Class.getMethod…#3135
amodolo wants to merge 2 commits intoassertj:mainfrom
amodolo:fix/3125_comparing_properties_include_interfaces

Conversation

@amodolo
Copy link
Contributor

@amodolo amodolo commented Aug 1, 2023

I change the way the properties are collected using the Class.getMethods() api instead iterating the class hierarchy using Class.declaredMethods(). I think that collect the properties using the getMethods api should be a better approach because:

  • it returns all public methods considering both super classes and interfaces
  • there's no need to filter public methods
  • there's no need to iterate through the class hierarchy

Moreover, in this way the properties declared in the interfaces will not be ignored.

Check List:

@scordio scordio added the theme: recursive comparison An issue related to the recursive comparison label Aug 1, 2023
@amodolo amodolo force-pushed the fix/3125_comparing_properties_include_interfaces branch 3 times, most recently from d5855d3 to b65a925 Compare August 2, 2023 20:36
@joel-costigliola joel-costigliola self-requested a review August 2, 2023 21:20
@joel-costigliola
Copy link
Member

Thanks @amodolo, I will do my best to review your PR this weekend !

@joel-costigliola joel-costigliola added this to the 3.25.0 milestone Aug 2, 2023
amodolo added 2 commits August 3, 2023 09:13
…s() api instead iterating the class hierarchy using Class.declaredMethods(). This way the properties declared in the interfaces will not be ignored.
@amodolo amodolo force-pushed the fix/3125_comparing_properties_include_interfaces branch from 4ba926c to edfad62 Compare August 3, 2023 07:13
@joel-costigliola
Copy link
Member

Integrated thanks @amodolo!

@amodolo amodolo deleted the fix/3125_comparing_properties_include_interfaces branch August 7, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme: recursive comparison An issue related to the recursive comparison

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recursion comparison using properties ignores default interface methods.

3 participants