Usually leading asterisks of a javadoc are aligned so the common indent for the lines in a snippet's body is obvious,
but nevertheless javadoc can have multiple leading asterisks, and they don't have to be aligned.
This patch fixes the indent stripping: if the indent is too short, which will result in leaving some leading
asterisks after stripping the indent from the line, the indent gets increased, so it goes after the last leading asterisk in the line.
GitOrigin-RevId: c79bcb3e25b96b5b1ff52da350f926673d155199
1. analyze all calls in method in one go
2. use UncheckedIOException instead of RuntimeException when wrapping into try catch
3. info level when try catch needed + no report in batch mode
4. updated description
GitOrigin-RevId: 0a2542b851fa32c5fde98725985f55079447b02b
1. report for arbitrary expressions that expect OutputStream / InputStream
2. report for arbitrary file creation arguments
3. check recursively if file creation argument is effectively final
4. reuse effectively final path variables if possible
5. use Paths.get() instead of Path.of() since 'of' method appeared only in java 11
6. info level for java 10 and higher
GitOrigin-RevId: 0a778328fe938faa0fe7eb2f199064f90b7a6d1b
Inspection reports multiple java.io.File attribute calls in a row. Attribute calls:
- lastModified
- isFile
- isDirectory
- length
It suggests replacing them with a single attributes extraction using java.nio.file.Files.readAttributes method
GitOrigin-RevId: cd2f93645aab9a4cba2e1f87e05b431f0d21ee50
Inspection suggests conversions:
1. FileInputStream -> Files.newInputStream
2. FileOutputStream -> Files.newOutputStream
in cases when FileInputStream can be replaced with InputStream.
Also, it reuses path variable after conversion when possible (path variable should be effectively final).
GitOrigin-RevId: 474dcaeeb5336fcc8330b4b3ed65d443042ecf2f
Implement updating the content of a snippet tag with the help from a method implementer. A snippet might invoke overriding a method though a completion and when a parent method is inserted it might contain javadoc. In this case it's impossible to recreate a snippet tag because the new text for the tag contains "/**" and "*/" that come from the parent method's javadoc. The implemented method implementer helps to strip a method's javadoc if it's present.
Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>
GitOrigin-RevId: 42b315ed2670701e50574a383f0442df69accd35
Fix injection for empty snippets. The range to inject is now starts after the colon and ends when the body ends. If no colon exist, then use the whole body as an injection point.
GitOrigin-RevId: c7961f13c30212f52aad45a121bcf11b70ce8f2b
Add an enclosing class for snippets in order not to make users define a class in a snippet code to eliminate syntax errors when the code consists of a set of instructions
GitOrigin-RevId: c6f52f94d51fdc6393c8a9fdc0ddb615e8d37b17
`throw e` won't fix the compilation error, comment - is not really better than empty catch block.
GitOrigin-RevId: ea002c332900b032392e766f3dd13fe3258ad49c
JEP-413 says that by default a snippet tag's body is in JAVA language, so JavadocInjector injects JAVA into a snippet tag automatically. The injector relies on the lang attribute to inject a language, if the attribute is not present, then JAVA is used.
In order to make a user's live easier the injector doesn't make user guess the correct language name, instead if the injector didn't find a language by the value from the `lang` attribute it traverses throughout all the registered languages and looks for the one the name of which matches the specified ignoring case. That is the case for java: in our code base the language goes by the `JAVA` id, but users tend to write the language name in lowercase ("java") or with only the first letter in the capital case ("Java")
Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>
GitOrigin-RevId: cca8c90bb5ad04485f1bf4119b9936114e5492e4