Single Inspection Missing "Fix all xyz problems" Option

已回答

In older versions of Intellij, I had the option to fix all inspection problems for a particular type within a file, but I don't see that option in 2016.3.4.  Was it removed or am I missing something?  To clarify in older versions:

  • Place cursor on highlighted band of code which was identified as problematic by the Automatic Inspections
  • Click Alt+Enter
  • Right Arrow to get to sub-context menu
  • Select "Fix all xyz problems"

So if I had 10 fields in a class, and the inspections are telling me that they should be defined as private instead of public.  I could fix all 10 problems with a single operation.  Now I have to fix each problem individually.

0
Avatar
Permanently deleted user

Thanks Serge!

0

This feature is missing again in the 2018 series.

0

@Mkalinovits, please follow the code:

class Foo {
public int val1;

public int val2;

public int val3;

public Foo (final int val1, final int val2, final int val3) {
this.val1 = val1;
this.val2 = val2;
this.val3 = val3;
}
}

Fix all quick-fix fixes all `Declaration access can be weaker` cases in the sample (IDEA 2018.3.5). Please share the IDEA version and the code sample where the fix doesn't work correct. Thank you

 

0

Thanks for the quick response.

Fix all is working on your sample code, however it is not so intuitive to nest the fix all option under "fix".

But:

The below code has unnecessary "throws Exception" parts what can be fixed only one by one.
In previous versions (2017.x.x) it just worked.

Version: 2018.3.4 (same in 2018.3.5)
OS: MacOS 10.14.3

public class CustomFieldHeaderParserTest {

private CustomFieldHeaderParser parser = new CustomFieldHeaderParser();

@Test(expected=IllegalArgumentException.class)
public void testParseMultipleTypes() throws Exception {
parser.parse("Temperature {number} {date}", "A1");
}

@Test(expected=IllegalArgumentException.class)
public void testParseNoType() throws Exception {
parser.parse("Temperature", "A1");
}
}
0

请先登录再写评论。