Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364560 - [xtend] Warning for private fields / local variables that are never read but only written
Summary: [xtend] Warning for private fields / local variables that are never read but ...
Status: NEW
Alias: None
Product: Xtend
Classification: Tools
Component: Core (show other bugs)
Version: 2.2.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 404167
Blocks:
  Show dependency tree
 
Reported: 2011-11-23 05:04 EST by Sebastian Zarnekow CLA
Modified: 2013-09-12 08:12 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Zarnekow CLA 2011-11-23 05:04:11 EST
def foo(int param) {
  var x = 7
  x = 8
  return param;
}

class Z {
  String s;

  new(String s) {
    this.s = s;
  }
}
Comment 1 Holger Schill CLA 2011-11-23 09:33:46 EST
I think we need some more infrastructure for that. It would be doable without that but I am afraid the code would become complicated.
Comment 2 Sven Efftinge CLA 2011-11-23 09:49:25 EST
Just to clarify what I meant by infrastructure:

Moritz showed me how he did control flow analysis for a customer based on a control-flow model. That looked quite comprehensive and simple to use. I just would like to have something similar and do the analysis for this feature enhancement based on that. 
Not a big deal, though.
Comment 3 Sebastian Zarnekow CLA 2011-11-24 02:26:54 EST
I don't think that this is actually a complicated thing. Wouldn't it be sufficient to collect all references to a local variable, remove every location that's on the left hand of an assignment (only written) and check for remaining references (the readers)?

Did I miss something?
Comment 4 Sven Efftinge CLA 2011-11-24 02:37:24 EST
(In reply to comment #3)
> Did I miss something?

My comment maybe ;-)

I said it's not a big deal, but I want to build something which we can use to solve these kine of problems.
Comment 5 Sebastian Zarnekow CLA 2011-11-24 02:39:22 EST
(In reply to comment #4)
> I said it's not a big deal, but I want to build something which we can use to
> solve these kine of problems.

Yeah this 'something' was a little blurry to me since the solution for this particular problem was so obvious to me. I cannot image that some infrastructure will simpify that further.