{"record":{"id":"89ea3207dc25d7bc","repo":"quarkusio/quarkus","slug":"classinfo-name-should-not-be-extended-or-impl","errorCode":null,"errorMessage":"${classInfo.name()} should not be extended or implemented","messagePattern":"(.+?) should not be extended or implemented","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/panache/hibernate-orm-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/HibernateOrmPanacheRestProcessor.java","lineNumber":157,"sourceCode":"                    new UnremovableBeanBuildItem.BeanClassNameExclusion(repositoryClassName)));\n\n            restDataResourceProducer.produce(new RestDataResourceBuildItem(\n                    new ResourceMetadata(resourceClass, resourceInterface, entityType, idType,\n                            getEntityFields(index.getIndex(), entityType))));\n        }\n    }\n\n    private void validateResource(IndexView index, ClassInfo classInfo) {\n        if (!Modifier.isInterface(classInfo.flags())) {\n            throw new RuntimeException(classInfo.name() + \" has to be an interface\");\n        }\n\n        if (classInfo.interfaceNames().size() > 1) {\n            throw new RuntimeException(classInfo.name() + \" should only extend REST Data Panache interface\");\n        }\n\n        if (!index.getKnownDirectImplementors(classInfo.name()).isEmpty()) {\n            throw new RuntimeException(classInfo.name() + \" should not be extended or implemented\");\n        }\n    }\n\n    private List<Type> getGenericTypes(ClassInfo classInfo) {\n        return classInfo.interfaceTypes()\n                .stream()\n                .findFirst()\n                .orElseThrow(() -> new RuntimeException(classInfo.toString() + \" does not have generic types\"))\n                .asParameterizedType()\n                .arguments();\n    }\n}\n","sourceCodeStart":139,"sourceCodeEnd":170,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/panache/hibernate-orm-rest-data-panache/deployment/src/main/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/HibernateOrmPanacheRestProcessor.java#L139-L170","documentation":"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.","triggerScenarios":"Creating 'interface SpecialPersonResource extends PersonResource' or 'class PersonResourceImpl implements PersonResource' where PersonResource is the REST Data Panache resource.","commonSituations":"Hand-writing an implementation class for a resource interface; trying to inherit/override resource behavior via subinterfaces; accidental implementation in the same codebase.","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"],"exampleFix":"// before\npublic class PersonResourceImpl implements PersonResource {} // delete this\n// after\n// no implementing class; customize via the repository bean instead","handlingStrategy":"validation","validationCode":"for (Class<?> impl : knownImplementors(resourceClass))\n    throw new IllegalStateException(\"Resource interface \" + resourceClass + \" must not be extended or implemented: \" + impl);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-implement a REST Data Panache resource interface","Avoid creating subinterfaces of resource interfaces","Customize endpoints via the underlying repository bean methods"],"tags":["quarkus","panache","rest-data","build-time","interface"],"backgroundTag":"resource-must-be-interface","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}