Skip to content

Commit

Permalink
Update task.md
Browse files Browse the repository at this point in the history
language checked
  • Loading branch information
stephen-hero authored May 28, 2024
1 parent a791882 commit 59fc277
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ They are a form of syntactic metadata that can be added to the code but do not d

The `@Deprecated` annotation marks a program element as deprecated, indicating that the element should no longer be used.

**Task**
**Task**:
Implement the function
```kotlin
fun addDeprecatedAnnotations(psiFile: PsiFile)
```

This function should iterate over all Kotlin functions (`KtFunction`) in the given PSI file.
For each function that does not already have a `@Deprecated` annotation, you will add one with a message indicating that the method is deprecated.
For each function that lacks a `@Deprecated` annotation, one should be added, accompanied by a message that signifies the method's deprecation.

<div class="hint" title="How to find all function declarations">

Expand All @@ -19,11 +19,11 @@ Use `PsiTreeUtil.findChildrenOfType` to find all Kotlin function declarations (`

<div class="hint" title="Creating annotations">

Use `KtPsiFactory` to create a new annotation entry. Look into how to instantiate KtPsiFactory and use it to create annotations.
Use `KtPsiFactory` to create a new annotation entry. Learn how to instantiate `KtPsiFactory` and use it to create annotations.
</div>

<div class="hint" title="Checking for existing annotations">

Implement a helper method to check if a `KtFunction` already has a `@Deprecated` annotation.
You might find KtFunction’s `annotationEntries` property useful for this.
</div>
The `annotationEntries` property of 'KtFunction' might be useful for this.
</div>

0 comments on commit 59fc277

Please sign in to comment.