diff options
author | SciWhiz12 <arnoldnunag12@gmail.com> | 2021-05-15 12:03:09 +0800 |
---|---|---|
committer | SciWhiz12 <arnoldnunag12@gmail.com> | 2021-05-15 12:08:14 +0800 |
commit | 499ff87b31ad4714acfc7b160a89494547ad55a4 (patch) | |
tree | 8d3a8db2a742572761cd56d139816d724cafd836 | |
parent | bf76791ab0cfef81b5ae16736938913903fe676f (diff) | |
download | Artifactural-499ff87b31ad4714acfc7b160a89494547ad55a4.tar.gz Artifactural-499ff87b31ad4714acfc7b160a89494547ad55a4.tar.bz2 Artifactural-499ff87b31ad4714acfc7b160a89494547ad55a4.zip |
Remove ModifierAccess and java9 source set/project
-rw-r--r-- | build.gradle | 43 | ||||
-rw-r--r-- | settings.gradle | 3 | ||||
-rw-r--r-- | src/gradlecomp/java/net/minecraftforge/artifactural/gradle/ModifierAccess.java | 55 | ||||
-rw-r--r-- | src/java9/net/minecraftforge/artifactural/gradle/ModifierAccess.java | 57 |
4 files changed, 1 insertions, 157 deletions
diff --git a/build.gradle b/build.gradle index 6b06ff4..9fff891 100644 --- a/build.gradle +++ b/build.gradle @@ -15,7 +15,6 @@ sourceSets { api shared gradlecomp - java9 } repositories { @@ -35,8 +34,6 @@ configurations { } dependencies { - java9Implementation files(sourceSets.main.output.classesDirs) { builtBy compileJava } - sharedImplementation sourceSets.api.output gradlecompImplementation sourceSets.shared.output @@ -58,50 +55,10 @@ java { toolchain.languageVersion = JavaLanguageVersion.of(8) } -project(':artifactural9') { - apply plugin: 'java' - apply plugin: 'eclipse' - group = rootProject.group - java.toolchain.languageVersion = JavaLanguageVersion.of(9) - - sourceSets { - java9.java.srcDirs = [rootProject.file('src/java9').getAbsolutePath()] - } - - eclipse { - project { - name rootProject.name + '9' - linkedResource name: 'java9', type: '2', location: rootProject.file('src/java9').getAbsolutePath() - } - jdt { - sourceCompatibility = targetCompatibility = 9 - } - } - - tasks.withType(JavaCompile) { - options.encoding = 'utf-8' - javaCompiler = javaToolchains.compilerFor { - languageVersion = JavaLanguageVersion.of(9) - } - } -} - - - jar { from sourceSets.api.output from sourceSets.shared.output from(sourceSets.gradlecomp.output) - - into('META-INF/versions/9') { - from project(':artifactural9').sourceSets.java9.output - } - - manifest { - attributes( - 'Multi-Release': 'true' - ) - } } task sourcesJar(type: Jar, dependsOn: classes) { diff --git a/settings.gradle b/settings.gradle index c0a8d84..20e6c4f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1 @@ -rootProject.name = 'artifactural' -include 'artifactural9' +rootProject.name = 'artifactural'
\ No newline at end of file diff --git a/src/gradlecomp/java/net/minecraftforge/artifactural/gradle/ModifierAccess.java b/src/gradlecomp/java/net/minecraftforge/artifactural/gradle/ModifierAccess.java deleted file mode 100644 index fb68144..0000000 --- a/src/gradlecomp/java/net/minecraftforge/artifactural/gradle/ModifierAccess.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018-2021. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.artifactural.gradle; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -public class ModifierAccess { - private static Field MODIFIER_ACCESS = null; - private static boolean accessAttempted = false; - - public static synchronized boolean definalize(Field target) { - if ((target.getModifiers() & Modifier.FINAL) == 0) { - return true; - } - - if (MODIFIER_ACCESS == null && !accessAttempted) { - try { - final Field modifiers = Field.class.getDeclaredField("modifiers"); - modifiers.setAccessible(true); - MODIFIER_ACCESS = modifiers; - } catch (NoSuchFieldException e) { - throw new RuntimeException("Could not access Field.modifiers to definalize reflection object. Use Java 8, current version: " + System.getProperty("java.version"), e); - } - accessAttempted = true; - } - if (MODIFIER_ACCESS != null) { - try { - MODIFIER_ACCESS.setInt(target, target.getModifiers() & ~Modifier.FINAL); - } catch (IllegalArgumentException | IllegalAccessException e) { - throw new RuntimeException("Could not definalize field " + target.getDeclaringClass().getName() + "." + target.getName(), e); - } - return true; - } - return false; - } - -} diff --git a/src/java9/net/minecraftforge/artifactural/gradle/ModifierAccess.java b/src/java9/net/minecraftforge/artifactural/gradle/ModifierAccess.java deleted file mode 100644 index cf6f65f..0000000 --- a/src/java9/net/minecraftforge/artifactural/gradle/ModifierAccess.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Artifactural - * Copyright (c) 2018. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.artifactural.gradle; - -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandles.Lookup; -import java.lang.invoke.VarHandle; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -public class ModifierAccess { - private static VarHandle MODIFIER_ACCESS = null; - private static boolean accessAttempted = false; - - public static synchronized boolean definalize(Field target) { - if ((target.getModifiers() & Modifier.FINAL) == 0) { - return true; - } - - if (MODIFIER_ACCESS == null && !accessAttempted) { - try { - Lookup lookup = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup()); - MODIFIER_ACCESS = lookup.findVarHandle(Field.class, "modifiers", int.class); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new RuntimeException("Could not access Field.modifiers to definalize reflection object. Use Java 8, current version: " + System.getProperty("java.version"), e); - } - accessAttempted = true; - } - if (MODIFIER_ACCESS != null) { - try { - MODIFIER_ACCESS.set(target, target.getModifiers() & ~Modifier.FINAL); - } catch (IllegalArgumentException e) { - throw new RuntimeException("Could not definalize field " + target.getDeclaringClass().getName() + "." + target.getName(), e); - } - return true; - } - return false; - } - -} |