mirror of https://github.com/PaperMC/Paper.git
move test data to its own sourceset
This commit is contained in:
parent
ef904be40d
commit
4fa3ae8f31
|
@ -11,6 +11,8 @@ extensions.configure(PaperweightSourceGeneratorExt::class) {
|
|||
atFile.set(projectDir.toPath().resolve("wideners.at").toFile())
|
||||
}
|
||||
|
||||
val testData = sourceSets.create("testData")
|
||||
|
||||
dependencies {
|
||||
implementation("com.squareup:javapoet:1.13.0")
|
||||
implementation(project(":paper-api"))
|
||||
|
@ -18,6 +20,7 @@ dependencies {
|
|||
implementation("org.jetbrains:annotations:24.0.1")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
testImplementation(testData.output)
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("generate") {
|
||||
|
@ -40,6 +43,7 @@ tasks {
|
|||
// excludeTags("parser") // comment this line while working on parser related things
|
||||
}
|
||||
}
|
||||
inputs.files(testData.output.files)
|
||||
}
|
||||
|
||||
compileTestJava {
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
|
||||
public class NearScopeClass{ // << 27
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
|
||||
public class NewlineScopedClass
|
||||
{ // << 0
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;import org.bukkit.NamespacedKey; import org.bukkit.Statistic.Type;import org.bukkit.*;/**/import static org.bukkit.Statistic.ANIMALS_BRED; /* */ import static org.bukkit.Material.*;public class FancyInlinedImportType {
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;
|
||||
|
||||
import org. bukkit.NamespacedKey ;
|
||||
import org.bukkit .Statistic. Type;
|
||||
import org .bukkit.* ;
|
||||
import static org. bukkit. Statistic.ANIMALS_BRED ;
|
||||
import static org.bukkit. Material. * ;
|
||||
|
||||
public class FancySpaceImportType {
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;
|
||||
|
||||
import org.bukkit.NamespacedKey; // root class import
|
||||
import org.bukkit.Statistic.Type; // inner class import (directly referenced)
|
||||
import org.bukkit.*; // star import (whole package + one level)
|
||||
import static org.bukkit.Statistic.ANIMALS_BRED; // static import
|
||||
import static org.bukkit.Material.*; // static star import
|
||||
|
||||
public class StandardImportType {
|
||||
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
import org.bukkit.*;
|
||||
import static org.bukkit.Statistic.*;
|
||||
|
||||
public class GlobalImportType {
|
||||
{
|
||||
var a = Material.VINE;
|
||||
var b = ARMOR_CLEANED;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import static org.bukkit.Statistic.ARMOR_CLEANED;
|
||||
import static org.bukkit.Statistic.valueOf;
|
||||
|
||||
public class RegularImportType {
|
||||
{
|
||||
var a = Material.VINE;
|
||||
var b = ARMOR_CLEANED;
|
||||
valueOf(b.name());
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.one.OneDepthClass.*;
|
||||
|
||||
public class RemoteGlobalInnerClassImportType {
|
||||
{
|
||||
var a = NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.one.OneDepthClass.NonStaticClass;
|
||||
import static io.papermc.generator.rewriter.data.sample.parser.name.one.OneDepthClass.StaticClass;
|
||||
|
||||
public class RemoteInnerClassImportType {
|
||||
{
|
||||
var a = NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
import static io.papermc.generator.rewriter.data.sample.parser.name.one.OneDepthClass.*;
|
||||
|
||||
public class RemoteStaticGlobalInnerClassImportType {
|
||||
{
|
||||
var a = io.papermc.generator.rewriter.data.sample.parser.name.one.OneDepthClass.NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
|
||||
public class SamePackageClass {
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
package io.papermc.generator.rewriter.parser;
|
||||
|
||||
import imports.FancyCommentImportType;
|
||||
import imports.FancyInlinedImportType;
|
||||
import imports.FancyNewlineImportType;
|
||||
import imports.FancySpaceImportType;
|
||||
import imports.MixedCommentImportType;
|
||||
import imports.StandardImportType;
|
||||
import io.papermc.generator.rewriter.ClassNamed;
|
||||
import io.papermc.generator.rewriter.context.ImportTypeCollector;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.FancyInlinedImportType;
|
||||
import io.papermc.generator.rewriter.data.yaml.ImportMapping;
|
||||
import io.papermc.generator.rewriter.data.yaml.ImportSet;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.FancyCommentImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.FancyNewlineImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.FancySpaceImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.MixedCommentImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.imports.StandardImportType;
|
||||
import io.papermc.generator.rewriter.data.yaml.YamlMappingConverter;
|
||||
import io.papermc.generator.rewriter.yaml.ImportMapping;
|
||||
import io.papermc.generator.rewriter.yaml.ImportSet;
|
||||
import io.papermc.generator.rewriter.yaml.YamlMappingConverter;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.converter.ConvertWith;
|
||||
|
@ -29,7 +29,7 @@ public class ImportCollectTest extends ParserTest {
|
|||
return Arguments.of(
|
||||
CONTAINER.resolve(sampleClass.getCanonicalName().replace('.', '/') + ".java"),
|
||||
sampleClass,
|
||||
"parser/expected/imports/%s.yaml".formatted(sampleClass.getSimpleName())
|
||||
"expected/imports/%s.yaml".formatted(sampleClass.getSimpleName())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class ImportCollectTest extends ParserTest {
|
|||
private static class ImportMappingConverter extends YamlMappingConverter<ImportMapping> {
|
||||
|
||||
protected ImportMappingConverter() {
|
||||
super(ImportMapping.class, null);
|
||||
super(ImportMapping.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package io.papermc.generator.rewriter.parser;
|
||||
|
||||
import area.AnnotationClass;
|
||||
import area.AnnotationPresentClass;
|
||||
import area.AnnotationTrapClass;
|
||||
import area.FancyNewlineAnnotationPresentClass;
|
||||
import area.FancyScopeClass;
|
||||
import area.FancyScopeClass2;
|
||||
import area.MixedAnnotationPresentClass;
|
||||
import area.NearScopeClass;
|
||||
import area.NewlineScopedClass;
|
||||
import area.SimpleTrapClass;
|
||||
import io.papermc.generator.rewriter.ClassNamed;
|
||||
import io.papermc.generator.rewriter.context.ImportTypeCollector;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.AnnotationClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.AnnotationPresentClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.AnnotationTrapClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.FancyNewlineAnnotationPresentClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.FancyScopeClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.FancyScopeClass2;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.MixedAnnotationPresentClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.NearScopeClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.NewlineScopedClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.area.SimpleTrapClass;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.function.Consumer;
|
|||
@Tag("parser")
|
||||
public class ParserTest {
|
||||
|
||||
protected static final Path CONTAINER = Path.of(System.getProperty("user.dir"), "src/test/java");
|
||||
protected static final Path CONTAINER = Path.of(System.getProperty("user.dir"), "src/testData/java");
|
||||
|
||||
protected void parseFile(Path path, ImportCollector importCollector) throws IOException {
|
||||
parseFile(path, importCollector, null, null);
|
||||
|
|
|
@ -2,21 +2,21 @@ package io.papermc.generator.rewriter.parser;
|
|||
|
||||
import io.papermc.generator.rewriter.ClassNamed;
|
||||
import io.papermc.generator.rewriter.context.ImportTypeCollector;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.GlobalImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.PackageClassImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.RegularImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.RemoteGlobalInnerClassImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.RemoteInnerClassImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.RemoteStaticGlobalInnerClassImportType;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.SamePackageClass;
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.SelfInnerClass;
|
||||
import io.papermc.generator.rewriter.data.yaml.ImportShortNameMapping;
|
||||
import io.papermc.generator.rewriter.data.yaml.YamlMappingConverter;
|
||||
import io.papermc.generator.rewriter.yaml.ImportShortNameMapping;
|
||||
import io.papermc.generator.rewriter.yaml.YamlMappingConverter;
|
||||
import io.papermc.generator.utils.ClassHelper;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
import name.GlobalImportType;
|
||||
import name.PackageClassImportType;
|
||||
import name.RegularImportType;
|
||||
import name.RemoteGlobalInnerClassImportType;
|
||||
import name.RemoteInnerClassImportType;
|
||||
import name.RemoteStaticGlobalInnerClassImportType;
|
||||
import name.SamePackageClass;
|
||||
import name.SelfInnerClass;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.converter.ConvertWith;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
|
@ -38,7 +38,7 @@ public class ShortNameTest extends ParserTest {
|
|||
CONTAINER.resolve(sampleClass.getCanonicalName().replace('.', '/') + ".java"),
|
||||
sampleInnerClass,
|
||||
name,
|
||||
"parser/expected/name/%s.yaml".formatted(sampleInnerClass.getName().substring(sampleInnerClass.getPackageName().length() + 1))
|
||||
"expected/name/%s.yaml".formatted(sampleInnerClass.getName().substring(sampleInnerClass.getPackageName().length() + 1))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class ShortNameTest extends ParserTest {
|
|||
private static class ImportShortNameMappingConverter extends YamlMappingConverter<ImportShortNameMapping> {
|
||||
|
||||
protected ImportShortNameMappingConverter() {
|
||||
super(ImportShortNameMapping.class, SamePackageClass.class.getPackageName());
|
||||
super(ImportShortNameMapping.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.yaml;
|
||||
package io.papermc.generator.rewriter.yaml;
|
||||
|
||||
public class ImportMapping {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.yaml;
|
||||
package io.papermc.generator.rewriter.yaml;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.yaml;
|
||||
package io.papermc.generator.rewriter.yaml;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
package io.papermc.generator.rewriter.data.yaml;
|
||||
package io.papermc.generator.rewriter.yaml;
|
||||
|
||||
import org.junit.jupiter.params.converter.TypedArgumentConverter;
|
||||
import org.yaml.snakeyaml.LoaderOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.constructor.Constructor;
|
||||
import org.yaml.snakeyaml.nodes.ScalarNode;
|
||||
import org.yaml.snakeyaml.nodes.Tag;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -19,23 +17,9 @@ public class YamlMappingConverter<T> extends TypedArgumentConverter<String, T> {
|
|||
|
||||
private final Constructor yamlConstructor;
|
||||
|
||||
protected YamlMappingConverter(Class<T> clazz, String relativePackage) {
|
||||
protected YamlMappingConverter(Class<T> clazz) {
|
||||
super(String.class, clazz);
|
||||
if (relativePackage == null) {
|
||||
this.yamlConstructor = new Constructor(clazz, OPTIONS);
|
||||
} else {
|
||||
this.yamlConstructor = new Constructor(clazz, OPTIONS) {
|
||||
|
||||
@Override
|
||||
public String constructScalar(ScalarNode node) {
|
||||
if (node.getTag() == Tag.STR && node.getValue().startsWith("(_).")) {
|
||||
return node.getValue().replaceFirst("\\(_\\)", relativePackage);
|
||||
}
|
||||
|
||||
return super.constructScalar(node);
|
||||
}
|
||||
};
|
||||
}
|
||||
this.yamlConstructor = new Constructor(clazz, OPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,10 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
- "org.bukkit.Statistic.Type"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "org.bukkit.Statistic.ANIMALS_BRED"
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,12 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
- "org.bukkit.Statistic.Type"
|
||||
global:
|
||||
- "org.bukkit"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "org.bukkit.Statistic.ANIMALS_BRED"
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,12 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
- "org.bukkit.Statistic.Type"
|
||||
global:
|
||||
- "org.bukkit"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "org.bukkit.Statistic.ANIMALS_BRED"
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,12 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
- "org.bukkit.Statistic.Type"
|
||||
global:
|
||||
- "org.bukkit"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "org.bukkit.Statistic.ANIMALS_BRED"
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,7 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
|
||||
staticImports:
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,12 +0,0 @@
|
|||
imports:
|
||||
single:
|
||||
- "org.bukkit.NamespacedKey"
|
||||
- "org.bukkit.Statistic.Type"
|
||||
global:
|
||||
- "org.bukkit"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "org.bukkit.Statistic.ANIMALS_BRED"
|
||||
global:
|
||||
- "org.bukkit.Material"
|
|
@ -1,7 +0,0 @@
|
|||
shortNames: {
|
||||
"org.bukkit.Material": "Material",
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"org.bukkit.Statistic.ARMOR_CLEANED": "ARMOR_CLEANED"
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).SamePackageClass": "SamePackageClass",
|
||||
"(_).one.OneDepthClass": "OneDepthClass",
|
||||
"(_).one.OneDepthClass$NonStaticClass": "OneDepthClass.NonStaticClass",
|
||||
"(_).one.OneDepthClass$StaticClass": "OneDepthClass.StaticClass"
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
shortNames: {
|
||||
"org.bukkit.Material": "Material",
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"org.bukkit.Statistic.ARMOR_CLEANED": "ARMOR_CLEANED",
|
||||
"org.bukkit.Statistic.valueOf": "valueOf",
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).one.OneDepthClass$NonStaticClass": "NonStaticClass",
|
||||
"(_).one.OneDepthClass$StaticClass": "StaticClass"
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).one.OneDepthClass$NonStaticClass": "NonStaticClass"
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"(_).one.OneDepthClass.StaticClass": "StaticClass"
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).one.OneDepthClass$NonStaticClass": "(_).one.OneDepthClass.NonStaticClass",
|
||||
"(_).one.OneDepthClass$StaticClass": "StaticClass"
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).SelfInnerClass$A": "A",
|
||||
"(_).SelfInnerClass$A$B": "B",
|
||||
"(_).SelfInnerClass$A$B$C": "C",
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
shortNames: {
|
||||
"(_).SelfInnerClass$A": "A",
|
||||
"(_).SelfInnerClass$A$B": "A.B",
|
||||
"(_).SelfInnerClass$A$B$C": "A.B.C",
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
@ -10,8 +9,16 @@ import java.lang.annotation.Target;
|
|||
@Target({
|
||||
ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.PACKAGE
|
||||
})
|
||||
@ApiStatus.Experimental@ApiStatus.Internal
|
||||
@AnnotationClass.NestedAnnot@AnnotationClass.NestedAnnot2
|
||||
public @interface AnnotationClass { // << 34
|
||||
// @interface should be invalidated and not detected as an annotation
|
||||
// via its keyword: interface
|
||||
|
||||
@interface NestedAnnot {
|
||||
|
||||
}
|
||||
|
||||
@interface NestedAnnot2 {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper
|
||||
public class AnnotationPresentClass { // << 36
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
@AnnotationTrapClass.Trapped
|
||||
(
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
@SuppressWarnings
|
||||
(
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
;;;
|
||||
;;;public/* d */class/* d */FancyScopeClass/* d */
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
package area;
|
||||
|
||||
public/* d */class/* d */FancyScopeClass2/* d */ /* d */{//d // << 56
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
package area;
|
||||
|
||||
@SuppressWarnings//discard /**/
|
||||
/* a*/ ( /* a b*/
|
||||
|
@ -12,12 +10,12 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
) // a
|
||||
// Paper
|
||||
@//a
|
||||
ApiStatus//b
|
||||
AnnotationClass//b
|
||||
.//c
|
||||
Internal//d
|
||||
NestedAnnot//d
|
||||
@/* a*/
|
||||
ApiStatus/* a*/./* a*/
|
||||
Experimental/* a*///a/* a*/
|
||||
AnnotationClass/* a*/./* a*/
|
||||
NestedAnnot2/* a*///a/* a*/
|
||||
public class MixedAnnotationPresentClass { // << 41
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package area;
|
||||
|
||||
public class NearScopeClass{ // << 27
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package area;
|
||||
|
||||
public class NewlineScopedClass
|
||||
{ // << 0
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.area;//{
|
||||
package area;//{
|
||||
|
||||
// { //{
|
||||
//{
|
|
@ -1,7 +1,7 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;
|
||||
package imports;
|
||||
|
||||
import/* hi */org.bukkit.NamespacedKey; // multi line comment filled gap between import and typeName
|
||||
import org.bukkit/* my */./*hidden*/Statistic/*message*/.Type/* ! */; // comment in type name
|
||||
import/* hi */java.util.List; // multi line comment filled gap between import and typeName
|
||||
import java.util/* my */./*hidden*/random/**/.RandomGenerator/*message*/.JumpableGenerator/* ! */; // comment in type name
|
||||
// import org.bukkit.block.Commented;
|
||||
/*
|
||||
import org.bukkit.block.Commented;
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.block.Commented;
|
|||
import org.bukkit.block.Commented;
|
||||
*/// import org.bukkit.block.Commented;import org.bukkit.block.Commented;
|
||||
|
||||
import/* hi */static/* ! */org.bukkit. Statistic.ANIMALS_BRED; // multi line comment filled gap between static and typeName
|
||||
import/* hi */static/* ! */javax.lang.model. SourceVersion.RELEASE_21; // multi line comment filled gap between static and typeName
|
||||
// import static org.bukkit.Statistic.COMMENTED;
|
||||
/*
|
||||
import static org.bukkit.Statistic.COMMENTED;
|
||||
|
@ -22,7 +22,7 @@ import static org.bukkit.Statistic.COMMENTED;
|
|||
*//*
|
||||
import static org.bukkit.Statistic.COMMENTED;
|
||||
*/// import static org.bukkit.Statistic.COMMENTED;import static org.bukkit.Statistic.COMMENTED;
|
||||
import static org.bukkit.Material./* hi */* /* ! */;
|
||||
import static javax.lang.model.SourceVersion./* hi */* /* ! */;
|
||||
|
||||
public class FancyCommentImportType {
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
package imports;import java.util.List; import java.util.random.RandomGenerator.JumpableGenerator;import java.util.*;/**/import static javax.lang.model.SourceVersion.RELEASE_21; /* */ import static javax.lang.model.SourceVersion.*;public class FancyInlinedImportType {
|
||||
|
||||
}
|
|
@ -1,23 +1,23 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;
|
||||
package imports;
|
||||
|
||||
import
|
||||
org
|
||||
java
|
||||
.
|
||||
bukkit
|
||||
util
|
||||
.
|
||||
|
||||
NamespacedKey
|
||||
List
|
||||
; // multi line import
|
||||
import org
|
||||
.bukkit
|
||||
import java.util
|
||||
.random
|
||||
.
|
||||
Statistic.
|
||||
Type; // multi line import with dot art
|
||||
RandomGenerator.
|
||||
JumpableGenerator; // multi line import with dot art
|
||||
|
||||
import
|
||||
org
|
||||
java
|
||||
.
|
||||
bukkit
|
||||
util
|
||||
.
|
||||
|
||||
*
|
||||
|
@ -26,22 +26,23 @@ import
|
|||
|
||||
import
|
||||
static
|
||||
org
|
||||
javax
|
||||
.
|
||||
|
||||
bukkit
|
||||
lang.model
|
||||
.
|
||||
Statistic
|
||||
SourceVersion
|
||||
.
|
||||
ANIMALS_BRED
|
||||
RELEASE_21
|
||||
; // multi line static import
|
||||
|
||||
import
|
||||
static org
|
||||
static javax
|
||||
.
|
||||
bukkit
|
||||
lang.
|
||||
model
|
||||
.
|
||||
Material
|
||||
SourceVersion
|
||||
|
||||
.
|
||||
*
|
|
@ -0,0 +1,11 @@
|
|||
package imports;
|
||||
|
||||
import java. util.List ;
|
||||
import java.util .random .RandomGenerator. JumpableGenerator;
|
||||
import java .util.* ;
|
||||
import static javax. lang. model . SourceVersion.RELEASE_21 ;
|
||||
import static javax.lang . model.SourceVersion. * ;
|
||||
|
||||
public class FancySpaceImportType {
|
||||
|
||||
}
|
|
@ -1,25 +1,26 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.imports;
|
||||
package imports;
|
||||
|
||||
import// discard?
|
||||
org /* hi */
|
||||
java /* hi */
|
||||
/* hi */ .
|
||||
bukkit /* hi */ // /*/
|
||||
util /* hi */ // /*/
|
||||
/* hi */ .
|
||||
|
||||
NamespacedKey// discard?
|
||||
List// discard?
|
||||
/* hi */; // multi line import
|
||||
|
||||
import/*a*//// discard?
|
||||
static/*a*/// discard?
|
||||
org// discard?
|
||||
javax// discard?
|
||||
/* hi */ . /* hi */
|
||||
|
||||
/* hi */ bukkit /* hi */
|
||||
/* hi */ lang /* hi */
|
||||
/* hi */ .
|
||||
model.
|
||||
/* a */
|
||||
// a
|
||||
|
||||
Material
|
||||
SourceVersion
|
||||
|
||||
.
|
||||
*// discard?
|
|
@ -0,0 +1,11 @@
|
|||
package imports;
|
||||
|
||||
import java.util.List; // root class import
|
||||
import java.util.random.RandomGenerator.JumpableGenerator; // inner class import (directly referenced)
|
||||
import java.util.*; // star import (whole package + one level)
|
||||
import static javax.lang.model.SourceVersion.RELEASE_21; // static import
|
||||
import static javax.lang.model.SourceVersion.*; // static star import
|
||||
|
||||
public class StandardImportType {
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package name;
|
||||
|
||||
import java.util.*;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
public class GlobalImportType {
|
||||
{
|
||||
var a = List.of();
|
||||
var b = RELEASE_21;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
package name;
|
||||
|
||||
import io.papermc.generator.rewriter.data.sample.parser.name.one.*;
|
||||
import name.one.*;
|
||||
|
||||
public class PackageClassImportType {
|
||||
{
|
|
@ -0,0 +1,13 @@
|
|||
package name;
|
||||
|
||||
import java.util.List;
|
||||
import static javax.lang.model.SourceVersion.RELEASE_21;
|
||||
import static javax.lang.model.SourceVersion.valueOf;
|
||||
|
||||
public class RegularImportType {
|
||||
{
|
||||
var a = List.of();
|
||||
var b = RELEASE_21;
|
||||
valueOf(b.name());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package name;
|
||||
|
||||
import name.one.OneDepthClass.*;
|
||||
|
||||
public class RemoteGlobalInnerClassImportType {
|
||||
{
|
||||
var a = NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package name;
|
||||
|
||||
import name.one.OneDepthClass.NonStaticClass;
|
||||
import static name.one.OneDepthClass.StaticClass;
|
||||
|
||||
public class RemoteInnerClassImportType {
|
||||
{
|
||||
var a = NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package name;
|
||||
|
||||
import static name.one.OneDepthClass.*;
|
||||
|
||||
public class RemoteStaticGlobalInnerClassImportType {
|
||||
{
|
||||
var a = name.one.OneDepthClass.NonStaticClass.class;
|
||||
var b = StaticClass.class;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package name;
|
||||
|
||||
public class SamePackageClass {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name;
|
||||
package name;
|
||||
|
||||
public class SelfInnerClass {
|
||||
public class A {
|
|
@ -1,4 +1,4 @@
|
|||
package io.papermc.generator.rewriter.data.sample.parser.name.one;
|
||||
package name.one;
|
||||
|
||||
public class OneDepthClass {
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
- "java.util.random.RandomGenerator.JumpableGenerator"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "javax.lang.model.SourceVersion.RELEASE_21"
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,12 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
- "java.util.random.RandomGenerator.JumpableGenerator"
|
||||
global:
|
||||
- "java.util"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "javax.lang.model.SourceVersion.RELEASE_21"
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,12 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
- "java.util.random.RandomGenerator.JumpableGenerator"
|
||||
global:
|
||||
- "java.util"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "javax.lang.model.SourceVersion.RELEASE_21"
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,12 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
- "java.util.random.RandomGenerator.JumpableGenerator"
|
||||
global:
|
||||
- "java.util"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "javax.lang.model.SourceVersion.RELEASE_21"
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,7 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
|
||||
staticImports:
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,12 @@
|
|||
imports:
|
||||
single:
|
||||
- "java.util.List"
|
||||
- "java.util.random.RandomGenerator.JumpableGenerator"
|
||||
global:
|
||||
- "java.util"
|
||||
|
||||
staticImports:
|
||||
single:
|
||||
- "javax.lang.model.SourceVersion.RELEASE_21"
|
||||
global:
|
||||
- "javax.lang.model.SourceVersion"
|
|
@ -0,0 +1,7 @@
|
|||
shortNames: {
|
||||
"java.util.List": "List",
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"javax.lang.model.SourceVersion.RELEASE_21": "RELEASE_21"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
shortNames: {
|
||||
"name.SamePackageClass": "SamePackageClass",
|
||||
"name.one.OneDepthClass": "OneDepthClass",
|
||||
"name.one.OneDepthClass$NonStaticClass": "OneDepthClass.NonStaticClass",
|
||||
"name.one.OneDepthClass$StaticClass": "OneDepthClass.StaticClass"
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
shortNames: {
|
||||
"java.util.List": "List",
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"javax.lang.model.SourceVersion.RELEASE_21": "RELEASE_21",
|
||||
"javax.lang.model.SourceVersion.valueOf": "valueOf",
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
shortNames: {
|
||||
"name.one.OneDepthClass$NonStaticClass": "NonStaticClass",
|
||||
"name.one.OneDepthClass$StaticClass": "StaticClass"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
shortNames: {
|
||||
"name.one.OneDepthClass$NonStaticClass": "NonStaticClass"
|
||||
}
|
||||
|
||||
memberShortNames: {
|
||||
"name.one.OneDepthClass.StaticClass": "StaticClass"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
shortNames: {
|
||||
"name.one.OneDepthClass$NonStaticClass": "name.one.OneDepthClass.NonStaticClass",
|
||||
"name.one.OneDepthClass$StaticClass": "StaticClass"
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
shortNames: {
|
||||
"name.SelfInnerClass$A": "A",
|
||||
"name.SelfInnerClass$A$B": "B",
|
||||
"name.SelfInnerClass$A$B$C": "C",
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
shortNames: {
|
||||
"name.SelfInnerClass$A": "A",
|
||||
"name.SelfInnerClass$A$B": "A.B",
|
||||
"name.SelfInnerClass$A$B$C": "A.B.C",
|
||||
}
|
Loading…
Reference in New Issue