Back to Intellij Community

PathAnnotationInspection

plugins/devkit/devkit-core/resources/inspectionDescriptions/PathAnnotationInspection.html

2025.3-rc-21.1 KB
Original Source

Reports incorrect usage of path annotations.

This inspection detects cases where a string annotated with one path annotation is used in a context that expects a string with a different path annotation. It helps ensure proper usage of @MultiRoutingFileSystemPath and @NativePath annotations.

The inspection highlights the following issues:

  • When a string annotated with @NativePath is used in a Path constructor or factory method
  • When a string annotated with @NativePath is passed to a method parameter annotated with @MultiRoutingFileSystemPath
  • When a string annotated with @MultiRoutingFileSystemPath is passed to a method parameter annotated with @NativePath
  • When a string literal is used in a context that expects either annotation

Quick fixes are provided to add the appropriate annotation where needed.

This inspection helps prevent runtime errors that can occur when paths with different formats are used incorrectly. The @MultiRoutingFileSystemPath annotation is used for paths that should work across different file systems, while the @NativePath annotation is used for paths that are specific to the native file system.