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

Add check for overriding event annotations #90

Merged
merged 28 commits into from
May 8, 2024

Conversation

LeStegii
Copy link
Collaborator

@LeStegii LeStegii commented May 6, 2024

If a method is annotated with an event annotation such as @OnInit and is overriding a method from a super class which is also annotated with an event annotation, the method in the class will be called twice due to how java handles overwriting methods.

Therefore, overriding an event method shouldn't be allowed and will result in the following error:
Method 'method()' annotated with an event annotation in class 'de.uniks.ludo.controller.SetupController' overrides event method in class 'de.uniks.ludo.controller.BaseController'. [FFX1013]

  • Check method overrides in reflection sidecar
  • Check method overrides in processor sidecar

This PR refactors the processing classes by adding a helper class which doesn't contain framework specific code but methods for streaming different elements

Fixes #86

@LeStegii LeStegii changed the title Fix/override annotations Add check for overriding event annotations May 6, 2024
@LeStegii
Copy link
Collaborator Author

LeStegii commented May 7, 2024

Everything should now work as expected. However, when there is a chain of inheriented classes like Parent.class -> Sub.class -> SubSub.class which override each others methods, some error messages can be duplicated.

While this doesn't affect the process itself, it could be harder to read the error in certain conditions.
For SubSub.class, this happens because the method not only overrides the method of its direct parent, but also the parent's parent.

grafik

@LeStegii LeStegii requested a review from Clashsoft May 7, 2024 14:21
@LeStegii LeStegii requested a review from Clashsoft May 7, 2024 17:57
@LeStegii LeStegii requested a review from Clashsoft May 8, 2024 13:05
@Clashsoft Clashsoft merged commit 4a76a95 into master May 8, 2024
5 checks passed
@Clashsoft Clashsoft deleted the fix/override-annotations branch May 8, 2024 16:41
@Clashsoft Clashsoft self-assigned this May 14, 2024
@Clashsoft Clashsoft added the enhancement New feature or request label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overriden annotated methods result in unexpected behaviour
2 participants