Commit 3781bd920078da4d2596cba5acfc412d5e4197b0

Authored by Mumfrey
1 parent 43cb3bc4

Style update part 2 - basic style fixes

Showing 23 changed files with 104 additions and 41 deletions
src/client/java/com/mumfrey/liteloader/client/LiteLoaderPanelManager.java
... ... @@ -278,10 +278,6 @@ public class LiteLoaderPanelManager implements PanelManager<GuiScreen>
278 278  
279 279 private boolean isPanelSupportedOnScreen(GuiScreen guiScreen)
280 280 {
281   - return (
282   - guiScreen instanceof GuiMainMenu ||
283   - guiScreen instanceof GuiIngameMenu ||
284   - guiScreen instanceof GuiOptions
285   - );
  281 + return (guiScreen instanceof GuiMainMenu || guiScreen instanceof GuiIngameMenu || guiScreen instanceof GuiOptions);
286 282 }
287 283 }
... ...
src/client/java/com/mumfrey/liteloader/client/gui/GuiPanelConfigContainer.java
... ... @@ -65,9 +65,9 @@ class GuiPanelConfigContainer extends GuiPanel implements ConfigPanelHost
65 65 */
66 66 @SuppressWarnings("unchecked")
67 67 @Override
68   - public <ModClass extends LiteMod> ModClass getMod()
  68 + public <TModClass extends LiteMod> TModClass getMod()
69 69 {
70   - return (ModClass)this.mod;
  70 + return (TModClass)this.mod;
71 71 }
72 72  
73 73 /* (non-Javadoc)
... ...
src/client/java/com/mumfrey/liteloader/client/gui/startup/LoadingBar.java
... ... @@ -37,8 +37,8 @@ public class LoadingBar extends LoadingProgress
37 37 {
38 38 private static LoadingBar instance;
39 39  
40   - private final String LOADING_MESSAGE_1 = "Starting Game...";
41   - private final String LOADING_MESSAGE_2 = "Initialising...";
  40 + private static final String LOADING_MESSAGE_1 = "Starting Game...";
  41 + private static final String LOADING_MESSAGE_2 = "Initialising...";
42 42  
43 43 private int minecraftProgress = 0;
44 44 private int totalMinecraftProgress = 606;
... ... @@ -50,7 +50,7 @@ public class LoadingBar extends LoadingProgress
50 50  
51 51 private ResourceLocation textureLocation = new ResourceLocation("textures/gui/title/mojang.png");
52 52  
53   - private String minecraftMessage = this.LOADING_MESSAGE_1;
  53 + private String minecraftMessage = LoadingBar.LOADING_MESSAGE_1;
54 54 private String message = "";
55 55  
56 56 private Minecraft minecraft;
... ... @@ -118,7 +118,7 @@ public class LoadingBar extends LoadingProgress
118 118  
119 119 protected void _initTextures()
120 120 {
121   - this.minecraftMessage = this.LOADING_MESSAGE_2;
  121 + this.minecraftMessage = LoadingBar.LOADING_MESSAGE_2;
122 122 }
123 123  
124 124 @Override
... ...
src/client/java/com/mumfrey/liteloader/gl/GL.java
... ... @@ -1178,9 +1178,9 @@ public class GL
1178 1178 return GL11.glGetBoolean(pname);
1179 1179 }
1180 1180  
1181   - public static void gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer win_pos)
  1181 + public static void gluProject(float objx, float objy, float objz, FloatBuffer modelMatrix, FloatBuffer projMatrix, IntBuffer viewport, FloatBuffer winPos)
1182 1182 {
1183   - GLU.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, win_pos);
  1183 + GLU.gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winPos);
1184 1184 }
1185 1185  
1186 1186 public static void gluPerspective(float fovy, float aspect, float zNear, float zFar)
... ...
src/client/java/com/mumfrey/liteloader/util/ModUtilities.java
... ... @@ -141,7 +141,10 @@ public abstract class ModUtilities
141 141 }
142 142 }
143 143 }
144   - catch (Exception ex) { ex.printStackTrace(); }
  144 + catch (Exception ex)
  145 + {
  146 + ex.printStackTrace();
  147 + }
145 148 }
146 149 }
147 150  
... ...
src/debug/java/com/mumfrey/liteloader/debug/LoginManager.java
... ... @@ -162,14 +162,20 @@ public class LoginManager
162 162 AuthData authData = new AuthData(this.authService, this.authentication, this.offline, this.defaultUsername, this.defaultDisplayName);
163 163 LoginManager.gson.toJson(authData, fileWriter);
164 164 }
165   - catch (IOException ex) { ex.printStackTrace(); }
  165 + catch (IOException ex)
  166 + {
  167 + ex.printStackTrace();
  168 + }
166 169 finally
167 170 {
168 171 try
169 172 {
170 173 if (fileWriter != null) fileWriter.close();
171 174 }
172   - catch (IOException ex) { ex.printStackTrace(); }
  175 + catch (IOException ex)
  176 + {
  177 + ex.printStackTrace();
  178 + }
173 179 }
174 180 }
175 181 }
... ...
src/debug/java/com/mumfrey/liteloader/debug/LoginPanel.java
... ... @@ -116,14 +116,16 @@ public class LoginPanel extends JPanel
116 116  
117 117 this.btnLogin = new JButton("Log in");
118 118 this.btnLogin.addActionListener(new ActionListener() {
119   - @Override public void actionPerformed(ActionEvent e) {
  119 + @Override public void actionPerformed(ActionEvent e)
  120 + {
120 121 LoginPanel.this.onLoginClick();
121 122 }
122 123 });
123 124  
124 125 this.btnCancel = new JButton("Cancel");
125 126 this.btnCancel.addActionListener(new ActionListener() {
126   - @Override public void actionPerformed(ActionEvent e) {
  127 + @Override public void actionPerformed(ActionEvent e)
  128 + {
127 129 LoginPanel.this.onCancelClick();
128 130 }
129 131 });
... ...
src/main/java/com/mumfrey/liteloader/api/EnumeratorPlugin.java
... ... @@ -23,8 +23,7 @@ public interface EnumeratorPlugin
23 23 *
24 24 * @param container Container to inspect
25 25 * @param classloader ClassLoader for this container
26   - * @param superClass Superclass the class must implement
27   - * @param supportedPrefixes Registered class prefixes
  26 + * @param validator Mod class validator
28 27 * @return
29 28 */
30 29 public abstract <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator);
... ...
src/main/java/com/mumfrey/liteloader/core/EnabledModsList.java
... ... @@ -19,7 +19,7 @@ import com.google.gson.GsonBuilder;
19 19 public class EnabledModsList
20 20 {
21 21 @SuppressWarnings("unused")
22   - private static transient final long serialVersionUID = -6449451105617763769L;
  22 + private static final transient long serialVersionUID = -6449451105617763769L;
23 23  
24 24 /**
25 25 * Gson object for serialisation/deserialisation
... ...
src/main/java/com/mumfrey/liteloader/core/PacketEvents.java
... ... @@ -38,7 +38,14 @@ public abstract class PacketEvents implements InterfaceProvider
38 38 class PacketHandlerList extends HandlerList<PacketHandler>
39 39 {
40 40 private static final long serialVersionUID = 1L;
41   - PacketHandlerList() { super(PacketHandler.class, ReturnLogicOp.AND_BREAK_ON_FALSE); }
  41 +
  42 + /**
  43 + * ctor
  44 + */
  45 + PacketHandlerList()
  46 + {
  47 + super(PacketHandler.class, ReturnLogicOp.AND_BREAK_ON_FALSE);
  48 + }
42 49 }
43 50  
44 51 /**
... ... @@ -46,7 +53,7 @@ public abstract class PacketEvents implements InterfaceProvider
46 53 */
47 54 protected final LiteLoader loader;
48 55  
49   - private PacketHandlerList packetHandlers[] = new PacketHandlerList[Packets.count()];
  56 + private PacketHandlerList[] packetHandlers = new PacketHandlerList[Packets.count()];
50 57  
51 58 private FastIterable<ServerChatFilter> serverChatFilters = new HandlerList<ServerChatFilter>(ServerChatFilter.class, ReturnLogicOp.AND_BREAK_ON_FALSE);
52 59  
... ... @@ -58,6 +65,9 @@ public abstract class PacketEvents implements InterfaceProvider
58 65 private final int clientPayloadPacketId = Packets.C17PacketCustomPayload.getIndex();
59 66 private final int clientSettingsPacketId = Packets.C15PacketClientSettings.getIndex();
60 67  
  68 + /**
  69 + * ctor
  70 + */
61 71 public PacketEvents()
62 72 {
63 73 PacketEvents.instance = this;
... ... @@ -90,6 +100,11 @@ public abstract class PacketEvents implements InterfaceProvider
90 100 this.serverChatFilters.add(serverChatFilter);
91 101 }
92 102  
  103 + /**
  104 + * Register a new packet handler
  105 + *
  106 + * @param handler
  107 + */
93 108 public void registerPacketHandler(PacketHandler handler)
94 109 {
95 110 List<Class<? extends Packet>> handledPackets = handler.getHandledPackets();
... ... @@ -115,6 +130,12 @@ public abstract class PacketEvents implements InterfaceProvider
115 130 }
116 131 }
117 132  
  133 + /**
  134 + * Event callback
  135 + *
  136 + * @param e
  137 + * @param netHandler
  138 + */
118 139 public static void handlePacket(PacketEventInfo<Packet> e, INetHandler netHandler)
119 140 {
120 141 PacketEvents.instance.handlePacket(e, netHandler, e.getPacketId());
... ...
src/main/java/com/mumfrey/liteloader/core/event/HandlerList.java
... ... @@ -546,7 +546,7 @@ public class HandlerList&lt;T&gt; extends LinkedList&lt;T&gt; implements FastIterableDeque&lt;T
546 546 *
547 547 * @param <T>
548 548 */
549   - public static abstract class BakedHandlerList<T>
  549 + public abstract static class BakedHandlerList<T>
550 550 {
551 551 public abstract T get();
552 552  
... ...
src/main/java/com/mumfrey/liteloader/core/event/ProfilingHandlerList.java
... ... @@ -194,7 +194,7 @@ public class ProfilingHandlerList&lt;T extends Listener&gt; extends HandlerList&lt;T&gt;
194 194 *
195 195 * @param <T>
196 196 */
197   - public static abstract class BakedList<T> extends HandlerList.BakedHandlerList<T>
  197 + public abstract static class BakedList<T> extends HandlerList.BakedHandlerList<T>
198 198 {
199 199 private final Profiler profiler;
200 200  
... ...
src/main/java/com/mumfrey/liteloader/launch/ClassPathUtilities.java
... ... @@ -287,7 +287,10 @@ public abstract class ClassPathUtilities
287 287 File targetFile = new File(new URI(jarPath));
288 288 return returnParent ? targetFile.getParentFile() : targetFile;
289 289 }
290   - catch (URISyntaxException ex) { }
  290 + catch (URISyntaxException ex)
  291 + {
  292 + // derp
  293 + }
291 294 }
292 295  
293 296 return null;
... ...
src/main/java/com/mumfrey/liteloader/modconfig/ConfigPanelHost.java
... ... @@ -12,7 +12,7 @@ public interface ConfigPanelHost
12 12 /**
13 13 * Get the mod instance which owns the panel
14 14 */
15   - public abstract <ModClass extends LiteMod> ModClass getMod();
  15 + public abstract <TModClass extends LiteMod> TModClass getMod();
16 16  
17 17 /**
18 18 * Get the width of the configuration panel area
... ...
src/main/java/com/mumfrey/liteloader/transformers/ByteCodeUtilities.java
... ... @@ -478,9 +478,10 @@ public abstract class ByteCodeUtilities
478 478 String typeName = type.getClassName();
479 479 typeName = typeName.substring(typeName.lastIndexOf('.') + 1);
480 480 return typeName;
  481 + default:
  482 + return "Object";
481 483 }
482 484  
483   - return "Object";
484 485 }
485 486  
486 487 /**
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/InjectionPoint.java
... ... @@ -99,7 +99,7 @@ public abstract class InjectionPoint
99 99 *
100 100 * @author Adam Mummery-Smith
101 101 */
102   - static abstract class CompositeInjectionPoint extends InjectionPoint
  102 + abstract static class CompositeInjectionPoint extends InjectionPoint
103 103 {
104 104 protected final InjectionPoint[] components;
105 105  
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/ReturnEventInfo.java
... ... @@ -100,6 +100,8 @@ public class ReturnEventInfo&lt;S, R&gt; extends EventInfo&lt;S&gt;
100 100 {
101 101 return this.returnValue;
102 102 }
  103 +
  104 + // CHECKSTYLE:OFF
103 105  
104 106 // All of the accessors below are to avoid having to generate unboxing conversions in bytecode
105 107 public byte getReturnValueB() { if (this.returnValue == null) return 0; return (Byte) this.returnValue; }
... ... @@ -111,6 +113,9 @@ public class ReturnEventInfo&lt;S, R&gt; extends EventInfo&lt;S&gt;
111 113 public short getReturnValueS() { if (this.returnValue == null) return 0; return (Short) this.returnValue; }
112 114 public boolean getReturnValueZ() { if (this.returnValue == null) return false; return (Boolean) this.returnValue; }
113 115  
  116 + // CHECKSTYLE:ON
  117 +
  118 +
114 119 public static String getReturnAccessor(Type returnType)
115 120 {
116 121 if (returnType.getSort() == Type.OBJECT)
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonInjection.java
... ... @@ -125,10 +125,11 @@ public class JsonInjection implements Serializable
125 125 catch (Exception ex)
126 126 {
127 127 throw new RuntimeException(ex);
128   - }
129   - }
  128 + }
130 129  
131   - throw new InvalidEventJsonException("Could not parse injection type");
  130 + default:
  131 + throw new InvalidEventJsonException("Could not parse injection type");
  132 + }
132 133 }
133 134  
134 135 private Object getArg(int arg)
... ... @@ -174,6 +175,9 @@ public class JsonInjection implements Serializable
174 175  
175 176 case BEFORE:
176 177 return InjectionPoint.before(injectionPoint);
  178 +
  179 + default:
  180 + return injectionPoint;
177 181 }
178 182 }
179 183  
... ...
src/main/java/com/mumfrey/liteloader/util/ChatUtilities.java
... ... @@ -56,6 +56,7 @@ public abstract class ChatUtilities
56 56 case STRIKETHROUGH: style.setStrikethrough(true); break;
57 57 case UNDERLINE: style.setUnderlined(true); break;
58 58 case OBFUSCATED: style.setObfuscated(true); break;
  59 + default: return style;
59 60 }
60 61 }
61 62  
... ...
src/main/java/com/mumfrey/liteloader/util/log/LiteLoaderLogger.java
... ... @@ -95,9 +95,9 @@ public class LiteLoaderLogger extends AbstractAppender
95 95  
96 96 while (message.indexOf('\n') > -1)
97 97 {
98   - int LF = message.indexOf('\n');
99   - this.appendLine(date + message.substring(0, LF));
100   - message = message.substring(LF + 1);
  98 + int lineFeedPos = message.indexOf('\n');
  99 + this.appendLine(date + message.substring(0, lineFeedPos));
  100 + message = message.substring(lineFeedPos + 1);
101 101 }
102 102  
103 103 this.appendLine(date + message);
... ... @@ -151,7 +151,14 @@ public class LiteLoaderLogger extends AbstractAppender
151 151 StringWriter sw = new StringWriter();
152 152 LiteLoaderLogger.lastThrowable.printStackTrace(new PrintWriter(sw));
153 153 lastThrowableWrapped = new Throwable(sw.toString());
154   - try { sw.close(); } catch (IOException ex) {}
  154 + try
  155 + {
  156 + sw.close();
  157 + }
  158 + catch (IOException ex)
  159 + {
  160 + // oh well
  161 + }
155 162 }
156 163  
157 164 return lastThrowableWrapped;
... ...
src/main/java/com/mumfrey/liteloader/util/net/LiteLoaderLogUpload.java
... ... @@ -107,7 +107,10 @@ public class LiteLoaderLogUpload extends Thread
107 107 reader.close();
108 108 this.response = readString.toString();
109 109 }
110   - catch (IOException ex) { ex.printStackTrace(); }
  110 + catch (IOException ex)
  111 + {
  112 + ex.printStackTrace();
  113 + }
111 114  
112 115 httpStream.close();
113 116 outputStream.close();
... ...
src/main/java/com/mumfrey/liteloader/util/net/PastebinUpload.java
... ... @@ -115,7 +115,10 @@ public class PastebinUpload extends Thread
115 115 reader.close();
116 116 this.pasteUrl = readString.toString();
117 117 }
118   - catch (IOException ex) { ex.printStackTrace(); }
  118 + catch (IOException ex)
  119 + {
  120 + ex.printStackTrace();
  121 + }
119 122  
120 123 httpStream.close();
121 124 }
... ...
src/main/java/net/eq2online/permissions/ReplicatedPermissionsContainer.java
... ... @@ -108,9 +108,18 @@ public class ReplicatedPermissionsContainer implements Serializable
108 108 ReplicatedPermissionsContainer object = (ReplicatedPermissionsContainer)inputStream.readObject();
109 109 return object;
110 110 }
111   - catch (IOException e) { }
112   - catch (ClassNotFoundException e) { }
113   - catch (ClassCastException e) { }
  111 + catch (IOException e)
  112 + {
  113 + // Don't care
  114 + }
  115 + catch (ClassNotFoundException e)
  116 + {
  117 + // Don't care
  118 + }
  119 + catch (ClassCastException e)
  120 + {
  121 + // Don't care
  122 + }
114 123  
115 124 return null;
116 125 }
... ...