Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #14

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions src/org/antlr/works/IDE.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public String getMessage() {
}

public static String getApplicationPath() {
Class c = XJApplication.getAppDelegate().getClass();
Class<?> c = XJApplication.getAppDelegate().getClass();
URL url = c.getProtectionDomain().getCodeSource().getLocation();
String p;
if(url == null) {
Expand Down Expand Up @@ -332,7 +332,7 @@ public static String getApplicationPath() {
return p;
}

public static void debugVerbose(Console console, Class c, String s) {
public static void debugVerbose(Console console, Class<?> c, String s) {
if(AWPrefs.getDebugVerbose()) {
String message = c.getName()+": "+s;
if(console != null)
Expand Down Expand Up @@ -398,7 +398,7 @@ public void appWillTerminate() {
StatisticsAW.shared().close();
}

public Class appPreferencesPanelClass() {
public Class<? extends XJPanel> appPreferencesPanelClass() {
return AWPrefsDialog.class;
}

Expand All @@ -418,7 +418,7 @@ public boolean useDesktopMode() {
return AWPrefs.getUseDesktopMode();
}

public Class appPreferencesClass() {
public Class<?> appPreferencesClass() {
return IDE.class;
}

Expand Down
11 changes: 5 additions & 6 deletions src/org/antlr/works/ate/swing/ATERenderingToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

*/

public abstract class ATERenderingToken implements Comparable {
public abstract class ATERenderingToken implements Comparable<ATERenderingToken> {

protected int index;

Expand All @@ -52,11 +52,10 @@ public void setIndex(int index) {
public abstract void drawToken(ATERenderingView view, ATERenderingToken t, Graphics g, FontMetrics metrics,
int x, int y, char c, Document doc, AttributeSet attribute, Segment text) throws BadLocationException;

public int compareTo(Object o) {
if(!(o instanceof ATERenderingToken)) return 0;
ATERenderingToken other = (ATERenderingToken) o;
if(index > other.index) return 1;
if(index < other.index) return -1;
public int compareTo(ATERenderingToken o) {
if(o == null) return 1;
if(index > o.index) return 1;
if(index < o.index) return -1;
return 0;
}
}
10 changes: 5 additions & 5 deletions src/org/antlr/works/ate/syntax/generic/ATESyntaxParser.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.antlr.works.ate.syntax.generic;

import java.util.ArrayList;
import java.util.List;
import org.antlr.works.ate.syntax.misc.ATEToken;

import java.util.List;
import java.util.Stack;
/*

[The "BSD licence"]
Expand Down Expand Up @@ -38,7 +38,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
public abstract class ATESyntaxParser {

private List<ATEToken> tokens;
private Stack<Integer> marks = new Stack<Integer>();
private List<Integer> marks = new ArrayList<Integer>();
private int position;

private ATEToken t0;
Expand Down Expand Up @@ -73,11 +73,11 @@ public int getPosition() {
}

public void mark() {
marks.push(position);
marks.add(position);
}

public void rewind() {
position = marks.pop();
position = marks.remove(marks.size() - 1);
clearTokenCache();
}

Expand Down
11 changes: 5 additions & 6 deletions src/org/antlr/works/ate/syntax/misc/ATEToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT

package org.antlr.works.ate.syntax.misc;

public class ATEToken implements Comparable {
public class ATEToken implements Comparable<ATEToken> {

public int type;

Expand Down Expand Up @@ -112,13 +112,12 @@ public boolean equals(Object otherObject) {
}
}

public int compareTo(Object o) {
if(o instanceof ATEToken) {
ATEToken otherToken = (ATEToken)o;
return this.getAttribute().compareTo(otherToken.getAttribute());
} else {
public int compareTo(ATEToken o) {
if (o == null) {
return 1;
}

return this.getAttribute().compareTo(o.getAttribute());
}

public String toString() {
Expand Down
6 changes: 4 additions & 2 deletions src/org/antlr/works/components/GrammarDocumentFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import org.antlr.works.utils.Localizable;
import org.antlr.xjlib.appkit.document.XJDataPlainText;
import org.antlr.xjlib.appkit.document.XJDocumentFactory;/*
import org.antlr.xjlib.appkit.document.XJDocumentFactory;
import org.antlr.xjlib.appkit.frame.XJWindow;
/*

[The "BSD licence"]
Copyright (c) 2005-07 Jean Bovet
Expand Down Expand Up @@ -36,7 +38,7 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
public class GrammarDocumentFactory extends XJDocumentFactory {

// todo provide factory?
public GrammarDocumentFactory(Class windowClass) {
public GrammarDocumentFactory(Class<? extends XJWindow> windowClass) {
super(GrammarDocument.class,
windowClass,
XJDataPlainText.class,
Expand Down
2 changes: 1 addition & 1 deletion src/org/antlr/works/components/GrammarWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public void rulesDidChange() {
interpreterTab.updateIgnoreTokens(getRules());
}

public JPopupMenu rulesGetContextualMenu(List selectedObjects) {
public JPopupMenu rulesGetContextualMenu(List<?> selectedObjects) {
if(selectedObjects.isEmpty())
return null;

Expand Down
6 changes: 2 additions & 4 deletions src/org/antlr/works/debugger/DebuggerEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,8 @@ public static String compileFiles(Console console, String[] files, String output
System.arraycopy(files, 0, args, 2, files.length);

Class<?> javac = Class.forName("com.sun.tools.javac.Main");
Class[] p = new Class[] { String[].class };
Method m = javac.getMethod("compile", p);
Object[] a = new Object[] { args };
Object r = m.invoke(javac.newInstance(), a);
Method m = javac.getMethod("compile", String[].class);
Object r = m.invoke(javac.newInstance(), (Object)args);
result = (Integer) r;
//result = com.sun.tools.javac.Main.compile(args);
}
Expand Down
2 changes: 1 addition & 1 deletion src/org/antlr/works/debugger/DebuggerTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public void addEvent(DBEvent event, DBPlayerContextInfo info) {
eventsPanel.addEvent(event, info);
}

public void playEvents(List events, int lastEventPosition, boolean reset) {
public void playEvents(List<? extends DBEvent> events, int lastEventPosition, boolean reset) {
player.playEvents(events, lastEventPosition, reset);
breaksOnEvent();
}
Expand Down
6 changes: 3 additions & 3 deletions src/org/antlr/works/debugger/panels/DBControlPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import org.antlr.works.prefs.AWPrefs;
import org.antlr.works.stats.StatisticsAW;
import org.antlr.works.utils.IconManager;
import org.antlr.works.utils.NumberSet;
import org.antlr.works.utils.Toolbar;
import org.antlr.xjlib.appkit.swing.XJRollOverButton;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashSet;
import java.util.Set;
/*

Expand Down Expand Up @@ -229,8 +229,8 @@ public JComponent createInfoLabelPanel() {
return infoLabel;
}

public Set getBreakEvent() {
NumberSet set = new NumberSet();
public Set<Integer> getBreakEvent() {
Set<Integer> set = new HashSet<Integer>();

if(breakAllButton.isSelected())
set.add(DBEvent.ALL);
Expand Down
2 changes: 1 addition & 1 deletion src/org/antlr/works/debugger/panels/DBEventsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public String getColumnName(int column) {
return super.getColumnName(column);
}

public Class getColumnClass(int columnIndex) {
public Class<?> getColumnClass(int columnIndex) {
switch(columnIndex) {
case INFO_COLUMN_COUNT: return String.class;
case INFO_COLUMN_EVENT: return String.class;
Expand Down
13 changes: 7 additions & 6 deletions src/org/antlr/works/debugger/panels/DBStackPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import javax.swing.table.AbstractTableModel;
import java.awt.*;
import java.util.ArrayList;
import java.util.Stack;
import java.util.List;

/*

[The "BSD licence"]
Expand Down Expand Up @@ -49,7 +50,7 @@ public class DBStackPanel extends DetachablePanel {

private XJTableView infoTableView;
private DBStackPanel.RuleTableDataModel ruleTableDataModel;
private Stack<DBEventEnterRule> rules = new Stack<DBEventEnterRule>();
private List<DBEventEnterRule> rules = new ArrayList<DBEventEnterRule>();

public DBStackPanel(DebuggerTab debuggerTab) {
super("Stack", debuggerTab);
Expand Down Expand Up @@ -89,20 +90,20 @@ public void run() {
}

public void pushRule(DBEventEnterRule rule) {
rules.push(rule);
rules.add(rule);
ruleTableDataModel.add(rule.name);
}

public void popRule() {
ruleTableDataModel.remove(rules.peek().name);
rules.pop();
ruleTableDataModel.remove(rules.get(rules.size() - 1).name);
rules.remove(rules.size() - 1);
}

public DBEventEnterRule peekRule() {
if(rules.isEmpty()) {
return null;
} else {
return rules.peek();
return rules.get(rules.size() - 1);
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/org/antlr/works/debugger/tivo/DBPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,24 @@ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
import org.antlr.works.debugger.input.DBInputProcessor;
import org.antlr.works.debugger.input.DBInputTextTokenInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class DBPlayer {

protected DebuggerTab debuggerTab;
protected DBInputProcessor processor;

protected DBPlayerContextInfo contextInfo;
protected Stack<Integer> markStack;
protected List<Integer> markStack;

protected int resyncing = 0;
protected int eventPlayedCount = 0;

public DBPlayer(DebuggerTab debuggerTab) {
this.debuggerTab = debuggerTab;
contextInfo = new DBPlayerContextInfo();
markStack = new Stack<Integer>();
markStack = new ArrayList<Integer>();
}

public void close() {
Expand Down Expand Up @@ -88,13 +88,13 @@ the events are reset (when the debugger starts).
eventPlayedCount = 0;
}

public void playEvents(List events, int lastEventPosition, boolean reset) {
public void playEvents(List<? extends DBEvent> events, int lastEventPosition, boolean reset) {
if(reset)
resetPlayEvents(false);

int lastIndex = lastEventPosition - 1;
for(int i=eventPlayedCount; i< lastEventPosition; i++) {
DBEvent event = (DBEvent)events.get(i);
DBEvent event = events.get(i);

try {
playEvent(event);
Expand Down Expand Up @@ -317,13 +317,13 @@ public void playLocation() {

public void playMark(DBEventMark event) {
contextInfo.mark(event.id);
markStack.push(processor.getCurrentTokenIndex());
markStack.add(processor.getCurrentTokenIndex());
}

public void playRewind(DBEventRewind event) {
processor.rewind(markStack.peek());
processor.rewind(markStack.get(markStack.size() - 1));
if(!event.rewindToLastMark()) {
markStack.pop();
markStack.remove(markStack.size() - 1);
contextInfo.rewind();
}
}
Expand Down
Loading