quarkusio/quarkus · error · RuntimeException
${classInfo.name()} should not be extended or implemented
Error message
${classInfo.name()} should not be extended or implemented What it means
validateResource rejects resource interfaces that are extended or implemented by other types (Jandex finds direct implementors). The resource interface must be a leaf: the extension generates the implementation itself, so user-side subtyping is unsupported and fails the build.
Source
Thrown at extensions/panache/hibernate-orm-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/HibernateOrmPanacheRestProcessor.java:157
new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));
restDataResourceProducer.produce(new RestDataResourceBuildItem(
new ResourceMetadata(resourceClass, resourceInterface, entityType, idType,
getEntityFields(index.getIndex(), entityType))));
}
}
private void validateResource(IndexView index, ClassInfo classInfo) {
if (!Modifier.isInterface(classInfo.flags())) {
throw new RuntimeException(classInfo.name() + " has to be an interface");
}
if (classInfo.interfaceNames().size() > 1) {
throw new RuntimeException(classInfo.name() + " should only extend REST Data Panache interface");
}
if (!index.getKnownDirectImplementors(classInfo.name()).isEmpty()) {
throw new RuntimeException(classInfo.name() + " should not be extended or implemented");
}
}
private List<Type> getGenericTypes(ClassInfo classInfo) {
return classInfo.interfaceTypes()
.stream()
.findFirst()
.orElseThrow(() -> new RuntimeException(classInfo.toString() + " does not have generic types"))
.asParameterizedType()
.arguments();
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Delete any class implementing the resource interface (the extension generates it)
- Remove any interface extending the resource interface
- Customize behavior using entity/repository methods instead of resource subtyping
Example fix
// before
public class PersonResourceImpl implements PersonResource {} // delete this
// after
// no implementing class; customize via the repository bean instead Defensive patterns
Strategy: validation
Validate before calling
for (Class<?> impl : knownImplementors(resourceClass))
throw new IllegalStateException("Resource interface " + resourceClass + " must not be extended or implemented: " + impl); Prevention
- Never hand-implement a REST Data Panache resource interface
- Avoid creating subinterfaces of resource interfaces
- Customize endpoints via the underlying repository bean methods
When it happens
Trigger: Creating 'interface SpecialPersonResource extends PersonResource' or 'class PersonResourceImpl implements PersonResource' where PersonResource is the REST Data Panache resource.
Common situations: Hand-writing an implementation class for a resource interface; trying to inherit/override resource behavior via subinterfaces; accidental implementation in the same codebase.
Related errors
- ${classInfo.name()} has to be an interface
- ${classInfo.name()} should only extend REST Data Panache int
- Couldn't find id field of ${classInfo}
- has to be an interface
- should only extend REST Data Panache interface
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/89ea3207dc25d7bc.
Report an issue: GitHub.