From 78ceacb0ce549fd53e43e00208164af58b9e6704 Mon Sep 17 00:00:00 2001 From: Zukero Date: Tue, 13 Feb 2018 15:26:13 +0100 Subject: [PATCH] Warnings hunt. --- .../java/com/zackehh/siphash/SipHash.java | 7 +++- .../rpg/atcontentstudio/ATContentStudio.java | 4 +- .../rpg/atcontentstudio/model/Project.java | 6 +-- .../model/WorkspaceSettings.java | 4 +- .../model/gamedata/Requirement.java | 1 + .../atcontentstudio/model/maps/TMXMapSet.java | 2 +- .../gpl/rpg/atcontentstudio/ui/Editor.java | 5 +-- .../gamedataeditors/ActorConditionEditor.java | 2 + .../ui/gamedataeditors/DialogueEditor.java | 2 + .../ui/gamedataeditors/JSONElementEditor.java | 2 +- .../ui/gamedataeditors/QuestEditor.java | 2 - .../ui/map/WorldMapEditor.java | 10 ++--- .../atcontentstudio/ui/map/WorldMapView.java | 2 +- .../ui/tools/writermode/WriterModeEditor.java | 40 +++++++++---------- 14 files changed, 48 insertions(+), 41 deletions(-) diff --git a/siphash-zackehh/src/main/java/com/zackehh/siphash/SipHash.java b/siphash-zackehh/src/main/java/com/zackehh/siphash/SipHash.java index d6d9da3..c82cb1f 100644 --- a/siphash-zackehh/src/main/java/com/zackehh/siphash/SipHash.java +++ b/siphash-zackehh/src/main/java/com/zackehh/siphash/SipHash.java @@ -1,6 +1,11 @@ package com.zackehh.siphash; -import static com.zackehh.siphash.SipHashConstants.*; +import static com.zackehh.siphash.SipHashConstants.DEFAULT_C; +import static com.zackehh.siphash.SipHashConstants.DEFAULT_D; +import static com.zackehh.siphash.SipHashConstants.INITIAL_V0; +import static com.zackehh.siphash.SipHashConstants.INITIAL_V1; +import static com.zackehh.siphash.SipHashConstants.INITIAL_V2; +import static com.zackehh.siphash.SipHashConstants.INITIAL_V3; /** * Main entry point for SipHash, providing a basic hash diff --git a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java index 94d6c29..e81e867 100644 --- a/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java +++ b/src/com/gpl/rpg/atcontentstudio/ATContentStudio.java @@ -32,13 +32,13 @@ import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import javax.swing.plaf.FontUIResource; +import prefuse.data.expression.parser.ExpressionParser; + import com.gpl.rpg.atcontentstudio.model.Workspace; import com.gpl.rpg.atcontentstudio.ui.StudioFrame; import com.gpl.rpg.atcontentstudio.ui.WorkerDialog; import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector; -import prefuse.data.expression.parser.ExpressionParser; - public class ATContentStudio { diff --git a/src/com/gpl/rpg/atcontentstudio/model/Project.java b/src/com/gpl/rpg/atcontentstudio/model/Project.java index ea443d3..d551932 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/Project.java +++ b/src/com/gpl/rpg/atcontentstudio/model/Project.java @@ -1,6 +1,7 @@ package com.gpl.rpg.atcontentstudio.model; import java.awt.Image; +import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -8,7 +9,6 @@ import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.Serializable; -import java.io.StringBufferInputStream; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; @@ -16,12 +16,10 @@ import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.LinkedHashMap; -import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.Set; import javax.swing.tree.TreeNode; import javax.xml.parsers.DocumentBuilder; @@ -1313,7 +1311,7 @@ public class Project implements ProjectTreeNode, Serializable { transformer.transform(input, output); String tempString = temp.toString(); - doc = builder.parse(new StringBufferInputStream(tempString)); + doc = builder.parse(new ByteArrayInputStream(tempString.getBytes("UTF-8"))); input = new DOMSource(doc); transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader( "\r\n" + diff --git a/src/com/gpl/rpg/atcontentstudio/model/WorkspaceSettings.java b/src/com/gpl/rpg/atcontentstudio/model/WorkspaceSettings.java index 9bc85ab..79ce879 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/WorkspaceSettings.java +++ b/src/com/gpl/rpg/atcontentstudio/model/WorkspaceSettings.java @@ -158,7 +158,7 @@ public class WorkspaceSettings { value = defaultValue; } - public abstract void readFromJson(Map json); + public abstract void readFromJson(@SuppressWarnings("rawtypes") Map json); @SuppressWarnings({ "rawtypes", "unchecked" }) public void saveToJson(Map json) { @@ -188,6 +188,7 @@ public class WorkspaceSettings { super(id, null); } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void saveToJson(Map json) { if (value != null) json.put(id, value); @@ -201,6 +202,7 @@ public class WorkspaceSettings { this.value = this.defaultValue = defaultValue; } + @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void readFromJson(Map json) { value = new ArrayList(); diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java index 47087a0..e1356fb 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java +++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/Requirement.java @@ -172,6 +172,7 @@ public class Requirement extends JSONElement { case skillLevel: case spentGold: case timerElapsed: + case factionScore: break; } if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent); diff --git a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java index b85354e..1e14eb5 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java +++ b/src/com/gpl/rpg/atcontentstudio/model/maps/TMXMapSet.java @@ -99,7 +99,7 @@ public class TMXMapSet implements ProjectTreeNode { while(getProject().open) { try { watchService = FileSystems.getDefault().newWatchService(); - WatchKey watchKey = folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); + /*WatchKey watchKey = */folderPath.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); WatchKey wk; validService: while(getProject().open) { wk = watchService.take(); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java index 7c5e7ac..d40be0a 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/Editor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/Editor.java @@ -652,7 +652,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener { return gdeBox; } - public JComboBox addQuestStageBox(JPanel pane, Project proj, String label, Integer initialValue, boolean writable, final FieldUpdateListener listener, Quest quest, final JComboBox questSelectionBox) { + public JComboBox addQuestStageBox(JPanel pane, Project proj, String label, Integer initialValue, boolean writable, final FieldUpdateListener listener, Quest quest, @SuppressWarnings("rawtypes") final JComboBox questSelectionBox) { JPanel gdePane = new JPanel(); gdePane.setLayout(new JideBoxLayout(gdePane, JideBoxLayout.LINE_AXIS, 6)); JLabel gdeLabel = new JLabel(label); @@ -702,7 +702,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener { - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({ "rawtypes"}) public JList addBacklinksList(JPanel pane, GameDataElement gde) { return addBacklinksList(pane, gde, "Elements linking to this one"); } @@ -866,7 +866,6 @@ public abstract class Editor extends JPanel implements ProjectElementListener { return currentQuest.stages.get(index - 1); } - @SuppressWarnings("unchecked") @Override public void setSelectedItem(Object anItem) { selected = (QuestStage) anItem; diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java index 266de5b..b87c20e 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java @@ -36,6 +36,7 @@ public class ActorConditionEditor extends JSONElementEditor { private IntegerBasedCheckBox stackingBox; //private JTextField roundVisualField; + @SuppressWarnings("rawtypes") private JComboBox roundVisualField; private JSpinner roundHpMinField; private JSpinner roundHpMaxField; @@ -43,6 +44,7 @@ public class ActorConditionEditor extends JSONElementEditor { private JSpinner roundApMaxField; //private JTextField fullRoundVisualField; + @SuppressWarnings("rawtypes") private JComboBox fullRoundVisualField; private JSpinner fullRoundHpMinField; private JSpinner fullRoundHpMaxField; diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java index 072c3fd..858a07c 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/DialogueEditor.java @@ -96,6 +96,7 @@ public class DialogueEditor extends JSONElementEditor { private JPanel rewardsParamsPane; private MyComboBox rewardMap; private JTextField rewardObjId; + @SuppressWarnings("rawtypes") private JComboBox rewardObjIdCombo; private MyComboBox rewardObj; private JComponent rewardValue; @@ -120,6 +121,7 @@ public class DialogueEditor extends JSONElementEditor { private JComboBox requirementTypeCombo; private JPanel requirementParamsPane; private MyComboBox requirementObj; + @SuppressWarnings("rawtypes") private JComboBox requirementSkill; private JTextField requirementObjId; private JComponent requirementValue; diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/JSONElementEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/JSONElementEditor.java index 48f4316..c70b5e8 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/JSONElementEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/JSONElementEditor.java @@ -44,7 +44,6 @@ import com.gpl.rpg.atcontentstudio.ui.ScrollablePanel; import com.gpl.rpg.atcontentstudio.ui.ScrollablePanel.ScrollableSizeHint; import com.gpl.rpg.atcontentstudio.ui.sprites.SpriteChooser; import com.jidesoft.swing.JideBoxLayout; -import com.jidesoft.swing.JideScrollPane; import com.jidesoft.swing.JideTabbedPane; public abstract class JSONElementEditor extends Editor { @@ -303,6 +302,7 @@ public abstract class JSONElementEditor extends Editor { } + @SuppressWarnings("unchecked") public boolean idChanging() { JSONElement node = (JSONElement) target; List toModify = new LinkedList(); diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/QuestEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/QuestEditor.java index 4e416f5..39a0b73 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/QuestEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/QuestEditor.java @@ -40,8 +40,6 @@ public class QuestEditor extends JSONElementEditor { private static final long serialVersionUID = 5701667955210615366L; - private static final Integer one = 1; - private static final String form_view_id = "Form"; private static final String json_view_id = "JSON"; diff --git a/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapEditor.java index 3b60527..bdcdf17 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapEditor.java @@ -316,7 +316,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener { @Override public void mouseClicked(MouseEvent e) { String selectedMap = null; - boolean update = false; +// boolean update = false; int x = (int) (e.getX() / mapView.zoomLevel); int y = (int) (e.getY() / mapView.zoomLevel); for (String s : mapView.mapLocations.keySet()) { @@ -333,19 +333,19 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener { if (mapView.getSelectedMapsIDs().size() > 1) { removeFromSelection(selectedMap); // mapView.selected.remove(selectedMap); - update = true; +// update = true; } } else { addToSelection(selectedMap); // mapView.selected.add(selectedMap); - update = true; +// update = true; } } else { clearSelection(); // mapView.selected.clear(); addToSelection(selectedMap); // mapView.selected.add(selectedMap); - update = true; +// update = true; } } } else if (editMode == EditMode.addMap && mapBeingAddedID != null) { @@ -354,7 +354,7 @@ public class WorldMapEditor extends Editor implements FieldUpdateListener { pushToModel(); } mapView.updateFromModel(); - update = true; +// update = true; mapBeingAddedID = null; } // if (update) { diff --git a/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapView.java b/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapView.java index 67e768f..68f16e9 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapView.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/map/WorldMapView.java @@ -85,7 +85,7 @@ public class WorldMapView extends JComponent implements Scrollable { @Override public void mouseClicked(MouseEvent e) { String selectedMap = null; - boolean update = false; +// boolean update = false; int x = (int) (e.getX() / zoomLevel); int y = (int) (e.getY() / zoomLevel); for (String s : mapLocations.keySet()) { diff --git a/src/com/gpl/rpg/atcontentstudio/ui/tools/writermode/WriterModeEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/tools/writermode/WriterModeEditor.java index 7445dbe..47509d1 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/tools/writermode/WriterModeEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/tools/writermode/WriterModeEditor.java @@ -341,12 +341,12 @@ public class WriterModeEditor extends Editor { } Node rNode; - int i = 1; +// int i = 1; for (WriterModeData.WriterReply reply : dialogue.replies) { if (reply instanceof EmptyReply && reply.next_dialogue != null) { if (cells.get(reply.next_dialogue) == null) { rNode = addDialogueNode(reply.next_dialogue); - Edge e = graph.addEdge(dNode, rNode); + /*Edge e = */graph.addEdge(dNode, rNode); } else { rNode = cells.get(reply.next_dialogue); Edge e = graph.addEdge(dNode, rNode); @@ -355,7 +355,7 @@ public class WriterModeEditor extends Editor { } else { if (cells.get(reply) == null) { rNode = addReplyNode(reply); - Edge e = graph.addEdge(dNode, rNode); + /*Edge e = */graph.addEdge(dNode, rNode); // e.setString(LABEL, "#"+i++); } else { rNode = cells.get(reply); @@ -380,7 +380,7 @@ public class WriterModeEditor extends Editor { if (reply.next_dialogue != null) { if (cells.get(reply.next_dialogue) == null) { Node dNode = addDialogueNode(reply.next_dialogue); - Edge e = graph.addEdge(rNode, dNode); + /*Edge e = */graph.addEdge(rNode, dNode); } else { Node dNode = cells.get(reply.next_dialogue); Edge e = graph.addEdge(rNode, dNode); @@ -665,7 +665,7 @@ public class WriterModeEditor extends Editor { cells.get(selected).set(LABEL, selected.text); } - static final String createNextDefaultNodeString = "createNextDefaultNode"; +// static final String createNextDefaultNodeString = "createNextDefaultNode"; final AbstractAction createNextDefaultNode = new AbstractAction("Create next default") { private static final long serialVersionUID = 1658086056088672748L; @@ -689,7 +689,7 @@ public class WriterModeEditor extends Editor { } } if (newNode!= null) { - Edge edge = graph.addEdge(cells.get(selected), newNode); + /*Edge edge = */graph.addEdge(cells.get(selected), newNode); setSelected(newWrNode); m_vis.run("colors"); @@ -732,7 +732,7 @@ public class WriterModeEditor extends Editor { temp.next_dialogue = newWrNode; newNode = addDialogueNode(newWrNode); - Edge edge = graph.addEdge(cells.get(selected), newNode); + /*Edge edge = */graph.addEdge(cells.get(selected), newNode); setSelected(newWrNode); m_vis.run("colors"); @@ -758,7 +758,7 @@ public class WriterModeEditor extends Editor { if (selected instanceof WriterReply) { newWrNode = data.new WriterReply(((WriterReply) selected).parent); newNode = addReplyNode(newWrNode); - Edge edge = graph.addEdge(cells.get(((WriterReply) selected).parent), newNode); + /*Edge edge = */graph.addEdge(cells.get(((WriterReply) selected).parent), newNode); setSelected(newWrNode); m_vis.run("colors"); @@ -903,18 +903,18 @@ public class WriterModeEditor extends Editor { } } - public void selectScrollAndEdit(WriterNode node) { - if (node != null) { - setSelected(node); - - m_vis.run("colors"); - m_vis.run("layout"); - m_vis.run("scrollToSelectedAndEdit"); - - revalidate(); - repaint(); - } - } +// public void selectScrollAndEdit(WriterNode node) { +// if (node != null) { +// setSelected(node); +// +// m_vis.run("colors"); +// m_vis.run("layout"); +// m_vis.run("scrollToSelectedAndEdit"); +// +// revalidate(); +// repaint(); +// } +// }