unused def highlighting on reference name is back

This commit is contained in:
Maxim.Medvedev
2012-05-25 16:54:39 +04:00
parent 43c3b39adc
commit 8613a92a61
7 changed files with 7 additions and 7 deletions
@@ -147,7 +147,7 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase {
}
}
else if (element instanceof GrVariable) {
toHighlight = ((GrVariable)element).getInitializerGroovy();
toHighlight = ((GrVariable)element).getNameIdentifierGroovy();
}
if (toHighlight == null) toHighlight = element;
return toHighlight;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
def m = [a: 1, b: 2]
def m1 = <warning descr="Assignment is not used">[a: 1, b: 2]</warning>
def <warning descr="Assignment is not used">m1</warning> = [a: 1, b: 2]
def val = 'a'
switch (val) {
@@ -14,7 +14,7 @@
* limitations under the License.
*/
def m = [a: 1, b: 2]
def m1 = <warning descr="Assignment is not used">[a: 1, b: 2]</warning>
def <warning descr="Assignment is not used">m1</warning> = [a: 1, b: 2]
def val = 'a'
switch (val) {
@@ -16,7 +16,7 @@
def testV(def variable) {
def v = "s"
def m="10"
def x=<warning descr="Assignment is not used">"10"</warning>
def <warning descr="Assignment is not used">x</warning>="10"
try {
switch (variable) {
case 1:
+1 -1
View File
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Class clazz = <warning descr="Assignment is not used">null</warning>
Class <warning descr="Assignment is not used">clazz</warning> = null
@@ -15,6 +15,6 @@
*/
def x = new Date()
def y = new Date()
def z = <warning descr="Assignment is not used">new Date()</warning>
def <warning descr="Assignment is not used">z</warning> = new Date()
assert false : "should have thrown exception, but returned $x"
assert false : "should have thrown exception, but returned ${y}"
@@ -19,7 +19,7 @@ class TroubleCase {
private Foo<Baz> fooBaz;
private void troubleMethod(boolean b) {
def icDao = <warning descr="Assignment is not used">(b?fooBaz:fooBar)</warning>;
def <warning descr="Assignment is not used">icDao</warning> = (b?fooBaz:fooBar);
for(Object x: new ArrayList()) {
}