disable Cannot Resolve Method highlighting in intellij - java

I'm using IDEA 13.1.4, and I'm making some calls to aspectj-woven ITD methods that intellij doesn't recognize but that compile and run just fine. My only problem is that I hate red squiggly lines, and because I have quite a few classes making these calls, I'm being bombarded with them.
I certainly don't want to disable all highlighting, but I am comfortable disabling it for all unresolvable method calls. However, I've gone through the inspections menu and cannot find an option to disable this particular warning. Is it there and I'm just not finding it?

The quickest way is to type Alt + Enter on one of your unused methods. An option like Safe delete ... should appear. Expand this menu item with the right arrow and select Edit inspection profile setting. This should directly show the inspection rule, which you can disable. This should be either Unused declaration or Unused symbol. After clicking on the inspection options more options for enabling/disabling appear on the right side of the dialog.

Related

IDEA IntelliJ show message "Incompatible type" and can not fix error

I have tried to click on suggestion action of IDE but it didn't change any thing and error still there. There are same class and library. It's so confusing.
Is that a problem of IDE or can I turn off that error inspection?
This is the error message:
Required type: org.springframework.web.client.RestTemplate
Provided: org.springframework.web.client.RestTemplate
I clicked on Quick Fix but it didn't change any thing.
It's okay when I run or debug all projects. I just want to turn off that error of IDE, it always show error when I code
You should be able to disable specific inspections, as per Jetbrains Website.
The easiest way is probably this one:
Disable an inspection in the editor
Place the caret at the highlighted line and press Alt+Enter (or click the Intention action icon to use the intention action).
Click the arrow next to the inspection you want to disable, and select Disable inspection.
Alternatively, you can also suppress inspections:
When you suppress an inspection, the code analysis engine doesn't highlight the problem found by this inspection in the specific piece of code (class, method, field, or statement). You can also suppress all inspections in the current class.
After you suppress an inspection, IntelliJ IDEA adds a new element before the selected symbol.
For example in Java, if you suppress an inspection for a class, a method, or a field, the IDE adds the #SuppressWarnings annotation.
Suppress an inspection in the editor
Place the caret at the highlighted line and press Alt+Enter (or click the Intention action icon to use the intention action).
Click the arrow next to the inspection you want to suppress, and select the necessary suppress action.

Apply Intellij Code Improvement Suggestions

I'm using Intellij for Java development. In the code editor on the right, it displays some yellow markers which indicate issue with my code, e.g. improvement suggestions. When I hover over the affected code line it tell me what to do. Unfortunately I didn't find a way of automatically applying said suggestion. How do I do that? I don't want to do fixes by hand but rather allow Intellij to do them for convenience.
CTRL + Space is only code completion.
Just place the cursor over the highlighted code, hit Alt+Enter, select the suggested fix and hit Enter.
You can also apply the fix for all problems of the given type within specified scope (current file, project, ...). If you want to do that, just select Run inspection on from the menu that is shown.
I'm not sure if there is a way to apply these fixes automatically completely without user intervention, but even if there was, it probably wouldn't be very user friendly, as the warnings are sometimes false-positive.
If you want to apply a code suggestion it it simply Alt+Enter while the cursor is over the highlighted code. I would strongly suggest not automatically applying suggestions and to use your better judgement.
I can personally attest that while it's a little extra work, being able to choose the suggestions validity is much better. There's been more than a few times when the suggestion wouldn't make sense in the context.
As a sidenote I'd suggest having a reference for the KB shortcuts open so you can improve your speed within the IDE: Mac or Windows/Linux

Accept multiple IntellijIdea's inspection suggestions at the same time (all of the same type)

I made a mistake and I flipped expected and actual in my assert assertEqual.
Fortunately after importing project IntellijIdea detected problem and suggested flipping arguments.
Unfortunately this problem is repeated in multiple assertEquals.
Is it possible to accept multiple IntellijIdea's inspection suggestions at the same time? I found only way to accept it for a single instance of problem.
Press CTRL+SHIFT+A and select Run Inspection by Name (or hit CTRL+ALT+SHIFT+I), select the inspection you want to run, select the scope (current file, whole project ...) and hit Enter.
All candidates for the inspection you selected will be shown in a tool window. You can then select the ones you want to apply the inspection to, right click and choose what to do from the menu (for instance Delete if the inspection is unused declaration).

CheckStyle plugin for IDEA - java way of warnings presentation and automatic fixes?

Is it possible to make it present the list of warnings java/spellchecker style as opposed to a old school list of errors with line numbers?
Can it automatically fix things like missed space near '=' etc?
Maybe I need a different plugin, which one then?
Try QAPlug - Checkstyle plugin. Then go Analyze - Analyze Code (not the standard Analyze!) then click "..." near Run with chosen profile select a concrete profile and press the import button.
In the next dialog select the checkstyle rules file and then click the OK button. That's it. Just wait for the results. I got something like this.
That plugin has its limitations however. For example, I didn't manage to use a file with suppressions with it.
You can also use the plugin CheckStyle-IDEA which also has good configurations and allows you to use suppressions, custom checks and displays the inspection warnings in the editor immediately, but to apply that you need to set Project Settings - Inspections - CheckStyle - Real-Time Scan in the IDE settins.
Answering the second question, I didn't find any automatical reformat capabilities in these plugins, just checks.

Can't fold comments in Eclipse 3.5.2

Aren't i supposed to be able to do this? Folding is enabled in the Java preferences, but no +/- button appears next to comments. I can fold imports and classes and methods, but not comments. Also, checking the Comments box in "Initially fold these elements" does nothing.
It could be a side-effect of another option setting the code folding for a plugin you don't have.
See bug 153449 for an example (written at the time when Mylyn was called Mylar):
I can enable and disable folding, and I see my editor margin increase/decrease
in size providing a gutter for the code folding markers to appear in, but they
simply aren't there. Also, all of the menu options to expand all and collapse
all are there and enabled but they do nothing.
Actually, I just saw this in my exported preferences:
/instance/org.eclipse.jdt.ui/editor_folding_provider=org.eclipse.mylar.java.ui.editor.foldingprovider
And I don't have Mylar installed. I'm betting this is the problem. I'll try
to get rid of it and see what happens.

Categories

Resources