Skip to content

Commit bf8f482

Browse files
committed
Typed members for SPMObjectInfo (actions and exports fields)
1 parent 85390d2 commit bf8f482

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

SPManager/src/artofillusion/spmanager/SPMObjectInfo.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public class SPMObjectInfo
6868
private List<String> changeLog;
6969
private List<String> details;
7070

71-
protected HashMap exports;
72-
public HashMap actions;
71+
protected Map<String, String> exports;
72+
public Map<String, String> actions;
7373

7474
/**
7575
* Script file name
@@ -704,8 +704,8 @@ private void readInfoFromDocumentNode(Node script)
704704
details = new Vector<>(16);
705705
externals = new HashMap<>(16);
706706
destination = new ArrayList(16);
707-
actions = new HashMap(16);
708-
exports = new HashMap(32);
707+
actions = new HashMap<>(16);
708+
exports = new HashMap<>(32);
709709
}
710710
else {
711711
changeLog.clear();

SPManager/src/artofillusion/spmanager/SPManagerPlugin.java

+11-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
21
/*
32
* Copyright 2004 Francois Guillet
3+
* Changes copyright 2022 by Maksim Khramov
44
* This program is free software; you can redistribute it and/or modify it under the
55
* terms of the GNU General Public License as published by the Free Software
66
* Foundation; either version 2 of the License, or (at your option) any later version.
@@ -15,7 +15,6 @@
1515
import artofillusion.ui.*;
1616

1717
import java.awt.*;
18-
import java.awt.event.*;
1918
import buoy.event.*;
2019
import buoy.widget.*;
2120

@@ -53,6 +52,7 @@ public class SPManagerPlugin implements Plugin
5352
*@param message Description of the Parameter
5453
*@param args Description of the Parameter
5554
*/
55+
@Override
5656
public void processMessage( int message, Object args[] )
5757
{
5858
// NTJ: get the AOI run-time (*not* compile-time) version
@@ -101,8 +101,7 @@ public void processMessage( int message, Object args[] )
101101
Method addUrl = null;
102102

103103
try {
104-
addUrl =
105-
URLClassLoader.class.getDeclaredMethod("addURL", sig);
104+
addUrl = URLClassLoader.class.getDeclaredMethod("addURL", sig);
106105
addUrl.setAccessible(true);
107106
} catch (Exception e) {
108107
System.out.println("Error getting addURL method: " + e);
@@ -114,8 +113,8 @@ public void processMessage( int message, Object args[] )
114113
Class plugType;
115114
File files[], urlfile;
116115
URL url;
117-
Map.Entry entry;
118-
String key[], value;
116+
117+
119118
File plugdir = new File(PLUGIN_DIRECTORY);
120119
if (plugdir.exists()) {
121120
files = plugdir.listFiles();
@@ -157,11 +156,9 @@ public void processMessage( int message, Object args[] )
157156
}
158157

159158
// ok, now perform the actions
160-
for (Iterator iter = info.actions.entrySet().iterator();
161-
iter.hasNext(); ) {
162-
163-
entry = (Map.Entry) iter.next();
164-
key = entry.getKey().toString().split(":");
159+
for (Map.Entry<String, String> entry: info.actions.entrySet()) {
160+
String value = entry.getValue();
161+
String key[] = entry.getKey().split(":");
165162

166163
try {
167164
if (key[0].startsWith("/"))
@@ -177,30 +174,24 @@ public void processMessage( int message, Object args[] )
177174

178175
System.out.println("SPM: adding path: " + url);
179176

180-
value = entry.getValue().toString();
181-
182-
183177
if ("classpath".equalsIgnoreCase(value)) {
184178
if (searchldr != null)
185179
searchldr.add(url);
186180
else if (addUrl != null) {
187181
try {
188182
addUrl.invoke(urlldr, url);
189183
} catch (Exception e) {
190-
System.out.println("Error invoking: "
191-
+ e);
184+
System.out.println("Error invoking: " + e);
192185
}
193186
}
194-
else System.out.println("Could not add path" +
195-
url);
187+
else System.out.println("Could not add path" + url);
196188
}
197189
else if ("import".equalsIgnoreCase(value)) {
198190
ldr = (ClassLoader) loaders.get(url);
199191

200192
if (key.length == 1) {
201193
if (obj != null) searchldr.add(ldr);
202-
else System.out.println("SPM: could not find"
203-
+ " loader for: " + url);
194+
else System.out.println("SPM: could not find" + " loader for: " + url);
204195
}
205196

206197
}

0 commit comments

Comments
 (0)