Skip to content

Commit 56b2516

Browse files
authored
Support change signature refactoring (#2967)
--------- Signed-off-by: Shi Chen <[email protected]>
1 parent f56d092 commit 56b2516

19 files changed

+1428
-46
lines changed

.vscode/launch.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
"type": "extensionHost",
88
"request": "launch",
99
"runtimeExecutable": "${execPath}",
10+
"debugWebviews": true,
1011
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
1112
"env": {
1213
"DEBUG_VSCODE_JAVA":"true"
1314
},
1415
"stopOnEntry": false,
1516
"sourceMaps": true,
1617
"outFiles": [ "${workspaceRoot}/dist/**/*.js" ],
17-
"preLaunchTask": "npm: watch"
18+
"preLaunchTask": "npm: watch",
19+
"rendererDebugOptions": {
20+
"urlFilter": "*redhat.java*",
21+
"sourceMaps": true,
22+
}
1823
},
1924
{
2025
"name": "Launch Extension - Remote Server",
@@ -36,6 +41,7 @@
3641
"type": "extensionHost",
3742
"request": "launch",
3843
"runtimeExecutable": "${execPath}",
44+
"debugWebviews": true,
3945
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
4046
"stopOnEntry": false,
4147
"sourceMaps": true,
@@ -44,7 +50,11 @@
4450
"JDTLS_CLIENT_PORT": "5036",
4551
"DEBUG_VSCODE_JAVA":"true"
4652
},
47-
"preLaunchTask": "npm: watch"
53+
"preLaunchTask": "npm: watch",
54+
"rendererDebugOptions": {
55+
"urlFilter": "*redhat.java*",
56+
"sourceMaps": true,
57+
}
4858
},
4959
{
5060
"name": "Launch Extension - SyntaxLS Client",

document/_java.learnMoreAboutRefactorings.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
- [Inline constant](#inline-constant)
1919
- [Inline local variable](#inline-local-variable)
2020
- [Inline method](#inline-method)
21-
- [Introduce Parameter](#introduce-parameter)
21+
- Method signature
22+
- [Introduce Parameter](#introduce-parameter)
23+
- [Change method signature](#change-method-signature)
2224
- Invert boolean
2325
- [Invert conditions](#invert-conditions)
2426
- [Invert local variable](#invert-local-variable)
@@ -469,6 +471,41 @@ public void addUser(String name) {
469471
}
470472
```
471473

474+
---
475+
476+
## Change Method Signature
477+
Changes the method visibility, return type, name, and updates the parameters and exceptions. The above changes can be applied through the call hierarchy of the method.
478+
479+
### Example
480+
Let's change signature for the method `public void setAddress(String address)`.
481+
482+
#### Before
483+
484+
```java
485+
public void setAddress(String address) {
486+
this.address = address;
487+
}
488+
489+
public void setAddr() {
490+
this.setAddress("Addr");
491+
}
492+
```
493+
494+
#### Refactor configuration
495+
496+
![change_signature](./refactoring_change_signature.png)
497+
#### After
498+
```java
499+
public void setAddress1(Object newParam, String address) {
500+
this.address = address;
501+
}
502+
503+
public void setAddr() {
504+
this.setAddress1(null, "Addr");
505+
}
506+
```
507+
---
508+
472509
## Invert conditions
473510
Inverts the boolean expression in the conditions.
474511

32.8 KB
Loading

0 commit comments

Comments
 (0)