diff --git a/gradle.properties b/gradle.properties index 45ace9499..462fced2b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -45,7 +45,7 @@ enableModernJavaSyntax = true # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. -enableGenericInjection = false +enableGenericInjection = true # Generate a class with a String field for the mod version named as defined below. # If generateGradleTokenClass is empty or not missing, no such class will be generated. diff --git a/src/main/java/codechicken/nei/BookmarkPanel.java b/src/main/java/codechicken/nei/BookmarkPanel.java index 9bebb0d39..e47ed9d9f 100644 --- a/src/main/java/codechicken/nei/BookmarkPanel.java +++ b/src/main/java/codechicken/nei/BookmarkPanel.java @@ -1294,8 +1294,7 @@ public void draw(int x, int y) { RenderHelper.enableGUIStandardItemLighting(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glDisable(GL11.GL_DEPTH_TEST); - @SuppressWarnings("unchecked") - List slots = (List) this.gui.slotcontainer.inventorySlots; + List slots = this.gui.slotcontainer.inventorySlots; for (Slot slot : slots) { if (slot != null && slot.getStack() != null) { diff --git a/src/main/java/codechicken/nei/ClientHandler.java b/src/main/java/codechicken/nei/ClientHandler.java index e4a3de0af..586f65624 100644 --- a/src/main/java/codechicken/nei/ClientHandler.java +++ b/src/main/java/codechicken/nei/ClientHandler.java @@ -358,9 +358,10 @@ public void drawScreen(int par1, int par2, float par3) { } }; - @SuppressWarnings("serial") CustomModLoadingErrorDisplayException e = new CustomModLoadingErrorDisplayException() { + private static final long serialVersionUID = -5593387489666663375L; + @Override public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { Minecraft.getMinecraft().displayGuiScreen(errorGui); diff --git a/src/main/java/codechicken/nei/ContainerPotionCreator.java b/src/main/java/codechicken/nei/ContainerPotionCreator.java index 32a98bea3..26bd9d5fb 100644 --- a/src/main/java/codechicken/nei/ContainerPotionCreator.java +++ b/src/main/java/codechicken/nei/ContainerPotionCreator.java @@ -116,7 +116,6 @@ public void onContainerClosed(EntityPlayer player) { if (!player.worldObj.isRemote) InventoryUtils.dropOnClose(player, potionInv); } - @SuppressWarnings("unchecked") @Override public void handleServerPacket(PacketCustom packet) { ItemStack potion = potionInv.getStackInSlot(0); diff --git a/src/main/java/codechicken/nei/GuiExtendedCreativeInv.java b/src/main/java/codechicken/nei/GuiExtendedCreativeInv.java index 35711f491..de0947743 100644 --- a/src/main/java/codechicken/nei/GuiExtendedCreativeInv.java +++ b/src/main/java/codechicken/nei/GuiExtendedCreativeInv.java @@ -60,13 +60,13 @@ public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { } @Override - protected void handleMouseClick(Slot p_146984_1_, int p_146984_2_, int p_146984_3_, int p_146984_4_) { + protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) { // Hack for armor slots, because they are outside the container - if (p_146984_1_ != null && p_146984_4_ == 4 && p_146984_1_.xDisplayPosition < 0) { - p_146984_4_ = 0; + if (slotIn != null && clickType == 4 && slotIn.xDisplayPosition < 0) { + clickType = 0; } - super.handleMouseClick(p_146984_1_, p_146984_2_, p_146984_3_, p_146984_4_); + super.handleMouseClick(slotIn, slotId, clickedButton, clickType); } } diff --git a/src/main/java/codechicken/nei/ItemList.java b/src/main/java/codechicken/nei/ItemList.java index 435598e86..aec1ef956 100644 --- a/src/main/java/codechicken/nei/ItemList.java +++ b/src/main/java/codechicken/nei/ItemList.java @@ -210,7 +210,6 @@ private void damageSearch(Item item, List permutations) { } } - @SuppressWarnings("unchecked") private String getTooltip(ItemStack stack) { try { return String.join("\n", stack.getTooltip(Minecraft.getMinecraft().thePlayer, false)); diff --git a/src/main/java/codechicken/nei/ItemMobSpawner.java b/src/main/java/codechicken/nei/ItemMobSpawner.java index 23f86dc5d..f8ebfb933 100644 --- a/src/main/java/codechicken/nei/ItemMobSpawner.java +++ b/src/main/java/codechicken/nei/ItemMobSpawner.java @@ -66,7 +66,7 @@ public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World w } @Override - public void addInformation(ItemStack itemstack, EntityPlayer par2EntityPlayer, List list, boolean par4) { + public void addInformation(ItemStack itemstack, EntityPlayer par2EntityPlayer, List list, boolean par4) { setDefaultTag(itemstack); int meta = itemstack.getItemDamage(); if (meta == 0) { @@ -106,9 +106,10 @@ private void setDefaultTag(ItemStack itemstack) { public static void loadSpawners(World world) { if (loaded) return; loaded = true; - HashMap, String> classToStringMapping = (HashMap, String>) EntityList.classToStringMapping; - HashMap, Integer> classToIDMapping = (HashMap, Integer>) EntityList.classToIDMapping; - for (Class eclass : classToStringMapping.keySet()) { + Map, String> classToStringMapping = EntityList.classToStringMapping; + @SuppressWarnings("unchecked") + Map, Integer> classToIDMapping = (Map, Integer>) EntityList.classToIDMapping; + for (Class eclass : classToStringMapping.keySet()) { if (!EntityLiving.class.isAssignableFrom(eclass)) continue; try { EntityLiving entityliving = (EntityLiving) eclass.getConstructor(new Class[] { World.class }) @@ -131,7 +132,7 @@ public static void loadSpawners(World world) { } @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { + public void getSubItems(Item item, CreativeTabs tab, List list) { if (!NEIClientConfig.hasSMPCounterPart()) list.add(new ItemStack(item)); else for (int i : IDtoNameMap.keySet()) list.add(new ItemStack(item, 1, i)); } diff --git a/src/main/java/codechicken/nei/ItemZoom.java b/src/main/java/codechicken/nei/ItemZoom.java index 3aebc09bd..161826839 100644 --- a/src/main/java/codechicken/nei/ItemZoom.java +++ b/src/main/java/codechicken/nei/ItemZoom.java @@ -78,7 +78,6 @@ public void draw(int mx, int my) { if (key > 0) { String helpText = NEIClientUtils .translate("itemzoom.toggle", NEIClientConfig.getKeyName(key, true)); - @SuppressWarnings("unchecked") List lines = fontRenderer.listFormattedStringToWidth(helpText, this.availableAreaWidth); for (String line : lines) { diff --git a/src/main/java/codechicken/nei/NEIClientConfig.java b/src/main/java/codechicken/nei/NEIClientConfig.java index 1fa7e4fc4..80b37dbb4 100644 --- a/src/main/java/codechicken/nei/NEIClientConfig.java +++ b/src/main/java/codechicken/nei/NEIClientConfig.java @@ -681,7 +681,7 @@ public void run() { NEIClientConfig.pluginsList.parallelStream().forEach(clazz -> { try { - IConfigureNEI config = (IConfigureNEI) clazz.newInstance(); + IConfigureNEI config = (IConfigureNEI) clazz.getConstructor().newInstance(); config.loadConfig(); NEIModContainer.plugins.add(config); logger.debug("Loaded {}", clazz.getName()); diff --git a/src/main/java/codechicken/nei/NEIServerUtils.java b/src/main/java/codechicken/nei/NEIServerUtils.java index 92c86e800..d6e076c2e 100644 --- a/src/main/java/codechicken/nei/NEIServerUtils.java +++ b/src/main/java/codechicken/nei/NEIServerUtils.java @@ -89,9 +89,8 @@ public static ItemStack getSlotContents(EntityPlayer player, int slot, boolean c else return player.inventory.getStackInSlot(slot); } - @SuppressWarnings("unchecked") public static void deleteAllItems(EntityPlayerMP player) { - for (Slot slot : (List) player.openContainer.inventorySlots) slot.putStack(null); + for (Slot slot : player.openContainer.inventorySlots) slot.putStack(null); player.sendContainerAndContentsToPlayer(player.openContainer, player.openContainer.getInventory()); } diff --git a/src/main/java/codechicken/nei/SearchTokenParser.java b/src/main/java/codechicken/nei/SearchTokenParser.java index 98580956c..e45fce797 100644 --- a/src/main/java/codechicken/nei/SearchTokenParser.java +++ b/src/main/java/codechicken/nei/SearchTokenParser.java @@ -43,7 +43,6 @@ public static interface ISearchParserProvider { public ItemFilter getFilter(String searchText); - @SuppressWarnings("unchecked") public static List getAllLanguages() { return new ArrayList<>(Minecraft.getMinecraft().getLanguageManager().getLanguages()); } diff --git a/src/main/java/codechicken/nei/SpawnerRenderer.java b/src/main/java/codechicken/nei/SpawnerRenderer.java index 1bda171ae..7f68341bb 100644 --- a/src/main/java/codechicken/nei/SpawnerRenderer.java +++ b/src/main/java/codechicken/nei/SpawnerRenderer.java @@ -64,7 +64,6 @@ public void renderInventoryItem(RenderBlocks render, ItemStack item) { BossStatus.hasColorModifier = bossHasColorModifier; } - @SuppressWarnings("incomplete-switch") @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch (type) { @@ -75,6 +74,8 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { case ENTITY: renderInventoryItem((RenderBlocks) data[0], item); break; + default: + break; } } diff --git a/src/main/java/codechicken/nei/ThreadOperationTimer.java b/src/main/java/codechicken/nei/ThreadOperationTimer.java index 7727566b1..826199917 100644 --- a/src/main/java/codechicken/nei/ThreadOperationTimer.java +++ b/src/main/java/codechicken/nei/ThreadOperationTimer.java @@ -6,9 +6,9 @@ public class ThreadOperationTimer extends Thread { - @SuppressWarnings("serial") public static class TimeoutException extends RuntimeException { + private static final long serialVersionUID = -8621458005263888185L; public final Object operation; public TimeoutException(String msg, Object op) { diff --git a/src/main/java/codechicken/nei/api/IOverlayHandler.java b/src/main/java/codechicken/nei/api/IOverlayHandler.java index bf7aebe3a..3cb692d18 100644 --- a/src/main/java/codechicken/nei/api/IOverlayHandler.java +++ b/src/main/java/codechicken/nei/api/IOverlayHandler.java @@ -19,7 +19,6 @@ public interface IOverlayHandler { default List presenceOverlay(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) { final List itemPresenceSlots = new ArrayList<>(); final List ingredients = recipe.getIngredientStacks(recipeIndex); - @SuppressWarnings("unchecked") final List invStacks = ((List) firstGui.inventorySlots.inventorySlots).stream() .filter( s -> s != null && s.getStack() != null diff --git a/src/main/java/codechicken/nei/api/ItemInfo.java b/src/main/java/codechicken/nei/api/ItemInfo.java index f490a8b02..e47234edc 100644 --- a/src/main/java/codechicken/nei/api/ItemInfo.java +++ b/src/main/java/codechicken/nei/api/ItemInfo.java @@ -191,7 +191,7 @@ public String[] header() { public String[] dump(Block block, int id, String name) { final Item item = Item.getItemFromBlock(block); return new String[] { name, Integer.toString(id), Boolean.toString(item != null), - ItemInfo.itemOwners.get(block), block.getClass().getCanonicalName(), + ItemInfo.itemOwners.get(item), block.getClass().getCanonicalName(), item != null ? EnumChatFormatting.getTextWithoutFormattingCodes( GuiContainerManager.itemDisplayNameShort(new ItemStack(item))) : "null" }; } @@ -442,7 +442,6 @@ private static void addSpawnEggs() { addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc); } - @SuppressWarnings("unchecked") private static void addEntityEgg(Class entity, int i, int j) { int id = (Integer) EntityList.classToIDMapping.get(entity); EntityList.entityEggs.put(id, new EntityEggInfo(id, i, j)); diff --git a/src/main/java/codechicken/nei/config/RegistryDumper.java b/src/main/java/codechicken/nei/config/RegistryDumper.java index 5e0085eb1..a85138dbc 100644 --- a/src/main/java/codechicken/nei/config/RegistryDumper.java +++ b/src/main/java/codechicken/nei/config/RegistryDumper.java @@ -10,6 +10,7 @@ public RegistryDumper(String name) { super(name); } + @SuppressWarnings("unchecked") @Override public Iterable dump(int mode) { LinkedList list = new LinkedList<>(); diff --git a/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java b/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java index ffdf75918..d7f74b164 100644 --- a/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java +++ b/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java @@ -17,7 +17,6 @@ *
* This event is fired on the {@link MinecraftForge#EVENT_BUS}. */ -@SuppressWarnings("unused") public class NEIRegisterHandlerInfosEvent extends Event { public void registerHandlerInfo(HandlerInfo info) { diff --git a/src/main/java/codechicken/nei/guihook/GuiContainerManager.java b/src/main/java/codechicken/nei/guihook/GuiContainerManager.java index a01c7ac3e..97226e2d3 100644 --- a/src/main/java/codechicken/nei/guihook/GuiContainerManager.java +++ b/src/main/java/codechicken/nei/guihook/GuiContainerManager.java @@ -149,7 +149,6 @@ public static FontRenderer getFontRenderer(ItemStack stack) { * @param includeHandlers If true tooltip handlers will add to the item tip * @return A list of Strings representing the text to be displayed on each line of the tool tip. */ - @SuppressWarnings("unchecked") public static List itemDisplayNameMultiline(ItemStack stack, GuiContainer gui, boolean includeHandlers) { List namelist = null; try { @@ -239,7 +238,6 @@ public static String fluidAmountDetails(int amount) { public static String itemDisplayNameShort(ItemStack itemstack) { try { - @SuppressWarnings("unchecked") List namelist = itemstack.getTooltip(Minecraft.getMinecraft().thePlayer, false); if (!namelist.isEmpty() && !"".equals(namelist.get(0))) { diff --git a/src/main/java/codechicken/nei/guihook/HideousLinkedList.java b/src/main/java/codechicken/nei/guihook/HideousLinkedList.java index d70538abf..5f106a291 100644 --- a/src/main/java/codechicken/nei/guihook/HideousLinkedList.java +++ b/src/main/java/codechicken/nei/guihook/HideousLinkedList.java @@ -21,6 +21,7 @@ */ final class HideousLinkedList extends LinkedList { + private static final long serialVersionUID = -8504433551965776915L; private final List backing; HideousLinkedList(List backing) { diff --git a/src/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java b/src/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java index 8fc427928..2539c1872 100644 --- a/src/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java +++ b/src/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java @@ -17,10 +17,9 @@ import codechicken.nei.PositionedStack; import codechicken.nei.api.IOverlayHandler; -@SuppressWarnings("rawtypes, unchecked") public class DefaultOverlayHandler implements IOverlayHandler { - public static Class gtItem; + public static Class gtItem; static { try { @@ -85,7 +84,6 @@ public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeInd if (quantity != 0) moveIngredients(gui, assignedIngredients, quantity); } - @SuppressWarnings("unchecked") private boolean clearIngredients(GuiContainer gui, List ingreds) { for (PositionedStack pstack : ingreds) for (Slot slot : (List) gui.inventorySlots.inventorySlots) if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) { @@ -98,7 +96,6 @@ private boolean clearIngredients(GuiContainer gui, List ingreds return true; } - @SuppressWarnings("unchecked") private void moveIngredients(GuiContainer gui, List assignedIngredients, int quantity) { for (IngredientDistribution distrib : assignedIngredients) { if (distrib.slots.length == 0) continue; @@ -245,7 +242,6 @@ private List assignIngredients(List ing return assignedIngredients; } - @SuppressWarnings("unchecked") private void findInventoryQuantities(GuiContainer gui, List ingredStacks) { for (Slot slot : (List) gui.inventorySlots.inventorySlots) /* work out how much we have to go round */ { if (slot.getHasStack() && canMoveFrom(slot, gui)) { @@ -272,7 +268,6 @@ public boolean canMoveFrom(Slot slot, GuiContainer gui) { return slot.inventory instanceof InventoryPlayer; } - @SuppressWarnings("unchecked") public Slot[][] mapIngredSlots(GuiContainer gui, List ingredients) { Slot[][] recipeSlotList = new Slot[ingredients.size()][]; for (int i = 0; i < ingredients.size(); i++) /* identify slots */ { diff --git a/src/main/java/codechicken/nei/recipe/FuelRecipeHandler.java b/src/main/java/codechicken/nei/recipe/FuelRecipeHandler.java index 4fc3d62c6..254ad9bf2 100644 --- a/src/main/java/codechicken/nei/recipe/FuelRecipeHandler.java +++ b/src/main/java/codechicken/nei/recipe/FuelRecipeHandler.java @@ -51,7 +51,6 @@ public String getRecipeName() { return NEIClientUtils.translate("recipe.fuel"); } - @SuppressWarnings("unchecked") private void loadAllSmelting() { // Note: Not safe as written for parallelStream final Map smeltingRecipes = (Map) FurnaceRecipes.smelting() diff --git a/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java b/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java index 40cd5a648..a09bf4dcc 100644 --- a/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java +++ b/src/main/java/codechicken/nei/recipe/GuiOverlayButton.java @@ -9,7 +9,6 @@ import java.util.stream.Collectors; import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.GuiScreenEvent; @@ -223,8 +222,7 @@ public boolean hasOverlay() { private List presenceOverlay(List ingredients) { final List itemPresenceSlots = new ArrayList<>(); - @SuppressWarnings("unchecked") - final List invStacks = ((List) this.firstGui.inventorySlots.inventorySlots).stream() + final List invStacks = this.firstGui.inventorySlots.inventorySlots.stream() .filter( s -> s != null && s.getStack() != null && s.getStack().stackSize > 0 diff --git a/src/main/java/codechicken/nei/recipe/GuiRecipe.java b/src/main/java/codechicken/nei/recipe/GuiRecipe.java index 573bdc99a..021c2b69f 100644 --- a/src/main/java/codechicken/nei/recipe/GuiRecipe.java +++ b/src/main/java/codechicken/nei/recipe/GuiRecipe.java @@ -402,7 +402,6 @@ public void close() { } } - @SuppressWarnings("unchecked") public void initGui() { xSize = 176; ySize = Math.min(Math.max(height - 68, 166), 370); @@ -478,7 +477,6 @@ public void mouseReleased(int mouseX, int mouseY) { refreshPage(); } - @SuppressWarnings("unchecked") private void updateOverlayButtons() { final List indices = getRecipeIndices(); diff --git a/src/main/java/codechicken/nei/recipe/GuiRecipeTab.java b/src/main/java/codechicken/nei/recipe/GuiRecipeTab.java index a3d0d5cd8..bdd3fb01f 100644 --- a/src/main/java/codechicken/nei/recipe/GuiRecipeTab.java +++ b/src/main/java/codechicken/nei/recipe/GuiRecipeTab.java @@ -213,10 +213,9 @@ public static void loadHandlerInfo() { File handlerFile = NEIClientConfig.handlerFile; if (!handlerFile.exists()) { NEIClientConfig.logger.info("Config file doesn't exist, creating"); - try { + try (FileOutputStream fileOutputStream = new FileOutputStream(handlerFile.getAbsoluteFile())) { assert handlerUrl != null; ReadableByteChannel readableByteChannel = Channels.newChannel(handlerUrl.openStream()); - FileOutputStream fileOutputStream = new FileOutputStream(handlerFile.getAbsoluteFile()); FileChannel fileChannel = fileOutputStream.getChannel(); fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE); } catch (IOException e) { @@ -233,7 +232,7 @@ public static void loadHandlerInfo() { } } try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { - CSVParser csvParser = CSVFormat.EXCEL.withFirstRecordAsHeader().parse(reader); + CSVParser csvParser = CSVFormat.EXCEL.builder().setHeader().setSkipHeaderRecord(true).build().parse(reader); for (CSVRecord record : csvParser) { final String handler = record.get("handler"); final String modName = record.get("modName"); diff --git a/src/main/java/codechicken/nei/recipe/ItemsHistoryHandler.java b/src/main/java/codechicken/nei/recipe/ItemsHistoryHandler.java index d92b45a54..90f952a1a 100644 --- a/src/main/java/codechicken/nei/recipe/ItemsHistoryHandler.java +++ b/src/main/java/codechicken/nei/recipe/ItemsHistoryHandler.java @@ -70,12 +70,12 @@ public List handleItemTooltip(GuiRecipe gui, ItemStack stack, List gui, char keyChar, int keyCode, int recipe) { return false; } @Override - public boolean mouseClicked(GuiRecipe gui, int button, int recipe) { + public boolean mouseClicked(GuiRecipe gui, int button, int recipe) { return true; } diff --git a/src/main/java/codechicken/nei/recipe/RecipeCatalysts.java b/src/main/java/codechicken/nei/recipe/RecipeCatalysts.java index f1ccad70a..903d620cb 100644 --- a/src/main/java/codechicken/nei/recipe/RecipeCatalysts.java +++ b/src/main/java/codechicken/nei/recipe/RecipeCatalysts.java @@ -145,10 +145,9 @@ public static void loadCatalystInfo() { File catalystFile = NEIClientConfig.catalystFile; if (!catalystFile.exists()) { NEIClientConfig.logger.info("Config file doesn't exist, creating"); - try { + try (FileOutputStream fileOutputStream = new FileOutputStream(catalystFile.getAbsoluteFile())) { assert handlerUrl != null; ReadableByteChannel readableByteChannel = Channels.newChannel(handlerUrl.openStream()); - FileOutputStream fileOutputStream = new FileOutputStream(catalystFile.getAbsoluteFile()); FileChannel fileChannel = fileOutputStream.getChannel(); fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE); } catch (IOException e) { @@ -165,7 +164,7 @@ public static void loadCatalystInfo() { } } try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { - CSVParser csvParser = CSVFormat.EXCEL.withFirstRecordAsHeader().parse(reader); + CSVParser csvParser = CSVFormat.EXCEL.builder().setHeader().setSkipHeaderRecord(true).build().parse(reader); for (CSVRecord record : csvParser) { final String handler = record.get("handler"); final String modId = record.get("modId"); @@ -194,7 +193,7 @@ public static void loadCatalystInfo() { try { // gently handling copy&paste from handlers.csv Class clazz = Class.forName(handler); - Object object = clazz.newInstance(); + Object object = clazz.getConstructor().newInstance(); if (object instanceof IRecipeHandler) { if (forceClassName) { forceClassNameList.add(handler); diff --git a/src/main/java/codechicken/nei/recipe/StackInfo.java b/src/main/java/codechicken/nei/recipe/StackInfo.java index 1b0cf5bdd..26587ab8a 100644 --- a/src/main/java/codechicken/nei/recipe/StackInfo.java +++ b/src/main/java/codechicken/nei/recipe/StackInfo.java @@ -24,7 +24,9 @@ public class StackInfo { public static final ArrayList stackStringifyHandlers = new ArrayList<>(); private static final HashMap> guidfilters = new HashMap<>(); private static final ItemStackMap guidcache = new ItemStackMap<>(); - private static final LinkedHashMap fluidcache = new LinkedHashMap() { + private static final LinkedHashMap fluidcache = new LinkedHashMap<>() { + + private static final long serialVersionUID = 1042213947848622164L; @Override protected boolean removeEldestEntry(Map.Entry eldest) { diff --git a/src/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java b/src/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java index 8a80b49e8..6d546327f 100644 --- a/src/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java +++ b/src/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java @@ -594,7 +594,7 @@ public TemplateRecipeHandler newInstance() { // available // This will ideally have been pre-cached elsewhere and will be a NOOP findFuelsOnce(); - return getClass().newInstance(); + return getClass().getConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } diff --git a/src/main/java/codechicken/nei/util/NBTHelper.java b/src/main/java/codechicken/nei/util/NBTHelper.java index 0f2e28f96..331d25d36 100644 --- a/src/main/java/codechicken/nei/util/NBTHelper.java +++ b/src/main/java/codechicken/nei/util/NBTHelper.java @@ -1,7 +1,5 @@ package codechicken.nei.util; -import java.util.Set; - import javax.annotation.Nullable; import net.minecraft.nbt.NBTBase; @@ -34,8 +32,7 @@ public static boolean matchTag(@Nullable NBTBase template, @Nullable NBTBase tar private static boolean matchTagCompound(NBTTagCompound template, NBTTagCompound target) { if (template.tagMap.size() > target.tagMap.size()) return false; - // noinspection unchecked - for (String key : (Set) template.func_150296_c()) { + for (String key : template.func_150296_c()) { if (!matchTag(template.getTag(key), target.getTag(key))) return false; } diff --git a/src/main/java/codechicken/nei/util/NBTJson.java b/src/main/java/codechicken/nei/util/NBTJson.java index 8adcd4596..553cd352b 100644 --- a/src/main/java/codechicken/nei/util/NBTJson.java +++ b/src/main/java/codechicken/nei/util/NBTJson.java @@ -1,5 +1,6 @@ package codechicken.nei.util; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -216,8 +217,9 @@ protected static NBTBase restoreEmptyList(JsonObject obj) { if (obj.has("__custom_type")) { try { final String className = obj.get("__custom_type").getAsString(); - return (NBTBase) Class.forName(className).newInstance(); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException th) {} + return (NBTBase) Class.forName(className).getConstructor().newInstance(); + } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException + | SecurityException | ClassNotFoundException th) {} } return null; diff --git a/src/main/java/codechicken/nei/util/TextHistory.java b/src/main/java/codechicken/nei/util/TextHistory.java index eb804c8fc..4bc74d0e9 100644 --- a/src/main/java/codechicken/nei/util/TextHistory.java +++ b/src/main/java/codechicken/nei/util/TextHistory.java @@ -31,7 +31,7 @@ public boolean add(String currentText) { } public Optional get(Direction direction, String currentText) { - if (direction == direction.NEXT) { + if (direction == Direction.NEXT) { return getNext(currentText); } else { return getPrevious(currentText);