Skip to content

Commit 5737c5e

Browse files
committed
fixed some inspection warnings (made more things final, reduced visibility, removed unnecessary this)
1 parent 48fbec4 commit 5737c5e

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/com/github/johnthagen/cppcheck/Configuration.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import javax.swing.event.DocumentEvent;
1010
import javax.swing.event.DocumentListener;
1111

12-
public class Configuration implements Configurable {
12+
class Configuration implements Configurable {
1313
private boolean modified = false;
1414
private JFilePicker cppcheckFilePicker;
1515
private JTextField cppcheckOptionsField;
@@ -105,7 +105,7 @@ public boolean isModified() {
105105
}
106106

107107
private void setModified() {
108-
this.modified = true;
108+
modified = true;
109109
}
110110

111111
@Override
@@ -140,22 +140,22 @@ public void disposeUIResources() {
140140
private static class CppcheckConfigurationModifiedListener implements DocumentListener {
141141
private final Configuration option;
142142

143-
CppcheckConfigurationModifiedListener(Configuration option) {
143+
CppcheckConfigurationModifiedListener(final Configuration option) {
144144
this.option = option;
145145
}
146146

147147
@Override
148-
public void insertUpdate(DocumentEvent documentEvent) {
148+
public void insertUpdate(final DocumentEvent documentEvent) {
149149
option.setModified();
150150
}
151151

152152
@Override
153-
public void removeUpdate(DocumentEvent documentEvent) {
153+
public void removeUpdate(final DocumentEvent documentEvent) {
154154
option.setModified();
155155
}
156156

157157
@Override
158-
public void changedUpdate(DocumentEvent documentEvent) {
158+
public void changedUpdate(final DocumentEvent documentEvent) {
159159
option.setModified();
160160
}
161161
}

src/com/github/johnthagen/cppcheck/CppCheckInspectionImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import java.util.ArrayList;
3636
import java.util.List;
3737

38-
public class CppCheckInspectionImpl {
38+
class CppCheckInspectionImpl {
3939
private static ProblemHighlightType severityToHighlightType(@NotNull final String severity) {
4040
switch (severity) {
4141
case "error":
@@ -77,8 +77,8 @@ public static List<ProblemDescriptor> parseOutput(@NotNull final PsiFile psiFile
7777

7878
final List<ProblemDescriptor> descriptors = new ArrayList<>();
7979

80-
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
81-
DocumentBuilder db = dbf.newDocumentBuilder();
80+
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
81+
final DocumentBuilder db = dbf.newDocumentBuilder();
8282
final org.w3c.dom.Document doc = db.parse(new InputSource(new StringReader(cppcheckOutput)));
8383

8484
final NodeList errors = doc.getElementsByTagName("error");

src/com/github/johnthagen/cppcheck/CppcheckError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.jetbrains.annotations.NotNull;
44

5-
public class CppcheckError extends Error {
5+
class CppcheckError extends Error {
66
public CppcheckError(@NotNull final String message)
77
{
88
super(message);

src/com/github/johnthagen/cppcheck/CppcheckInspection.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
import java.util.Collections;
2727
import java.util.List;
2828

29-
public class CppcheckInspection extends LocalInspectionTool {
29+
class CppcheckInspection extends LocalInspectionTool {
3030
@Nullable
3131
@Override
32-
public ProblemDescriptor[] checkFile(@NotNull PsiFile file,
33-
@NotNull InspectionManager manager,
34-
boolean isOnTheFly) {
32+
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file,
33+
@NotNull final InspectionManager manager,
34+
final boolean isOnTheFly) {
3535
final VirtualFile vFile = file.getVirtualFile();
3636
if (vFile == null || !vFile.isInLocalFileSystem() || !isCFamilyFile(vFile)) {
3737
return ProblemDescriptor.EMPTY_ARRAY;
@@ -68,7 +68,7 @@ public ProblemDescriptor[] checkFile(@NotNull PsiFile file,
6868
final List<ProblemDescriptor> descriptors = CppCheckInspectionImpl.parseOutput(file, manager, document, cppcheckOutput,
6969
tempFile.getName());
7070
return descriptors.toArray(new ProblemDescriptor[0]);
71-
} catch (ExecutionException | CppcheckError | IOException | SAXException | ParserConfigurationException ex) {
71+
} catch (final ExecutionException | CppcheckError | IOException | SAXException | ParserConfigurationException ex) {
7272
Notifications.Bus.notify(new Notification("Cppcheck",
7373
"Cppcheck execution failed.",
7474
ex.getClass().getSimpleName() + ": " + ex.getMessage(),
@@ -83,7 +83,7 @@ public ProblemDescriptor[] checkFile(@NotNull PsiFile file,
8383
}
8484

8585
@NotNull
86-
private static String prependIncludeDir(@NotNull String cppcheckOptions, @NotNull VirtualFile vFile) {
86+
private static String prependIncludeDir(@NotNull final String cppcheckOptions, @NotNull final VirtualFile vFile) {
8787
final VirtualFile dir = vFile.getParent();
8888
if (dir == null) {
8989
return cppcheckOptions;

src/com/github/johnthagen/cppcheck/JFilePicker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class JFilePicker extends JPanel {
1111
private final JTextField textField;
1212
private final JFileChooser fileChooser;
1313

14-
JFilePicker(String textFieldLabel, String buttonLabel) {
14+
JFilePicker(final String textFieldLabel, final String buttonLabel) {
1515
fileChooser = new JFileChooser();
1616

1717
setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

src/com/github/johnthagen/cppcheck/Properties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
class Properties {
66
private static final PropertiesComponent INSTANCE = PropertiesComponent.getInstance();
77

8-
static void set(String key, String value) {
8+
static void set(final String key, final String value) {
99
INSTANCE.setValue(key, value);
1010
}
1111

12-
static String get(String key) {
12+
static String get(final String key) {
1313
return INSTANCE.getValue(key);
1414
}
1515
}

0 commit comments

Comments
 (0)