This commit is contained in:
Anuken
2020-06-08 17:31:02 -04:00
parent 5be5d11c8e
commit 6dd9369066
35 changed files with 121 additions and 125 deletions

View File

@@ -1,7 +1,7 @@
package mindustry.annotations;
import arc.files.*;
import arc.struct.Array;
import arc.struct.*;
import arc.util.*;
import arc.util.Log;
import arc.util.Log.*;
@@ -126,12 +126,12 @@ public abstract class BaseProcessor extends AbstractProcessor{
write(builder, null);
}
public static void write(TypeSpec.Builder builder, Array<String> imports) throws Exception{
public static void write(TypeSpec.Builder builder, Seq<String> imports) throws Exception{
JavaFile file = JavaFile.builder(packageName, builder.build()).skipJavaLangImports(true).build();
if(imports != null){
String rawSource = file.toString();
Array<String> result = new Array<>();
Seq<String> result = new Seq<>();
for (String s : rawSource.split("\n", -1)) {
result.add(s);
if (s.startsWith("package ")) {
@@ -152,22 +152,22 @@ public abstract class BaseProcessor extends AbstractProcessor{
}
}
public Array<Selement> elements(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).map(Selement::new);
public Seq<Selement> elements(Class<? extends Annotation> type){
return Seq.with(env.getElementsAnnotatedWith(type)).map(Selement::new);
}
public Array<Stype> types(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof TypeElement)
public Seq<Stype> types(Class<? extends Annotation> type){
return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof TypeElement)
.map(e -> new Stype((TypeElement)e));
}
public Array<Svar> fields(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof VariableElement)
public Seq<Svar> fields(Class<? extends Annotation> type){
return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof VariableElement)
.map(e -> new Svar((VariableElement)e));
}
public Array<Smethod> methods(Class<? extends Annotation> type){
return Array.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof ExecutableElement)
public Seq<Smethod> methods(Class<? extends Annotation> type){
return Seq.with(env.getElementsAnnotatedWith(type)).select(e -> e instanceof ExecutableElement)
.map(e -> new Smethod((ExecutableElement)e));
}

View File

@@ -24,7 +24,7 @@ public class EntityIO{
final String name;
final TypeSpec.Builder type;
final Fi directory;
final Array<Revision> revisions = new Array<>();
final Seq<Revision> revisions = new Seq<>();
boolean write;
MethodSpec.Builder method;
@@ -47,7 +47,7 @@ public class EntityIO{
int nextRevision = revisions.isEmpty() ? 0 : revisions.max(r -> r.version).version + 1;
//resolve preferred field order based on fields that fit
Array<FieldSpec> fields = Array.with(type.fieldSpecs).select(spec ->
Seq<FieldSpec> fields = Seq.with(type.fieldSpecs).select(spec ->
!spec.hasModifier(Modifier.TRANSIENT) &&
!spec.hasModifier(Modifier.STATIC) &&
!spec.hasModifier(Modifier.FINAL)/* &&
@@ -110,7 +110,7 @@ public class EntityIO{
}
}
void writeSync(MethodSpec.Builder method, boolean write, Array<Svar> syncFields, Array<Svar> allFields) throws Exception{
void writeSync(MethodSpec.Builder method, boolean write, Seq<Svar> syncFields, Seq<Svar> allFields) throws Exception{
this.method = method;
this.write = write;
@@ -147,7 +147,7 @@ public class EntityIO{
}
}
void writeSyncManual(MethodSpec.Builder method, boolean write, Array<Svar> syncFields) throws Exception{
void writeSyncManual(MethodSpec.Builder method, boolean write, Seq<Svar> syncFields) throws Exception{
this.method = method;
this.write = write;
@@ -170,7 +170,7 @@ public class EntityIO{
}
}
void writeInterpolate(MethodSpec.Builder method, Array<Svar> fields) throws Exception{
void writeInterpolate(MethodSpec.Builder method, Seq<Svar> fields) throws Exception{
this.method = method;
cont("if(lastUpdated != 0 && updateSpacing != 0)");
@@ -234,7 +234,7 @@ public class EntityIO{
String struct = type.substring(0, type.indexOf("<"));
String generic = type.substring(type.indexOf("<") + 1, type.indexOf(">"));
if(struct.equals("arc.struct.Queue") || struct.equals("arc.struct.Array")){
if(struct.equals("arc.struct.Queue") || struct.equals("arc.struct.Seq")){
if(write){
s("i", field + ".size");
cont("for(int INDEX = 0; INDEX < $L.size; INDEX ++)", field);
@@ -289,9 +289,9 @@ public class EntityIO{
public static class Revision{
int version;
Array<RevisionField> fields;
Seq<RevisionField> fields;
Revision(int version, Array<RevisionField> fields){
Revision(int version, Seq<RevisionField> fields){
this.version = version;
this.fields = fields;
}
@@ -299,7 +299,7 @@ public class EntityIO{
Revision(){}
/** @return whether these two revisions are compatible */
boolean equal(Array<FieldSpec> specs){
boolean equal(Seq<FieldSpec> specs){
if(fields.size != specs.size) return false;
for(int i = 0; i < fields.size; i++){

View File

@@ -30,18 +30,18 @@ import java.lang.annotation.*;
"mindustry.annotations.Annotations.TypeIOHandler"
})
public class EntityProcess extends BaseProcessor{
Array<EntityDefinition> definitions = new Array<>();
Array<GroupDefinition> groupDefs = new Array<>();
Array<Stype> baseComponents;
Seq<EntityDefinition> definitions = new Seq<>();
Seq<GroupDefinition> groupDefs = new Seq<>();
Seq<Stype> baseComponents;
ObjectMap<String, Stype> componentNames = new ObjectMap<>();
ObjectMap<Stype, Array<Stype>> componentDependencies = new ObjectMap<>();
ObjectMap<Selement, Array<Stype>> defComponents = new ObjectMap<>();
ObjectMap<Stype, Seq<Stype>> componentDependencies = new ObjectMap<>();
ObjectMap<Selement, Seq<Stype>> defComponents = new ObjectMap<>();
ObjectMap<Svar, String> varInitializers = new ObjectMap<>();
ObjectMap<Smethod, String> methodBlocks = new ObjectMap<>();
ObjectSet<String> imports = new ObjectSet<>();
Array<Selement> allGroups = new Array<>();
Array<Selement> allDefs = new Array<>();
Array<Stype> allInterfaces = new Array<>();
Seq<Selement> allGroups = new Seq<>();
Seq<Selement> allDefs = new Seq<>();
Seq<Stype> allInterfaces = new Seq<>();
ClassSerializer serializer;
{
@@ -58,7 +58,7 @@ public class EntityProcess extends BaseProcessor{
if(round == 1){
serializer = TypeIOResolver.resolve(this);
baseComponents = types(BaseComponent.class);
Array<Stype> allComponents = types(Component.class);
Seq<Stype> allComponents = types(Component.class);
//store code
for(Stype component : allComponents){
@@ -103,7 +103,7 @@ public class EntityProcess extends BaseProcessor{
}
//implement super interfaces
Array<Stype> depends = getDependencies(component);
Seq<Stype> depends = getDependencies(component);
for(Stype type : depends){
inter.addSuperinterface(ClassName.get(packageName, interfaceName(type)));
}
@@ -133,7 +133,7 @@ public class EntityProcess extends BaseProcessor{
//getter
if(!signatures.contains(cname + "()")){
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
.addAnnotations(Array.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get))
.addAnnotations(Seq.with(field.annotations()).select(a -> a.toString().contains("Null")).map(AnnotationSpec::get))
.addJavadoc(field.doc() == null ? "" : field.doc())
.returns(field.tname()).build());
}
@@ -144,7 +144,7 @@ public class EntityProcess extends BaseProcessor{
inter.addMethod(MethodSpec.methodBuilder(cname).addModifiers(Modifier.ABSTRACT, Modifier.PUBLIC)
.addJavadoc(field.doc() == null ? "" : field.doc())
.addParameter(ParameterSpec.builder(field.tname(), field.name())
.addAnnotations(Array.with(field.annotations())
.addAnnotations(Seq.with(field.annotations())
.select(a -> a.toString().contains("Null")).map(AnnotationSpec::get)).build()).build());
}
}
@@ -161,7 +161,7 @@ public class EntityProcess extends BaseProcessor{
//log methods generated
for(MethodSpec spec : inter.methodSpecs){
Log.debug("&g> > &c@ @(@)", simpleName(spec.returnType.toString()), spec.name, Array.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name));
Log.debug("&g> > &c@ @(@)", simpleName(spec.returnType.toString()), spec.name, Seq.with(spec.parameters).toString(", ", p -> simpleName(p.type.toString()) + " " + p.name));
}
Log.debug("");
@@ -172,7 +172,7 @@ public class EntityProcess extends BaseProcessor{
//parse groups
for(Selement<?> group : allGroups){
GroupDef an = group.annotation(GroupDef.class);
Array<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp);
Seq<Stype> types = types(an, GroupDef::value).map(this::interfaceToComp);
boolean collides = an.collide();
groupDefs.add(new GroupDefinition(group.name().startsWith("g") ? group.name().substring(1) : group.name(),
ClassName.bestGuess(packageName + "." + interfaceName(types.first())), types, an.spatial(), an.mapping(), collides));
@@ -209,9 +209,9 @@ public class EntityProcess extends BaseProcessor{
TypeSpec.Builder builder = TypeSpec.classBuilder(name).addModifiers(Modifier.PUBLIC);
if(isFinal) builder.addModifiers(Modifier.FINAL);
Array<Stype> components = allComponents(type);
Array<GroupDefinition> groups = groupDefs.select(g -> (!g.components.isEmpty() && !g.components.contains(s -> !components.contains(s))) || g.manualInclusions.contains(type));
ObjectMap<String, Array<Smethod>> methods = new ObjectMap<>();
Seq<Stype> components = allComponents(type);
Seq<GroupDefinition> groups = groupDefs.select(g -> (!g.components.isEmpty() && !g.components.contains(s -> !components.contains(s))) || g.manualInclusions.contains(type));
ObjectMap<String, Seq<Smethod>> methods = new ObjectMap<>();
ObjectMap<FieldSpec, Svar> specVariables = new ObjectMap<>();
ObjectSet<String> usedFields = new ObjectSet<>();
@@ -219,8 +219,8 @@ public class EntityProcess extends BaseProcessor{
builder.addMethod(MethodSpec.methodBuilder("serialize").addModifiers(Modifier.PUBLIC, Modifier.FINAL).returns(boolean.class).addStatement("return " + ann.serialize()).build());
//all SyncField fields
Array<Svar> syncedFields = new Array<>();
Array<Svar> allFields = new Array<>();
Seq<Svar> syncedFields = new Seq<>();
Seq<Svar> allFields = new Seq<>();
boolean isSync = components.contains(s -> s.name().contains("Sync"));
@@ -228,7 +228,7 @@ public class EntityProcess extends BaseProcessor{
for(Stype comp : components){
//write fields to the class; ignoring transient/imported ones
Array<Svar> fields = comp.fields().select(f -> !f.has(Import.class));
Seq<Svar> fields = comp.fields().select(f -> !f.has(Import.class));
for(Svar f : fields){
if(!usedFields.add(f.name())){
err("Field '" + f.name() + "' of component '" + comp.name() + "' re-defines a field in entity '" + type.name() + "'");
@@ -279,7 +279,7 @@ public class EntityProcess extends BaseProcessor{
//get all utility methods from components
for(Smethod elem : comp.methods()){
methods.get(elem.toString(), Array::new).add(elem);
methods.get(elem.toString(), Seq::new).add(elem);
}
}
@@ -297,7 +297,7 @@ public class EntityProcess extends BaseProcessor{
boolean hasIO = ann.genio() && (components.contains(s -> s.name().contains("Sync")) || ann.serialize());
//add all methods from components
for(ObjectMap.Entry<String, Array<Smethod>> entry : methods){
for(ObjectMap.Entry<String, Seq<Smethod>> entry : methods){
if(entry.value.contains(m -> m.has(Replace.class))){
//check replacements
if(entry.value.count(m -> m.has(Replace.class)) > 1){
@@ -513,7 +513,7 @@ public class EntityProcess extends BaseProcessor{
if(!idProps.exists()) idProps.writeString("");
PropertiesUtils.load(map, idProps.reader());
//next ID to be used in generation
Integer max = map.values().toArray().map(Integer::parseInt).max(i -> i);
Integer max = map.values().toSeq().map(Integer::parseInt).max(i -> i);
int maxID = max == null ? 0 : max + 1;
//assign IDs
@@ -591,7 +591,7 @@ public class EntityProcess extends BaseProcessor{
//generate getter/setter for each method
for(Smethod method : inter.methods()){
String var = method.name();
FieldSpec field = Array.with(def.builder.fieldSpecs).find(f -> f.name.equals(var));
FieldSpec field = Seq.with(def.builder.fieldSpecs).find(f -> f.name.equals(var));
//make sure it's a real variable AND that the component doesn't already implement it somewhere with custom logic
if(field == null || methodNames.contains(method.simpleString())) continue;
@@ -601,7 +601,7 @@ public class EntityProcess extends BaseProcessor{
}
//setter
if(method.isVoid() && !Array.with(field.annotations).contains(f -> f.type.toString().equals("@mindustry.annotations.Annotations.ReadOnly"))){
if(method.isVoid() && !Seq.with(field.annotations).contains(f -> f.type.toString().equals("@mindustry.annotations.Annotations.ReadOnly"))){
def.builder.addMethod(MethodSpec.overriding(method.e).addModifiers(Modifier.FINAL).addStatement("this." + var + " = " + var).build());
}
}
@@ -616,8 +616,8 @@ public class EntityProcess extends BaseProcessor{
//create mock types of all components
for(Stype interf : allInterfaces){
//indirect interfaces to implement methods for
Array<Stype> dependencies = interf.allInterfaces().and(interf);
Array<Smethod> methods = dependencies.flatMap(Stype::methods);
Seq<Stype> dependencies = interf.allInterfaces().and(interf);
Seq<Smethod> methods = dependencies.flatMap(Stype::methods);
methods.sortComparing(Object::toString);
//used method signatures
@@ -668,8 +668,8 @@ public class EntityProcess extends BaseProcessor{
}
}
Array<String> getImports(Element elem){
return Array.with(trees.getPath(elem).getCompilationUnit().getImports()).map(Object::toString);
Seq<String> getImports(Element elem){
return Seq.with(trees.getPath(elem).getCompilationUnit().getImports()).map(Object::toString);
}
/** @return interface for a component type */
@@ -682,11 +682,11 @@ public class EntityProcess extends BaseProcessor{
}
/** @return all components that a entity def has */
Array<Stype> allComponents(Selement<?> type){
Seq<Stype> allComponents(Selement<?> type){
if(!defComponents.containsKey(type)){
//get base defs
Array<Stype> interfaces = types(type.annotation(EntityDef.class), EntityDef::value);
Array<Stype> components = new Array<>();
Seq<Stype> interfaces = types(type.annotation(EntityDef.class), EntityDef::value);
Seq<Stype> components = new Seq<>();
for(Stype i : interfaces){
Stype comp = interfaceToComp(i);
if(comp != null){
@@ -709,7 +709,7 @@ public class EntityProcess extends BaseProcessor{
return defComponents.get(type);
}
Array<Stype> getDependencies(Stype component){
Seq<Stype> getDependencies(Stype component){
if(!componentDependencies.containsKey(component)){
ObjectSet<Stype> out = new ObjectSet<>();
//add base component interfaces
@@ -746,7 +746,7 @@ public class EntityProcess extends BaseProcessor{
}
String createName(Selement<?> elem){
Array<Stype> comps = types(elem.annotation(EntityDef.class), EntityDef::value).map(this::interfaceToComp);;
Seq<Stype> comps = types(elem.annotation(EntityDef.class), EntityDef::value).map(this::interfaceToComp);;
comps.sortComparing(Selement::name);
return comps.toString("", s -> s.name().replace("Comp", "")) + "Entity";
}
@@ -755,11 +755,11 @@ public class EntityProcess extends BaseProcessor{
return type.annotation(Component.class) != null;
}
<T extends Annotation> Array<Stype> types(T t, Cons<T> consumer){
<T extends Annotation> Seq<Stype> types(T t, Cons<T> consumer){
try{
consumer.get(t);
}catch(MirroredTypesException e){
return Array.with(e.getTypeMirrors()).map(Stype::of);
return Seq.with(e.getTypeMirrors()).map(Stype::of);
}
throw new IllegalArgumentException("Missing types.");
}
@@ -767,11 +767,11 @@ public class EntityProcess extends BaseProcessor{
class GroupDefinition{
final String name;
final ClassName baseType;
final Array<Stype> components;
final Seq<Stype> components;
final boolean spatial, mapping, collides;
final ObjectSet<Selement> manualInclusions = new ObjectSet<>();
public GroupDefinition(String name, ClassName bestType, Array<Stype> components, boolean spatial, boolean mapping, boolean collides){
public GroupDefinition(String name, ClassName bestType, Seq<Stype> components, boolean spatial, boolean mapping, boolean collides){
this.baseType = bestType;
this.components = components;
this.name = name;
@@ -787,14 +787,14 @@ public class EntityProcess extends BaseProcessor{
}
class EntityDefinition{
final Array<GroupDefinition> groups;
final Array<Stype> components;
final Seq<GroupDefinition> groups;
final Seq<Stype> components;
final TypeSpec.Builder builder;
final Selement base;
final String name;
int classID;
public EntityDefinition(String name, Builder builder, Selement base, Array<Stype> components, Array<GroupDefinition> groups){
public EntityDefinition(String name, Builder builder, Selement base, Seq<Stype> components, Seq<GroupDefinition> groups){
this.builder = builder;
this.name = name;
this.base = base;

View File

@@ -69,7 +69,7 @@ public class AssetsProcess extends BaseProcessor{
});
for(Element elem : elements){
Array.with(((TypeElement)elem).getEnclosedElements()).each(e -> e.getKind() == ElementKind.FIELD, field -> {
Seq.with(((TypeElement)elem).getEnclosedElements()).each(e -> e.getKind() == ElementKind.FIELD, field -> {
String fname = field.getSimpleName().toString();
if(fname.startsWith("default")){
loadStyles.addStatement("arc.Core.scene.addStyle(" + field.asType().toString() + ".class, mindustry.ui.Styles." + fname + ")");

View File

@@ -23,17 +23,17 @@ public class LoadRegionProcessor extends BaseProcessor{
.addParameter(tname("mindustry.ctype.MappableContent"), "content")
.addModifiers(Modifier.STATIC, Modifier.PUBLIC);
ObjectMap<Stype, Array<Svar>> fieldMap = new ObjectMap<>();
ObjectMap<Stype, Seq<Svar>> fieldMap = new ObjectMap<>();
for(Svar field : fields(Load.class)){
if(!field.is(Modifier.PUBLIC)){
err("@LoadRegion field must be public", field);
}
fieldMap.get(field.enclosingType(), Array::new).add(field);
fieldMap.get(field.enclosingType(), Seq::new).add(field);
}
for(Entry<Stype, Array<Svar>> entry : fieldMap){
for(Entry<Stype, Seq<Svar>> entry : fieldMap){
method.beginControlFlow("if(content instanceof $T)", entry.key.tname());
for(Svar field : entry.value){

View File

@@ -139,7 +139,7 @@ public class RemoteWriteGenerator{
//reset stream
method.addStatement("OUT.reset()");
method.addTypeVariables(Array.with(elem.getTypeParameters()).map(BaseProcessor::getTVN));
method.addTypeVariables(Seq.with(elem.getTypeParameters()).map(BaseProcessor::getTVN));
for(int i = 0; i < elem.getParameters().size(); i++){
//first argument is skipped as it is always the player caller

View File

@@ -9,7 +9,7 @@ public class SerializerResolver{
public static String locate(ExecutableElement elem, TypeMirror mirror, boolean write){
//generic type
if((mirror.toString().equals("T") && Array.with(elem.getTypeParameters().get(0).getBounds()).contains(SerializerResolver::isEntity)) ||
if((mirror.toString().equals("T") && Seq.with(elem.getTypeParameters().get(0).getBounds()).contains(SerializerResolver::isEntity)) ||
isEntity(mirror)){
return write ? "mindustry.io.TypeIO.writeEntity" : "mindustry.io.TypeIO.readEntity";
}

View File

@@ -1,6 +1,6 @@
package mindustry.annotations.util;
import arc.struct.Array;
import arc.struct.*;
import arc.util.ArcAnnotate.*;
import com.squareup.javapoet.*;
import com.sun.tools.javac.code.Attribute.*;
@@ -23,8 +23,8 @@ public class Selement<T extends Element>{
return BaseProcessor.elementu.getDocComment(e);
}
public Array<Selement<?>> enclosed(){
return Array.with(e.getEnclosedElements()).map(Selement::new);
public Seq<Selement<?>> enclosed(){
return Seq.with(e.getEnclosedElements()).map(Selement::new);
}
public String fullName(){
@@ -55,8 +55,8 @@ public class Selement<T extends Element>{
return e instanceof ExecutableElement;
}
public Array<? extends AnnotationMirror> annotations(){
return Array.with(e.getAnnotationMirrors());
public Seq<? extends AnnotationMirror> annotations(){
return Seq.with(e.getAnnotationMirrors());
}
public <A extends Annotation> A annotation(Class<A> annotation){

View File

@@ -29,20 +29,20 @@ public class Smethod extends Selement<ExecutableElement>{
return new Stype((TypeElement)up());
}
public Array<TypeMirror> thrown(){
return Array.with(e.getThrownTypes()).as();
public Seq<TypeMirror> thrown(){
return Seq.with(e.getThrownTypes()).as();
}
public Array<TypeName> thrownt(){
return Array.with(e.getThrownTypes()).map(TypeName::get);
public Seq<TypeName> thrownt(){
return Seq.with(e.getThrownTypes()).map(TypeName::get);
}
public Array<TypeParameterElement> typeVariables(){
return Array.with(e.getTypeParameters()).as();
public Seq<TypeParameterElement> typeVariables(){
return Seq.with(e.getTypeParameters()).as();
}
public Array<Svar> params(){
return Array.with(e.getParameters()).map(Svar::new);
public Seq<Svar> params(){
return Seq.with(e.getParameters()).map(Svar::new);
}
public boolean isVoid(){

View File

@@ -20,19 +20,19 @@ public class Stype extends Selement<TypeElement>{
return mirror().toString();
}
public Array<Stype> interfaces(){
return Array.with(e.getInterfaces()).map(Stype::of);
public Seq<Stype> interfaces(){
return Seq.with(e.getInterfaces()).map(Stype::of);
}
public Array<Stype> allInterfaces(){
public Seq<Stype> allInterfaces(){
return interfaces().flatMap(s -> s.allInterfaces().and(s)).distinct();
}
public Array<Stype> superclasses(){
return Array.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of);
public Seq<Stype> superclasses(){
return Seq.with(BaseProcessor.typeu.directSupertypes(mirror())).map(Stype::of);
}
public Array<Stype> allSuperclasses(){
public Seq<Stype> allSuperclasses(){
return superclasses().flatMap(s -> s.allSuperclasses().and(s)).distinct();
}
@@ -40,17 +40,17 @@ public class Stype extends Selement<TypeElement>{
return new Stype((TypeElement)BaseProcessor.typeu.asElement(BaseProcessor.typeu.directSupertypes(mirror()).get(0)));
}
public Array<Svar> fields(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof VariableElement).map(e -> new Svar((VariableElement)e));
public Seq<Svar> fields(){
return Seq.with(e.getEnclosedElements()).select(e -> e instanceof VariableElement).map(e -> new Svar((VariableElement)e));
}
public Array<Smethod> methods(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
public Seq<Smethod> methods(){
return Seq.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
&& !e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e));
}
public Array<Smethod> constructors(){
return Array.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
public Seq<Smethod> constructors(){
return Seq.with(e.getEnclosedElements()).select(e -> e instanceof ExecutableElement
&& e.getSimpleName().toString().contains("<")).map(e -> new Smethod((ExecutableElement)e));
}

View File

@@ -19,10 +19,10 @@ public class TypeIOResolver{
ClassSerializer out = new ClassSerializer(new ObjectMap<>(), new ObjectMap<>(), new ObjectMap<>());
for(Stype type : processor.types(TypeIOHandler.class)){
//look at all TypeIOHandler methods
Array<Smethod> methods = type.methods();
Seq<Smethod> methods = type.methods();
for(Smethod meth : methods){
if(meth.is(Modifier.PUBLIC) && meth.is(Modifier.STATIC)){
Array<Svar> params = meth.params();
Seq<Svar> params = meth.params();
//2 params, second one is type, first is writer
if(params.size == 2 && params.first().tname().toString().equals("arc.util.io.Writes")){
out.writers.put(params.get(1).tname().toString(), type.fullName() + "." + meth.name());