Cursed Java 17 compatibility

This commit is contained in:
RaphiMC 2023-01-12 18:48:45 +01:00
parent 86fcd183fd
commit 5395ec40c1
2 changed files with 49 additions and 3 deletions

View file

@ -4,10 +4,17 @@ plugins {
id "net.kyori.blossom" version "1.3.1" id "net.kyori.blossom" version "1.3.1"
} }
sourceSets {
java17compat
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava.sourceCompatibility = JavaVersion.VERSION_1_8 [compileJava, compileTestJava, compileJava17compatJava].each {
compileJava.targetCompatibility = JavaVersion.VERSION_1_8 it.options.encoding = "UTF-8"
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8" it.sourceCompatibility = JavaVersion.VERSION_1_8
it.targetCompatibility = JavaVersion.VERSION_1_8
}
javadoc.options.encoding = "UTF-8"
group = project.maven_group group = project.maven_group
archivesBaseName = project.maven_name archivesBaseName = project.maven_name
@ -50,6 +57,8 @@ repositories {
} }
dependencies { dependencies {
compileOnly sourceSets.java17compat.output
include "com.viaversion:viaversion:4.5.2-SNAPSHOT" include "com.viaversion:viaversion:4.5.2-SNAPSHOT"
include("com.viaversion:viabackwards-common:4.5.2-SNAPSHOT") { include("com.viaversion:viabackwards-common:4.5.2-SNAPSHOT") {
exclude group: "com.viaversion", module: "viaversion" exclude group: "com.viaversion", module: "viaversion"

View file

@ -0,0 +1,37 @@
/*
* This file is part of ViaProxy - https://github.com/RaphiMC/ViaProxy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package java.lang;
/**
* Dummy class to make IntelliJ able to access records in Java 8 code
*/
public abstract class Record {
protected Record() {
}
@Override
public abstract boolean equals(Object obj);
@Override
public abstract int hashCode();
@Override
public abstract String toString();
}