diff --git a/build.gradle b/build.gradle index 004882169c..0fd170d5d6 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ allprojects { gradle.projectsEvaluated { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:deprecation" + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } } diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java index e77964a5ca..923f781237 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/ScriptLoader.java @@ -56,7 +56,7 @@ public class ScriptLoader int numSwitches = in.readUnsignedByte(); if (numSwitches > 0) { - Map[] switches = new Map[numSwitches]; + @SuppressWarnings("unchecked") Map[] switches = new Map[numSwitches]; def.setSwitches(switches); for (int i = 0; i < numSwitches; ++i) diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/WorldMapLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/WorldMapLoader.java index 15ec975d6d..3ce0bf4c3d 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/WorldMapLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/WorldMapLoader.java @@ -36,6 +36,7 @@ import net.runelite.cache.region.Position; public class WorldMapLoader { + @SuppressWarnings("unchecked") public WorldMapDefinition load(byte[] b, int fileId) { WorldMapDefinition def = new WorldMapDefinition(); diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/Assembler.java b/cache/src/main/java/net/runelite/cache/script/assembler/Assembler.java index 643057911e..85c37c4048 100644 --- a/cache/src/main/java/net/runelite/cache/script/assembler/Assembler.java +++ b/cache/src/main/java/net/runelite/cache/script/assembler/Assembler.java @@ -29,7 +29,7 @@ import java.io.InputStream; import net.runelite.cache.definitions.ScriptDefinition; import net.runelite.cache.script.Instructions; import net.runelite.cache.script.assembler.rs2asmParser.ProgContext; -import org.antlr.v4.runtime.ANTLRInputStream; +import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.tree.ParseTreeWalker; @@ -45,7 +45,7 @@ public class Assembler public ScriptDefinition assemble(InputStream in) throws IOException { // Get our lexer - rs2asmLexer lexer = new rs2asmLexer(new ANTLRInputStream(in)); + rs2asmLexer lexer = new rs2asmLexer(CharStreams.fromStream(in)); LexerErrorListener errorListener = new LexerErrorListener(); lexer.addErrorListener(errorListener); diff --git a/cache/src/main/java/net/runelite/cache/script/assembler/ScriptWriter.java b/cache/src/main/java/net/runelite/cache/script/assembler/ScriptWriter.java index 2797d4a4c6..60ebfb3369 100644 --- a/cache/src/main/java/net/runelite/cache/script/assembler/ScriptWriter.java +++ b/cache/src/main/java/net/runelite/cache/script/assembler/ScriptWriter.java @@ -259,7 +259,7 @@ public class ScriptWriter extends rs2asmBaseListener } int index = 0; - Map[] maps = new Map[count]; + @SuppressWarnings("unchecked") Map[] maps = new Map[count]; for (LookupSwitch lswitch : switches) { if (lswitch == null) diff --git a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java index ec332656b2..a389e86139 100644 --- a/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java +++ b/cache/src/test/java/net/runelite/cache/SoundEffectsDumperTest.java @@ -24,6 +24,7 @@ */ package net.runelite.cache; +import com.google.common.io.FileWriteMode; import com.google.common.io.Files; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -81,7 +82,7 @@ public class SoundEffectsDumperTest SoundEffectTrackLoader setLoader = new SoundEffectTrackLoader(); SoundEffectTrackDefinition soundEffect = setLoader.load(contents); - Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()); + Files.asCharSink(new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(soundEffect)); ++count; } } diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java index 6edced53b5..d191be1799 100644 --- a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java @@ -66,6 +66,7 @@ public class InvokeDynamic extends Instruction implements InvokeInstruction } @Override + @SuppressWarnings("unchecked") public List getMethods() { return Collections.EMPTY_LIST; diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java index 12befd9f0b..ea4e2a8254 100644 --- a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java @@ -75,6 +75,7 @@ public class InvokeSpecial extends Instruction implements InvokeInstruction } @Override + @SuppressWarnings("unchecked") public List getMethods() { return myMethod != null ? Arrays.asList(myMethod) : Collections.EMPTY_LIST; diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java index d1420adba5..f992fb6621 100644 --- a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java @@ -83,6 +83,7 @@ public class InvokeStatic extends Instruction implements InvokeInstruction } @Override + @SuppressWarnings("unchecked") public List getMethods() { return myMethod != null ? Arrays.asList(myMethod) : Collections.EMPTY_LIST; diff --git a/deobfuscator/src/main/java/net/runelite/asm/execution/MethodContext.java b/deobfuscator/src/main/java/net/runelite/asm/execution/MethodContext.java index 0885df774b..e55d5e6aeb 100644 --- a/deobfuscator/src/main/java/net/runelite/asm/execution/MethodContext.java +++ b/deobfuscator/src/main/java/net/runelite/asm/execution/MethodContext.java @@ -70,6 +70,7 @@ public class MethodContext return contexts.get(i); } + @SuppressWarnings("unchecked") public Collection getInstructionContexts() { return (Collection) contexts.values(); diff --git a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/ModArith.java b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/ModArith.java index 294a323d58..f9d99a380e 100644 --- a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/ModArith.java +++ b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/ModArith.java @@ -167,7 +167,7 @@ public class ModArith implements Deobfuscator FieldInfo fieldInfo = getFieldInfo(fi.getMyField()); - List l = getInsInExpr(ctx, new HashSet(), false); + @SuppressWarnings("unchecked") List l = getInsInExpr(ctx, new HashSet(), false); boolean other = false; // check if this contains another field boolean getter = false, setter = false; for (InstructionContext i : l) @@ -272,7 +272,7 @@ public class ModArith implements Deobfuscator // parse the full multiplication expression to // get all associated constants - List insInExpr = getInsInExpr(ctx, new HashSet(), true); + @SuppressWarnings("unchecked") List insInExpr = getInsInExpr(ctx, new HashSet(), true); for (InstructionContext ctx2 : insInExpr) { diff --git a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantParameter.java b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantParameter.java index 735ea3c9a1..0970a9b3e1 100644 --- a/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantParameter.java +++ b/deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantParameter.java @@ -171,6 +171,7 @@ public class ConstantParameter implements Deobfuscator findConstantParameter(methods, ins); } + @SuppressWarnings("unchecked") private List findParametersForMethod(Method m) { Collection c = mparams.get(m); diff --git a/deobfuscator/src/test/java/net/runelite/runeloader/CheckExports.java b/deobfuscator/src/test/java/net/runelite/runeloader/CheckExports.java index ef586d7c5c..50a77f9a2d 100644 --- a/deobfuscator/src/test/java/net/runelite/runeloader/CheckExports.java +++ b/deobfuscator/src/test/java/net/runelite/runeloader/CheckExports.java @@ -52,7 +52,7 @@ public class CheckExports @Before public void before() throws MalformedURLException, ClassNotFoundException { - ClassLoader loader = new URLClassLoader(new URL[]{CLIENT.toURL()}); + ClassLoader loader = new URLClassLoader(new URL[]{CLIENT.toURI().toURL()}); Class c = loader.loadClass("net.runelite.rs.client.client"); classes.add(c); @@ -70,6 +70,7 @@ public class CheckExports } } + @SuppressWarnings("unchecked") private Class findClassWithObfuscatedName(String name) { for (Class c : classes) diff --git a/deobfuscator/src/test/java/net/runelite/runeloader/CheckMappings.java b/deobfuscator/src/test/java/net/runelite/runeloader/CheckMappings.java index 691067db31..06cd68abfc 100644 --- a/deobfuscator/src/test/java/net/runelite/runeloader/CheckMappings.java +++ b/deobfuscator/src/test/java/net/runelite/runeloader/CheckMappings.java @@ -53,7 +53,7 @@ public class CheckMappings @Before public void before() throws MalformedURLException, ClassNotFoundException { - ClassLoader loader = new URLClassLoader(new URL[]{CLIENT.toURL()}); + ClassLoader loader = new URLClassLoader(new URL[]{CLIENT.toURI().toURL()}); Class c = loader.loadClass("client"); classes.add(c); @@ -71,6 +71,7 @@ public class CheckMappings } } + @SuppressWarnings("unchecked") private Class findClassWithObfuscatedName(String name) { for (Class c : classes) diff --git a/http-api/src/main/java/net/runelite/http/api/animation/AnimationClient.java b/http-api/src/main/java/net/runelite/http/api/animation/AnimationClient.java index 7da50db2f4..fd79680edd 100644 --- a/http-api/src/main/java/net/runelite/http/api/animation/AnimationClient.java +++ b/http-api/src/main/java/net/runelite/http/api/animation/AnimationClient.java @@ -57,8 +57,9 @@ public class AnimationClient logger.debug("Built URI: {}", url); + RequestBody body = RequestBody.Companion.create(json, JSON); Request request = new Request.Builder() - .post(RequestBody.create(JSON, json)) + .post(body) .url(url) .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java index 36cf0f84c3..19c4d1f81f 100644 --- a/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java +++ b/http-api/src/main/java/net/runelite/http/api/chat/ChatClient.java @@ -38,6 +38,8 @@ import okhttp3.Response; public class ChatClient { + + private static final RequestBody body = RequestBody.Companion.create(new byte[0], null); private static final Predicate LAYOUT_VALIDATOR = Pattern .compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+") .asPredicate(); @@ -52,8 +54,9 @@ public class ChatClient .addQueryParameter("kc", Integer.toString(kc)) .build(); + Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -96,7 +99,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -141,7 +144,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -190,7 +193,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -233,7 +236,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -280,7 +283,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -303,7 +306,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -424,7 +427,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); @@ -453,7 +456,7 @@ public class ChatClient .build(); Request request = new Request.Builder() - .post(RequestBody.create(null, new byte[0])) + .post(body) .url(url) .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/discord/DiscordClient.java b/http-api/src/main/java/net/runelite/http/api/discord/DiscordClient.java index 4f536b68ff..63a41be11d 100644 --- a/http-api/src/main/java/net/runelite/http/api/discord/DiscordClient.java +++ b/http-api/src/main/java/net/runelite/http/api/discord/DiscordClient.java @@ -52,8 +52,9 @@ public class DiscordClient private void message(HttpUrl url, DiscordMessage discordMessage, int retryAttempt, int maxAttempts) { + RequestBody body = RequestBody.Companion.create(gson.toJson(discordMessage), JSON); Request request = new Request.Builder() - .post(RequestBody.create(JSON, gson.toJson(discordMessage))) + .post(body) .url(url) .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/examine/ExamineClient.java b/http-api/src/main/java/net/runelite/http/api/examine/ExamineClient.java index 5997799c2e..43096a61e1 100644 --- a/http-api/src/main/java/net/runelite/http/api/examine/ExamineClient.java +++ b/http-api/src/main/java/net/runelite/http/api/examine/ExamineClient.java @@ -67,9 +67,10 @@ public class ExamineClient logger.debug("Built URI: {}", url); + RequestBody body = RequestBody.Companion.create(text, TEXT); Request request = new Request.Builder() .url(url) - .post(RequestBody.create(TEXT, text)) + .post(body) .build(); RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() diff --git a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java index a1b97bc390..f016468e92 100644 --- a/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java +++ b/http-api/src/main/java/net/runelite/http/api/ge/GrandExchangeClient.java @@ -53,9 +53,10 @@ public class GrandExchangeClient .addPathSegment("ge") .build(); + RequestBody body = RequestBody.Companion.create(GSON.toJson(grandExchangeTrade), JSON); Request request = new Request.Builder() .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) - .post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade))) + .post(body) .url(url) .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java index d250620905..ab7307b186 100644 --- a/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java +++ b/http-api/src/main/java/net/runelite/http/api/loottracker/LootTrackerClient.java @@ -59,9 +59,10 @@ public class LootTrackerClient .addPathSegment("loottracker") .build(); + RequestBody body = RequestBody.Companion.create(GSON.toJson(lootRecord), JSON); Request request = new Request.Builder() .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()) - .post(RequestBody.create(JSON, GSON.toJson(lootRecord))) + .post(body) .url(url) .build(); diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java index d2bf09218c..c5d5b4c89a 100644 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java +++ b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java @@ -57,8 +57,9 @@ public class XteaClient logger.debug("Built URI: {}", url); + RequestBody body = RequestBody.Companion.create(json, JSON); Request request = new Request.Builder() - .post(RequestBody.create(JSON, json)) + .post(body) .url(url) .build(); diff --git a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java index 704e4f9cb2..841eb28eeb 100644 --- a/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java +++ b/http-service/src/main/java/net/runelite/http/service/SpringWebMvcConfigurer.java @@ -33,11 +33,11 @@ import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @EnableWebMvc -public class SpringWebMvcConfigurer extends WebMvcConfigurerAdapter +public class SpringWebMvcConfigurer implements WebMvcConfigurer { /** * Configure .js as application/json to trick Cloudflare into caching json responses diff --git a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java index 505f5dca30..eaeebc8b82 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java +++ b/runelite-client/src/main/java/net/runelite/client/config/ConfigManager.java @@ -43,7 +43,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.nio.channels.FileLock; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; @@ -108,7 +108,7 @@ public class ConfigManager final Properties properties = new Properties(); try (FileInputStream in = new FileInputStream(propertiesFile)) { - properties.load(new InputStreamReader(in, Charset.forName("UTF-8"))); + properties.load(new InputStreamReader(in, StandardCharsets.UTF_8)); } catch (Exception e) { @@ -116,7 +116,7 @@ public class ConfigManager return; } - final Map copy = (Map) ImmutableMap.copyOf(this.properties); + @SuppressWarnings("unchecked") final Map copy = (Map) ImmutableMap.copyOf(this.properties); copy.forEach((groupAndKey, value) -> { if (!properties.containsKey(groupAndKey)) @@ -160,7 +160,7 @@ public class ConfigManager try (FileInputStream in = new FileInputStream(SETTINGS_FILE)) { - properties.load(new InputStreamReader(in, Charset.forName("UTF-8"))); + properties.load(new InputStreamReader(in, StandardCharsets.UTF_8)); } catch (FileNotFoundException ex) { @@ -174,7 +174,7 @@ public class ConfigManager try { - Map copy = (Map) ImmutableMap.copyOf(properties); + @SuppressWarnings("unchecked") Map copy = (Map) ImmutableMap.copyOf(properties); copy.forEach((groupAndKey, value) -> { final String[] split = groupAndKey.split("\\.", 2); @@ -212,7 +212,7 @@ public class ConfigManager try { - properties.store(new OutputStreamWriter(out, Charset.forName("UTF-8")), "RuneLite configuration"); + properties.store(new OutputStreamWriter(out, StandardCharsets.UTF_8), "RuneLite configuration"); } finally { @@ -235,6 +235,7 @@ public class ConfigManager eventBus.post(ConfigChanged.class, configChanged); } + @SuppressWarnings("unchecked") public T getConfig(Class clazz) { if (!Modifier.isPublic(clazz.getModifiers())) @@ -263,6 +264,7 @@ public class ConfigManager return properties.getProperty(propertyKey); } + @SuppressWarnings("unchecked") public T getConfiguration(String groupName, String key, Class clazz) { String value = getConfiguration(groupName, key); @@ -464,6 +466,7 @@ public class ConfigManager } } + @SuppressWarnings("unchecked") static Object stringToObject(String str, Class type) { if (type == boolean.class || type == Boolean.class) @@ -633,22 +636,34 @@ public class ConfigManager newestFile = STANDARD_SETTINGS_FILE; - for (File profileDir : PROFILES_DIR.listFiles()) - { - if (!profileDir.isDirectory()) - { - continue; - } + File[] profileDirFiles = PROFILES_DIR.listFiles(); - for (File settings : profileDir.listFiles()) + if (profileDirFiles != null) + { + for (File profileDir : profileDirFiles) { - if (!settings.getName().equals(STANDARD_SETTINGS_FILE_NAME) || - settings.lastModified() < newestFile.lastModified()) + if (!profileDir.isDirectory()) { continue; } - newestFile = settings; + File[] settingsFiles = profileDir.listFiles(); + + if (settingsFiles == null) + { + continue; + } + + for (File settings : settingsFiles) + { + if (!settings.getName().equals(STANDARD_SETTINGS_FILE_NAME) || + settings.lastModified() < newestFile.lastModified()) + { + continue; + } + + newestFile = settings; + } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java index d3627aabe4..48a99e1629 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java @@ -118,6 +118,9 @@ public class PluginManager this.configManager = configManager; this.executor = executor; this.sceneTileManager = sceneTileManager; + + eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen); + eventBus.subscribe(SessionClose.class, this, this::onSessionClose); } public void watch() @@ -171,7 +174,7 @@ public class PluginManager return null; } - public List getPluginConfigProxies() + private List getPluginConfigProxies() { List injectors = new ArrayList<>(); injectors.add(RuneLite.getInjector()); @@ -224,6 +227,7 @@ public class PluginManager } } + @SuppressWarnings("unchecked") List scanAndInstantiate(ClassLoader classLoader, String packageName) throws IOException { MutableGraph> graph = GraphBuilder @@ -266,7 +270,7 @@ public class PluginManager continue; } - Class pluginClass = (Class) clazz; + @SuppressWarnings("unchecked") Class pluginClass = (Class) clazz; graph.addNode(pluginClass); } @@ -428,13 +432,14 @@ public class PluginManager if (value != null) { - return Boolean.valueOf(value); + return Boolean.parseBoolean(value); } final PluginDescriptor pluginDescriptor = plugin.getClass().getAnnotation(PluginDescriptor.class); return pluginDescriptor == null || pluginDescriptor.enabledByDefault(); } + @SuppressWarnings("unchecked") private Plugin instantiate(List scannedPlugins, Class clazz) throws PluginInstantiationException { PluginDependency[] pluginDependencies = clazz.getAnnotationsByType(PluginDependency.class); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java index c1da955f6a..a7943367d8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/clanchat/ClanChatPlugin.java @@ -119,6 +119,7 @@ public class ClanChatPlugin extends Plugin private List chats = new ArrayList<>(); + @SuppressWarnings("unchecked") public static CopyOnWriteArrayList getClanMembers() { return (CopyOnWriteArrayList) clanMembers.clone(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 0273fb6044..4388c08b9b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -526,6 +526,7 @@ public class ConfigPanel extends PluginPanel openGroupConfigPanel(listItem, config, cd, false); } + @SuppressWarnings("unchecked") private void openGroupConfigPanel(PluginListItem listItem, Config config, ConfigDescriptor cd, boolean refresh) { showingPluginList = false; @@ -657,10 +658,10 @@ public class ConfigPanel extends PluginPanel } else if (cid2.getType().isEnum()) { - Class type = (Class) cid2.getType(); + @SuppressWarnings("unchecked") Class type = (Class) cid2.getType(); try { - Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName())); + @SuppressWarnings("unchecked") Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName())); if (!cid.getItem().unhideValue().equals("")) { show = selectedItem.toString().equals(cid.getItem().unhideValue()); @@ -1307,7 +1308,7 @@ public class ConfigPanel extends PluginPanel return new Dimension(PANEL_WIDTH + SCROLLBAR_WIDTH, super.getPreferredSize().height); } - private class FixedWidthPanel extends JPanel + private static class FixedWidthPanel extends JPanel { @Override public Dimension getPreferredSize() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java index a4b21cb94d..6c8c26054b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/WidgetField.java @@ -67,6 +67,7 @@ public class WidgetField return MessageFormatter.format("{}", value).getMessage(); } + @SuppressWarnings("unchecked") void setValue(Widget widget, Object inValue) { Object value = null; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java index 81e73f59fd..b066d7b3ae 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java @@ -190,6 +190,7 @@ public class GroundMarkerPlugin extends Plugin * @param points * @return */ + @SuppressWarnings("unchecked") private Collection translateToWorld(Collection points) { if (points.isEmpty()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 68e9278fe6..88f37516b9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -714,7 +714,7 @@ public class LootTrackerPlugin extends Plugin break; } - int killCount = Integer.valueOf(m.group(1)); + int killCount = Integer.parseInt(m.group(1)); killCountMap.put(eventType.toUpperCase(), killCount); return; } @@ -755,11 +755,12 @@ public class LootTrackerPlugin extends Plugin if (boss.find()) { String bossName = boss.group(1); - int killCount = Integer.valueOf(boss.group(2)); + int killCount = Integer.parseInt(boss.group(2)); killCountMap.put(bossName.toUpperCase(), killCount); } } + @SuppressWarnings("unchecked") public void onItemContainerChanged(ItemContainerChanged event) { if (pvpDeath && RESPAWN_REGIONS.contains(client.getLocalPlayer().getWorldLocation().getRegionID())) @@ -849,7 +850,7 @@ public class LootTrackerPlugin extends Plugin } } - public void deleteLocalRecords() + void deleteLocalRecords() { try { @@ -960,7 +961,7 @@ public class LootTrackerPlugin extends Plugin * @param name - The String name of the record to toggle the hidden status of * @param ignore - true to ignore, false to remove */ - public void toggleNPC(String name, boolean ignore) + void toggleNPC(String name, boolean ignore) { final Set ignoredNPCSet = new HashSet<>(ignoredNPCs); if (ignore) @@ -981,7 +982,7 @@ public class LootTrackerPlugin extends Plugin * @param name - The String of the name to check * @return - true if it is being ignored, false otherwise */ - public boolean isIgnoredNPC(String name) + boolean isIgnoredNPC(String name) { return ignoredNPCs.contains(name); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java index cf7a0ef3da..ae21c93190 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/multiindicators/MapLocations.java @@ -35,11 +35,17 @@ import net.runelite.api.Constants; public class MapLocations { + @SuppressWarnings("unchecked") private static final List[] MULTICOMBAT = new List[Constants.MAX_Z]; + @SuppressWarnings("unchecked") private static final List[] NOT_MULTICOMBAT = new List[Constants.MAX_Z]; + @SuppressWarnings("unchecked") private static final List[] ROUGH_WILDERNESS = new List[Constants.MAX_Z]; + @SuppressWarnings("unchecked") private static final List[] WILDERNESS_LEVEL_LINES = new List[Constants.MAX_Z]; + @SuppressWarnings("unchecked") private static final List[] DEADMAN_SAFE_ZONES = new List[Constants.MAX_Z]; + @SuppressWarnings("unchecked") private static final List[] PVP_WORLD_SAFE_ZONES = new List[Constants.MAX_Z]; private static Area getArea(List shapes) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java index 421341e75f..234e79ab73 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/screenshot/ScreenshotPlugin.java @@ -824,10 +824,11 @@ public class ScreenshotPlugin extends Plugin Request request = null; if (IMGUR_IMAGE_UPLOAD_URL != null) { + RequestBody body = RequestBody.Companion.create(json, JSON); request = new Request.Builder() .url(IMGUR_IMAGE_UPLOAD_URL) .addHeader("Authorization", "Client-ID " + IMGUR_CLIENT_ID) - .post(RequestBody.create(JSON, json)) + .post(body) .build(); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java index c111789377..f0f594def6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/banked/components/ModifyPanel.java @@ -219,6 +219,7 @@ public class ModifyPanel extends JPanel labelContainer.repaint(); } + @SuppressWarnings("unchecked") private void updateAdjustContainer() { adjustContainer.removeAll(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java index 1b99c8549c..8513a87814 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java @@ -76,13 +76,13 @@ import net.runelite.client.eventbus.EventBus; import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.plugins.worldhopper.ping.Ping; import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.NavigationButton; import net.runelite.client.util.ExecutorServiceExceptionLogger; import net.runelite.client.util.HotkeyListener; import net.runelite.client.util.Text; import net.runelite.client.util.WorldUtil; +import net.runelite.client.util.ping.Ping; import net.runelite.http.api.worlds.World; import net.runelite.http.api.worlds.WorldClient; import net.runelite.http.api.worlds.WorldResult; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IPHlpAPI.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IPHlpAPI.java deleted file mode 100644 index 109ea36f77..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IPHlpAPI.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.worldhopper.ping; - -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.Pointer; - -interface IPHlpAPI extends Library -{ - IPHlpAPI INSTANCE = Native.loadLibrary("IPHlpAPI", IPHlpAPI.class); - - Pointer IcmpCreateFile(); - - boolean IcmpCloseHandle(Pointer handle); - - int IcmpSendEcho(Pointer IcmpHandle, int DestinationAddress, Pointer RequestData, short RequestSize, Pointer RequestOptions, IcmpEchoReply ReplyBuffer, int ReplySize, int Timeout); -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IcmpEchoReply.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IcmpEchoReply.java deleted file mode 100644 index 235ae136d8..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/IcmpEchoReply.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.worldhopper.ping; - -import com.sun.jna.Native; -import com.sun.jna.Pointer; -import com.sun.jna.Structure; -import com.sun.jna.platform.win32.WinDef; -import java.util.Arrays; -import java.util.List; - -public class IcmpEchoReply extends Structure -{ - private static final int IP_OPTION_INFO_SIZE = 1 + 1 + 1 + 1 + (Native.POINTER_SIZE == 8 ? 12 : 4); // on 64bit vms add 4 byte padding - public static final int SIZE = 4 + 4 + 4 + 2 + 2 + Native.POINTER_SIZE + IP_OPTION_INFO_SIZE; - - public WinDef.ULONG address; - public WinDef.ULONG status; - public WinDef.ULONG roundTripTime; - public WinDef.USHORT dataSize; - public WinDef.USHORT reserved; - public WinDef.PVOID data; - public WinDef.UCHAR ttl; - public WinDef.UCHAR tos; - public WinDef.UCHAR flags; - public WinDef.UCHAR optionsSize; - public WinDef.PVOID optionsData; - - IcmpEchoReply(final Pointer p) - { - super(p); - } - - @Override - protected List getFieldOrder() - { - return Arrays.asList("address", "status", "roundTripTime", "dataSize", "reserved", "data", "ttl", "tos", "flags", "optionsSize", "optionsData"); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java deleted file mode 100644 index 95c4aa51c7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/ping/Ping.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, Adam - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.plugins.worldhopper.ping; - -import com.sun.jna.Memory; -import com.sun.jna.Pointer; -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.UnknownHostException; -import lombok.extern.slf4j.Slf4j; -import net.runelite.client.util.OSType; -import net.runelite.http.api.worlds.World; - -@Slf4j -public class Ping -{ - private static final String RUNELITE_PING = "RuneLitePing"; - - private static final int TIMEOUT = 2000; - private static final int PORT = 43594; - - public static int ping(World world) - { - try - { - if (OSType.getOSType() == OSType.Windows) - { - return windowsPing(world); - } - return tcpPing(world); - } - catch (IOException ex) - { - log.warn("error pinging", ex); - return -1; - } - } - - private static int windowsPing(World world) throws UnknownHostException - { - IPHlpAPI ipHlpAPI = IPHlpAPI.INSTANCE; - Pointer ptr = ipHlpAPI.IcmpCreateFile(); - InetAddress inetAddress = InetAddress.getByName(world.getAddress()); - byte[] address = inetAddress.getAddress(); - String dataStr = RUNELITE_PING; - int dataLength = dataStr.length() + 1; - Pointer data = new Memory(dataLength); - data.setString(0L, dataStr); - IcmpEchoReply icmpEchoReply = new IcmpEchoReply(new Memory(IcmpEchoReply.SIZE + dataLength)); - assert icmpEchoReply.size() == IcmpEchoReply.SIZE; - int packed = (address[0] & 0xff) | ((address[1] & 0xff) << 8) | ((address[2] & 0xff) << 16) | ((address[3] & 0xff) << 24); - int ret = ipHlpAPI.IcmpSendEcho(ptr, packed, data, (short) (dataLength), Pointer.NULL, icmpEchoReply, IcmpEchoReply.SIZE + dataLength, TIMEOUT); - if (ret != 1) - { - ipHlpAPI.IcmpCloseHandle(ptr); - return -1; - } - - int rtt = Math.toIntExact(icmpEchoReply.roundTripTime.longValue()); - ipHlpAPI.IcmpCloseHandle(ptr); - - return rtt; - } - - private static int tcpPing(World world) throws IOException - { - try (Socket socket = new Socket()) - { - socket.setSoTimeout(TIMEOUT); - InetAddress inetAddress = InetAddress.getByName(world.getAddress()); - long start = System.nanoTime(); - socket.connect(new InetSocketAddress(inetAddress, PORT)); - long end = System.nanoTime(); - return (int) ((end - start) / 1000000L); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/util/DeferredEventBus.java b/runelite-client/src/main/java/net/runelite/client/util/DeferredEventBus.java index 59b2111b84..9fd82a51c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/DeferredEventBus.java +++ b/runelite-client/src/main/java/net/runelite/client/util/DeferredEventBus.java @@ -51,6 +51,7 @@ public class DeferredEventBus extends EventBus pendingEvents.add(new ImmutablePair<>(eventClass, event)); } + @SuppressWarnings("unchecked") public void replay() { int size = pendingEvents.size(); diff --git a/runelite-client/src/main/java/net/runelite/client/util/ping/IPHlpAPI.java b/runelite-client/src/main/java/net/runelite/client/util/ping/IPHlpAPI.java index f92a2b7142..34012ece06 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/ping/IPHlpAPI.java +++ b/runelite-client/src/main/java/net/runelite/client/util/ping/IPHlpAPI.java @@ -30,7 +30,7 @@ import com.sun.jna.Pointer; interface IPHlpAPI extends Library { - IPHlpAPI INSTANCE = Native.loadLibrary("IPHlpAPI", IPHlpAPI.class); + IPHlpAPI INSTANCE = Native.load("IPHlpAPI", IPHlpAPI.class); Pointer IcmpCreateFile(); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index c7570fc2ce..d9776b819a 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1410,7 +1410,7 @@ public abstract class RSClientMixin implements RSClient } // Get the message node which was added - Map chatLineMap = client.getChatLineMap(); + @SuppressWarnings("unchecked") Map chatLineMap = client.getChatLineMap(); RSChatChannel chatLineBuffer = chatLineMap.get(type); MessageNode messageNode = chatLineBuffer.getLines()[0]; @@ -1431,7 +1431,7 @@ public abstract class RSClientMixin implements RSClient public static void renderWidgetLayer(Widget[] widgets, int parentId, int minX, int minY, int maxX, int maxY, int x, int y, int var8) { Callbacks callbacks = client.getCallbacks(); - HashTable componentTable = client.getComponentTable(); + @SuppressWarnings("unchecked") HashTable componentTable = client.getComponentTable(); for (Widget rlWidget : widgets) { diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index 543bdf5c48..8135716926 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -143,7 +143,7 @@ public abstract class RSWidgetMixin implements RSWidget // parent id potentially incorrect // check the parent in the component table - HashTable componentTable = client.getComponentTable(); + @SuppressWarnings("unchecked") HashTable componentTable = client.getComponentTable(); WidgetNode widgetNode = componentTable.get(parentId); if (widgetNode == null || widgetNode.getId() != TO_GROUP(id)) { @@ -380,7 +380,7 @@ public abstract class RSWidgetMixin implements RSWidget return new Widget[0]; } - HashTable componentTable = client.getComponentTable(); + @SuppressWarnings("unchecked") HashTable componentTable = client.getComponentTable(); WidgetNode wn = componentTable.get(getId()); if (wn == null)