mistupv / JavaSlicer

A program slicer for Java, based on the system dependence graph (SDG).
https://mist.dsic.upv.es/JavaSlicer/demo/
GNU Affero General Public License v3.0
52 stars 18 forks source link

Global variables #34

Closed jacosro closed 3 years ago

jacosro commented 4 years ago

Static attributes of each class are represented as global variables. This means that each method declaration will have a global_formal_in and global_formal_out parameter for each one of the global variables of the program (static attributes of every class). Consequently, every method call will also have global_actual_in and global_actual_out nodes for each global variable.

Four new NodeTypes must be added: GLOBAL_FORMAL_IN, GLOBAL_FORMAL_OUT, GLOBAL_ACTUAL_IN, GLOBAL_ACTUAL_OUT, in order to be able to distinguish them from normal parameters.

@cargaji What do you think?

cargaji commented 4 years ago

I'm not sure whether new types are needed or not. Types as classes would be useful to unify both formal and actual types, but that can be done after-the-fact. The main difficulty here is locating global variable usage and definitions.

In Java, only static elements can be "global variables", as all others will be accessed via this, a parameter or a static field.

cargaji commented 3 years ago

This issue can be split into static fields (see #46) and class fields (already supported in 1.3.0).