4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
6
6
* You may obtain a copy of the License at
7
- *
7
+ *
8
8
* http://www.apache.org/licenses/LICENSE-2.0
9
- *
9
+ *
10
10
* Unless required by applicable law or agreed to in writing, software
11
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
22
import ghidra .app .cmd .function .FunctionRenameOption ;
23
23
import ghidra .framework .cmd .Command ;
24
24
import ghidra .framework .cmd .CompoundCmd ;
25
- import ghidra .framework .model .DomainObject ;
26
25
import ghidra .framework .plugintool .PluginTool ;
27
26
import ghidra .program .model .data .*;
28
- import ghidra .program .model .listing .Function ;
29
- import ghidra .program .model .listing .FunctionSignature ;
27
+ import ghidra .program .model .listing .*;
30
28
import ghidra .program .model .symbol .SourceType ;
31
29
import ghidra .util .Msg ;
32
30
import ghidra .util .exception .CancelledException ;
@@ -148,7 +146,7 @@ private static boolean allowCallFixup(Function function) {
148
146
@ Override
149
147
protected boolean applyChanges () throws CancelledException {
150
148
// create the command
151
- Command command = createCommand ();
149
+ Command < Program > command = createCommand ();
152
150
153
151
if (command == null ) {
154
152
return false ;
@@ -164,9 +162,9 @@ protected boolean applyChanges() throws CancelledException {
164
162
return true ;
165
163
}
166
164
167
- private Command createCommand () throws CancelledException {
165
+ private Command < Program > createCommand () throws CancelledException {
168
166
169
- Command cmd = null ;
167
+ Command < Program > cmd = null ;
170
168
if (isSignatureChanged () || isCallingConventionChanged () ||
171
169
(function .getSignatureSource () == SourceType .DEFAULT )) {
172
170
@@ -179,20 +177,20 @@ private Command createCommand() throws CancelledException {
179
177
FunctionRenameOption .RENAME );
180
178
}
181
179
182
- CompoundCmd compoundCommand = new CompoundCmd ("Update Function Signature" );
180
+ CompoundCmd < Program > compoundCommand = new CompoundCmd <> ("Update Function Signature" );
183
181
184
- compoundCommand .add (new Command () {
182
+ compoundCommand .add (new Command < Program > () {
185
183
String errMsg = null ;
186
184
187
185
@ Override
188
- public boolean applyTo (DomainObject obj ) {
186
+ public boolean applyTo (Program p ) {
189
187
try {
190
188
String conventionName = getCallingConvention ();
191
189
function .setCallingConvention (conventionName );
192
190
return true ;
193
191
}
194
192
catch (InvalidInputException e ) {
195
- errMsg = "Invalid calling convention. " + e .getMessage ();
193
+ errMsg = e .getMessage ();
196
194
Msg .error (this , "Unexpected Exception: " + e .getMessage (), e );
197
195
return false ;
198
196
}
@@ -209,9 +207,9 @@ public String getStatusMsg() {
209
207
}
210
208
});
211
209
if (allowInLine ) {
212
- compoundCommand .add (new Command () {
210
+ compoundCommand .add (new Command < Program > () {
213
211
@ Override
214
- public boolean applyTo (DomainObject obj ) {
212
+ public boolean applyTo (Program p ) {
215
213
function .setInline (isInlineSelected ());
216
214
return true ;
217
215
}
@@ -228,9 +226,9 @@ public String getStatusMsg() {
228
226
});
229
227
}
230
228
if (allowNoReturn ) {
231
- compoundCommand .add (new Command () {
229
+ compoundCommand .add (new Command < Program > () {
232
230
@ Override
233
- public boolean applyTo (DomainObject obj ) {
231
+ public boolean applyTo (Program p ) {
234
232
function .setNoReturn (hasNoReturnSelected ());
235
233
return true ;
236
234
}
@@ -247,9 +245,9 @@ public String getStatusMsg() {
247
245
});
248
246
}
249
247
if (allowCallFixup ) {
250
- compoundCommand .add (new Command () {
248
+ compoundCommand .add (new Command < Program > () {
251
249
@ Override
252
- public boolean applyTo (DomainObject obj ) {
250
+ public boolean applyTo (Program p ) {
253
251
function .setCallFixup (getCallFixupSelection ());
254
252
return true ;
255
253
}
0 commit comments