Build script reformatting / 'Fixed' all unchecked warnings

This commit is contained in:
Anuken
2018-12-13 18:01:51 -05:00
parent 18ddc040d1
commit 0b837925a2
15 changed files with 119 additions and 124 deletions
@@ -107,8 +107,6 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor{
ClassEntry clas = new ClassEntry(callLocation); ClassEntry clas = new ClassEntry(callLocation);
classMap.put(callLocation, clas); classMap.put(callLocation, clas);
classes.add(clas); classes.add(clas);
Utils.messager.printMessage(Kind.NOTE, "Generating class '" + clas.name + "'.");
} }
ClassEntry entry = classMap.get(callLocation); ClassEntry entry = classMap.get(callLocation);
@@ -45,6 +45,7 @@ public class SerializeAnnotationProcessor extends AbstractProcessor{
Set<TypeElement> elements = ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Serialize.class)); Set<TypeElement> elements = ElementFilter.typesIn(roundEnv.getElementsAnnotatedWith(Serialize.class));
TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC); TypeSpec.Builder classBuilder = TypeSpec.classBuilder(className).addModifiers(Modifier.PUBLIC);
classBuilder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class).addMember("value", "\"unchecked\"").build());
MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC); MethodSpec.Builder method = MethodSpec.methodBuilder("init").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
for(TypeElement elem : elements){ for(TypeElement elem : elements){
+3 -2
View File
@@ -7,7 +7,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies{ dependencies{
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.0' classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.5'
classpath "com.badlogicgames.gdx:gdx-tools:1.9.9" classpath "com.badlogicgames.gdx:gdx-tools:1.9.9"
} }
} }
@@ -139,7 +139,9 @@ project(":ios") {
} }
build.dependsOn(incrementConfig) build.dependsOn(incrementConfig)
if(file('robovm.properties').exists()){
build.dependsOn(copyGen) build.dependsOn(copyGen)
}
dependencies{ dependencies{
compile project(":core") compile project(":core")
@@ -150,7 +152,6 @@ project(":ios") {
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion" compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
//compileOnly project(":annotations")
} }
} }
+4
View File
@@ -2,3 +2,7 @@ apply plugin: "java"
sourceCompatibility = 1.8 sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceSets.main.java.srcDirs = ["src/"] sourceSets.main.java.srcDirs = ["src/"]
compileJava{
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
@@ -95,9 +95,8 @@ public class MapEditorDialog extends Dialog implements Disposable{
t.addImageTextButton("$text.editor.import", "icon-load-map", isize, () -> t.addImageTextButton("$text.editor.import", "icon-load-map", isize, () ->
createDialog("$text.editor.import", createDialog("$text.editor.import",
"$text.editor.importmap", "$text.editor.importmap.description", "icon-load-map", (Runnable) loadDialog::show, "$text.editor.importmap", "$text.editor.importmap.description", "icon-load-map", (Runnable) loadDialog::show,
"$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () -> { "$text.editor.importfile", "$text.editor.importfile.description", "icon-file", (Runnable) () ->
Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> { Platform.instance.showFileChooser("$text.loadimage", "Map Files", file -> ui.loadGraphics(() -> {
ui.loadGraphics(() -> {
try{ try{
DataInputStream stream = new DataInputStream(file.read()); DataInputStream stream = new DataInputStream(file.read());
@@ -110,11 +109,10 @@ public class MapEditorDialog extends Dialog implements Disposable{
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false))); ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e); Log.err(e);
} }
}); }), true, mapExtension),
}, true, mapExtension);
}, "$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() ->
"$text.editor.importimage", "$text.editor.importimage.description", "icon-file-image", (Runnable)() -> { Platform.instance.showFileChooser("$text.loadimage", "Image Files", file ->
Platform.instance.showFileChooser("$text.loadimage", "Image Files", file -> {
ui.loadGraphics(() -> { ui.loadGraphics(() -> {
try{ try{
MapTileData data = MapIO.readLegacyPixmap(new Pixmap(file)); MapTileData data = MapIO.readLegacyPixmap(new Pixmap(file));
@@ -125,12 +123,11 @@ public class MapEditorDialog extends Dialog implements Disposable{
ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false))); ui.showError(Bundles.format("text.editor.errorimageload", Strings.parseException(e, false)));
Log.err(e); Log.err(e);
} }
}); }), true, "png")
}, true, "png"); ));
}));
t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export", t.addImageTextButton("$text.editor.export", "icon-save-map", isize, () -> createDialog("$text.editor.export",
"$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () -> { "$text.editor.exportfile", "$text.editor.exportfile.description", "icon-file", (Runnable) () ->
Platform.instance.showFileChooser("$text.saveimage", "Map Files", file -> { Platform.instance.showFileChooser("$text.saveimage", "Map Files", file -> {
file = file.parent().child(file.nameWithoutExtension() + "." + mapExtension); file = file.parent().child(file.nameWithoutExtension() + "." + mapExtension);
FileHandle result = file; FileHandle result = file;
@@ -146,8 +143,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
Log.err(e); Log.err(e);
} }
}); });
}, false, mapExtension); }, false, mapExtension)));
}));
t.row(); t.row();
@@ -258,7 +254,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
* 2) icon name * 2) icon name
* 3) listener * 3) listener
*/ */
private FloatingDialog createDialog(String title, Object... arguments){ private void createDialog(String title, Object... arguments){
FloatingDialog dialog = new FloatingDialog(title); FloatingDialog dialog = new FloatingDialog(title);
float h = 90f; float h = 90f;
@@ -292,8 +288,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
dialog.addCloseButton(); dialog.addCloseButton();
dialog.show(); dialog.show();
return dialog;
} }
@Override @Override
@@ -556,9 +550,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
ImageButton button = new ImageButton("white", "clear-toggle"); ImageButton button = new ImageButton("white", "clear-toggle");
button.clicked(() -> editor.setDrawBlock(block)); button.clicked(() -> editor.setDrawBlock(block));
button.resizeImage(8 * 4f); button.resizeImage(8 * 4f);
button.getImageCell().setActor(stack); button.replaceImage(stack);
button.addChild(stack);
button.getImage().remove();
button.update(() -> button.setChecked(editor.getDrawBlock() == block)); button.update(() -> button.setChecked(editor.getDrawBlock() == block));
group.add(button); group.add(button);
content.add(button).size(50f); content.add(button).size(50f);
@@ -65,6 +65,7 @@ public class Unlocks{
save(); save();
} }
@SuppressWarnings("unchecked")
public void load(){ public void load(){
unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new); unlocked = Settings.getObject("unlockset", ObjectMap.class, ObjectMap::new);
} }
@@ -150,6 +150,7 @@ public class Sectors{
save(); save();
} }
@SuppressWarnings("unchecked")
public void load(){ public void load(){
for(Sector sector : grid.values()){ for(Sector sector : grid.values()){
sector.texture.dispose(); sector.texture.dispose();
@@ -261,6 +261,7 @@ public class Administration{
Settings.save(); Settings.save();
} }
@SuppressWarnings("unchecked")
private void load(){ private void load(){
playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new); playerInfo = Settings.getObject("player-info", ObjectMap.class, ObjectMap::new);
bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new); bannedIPs = Settings.getObject("banned-ips", Array.class, Array::new);
+1 -7
View File
@@ -25,11 +25,11 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
@SuppressWarnings("unchecked")
public class Net{ public class Net{
private static boolean server; private static boolean server;
private static boolean active; private static boolean active;
private static boolean clientLoaded; private static boolean clientLoaded;
private static String lastIP;
private static Array<Object> packetQueue = new Array<>(); private static Array<Object> packetQueue = new Array<>();
private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>(); private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>(); private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>();
@@ -106,7 +106,6 @@ public class Net{
*/ */
public static void connect(String ip, int port, Runnable success){ public static void connect(String ip, int port, Runnable success){
try{ try{
lastIP = ip + ":" + port;
if(!active){ if(!active){
clientProvider.connect(ip, port, success); clientProvider.connect(ip, port, success);
active = true; active = true;
@@ -119,11 +118,6 @@ public class Net{
} }
} }
/**Returns the last IP connected to.*/
public static String getLastIP() {
return lastIP;
}
/** /**
* Host a server at an address. * Host a server at an address.
*/ */
@@ -310,6 +310,7 @@ public class JoinDialog extends FloatingDialog{
return UIUtils.portrait() ? 350f : 500f; return UIUtils.portrait() ? 350f : 500f;
} }
@SuppressWarnings("unchecked")
private void loadServers(){ private void loadServers(){
servers = Settings.getObject("server-list", Array.class, Array::new); servers = Settings.getObject("server-list", Array.class, Array::new);
} }
@@ -101,6 +101,7 @@ public class Tile implements PosTrait, TargetTrait{
return -1; return -1;
} }
@SuppressWarnings("unchecked")
public <T extends TileEntity> T entity(){ public <T extends TileEntity> T entity(){
return (T) entity; return (T) entity;
} }
@@ -35,7 +35,6 @@ public class Conveyor extends Block{
private TextureRegion[][] regions = new TextureRegion[7][4]; private TextureRegion[][] regions = new TextureRegion[7][4];
protected float speed = 0f; protected float speed = 0f;
protected float carryCapacity = 8f;
protected Conveyor(String name){ protected Conveyor(String name){
super(name); super(name);
@@ -359,7 +358,7 @@ public class Conveyor extends Block{
public Array<Object> getDebugInfo(Tile tile){ public Array<Object> getDebugInfo(Tile tile){
ConveyorEntity entity = tile.entity(); ConveyorEntity entity = tile.entity();
Array<Object> arr = super.getDebugInfo(tile); Array<Object> arr = super.getDebugInfo(tile);
arr.addAll(Array.with( arr.addAll(Array.<Object>with(
"clogHeat", entity.clogHeat, "clogHeat", entity.clogHeat,
"sleeping", entity.isSleeping() "sleeping", entity.isSleeping()
)); ));
@@ -87,6 +87,7 @@ public class Consumers{
return map.containsKey(type); return map.containsKey(type);
} }
@SuppressWarnings("unchecked")
public <T extends Consume> T get(Class<T> type){ public <T extends Consume> T get(Class<T> type){
if(!map.containsKey(type)){ if(!map.containsKey(type)){
throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!"); throw new IllegalArgumentException("Block does not contain consumer of type '" + type + "'!");