Skip to content

Commit

Permalink
Fix a bunch of warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
norrisboyd committed Apr 25, 2007
1 parent c01d8ab commit 0039e45
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 79 deletions.
2 changes: 1 addition & 1 deletion examples/DynamicScopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static void main(String[] args)
useDynamicScope = true;
runScripts(cx, script);
} finally {
cx.exit();
Context.exit();
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/RunScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static void main(String args[])
Object result = cx.evaluateString(scope, s, "<cmd>", 1, null);

// Convert the result to a string and print it.
System.err.println(cx.toString(result));
System.err.println(Context.toString(result));

} finally {
// Exit from the context.
Expand Down
2 changes: 1 addition & 1 deletion examples/RunScript2.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void main(String args[])
s += args[i];
}
Object result = cx.evaluateString(scope, s, "<cmd>", 1, null);
System.err.println(cx.toString(result));
System.err.println(Context.toString(result));
} finally {
Context.exit();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/RunScript4.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void main(String args[])
s += args[i];
}
Object result = cx.evaluateString(scope, s, "<cmd>", 1, null);
System.err.println(cx.toString(result));
System.err.println(Context.toString(result));
} finally {
Context.exit();
}
Expand Down
10 changes: 5 additions & 5 deletions examples/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static String[] processOptions(Context cx, String args[]) {
if (arg.equals("-version")) {
if (++i == args.length)
usage(arg);
double d = cx.toNumber(args[i]);
double d = Context.toNumber(args[i]);
if (d != d)
usage(arg);
cx.setLanguageVersion((int) d);
Expand Down Expand Up @@ -202,7 +202,7 @@ public static double version(Context cx, Scriptable thisObj,
{
double result = (double) cx.getLanguageVersion();
if (args.length > 0) {
double d = cx.toNumber(args[0]);
double d = Context.toNumber(args[0]);
cx.setLanguageVersion((int) d);
}
return result;
Expand All @@ -219,7 +219,7 @@ public static void load(Context cx, Scriptable thisObj,
{
Shell shell = (Shell)getTopLevelScope(thisObj);
for (int i = 0; i < args.length; i++) {
shell.processSource(cx, cx.toString(args[i]));
shell.processSource(cx, Context.toString(args[i]));
}
}

Expand Down Expand Up @@ -267,8 +267,8 @@ private void processSource(Context cx, String filename)
Object result = cx.evaluateString(this, source,
sourceName, startline,
null);
if (result != cx.getUndefinedValue()) {
System.err.println(cx.toString(result));
if (result != Context.getUndefinedValue()) {
System.err.println(Context.toString(result));
}
}
catch (WrappedException we) {
Expand Down
2 changes: 0 additions & 2 deletions src/org/mozilla/classfile/ClassFileWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ public void startMethod(String methodName, String type, short flags) {
*
* @param maxLocals the maximum number of local variable slots
* (a.k.a. Java registers) used by the method
* @param vars the array of the variables for the method,
* or null if none
*/
public void stopMethod(short maxLocals) {
if (itsCurrentMethod == null)
Expand Down
2 changes: 0 additions & 2 deletions src/org/mozilla/javascript/ScriptableObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public abstract class ScriptableObject implements Scriptable, Serializable,
*/
private Scriptable parentScopeObject;

private static final Object HAS_STATIC_ACCESSORS = Void.TYPE;
private static final Slot REMOVED = new Slot(null, 0, READONLY);

static {
Expand Down Expand Up @@ -2312,7 +2311,6 @@ private static void copyTable(Slot[] slots, Slot[] newSlots, int count)
{
if (count == 0) throw Kit.codeBug();

int tableSize = newSlots.length;
int i = slots.length;
for (;;) {
--i;
Expand Down
10 changes: 0 additions & 10 deletions toolsrc/org/mozilla/javascript/tools/debugger/Dim.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ private String getNormalizedUrl(DebuggableScript fnOrScript) {
}
String replace = null;
int i = searchStart + 1;
boolean hasDigits = false;
while (i != urlLength) {
int c = url.charAt(i);
if (!('0' <= c && c <= '9')) {
Expand Down Expand Up @@ -728,8 +727,6 @@ private Object[] getObjectIdsImpl(Context cx, Object object) {
private void interrupted(Context cx, final StackFrame frame,
Throwable scriptException) {
ContextData contextData = frame.contextData();
int line = frame.getLineNumber();
String url = frame.getUrl();
boolean eventThreadFlag = callback.isGuiEventThread();
contextData.eventThreadFlag = eventThreadFlag;

Expand Down Expand Up @@ -1366,11 +1363,6 @@ public static class SourceInfo {
*/
private String url;

/**
* The line at which the script starts.
*/
private int minLine;

/**
* Array indicating which lines can have breakpoints set.
*/
Expand Down Expand Up @@ -1434,15 +1426,13 @@ private SourceInfo(String source, DebuggableScript[] functions,

if (minAll > maxAll) {
// No line information
this.minLine = -1;
this.breakableLines = EMPTY_BOOLEAN_ARRAY;
this.breakpoints = EMPTY_BOOLEAN_ARRAY;
} else {
if (minAll < 0) {
// Line numbers can not be negative
throw new IllegalStateException(String.valueOf(minAll));
}
this.minLine = minAll;
int linesTop = maxAll + 1;
this.breakableLines = new boolean[linesTop];
this.breakpoints = new boolean[linesTop];
Expand Down
45 changes: 0 additions & 45 deletions toolsrc/org/mozilla/javascript/tools/debugger/SwingGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ public class SwingGui extends JFrame implements GuiCallback {
*/
private JSInternalConsole console;

/**
* The script evaluation internal frame.
*/
private EvalWindow evalWindow;

/**
* The {@link JSplitPane} that separates {@link #desk} from {@link context}.
*/
Expand Down Expand Up @@ -227,7 +222,6 @@ private void init() {
"Step Out (F8)"};
int count = 0;
button = breakButton = new JButton("Break");
JButton focusButton = button;
button.setToolTipText("Break");
button.setActionCommand("Break");
button.addActionListener(menubar);
Expand Down Expand Up @@ -963,7 +957,6 @@ public static void showMessageDialog(Component parent, String msg,
char c = msg.charAt(i);
buf.append(c);
if (Character.isWhitespace(c)) {
int remainder = len - i;
int k;
for (k = i + 1; k < len; k++) {
if (Character.isWhitespace(msg.charAt(k))) {
Expand Down Expand Up @@ -1352,11 +1345,6 @@ class FilePopupMenu extends JPopupMenu {
*/
private static final long serialVersionUID = 3589525009546013565L;

/**
* The {@link FileTextArea} this popup menu is attached to.
*/
private FileTextArea w;

/**
* The popup x position.
*/
Expand All @@ -1371,7 +1359,6 @@ class FilePopupMenu extends JPopupMenu {
* Creates a new FilePopupMenu.
*/
public FilePopupMenu(FileTextArea w) {
this.w = w;
JMenuItem item;
add(item = new JMenuItem("Set Breakpoint"));
item.addActionListener(w);
Expand Down Expand Up @@ -1703,14 +1690,6 @@ public String showDialog(Component comp) {
return value;
}

/**
* Sets the selected value.
*/
private void setValue(String newValue) {
value = newValue;
list.setSelectedValue(value, true);
}

// ActionListener

/**
Expand Down Expand Up @@ -1770,11 +1749,6 @@ class FindFunction extends JDialog implements ActionListener {
*/
private JButton setButton;

/**
* The "Refresh" button.
*/
private JButton refreshButton;

/**
* The "Cancel" button.
*/
Expand Down Expand Up @@ -1861,14 +1835,6 @@ public String showDialog(Component comp) {
return value;
}

/**
* Sets the last function selected.
*/
private void setValue(String newValue) {
value = newValue;
list.setSelectedValue(value, true);
}

// ActionListener

/**
Expand Down Expand Up @@ -1973,15 +1939,13 @@ public void paint(Graphics g) {
Rectangle clip = g.getClipBounds();
g.setColor(getBackground());
g.fillRect(clip.x, clip.y, clip.width, clip.height);
int left = getX();
int ascent = metrics.getMaxAscent();
int h = metrics.getHeight();
int lineCount = textArea.getLineCount() + 1;
String dummy = Integer.toString(lineCount);
if (dummy.length() < 2) {
dummy = "99";
}
int maxWidth = metrics.stringWidth(dummy);
int startLine = clip.y / h;
int endLine = (clip.y + clip.height) / h + 1;
int width = getWidth();
Expand All @@ -1995,7 +1959,6 @@ public void paint(Graphics g) {
}
boolean isBreakPoint = fileWindow.isBreakPoint(i + 1);
text = Integer.toString(i + 1) + " ";
int w = metrics.stringWidth(text);
int y = i * h;
g.setColor(Color.blue);
g.drawString(text, 0, y + ascent);
Expand Down Expand Up @@ -2066,7 +2029,6 @@ public void mouseExited(MouseEvent e) {
public void mouseReleased(MouseEvent e) {
if (e.getComponent() == this
&& (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) {
int x = e.getX();
int y = e.getY();
Font font = fileWindow.textArea.getFont();
FontMetrics metrics = getFontMetrics(font);
Expand Down Expand Up @@ -2121,11 +2083,6 @@ class FileWindow extends JInternalFrame implements ActionListener {
*/
int currentPos;

/**
* The status bar.
*/
private JLabel statusBar;

/**
* Loads the file.
*/
Expand Down Expand Up @@ -2988,7 +2945,6 @@ public ContextWindow(final SwingGui debugGui) {
final JPanel finalThis = this;

ComponentListener clistener = new ComponentListener() {
boolean t1Docked = true;
boolean t2Docked = true;
void check(Component comp) {
Component thisParent = finalThis.getParent();
Expand Down Expand Up @@ -3057,7 +3013,6 @@ public void windowClosing(WindowEvent e) {
// no change
return;
}
t1Docked = leftDocked;
t2Docked = rightDocked;
JSplitPane split = (JSplitPane)thisParent;
if (leftDocked) {
Expand Down
10 changes: 2 additions & 8 deletions toolsrc/org/mozilla/javascript/tools/idswitch/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@

public class Main {

private static final String PROGRAM_NAME = "Main";

private static final String SWITCH_TAG_STR = "string_id_map";
private static final String GENERATED_TAG_STR = "generated";
private static final String STRING_TAG_STR = "string";
Expand Down Expand Up @@ -131,14 +129,14 @@ private void process_file() throws IOException {
int time_stamp_begin = -1, time_stamp_end = -1;

body.startLineLoop();
L:while (body.nextLine()) {
while (body.nextLine()) {
int begin = body.getLineBegin();
int end = body.getLineEnd();

int tag_id = extract_line_tag_id(buffer, begin, end);
boolean bad_tag = false;
switch (cur_state) {
case 0:
case NORMAL_LINE:
if (tag_id == SWITCH_TAG) {
cur_state = SWITCH_TAG;
all_pairs.removeAllElements();
Expand Down Expand Up @@ -216,7 +214,6 @@ else if (tag_id == -GENERATED_TAG) {
private String get_time_stamp() {
SimpleDateFormat f = new SimpleDateFormat
(" 'Last update:' yyyy-MM-dd HH:mm:ss z");
String dateString = f.format(new Date());
return f.format(new Date());
}

Expand Down Expand Up @@ -611,8 +608,5 @@ private int remove_nulls(String[] array) {
}
return destination;
}



}

Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ private void check_all_is_different(int begin, int end) {
}

private EvaluatorException on_same_pair_fail(IdValuePair a, IdValuePair b) {
StringBuffer sb = new StringBuffer();
int line1 = a.getLineNumber(), line2 = b.getLineNumber();
if (line2 > line1) { int tmp = line1; line1 = line2; line2 = tmp; }
String error_text = ToolErrorReporter.getMessage(
Expand Down Expand Up @@ -485,4 +484,3 @@ private void sort_pairs(int begin, int end, int comparator) {
}
}
}

1 change: 0 additions & 1 deletion toolsrc/org/mozilla/javascript/tools/shell/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ public static void processSource(Context cx, String filename)
int lineno = 1;
boolean hitEOF = false;
while (!hitEOF) {
int startline = lineno;
if (filename == null)
ps.print("js> ");
ps.flush();
Expand Down

0 comments on commit 0039e45

Please sign in to comment.