Skip to content

Refactor addAnnotation method for AnnotationTarget=Field #2339

Open
@EgorkaKulikov

Description

@EgorkaKulikov

Description

Currently the discussed method looks as follows:

private fun addAnnotation(annotation: CgAnnotation) {
        when (annotation.target) {
            AnnotationTarget.Method -> collectedMethodAnnotations.add(annotation)
            AnnotationTarget.Class -> currentTestClassContext.collectedTestClassAnnotations.add(annotation)
            // TODO: possibly introduce some scope cache like in methods and constructions processing.
            // It may allow to avoid return type in CgAnnotation method.
            AnnotationTarget.Field -> { }
        }

        importIfNeeded(annotation.classId)
    }

The mentioned TODO need to be fixed.
After that, it will be possible to make addAnnotation method return void that is better from the point of view of design.

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorcomp-springIssue is related to Spring projects supportctg-refactoringIssue related to refactoring process

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions