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

classes that inherit abstract classes w/ annotations always report validate() == false #912

Open
TwoClocks opened this issue Mar 29, 2022 · 1 comment

Comments

@TwoClocks
Copy link

In this case, all the annotations are on functions, but I want to generate one extension function per class that contains a function with an annotation. Ideally, the extension includes all the annotations for any implemented abstract classes.

A simple example:

abstract class Child {
  @MyAnno
  fun one() {...}
 ... other stuff ...
}

class Adult : Child {
  @MyAnno
  fun two() {...}
 ... other stuff ...
}

so for each annotation, I find out what class it's in via .parent. Then for each unique parent I generate my extension function by calling .getAllFunctions() and filtering by the @MyAnno annotation.

Two things I see that seem odd to me.
1 - .validate() on the Adult class always returns False. Even if I push it to the next round.
2 - When I iterate over the functions, the ones from the super class (fun one() in this case) always have parent and containingFile set to null

Is this expected? Am I using the library correctly?

@micheljung
Copy link

micheljung commented Sep 19, 2023

I have a similar issue:

@Mapper
interface PersonToPersonDtoMapper : Converter<Person, PersonDto>

This inherits the method Converter.convert(). While the function's parent is set to PersonToPersonDtoMapper, node.parent.containingFile unexpectedly returns null and node.parent.location is a NonExistLocation.

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

No branches or pull requests

2 participants