From 088e8bcf61b0b95528a7d9042d1678ab603377f2 Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Mon, 1 Mar 2021 23:40:24 +0000 Subject: [PATCH] Fix some deprecations --- .../asm/launch/platform/MixinConnectorManager.java | 2 +- .../org/spongepowered/asm/launch/platform/MixinContainer.java | 2 +- .../spongepowered/asm/launch/platform/MixinPlatformManager.java | 1 - src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java | 2 +- .../org/spongepowered/asm/mixin/transformer/PluginHandle.java | 2 +- .../org/spongepowered/asm/service/MixinServiceAbstract.java | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/spongepowered/asm/launch/platform/MixinConnectorManager.java b/src/main/java/org/spongepowered/asm/launch/platform/MixinConnectorManager.java index 36a26c5bc..01973cb6c 100644 --- a/src/main/java/org/spongepowered/asm/launch/platform/MixinConnectorManager.java +++ b/src/main/java/org/spongepowered/asm/launch/platform/MixinConnectorManager.java @@ -80,7 +80,7 @@ void loadConnectors() { } try { - IMixinConnector connector = connectorClass.newInstance(); + IMixinConnector connector = connectorClass.getDeclaredConstructor().newInstance(); this.connectors.add(connector); MixinConnectorManager.logger.info("Successfully loaded Mixin Connector [" + connectorClassName + "]"); } catch (ReflectiveOperationException ex) { diff --git a/src/main/java/org/spongepowered/asm/launch/platform/MixinContainer.java b/src/main/java/org/spongepowered/asm/launch/platform/MixinContainer.java index 6477b329d..91e10f227 100644 --- a/src/main/java/org/spongepowered/asm/launch/platform/MixinContainer.java +++ b/src/main/java/org/spongepowered/asm/launch/platform/MixinContainer.java @@ -70,7 +70,7 @@ public MixinContainer(MixinPlatformManager manager, IContainerHandle handle) { String simpleName = clazz.getSimpleName(); MixinContainer.logger.debug("Instancing new {} for {}", simpleName, this.handle); - IMixinPlatformAgent agent = clazz.newInstance(); + IMixinPlatformAgent agent = clazz.getDeclaredConstructor().newInstance(); AcceptResult acceptAction = agent.accept(manager, this.handle); if (acceptAction == AcceptResult.ACCEPTED) { diff --git a/src/main/java/org/spongepowered/asm/launch/platform/MixinPlatformManager.java b/src/main/java/org/spongepowered/asm/launch/platform/MixinPlatformManager.java index 2bb0634c3..b4e327eb9 100644 --- a/src/main/java/org/spongepowered/asm/launch/platform/MixinPlatformManager.java +++ b/src/main/java/org/spongepowered/asm/launch/platform/MixinPlatformManager.java @@ -297,7 +297,6 @@ final void addTokenProvider(String provider) { */ final void addConnector(String connectorClass) { this.connectors.addConnector(connectorClass); - } } diff --git a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java index 952888bf3..9a4095339 100644 --- a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java +++ b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java @@ -1070,7 +1070,7 @@ public MixinEnvironment registerTokenProviderClass(String providerName) { @SuppressWarnings("unchecked") Class providerClass = (Class)this.service.getClassProvider().findClass(providerName, true); - IEnvironmentTokenProvider provider = providerClass.newInstance(); + IEnvironmentTokenProvider provider = providerClass.getDeclaredConstructor().newInstance(); this.registerTokenProvider(provider); } catch (Throwable th) { MixinEnvironment.logger.error("Error instantiating " + providerName, th); diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/PluginHandle.java b/src/main/java/org/spongepowered/asm/mixin/transformer/PluginHandle.java index 31565a5f2..3a8ef03b6 100644 --- a/src/main/java/org/spongepowered/asm/mixin/transformer/PluginHandle.java +++ b/src/main/java/org/spongepowered/asm/mixin/transformer/PluginHandle.java @@ -94,7 +94,7 @@ enum CompatibilityMode { if (!Strings.isNullOrEmpty(pluginClassName)) { try { Class pluginClass = service.getClassProvider().findClass(pluginClassName, true); - plugin = (IMixinConfigPlugin)pluginClass.newInstance(); + plugin = (IMixinConfigPlugin)pluginClass.getDeclaredConstructor().newInstance(); } catch (Throwable th) { PluginHandle.logger.error("Error loading companion plugin class [{}] for mixin config [{}]. The plugin may be out of date: {}:{}", pluginClassName, parent, th.getClass().getSimpleName(), th.getMessage(), th); diff --git a/src/main/java/org/spongepowered/asm/service/MixinServiceAbstract.java b/src/main/java/org/spongepowered/asm/service/MixinServiceAbstract.java index b5c6a2465..1babae687 100644 --- a/src/main/java/org/spongepowered/asm/service/MixinServiceAbstract.java +++ b/src/main/java/org/spongepowered/asm/service/MixinServiceAbstract.java @@ -230,7 +230,7 @@ private List getServiceAgents() { try { @SuppressWarnings("unchecked") Class agentClass = (Class)this.getClassProvider().findClass(agentClassName, false); - IMixinPlatformAgent agent = agentClass.newInstance(); + IMixinPlatformAgent agent = agentClass.getDeclaredConstructor().newInstance(); if (agent instanceof IMixinPlatformServiceAgent) { this.serviceAgents.add((IMixinPlatformServiceAgent)agent); }