[BLUEJ-82] Show object names in Debugger and Object Inspector
Currently, the inspector shows the value of a variable of reference type as either null or an arrow (pointing nowhere). Likewise, the debugger shows the value of a variable of reference type as either null or the text "".
This is fine for objects that are not in the Object Bench, but if an object is in the Object Bench, its name should be shown in the Debugger and the Object Inspector.
Also, objects should not be allowed to be assigned more than one name; i.e. each object should have at most one name. (Perhaps this should be a separate feature request.)
------- Comment BLUEJ-1 From Michael K?lling 2006-04-26 12:33:18 [reply] -------
I think this would be misleading. It generates the impressions that objects have a (unique) name. This is not the case.
Objects don't have names, references have names. And there can be namy references (and indirectly, names) for any object.
------- Comment BLUEJ-2 From Michael K?lling 2006-04-26 12:41:48 [reply] -------
closed for version 2.1.3
------- Comment BLUEJ-3 From Bart Jacobs 2006-04-26 16:34:55 [reply] -------
I did not explain the rationale for my proposal sufficiently clearly. Please allow me to try and justify my proposal.
It is true that the Java Language Specification does not introduce the notion of an "object name", and indeed, objects do not intrinsically have a name. However, they do have an identity, and it seems to me to be perfectly reasonable to allow the BlueJ user to assign a name to an object for the purpose of identifying the object in various places (specifically, in the Object Bench, in Object Inspector windows, and in the Debugger). This name would indeed not be part of the semantics of the program itself; it would merely be a tool by which objects can be identified in BlueJ.
Adding this feature would fix the problem that BlueJ currently has, which is that there is no way to tell for an object reference that appears for example in a local variable in the Debugger, which specific object it points to. You can tell, using the Object Inspector, whether two objects have the same state, but you cannot tell whether they are in fact the same object.
I agree that it is important to distinguish between such BlueJ "object names" and names of variables that contain object references. You are right that there can be many variables, with different names, that point to the same object. So the two notions are distinct. Perhaps a good way to distinguish them would be to prefix object names by a hash mark, as in #cell1, to make it clear that these are names assigned to objects through the BlueJ user interface rather than variable names that appear in Java source code.
The current semantics of the Object Bench seems to be that the Object Bench contains a number of named variables that contain references to objects. And indeed, multiple variables can be added to the Object Bench that point to the same object. My point is that it would be useful to change this semantics; rather than introducing a new variable and assigning a name to the variable, one should be able to assign a name to the object itself. This would allow users to tell easily which object a given object reference points to.
(Note also that the VS 2005 debugger allows users to assign object IDs to objects, similarly to the object names that I am proposing here.)
Many thanks for reconsidering this.
Issue metadata
- Issue type: Task
- Priority: Low
- Fix versions: 3.1.6