Implementing refactoring with JBuilder 2005

Time:2021-12-21

There is an English proverb called “look before you jump”. It’s a good idea to look at the impact of this change to make a decision before starting reconstruction.

  1. View definition

Program classes call each other. JBuilder can facilitate you to view the definitions of classes, methods and value fields. Place the cursor on a code element, press Ctrl + enter or right-click, and select find definition in the pop-up menu. JBuilder will locate the element.

  2. View references

After the class, method and value field are defined, their references are scattered in different parts of the program. Viewing the definition is like “wandering to find the root”, while viewing the reference is just the opposite, that is, find all the places referencing the element from the element definition. Place the cursor at the element definition, press Ctrl + Shift + enter or right-click the pop-up menu, and select find references. JBuilder lists all references in the project in the information pane, as shown in the following figure:

Implementing refactoring with JBuilder 2005
  
References are organized in a tree. These references are grouped by classes. Below them are specific references. The following table lists the descriptions of icons in the tree:

Table 2 description of query reference structure Icon

Description of reference icon for query semantics
Class, inner class and interface 1) inheritance system of class
2) type reference: class declaration or instantiation of class object.
3) inheritance type reference: the descendant class of the current class or the place where these subclasses are referenced.
4) member reference: the member of the current class.
5) descendant class member reference: the member of the descendant class of the current class.
Method, constructor 1) declaration: at the current method declaration.
2) direct call: call through class object instance.
3) indirect call: indirect call through parent or child class object instances.
Value range and local variable 1) write: the place where the value range or local variable is changed.
2) read: the place where the value range or local variable is read.

In addition to viewing references in the project scope, you can also view reference relationships in the current class scope: right click the element definition and select find local references in the pop-up menu.

 3. View the coverage method

In the subclass or interface implementation class, position the cursor at the override method, right-click, and select find overridden method in the pop-up menu to view the ancestor method overridden by the current method.

Recommended Today

Microsoft’s high-tech modular “tractor shed”

Microsoft has completed the construction of the primary stage of the Quincy data center in Washington, which is characterized by the infrastructure of plug and play for modular deployment, and the newly deployed cloud computing provides excellent flexibility. Quincy data center adopts a lightweight shape design, which is jokingly called “tractor shed” by Microsoft. Each […]