Skip to content

protostuff-runtime can't convert interface to .protp #312

@tangmin823

Description

@tangmin823

If this tool convert java interface to proto, it will throw exception
image

Exception in thread "main" java.lang.RuntimeException: The root object can neither be an abstract class nor interface: "org.cango.demo.service.CarService
	at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:180)
	at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:156)
	at com.dyuproject.protostuff.runtime.IdStrategy.newSchema(IdStrategy.java:129)
	at com.dyuproject.protostuff.runtime.DefaultIdStrategy$Lazy.getSchema(DefaultIdStrategy.java:630)
	at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:119)
	at com.dyuproject.protostuff.runtime.RuntimeSchema.getSchema(RuntimeSchema.java:111)
	at net.webby.protostuff.runtime.NestedObjectTest.main(NestedObjectTest.java:28)

Code quoted:

public static void main(String[] args) {
      Schema<CarService> schema = RuntimeSchema.getSchema(CarService.class);
      String content = Generators.newProtoGenerator(schema).generate();
      System.out.println(content);
}
public interface CarService {

    Page<CarModelVO> findModelListBySeriesId(CarModelCondition condition);

}
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Page<T> {
    private Pagination page;
    private List<T> results;

    public Page(Pagination pagination) {
        this.page = pagination;
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions