Skip to content

Commit a37294e

Browse files
Cleaned up files to eliminate most compiler warnings as reported by Eclipse.
1 parent 99a07c4 commit a37294e

File tree

133 files changed

+275
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+275
-550
lines changed

drjava/src/edu/rice/cs/drjava/DrJava.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@
5656
import edu.rice.cs.util.ArgumentTokenizer;
5757
import edu.rice.cs.util.Log;
5858
import edu.rice.cs.util.UnexpectedException;
59-
import edu.rice.cs.util.FileOps;
6059
import edu.rice.cs.drjava.model.DrJavaFileUtils;
6160

62-
import static edu.rice.cs.plt.debug.DebugUtil.debug;
63-
6461
/** Startup class for DrJava consisting entirely of static members. The main method reads the .drjava file (creating
6562
* one if none exists) to get the critical information required to start the main JVM for DrJava:
6663
* (i) the location of tools.jar in the Java JDK installed on this machine (so DrJava can invoke the javac compiler

drjava/src/edu/rice/cs/drjava/DrJavaRestart.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public static void main(final String[] args) {
132132
dest.getAbsolutePath());
133133
}
134134
LOG.log("Restarting...");
135-
Process p = JVMBuilder.DEFAULT.classPath(exec).start(DrJava.class.getName(), "-new", "-delete-after-restart", args[2]);
135+
JVMBuilder.DEFAULT.classPath(exec).start(DrJava.class.getName(), "-new", "-delete-after-restart", args[2]);
136136
LOG.log("Done with DrJavaRestart");
137137
System.exit(0);
138138
}
@@ -201,7 +201,7 @@ public static void main(final String[] args) {
201201
}
202202
if (macOpenFile.exists()) {
203203
LOG.log("Restarting using ProcessBuilder...");
204-
Process p = new ProcessBuilder()
204+
new ProcessBuilder()
205205
.command(macOpenFile.getAbsolutePath(), exec.getAbsolutePath())
206206
.redirectErrorStream(true)
207207
.start();
@@ -210,7 +210,7 @@ public static void main(final String[] args) {
210210
else {
211211
LOG.log("Restarting using JVMBuilder...");
212212
exec = new File(exec,"Contents/Resources/Java/drjava.jar");
213-
Process p = JVMBuilder.DEFAULT.classPath(exec).start(DrJava.class.getName(), "-new", "-delete-after-restart", args[2]);
213+
JVMBuilder.DEFAULT.classPath(exec).start(DrJava.class.getName(), "-new", "-delete-after-restart", args[2]);
214214
LOG.log("Done with DrJavaRestart");
215215
System.exit(0);
216216
}

drjava/src/edu/rice/cs/drjava/RemoteControlServer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
package edu.rice.cs.drjava;
3838

3939
import edu.rice.cs.drjava.ui.MainFrame;
40-
import edu.rice.cs.util.FileOpenSelector;
41-
import edu.rice.cs.util.OperationCanceledException;
4240
import edu.rice.cs.drjava.config.OptionConstants;
4341

4442
import java.io.*;

drjava/src/edu/rice/cs/drjava/config/ConfigProperty.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public void update(PropertyMaps pm) {
6262
String value = om.getString(op);
6363
if (_name.equals("config." + key)) {
6464
if (op instanceof VectorOption<?>) {
65-
@SuppressWarnings("unchecked")
66-
Vector<?> vec = ((VectorOption)op).parse(value);
65+
Vector<?> vec = ((VectorOption<?>)op).parse(value);
6766
StringBuilder sb = new StringBuilder();
6867
for(Object o: vec) {
6968
sb.append(_attributes.get("sep"));

drjava/src/edu/rice/cs/drjava/config/DrJavaPropertySetup.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,8 +1419,10 @@ else if (f.isFile()) {
14191419
// now let's check if it contains DrJava
14201420
if (jf.getJarEntry(edu.rice.cs.drjava.DrJava.class.getName().replace('.', '/') + ".class") != null) {
14211421
found = f;
1422+
jf.close();
14221423
break;
14231424
}
1425+
jf.close();
14241426
}
14251427
}
14261428
catch(IOException e) { /* ignore, we'll continue with the next classpath item */ }

drjava/src/edu/rice/cs/drjava/config/DrJavaPropertySetupTest.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343

4444
import java.io.*;
4545

46-
import static edu.rice.cs.plt.debug.DebugUtil.debug;
47-
4846
/**
4947
* Tests for the variables and language constructs that can be used in external processes.
5048
* @author Mathias Ricken
@@ -965,29 +963,27 @@ public void testMisc() throws CloneNotSupportedException {
965963

966964
public void testControlFlow() throws CloneNotSupportedException {
967965
PropertyMaps pm = PropertyMaps.TEMPLATE.clone();
968-
DrJavaProperty p;
969966

970967
// if
971-
p = pm.getProperty("Misc","if");
968+
pm.getProperty("Misc","if");
972969

973970
// for
974-
p = pm.getProperty("Misc","for");
971+
pm.getProperty("Misc","for");
975972

976973
// var
977-
p = pm.getProperty("Misc","var");
974+
pm.getProperty("Misc","var");
978975

979976
// var.set
980-
p = pm.getProperty("Misc","var.set");
977+
pm.getProperty("Misc","var.set");
981978
}
982979

983980
public void testXML() throws CloneNotSupportedException {
984981
PropertyMaps pm = PropertyMaps.TEMPLATE.clone();
985-
DrJavaProperty p;
986982

987983
// xml.in
988-
p = pm.getProperty("Misc","xml.in");
984+
pm.getProperty("Misc","xml.in");
989985

990986
// xml.out.action
991-
p = pm.getProperty("Misc","xml.out.action");
987+
pm.getProperty("Misc","xml.out.action");
992988
}
993989
}

drjava/src/edu/rice/cs/drjava/config/OptionConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import javax.swing.UIManager.LookAndFeelInfo;
5252

5353
import edu.rice.cs.drjava.platform.PlatformFactory;
54-
import edu.rice.cs.plt.reflect.JavaVersion;
5554
import edu.rice.cs.util.FileOps;
5655

5756
import static java.awt.Event.*;

drjava/src/edu/rice/cs/drjava/config/OptionParser.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
package edu.rice.cs.drjava.config;
3838

3939
import java.util.HashMap;
40-
import java.util.ResourceBundle;
41-
import java.util.MissingResourceException;
4240

4341
/** The association of an OptionName with the ability to parse something to type T; the intended type
4442
* parameterization is covariant: if U extends T, then OptionParser<U> extends OptionParser<T>.

drjava/src/edu/rice/cs/drjava/config/ResourceBundleConfiguration.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
package edu.rice.cs.drjava.config;
3838

39-
import edu.rice.cs.util.swing.Utilities;
40-
4139
import java.util.ResourceBundle;
4240
import java.util.MissingResourceException;
4341
import java.io.*;
@@ -81,7 +79,7 @@ public <T> T getOption(OptionParser<T> o) {
8179
public <T> T setOption(Option<T> o, T val) {
8280
if (o == null) return _shadowed.getOptionMap().setOption(o, val);
8381
try {
84-
String str = _bundle.getString(o.getName());
82+
_bundle.getString(o.getName());
8583
return null; // defined in resource bundle, can't be set
8684
}
8785
catch(MissingResourceException mre) {
@@ -105,7 +103,7 @@ public <T> String getString(OptionParser<T> o) {
105103
public <T> void setString(OptionParser<T> o, String s) {
106104
if (o==null) _shadowed.getOptionMap().setString(o, s);
107105
try {
108-
String str = _bundle.getString(o.getName());
106+
_bundle.getString(o.getName());
109107
return; // defined in resource bundle, can't be set
110108
}
111109
catch(MissingResourceException mre) {
@@ -117,7 +115,7 @@ public <T> void setString(OptionParser<T> o, String s) {
117115
public <T> T removeOption(OptionParser<T> o) {
118116
if (o==null) return _shadowed.getOptionMap().removeOption(o);
119117
try {
120-
String str = _bundle.getString(o.getName());
118+
_bundle.getString(o.getName());
121119
return null; // defined in resource bundle, can't be removed
122120
}
123121
catch(MissingResourceException mre) {
@@ -147,7 +145,7 @@ public Iterable<OptionParser<?>> keys() {
147145
public <T> T setSetting(final Option<T> op, final T value) {
148146
if (op==null) return _shadowed.setSetting(op, value);
149147
try {
150-
String str = _bundle.getString(op.getName());
148+
_bundle.getString(op.getName());
151149
return null; // defined in resource bundle, can't be set
152150
}
153151
catch(MissingResourceException mre) {
@@ -173,7 +171,7 @@ public <T> T getSetting(Option<T> op) {
173171
public <T> boolean isEditable(Option<T> op) {
174172
if (op==null) return _shadowed.isEditable(op);
175173
try {
176-
String str = _bundle.getString(op.getName());
174+
_bundle.getString(op.getName());
177175
return false; // defined, not editable
178176
}
179177
catch(MissingResourceException mre) {

drjava/src/edu/rice/cs/drjava/model/AbstractGlobalModel.java

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
import javax.swing.ProgressMonitor;
8484

8585
import edu.rice.cs.drjava.DrJava;
86-
import edu.rice.cs.drjava.DrJavaRoot;
8786
import edu.rice.cs.drjava.config.Option;
8887
import edu.rice.cs.drjava.config.OptionParser;
8988
import edu.rice.cs.drjava.config.OptionConstants;
@@ -947,7 +946,7 @@ public void setExtraClassPath(Iterable<AbsRelFile> cp) {
947946
public void setCustomManifest(String manifest) { _manifest = manifest; }
948947
}
949948

950-
@SuppressWarnings("unchecked")
949+
@SuppressWarnings({ "unchecked", "rawtypes" })
951950
protected void removePreviousListeners() {
952951
for(Map.Entry<OptionParser<?>, OptionListener<?>> e: LISTENERS_TO_REMOVE.entrySet()) {
953952
// all keys should be full Option instances, not just OptionParser instances
@@ -958,7 +957,7 @@ protected void removePreviousListeners() {
958957
LISTENERS_TO_REMOVE.clear();
959958
}
960959

961-
@SuppressWarnings("unchecked")
960+
@SuppressWarnings({ "unchecked", "rawtypes" })
962961
protected void addNewListeners(Map<OptionParser<?>,String> newValues) {
963962
for(OptionParser<?> key: newValues.keySet()) {
964963
// all keys should be full Option instances, not just OptionParser instances
@@ -1426,15 +1425,9 @@ private OpenDefinitionsDocument[] _openFiles(File[] files)
14261425
_notifier.handleAlreadyOpenDocument(d);
14271426
_notifier.fileOpened(d);
14281427
}
1429-
}
1430-
1431-
if (retDocs != null) {
1432-
return retDocs.toArray(new OpenDefinitionsDocument[0]);
1433-
}
1434-
else {
1435-
//if we didn't open any files, then it's just as if they cancelled it...
1436-
throw new OperationCanceledException();
14371428
}
1429+
1430+
return retDocs.toArray(new OpenDefinitionsDocument[0]);
14381431
}
14391432

14401433

@@ -1649,7 +1642,6 @@ else if ( doc.isAuxiliaryFile()) {
16491642
* @param file where to save the project
16501643
* @param info
16511644
*/
1652-
@SuppressWarnings("unchecked")
16531645
public ProjectProfile _makeProjectProfile(File file, HashMap<OpenDefinitionsDocument, DocumentInfoGetter> info)
16541646
throws IOException {
16551647
ProjectProfile builder = new ProjectProfile(file);
@@ -2108,7 +2100,6 @@ public boolean closeFileWithoutPrompt(final OpenDefinitionsDocument doc) {
21082100
_bookmarkManager.removeRegions(doc);
21092101

21102102
// The following copy operation is dictated by the silly "no comodification" constraint on Collection iterators
2111-
@SuppressWarnings("unchecked")
21122103
List<RegionManager<MovingDocumentRegion>> managers = new ArrayList<RegionManager<MovingDocumentRegion>>(_findResultsManagers);
21132104
for (RegionManager<MovingDocumentRegion> rm: managers) rm.removeRegions(doc);
21142105
doc.clearBrowserRegions();

0 commit comments

Comments
 (0)