This commit is contained in:
Anuken
2020-05-02 12:30:29 -04:00
parent fd62125862
commit fed4d10ec6
31 changed files with 55 additions and 55 deletions

View File

@@ -89,11 +89,11 @@ public class Annotations{
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.SOURCE)
public @interface LoadRegion{
public @interface Load{
String value();
int length() default 1;
int[] lengths() default {};
String fallback() default "error"; //TODO
String fallback() default "error";
}
@Target(ElementType.TYPE)

View File

@@ -12,7 +12,7 @@ import mindustry.annotations.util.*;
import javax.annotation.processing.*;
import javax.lang.model.element.*;
@SupportedAnnotationTypes({"mindustry.annotations.Annotations.LoadRegion",})
@SupportedAnnotationTypes("mindustry.annotations.Annotations.Load")
public class LoadRegionProcessor extends BaseProcessor{
@Override
@@ -25,7 +25,7 @@ public class LoadRegionProcessor extends BaseProcessor{
ObjectMap<Stype, Array<Svar>> fieldMap = new ObjectMap<>();
for(Svar field : fields(LoadRegion.class)){
for(Svar field : fields(Load.class)){
if(!field.is(Modifier.PUBLIC)){
err("@LoadRegion field must be public", field);
}
@@ -37,7 +37,7 @@ public class LoadRegionProcessor extends BaseProcessor{
method.beginControlFlow("if(content instanceof $T)", entry.key.tname());
for(Svar field : entry.value){
LoadRegion an = field.annotation(LoadRegion.class);
Load an = field.annotation(Load.class);
//get # of array dimensions
int dims = count(field.mirror().toString(), "[]");
boolean doFallback = !an.fallback().equals("error");