UTBotJava icon indicating copy to clipboard operation
UTBotJava copied to clipboard

Refactor addAnnotation method for AnnotationTarget=Field

Open EgorkaKulikov opened this issue 3 years ago • 0 comments

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.

EgorkaKulikov avatar Jun 29 '23 11:06 EgorkaKulikov