Hardcoded file separator
Reports the forward (/
) or backward (\
) slash in a string or character literal. These characters are commonly used as file separators, and portability may suffer if they are hardcoded.
The inspection will not report backward slashes inside escape sequences and forward slashes immediately following the '<' character or immediately preceding the '>' character, as those often indicate XML or HTML tags rather than file names. Strings representing a java.util.TimeZone
ID, strings that are valid regular expressions, or strings that equal IANA-registered MIME media types will not be reported either.
Example:
Use the option to include example/*
in the set of recognized media types. Normally, usage of the example/*
MIME media type outside of an example (e.g. in a Content-Type
header) is an error.
Inspection options
Option | Type | Default |
---|---|---|
Include 'example/*' in recognized MIME media types | Checkbox | false |
Ignore arguments for the following methods | Table | None |
Class Name | TableColumn | [java.lang.Class, java.lang.ClassLoader] |
Method Name Regex | TableColumn | [getResource|getResourceAsStream, findResource|getResource|getResources|resources|getSystemResource|getSystemResources|getSystemResourceAsStream] |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |