History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-3206
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Eugene Vigdorchik
Reporter: Rob Harwood
Votes: 0
Watchers: 0
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

'Field can be local' doesn't seem to work

Created: 30 Jun 05 14:36   Updated: 22 Nov 06 19:29
Component/s: Editor. Error Highlighting
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: None
Image Attachments:

1. local.png
(26 kb)

Build: 3,386
Severity: High


 Description  « Hide
I have 'Field can be local' turned on, and Hector is paying attention, but the following code doesn't trigger the inspection:

public class D {
int q=4;
void d(){ System.out.println(q); }
}

I tried variations of private and final on the field to see if that was the issue, but I have yet to find any way to trigger the inspection. This class has no subclasses or anything like that. I'm trying to demonstrate this inspection for the 5.0 overview. Is there any way to trigger it?



 All   Comments   Work Log   Change History      Sort Order:
Maxim Shafirov - 30 Jun 05 15:05
That only works for private fields since we can't ensure with local scope if the field haven't been used directly in other classes.

Rob Harwood - 30 Jun 05 15:17
I tried private. It also does not work. Specifically, this code does not work:

public class D {
private int q=4;
void d(){ System.out.println(q); }
}

See screenshot.


Maxim Shafirov - 30 Jun 05 15:25
Well, that's slighly other use case from what we've been implementing.
public class D {
private int q;
void d(){ q = 4; System.out.println(q); }

void g(){ q = 4; System.out.println(q); } }
}

more strictly field claimed to be redundant if every method that uses that overwrites its value before any read.