mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
(no message)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>2</line>
|
||||
<description>Field can be converted to one or more local variables.</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
private int f;
|
||||
|
||||
void foo () {
|
||||
f = 0;
|
||||
int k = f;
|
||||
}
|
||||
|
||||
int bar () {
|
||||
f = 5;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.varScopeCanBeNarrowed.FieldCanBeLocalInspection;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class FieldCanBeLocalTest extends InspectionTestCase {
|
||||
private LocalInspectionTool myTool;
|
||||
private LocalInspectionToolWrapper myWrapper;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myTool = new FieldCanBeLocalInspection();
|
||||
myWrapper = new LocalInspectionToolWrapper(myTool);
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("fieldCanBeLocal/" + getTestName(false), myWrapper);
|
||||
}
|
||||
|
||||
public void testSimple () throws Exception {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user