Files
openide/java/java-tests/testData/codeInsight/overrideImplement
Marcin Mikosikandintellij-monorepo-bot 6092fd6604 IDEA-389407 [java]: Fix Duplicate @NotNull generated by implement-method intention
Bug root cause explanation:
When implement-method intention generates parameter copy for generated method then internally `com.intellij.psi.impl.PsiElementFactoryImpl#createParameter(...)` is used which generates all symbols with fully qualified names, so the copy is slightly different from original. Below two examples:
`@NotNull Integer` -> `java.lang.@org.jetbrains.annotations.NotNull Integer`
`@NotNull Map.Entry` -> `java.util.@org.jetbrains.annotations.NotNull Map.Entry`
when `com.intellij.codeInsight.generation.OverrideImplementsAnnotationsHandler#repeatAnnotationsFromSource` detect cases when some annotation is present on source but not on target by using `AnnotationUtil.isAnnotated`. When run for above 4 types it returns true for all of them except the fourth (`java.util.@org.jetbrains.annotations.NotNull Map.Entry`) as `@NotNull` is neither before the whole expression nor before the last part (`Entry`).

Merge-request: IJ-MR-204762
Merged-by: Marcin Mikosik <marcin.mikosik@jetbrains.com>

GitOrigin-RevId: 89804ff61806bbb3e312320e86966913c3e2d1b9
2026-05-21 16:22:45 +00:00
..