Reputation: 2235
IntelliJ Idea: 2016.1 Windows 10 Pro
When I create a new project or a new class in a new project, IntelliJ helpfully includes a default header containing my name and the date. However, it also highlights the code and displays a warning about the file using a "Default File Template". It suggests two ways to correct the code. Either by editing the template or by replacing it with an actual file template. However, neither option satisfies the warning; nor does manually replacing the contents of the header. I can't figure out a way to get rid of it.
I know that I can suppress the warning, but I would prefer to actually correct or fix it.
Any ideas?
Upvotes: 23
Views: 10171
Reputation: 806
Add -Djdk.util.zip.ensureTrailingSlash=false
in Help | Edit Custom VM Options.
Upvotes: -1
Reputation: 25261
Change the default template anyway you want and then the error is gone!
Upvotes: 7
Reputation: 5297
Press Alt+Enter inside the comment and after that use rightwards-arrow on your keyboard to get a submenu where you can disable the lint check.
Upvotes: 0
Reputation: 31
Go to Settings -> File and Code Templates -> includes
Update the comment to add an extra line like below..This stays even after formatting the code.
/**
* Created by ${USER}
* on ${DATE}.
*/
Upvotes: 3
Reputation: 1416
Just add a new line after Default Template statement which has name and date.
Intellij considers that new line as part of documentation, and then stops complaining.
Update
Like this:
/**
* Created by YourName on 2017/06/11.
* THIS LINE
*/
Upvotes: 17
Reputation: 6471
The point of it is to remind you to document your code by adding a description of the class. No matter what you set the template to, if you don't change the text that is in the template, it assumes you want a reminder to override it with some useful information. If you are not in the habit of adorning your code with informative comments, then you can disable that particular check.
To disable the check, where you see the comment block highlighted as a warning, click in that shaded area, wait for the "light bulb" intention icon to appear near the left margin, then, when it pops up a box that says "Edit template...", instead of clicking on the words, click on the little arrow to the right of the words, and select "Disable inspection".
Upvotes: 39