Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.10.1
-
Fix Version/s: 1.11
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
I have two classes where first (GenericControllerImpl) is some generic purpose controller with common CRUD methods. Second class (GroupControllerImpl) extends parent to add some REST methods.
With QDox I can't resolve type variables from GenericControllerImpl. JavaClass returned after parsing GroupControllerImpl also has no parent class.
Code
Test code
JavaDocBuilder builder = new JavaDocBuilder(); JavaSource source = builder.addSource(new File("GroupControllerImpl.java")); System.out.println(source.getClasses()[0].getParentClass()); source = builder.addSource(new File("GenericControllerImpl.java")); System.out.println(source.getClasses()[0].getImplementedInterfaces()[0].asType());
Classes looks next:
GroupControllerImpl
package org.code_house.web; import org.code_house.dataaccess.GroupDAO; import org.code_house.domain.Group; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; public class GroupControllerImpl extends GenericControllerImpl<Group, Long, GroupDAO> { @Autowired public void setUserDao(GroupDAO dao) { this.dao = dao; } @RequestMapping("/x") @ModelAttribute("test") public Boolean doSomething() { return null; } }
GenericControllerImpl.java
package org.code_house.web; import java.util.List; import org.code_house.dataaccess.GenericDAO; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; public abstract class GenericControllerImpl<T, K, D extends GenericDAO<T, K>> implements GenericController<T, K>, InitializingBean { protected D dao; @RequestMapping public T create(@RequestBody T object) { dao.create(object); return object; } @RequestMapping public Boolean update(@PathVariable K id, @RequestBody T object) { dao.update(object); return true; } @RequestMapping public T read(@PathVariable K id) { return dao.readById(id); } @RequestMapping public Boolean remove(@PathVariable K id) { return dao.deleteById(id); } @RequestMapping public List<T> getAllRecords() { return dao.getAll(); } public void afterPropertiesSet() { Assert.notNull(dao); } }
Activity
Robert Scholte
made changes -
Field | Original Value | New Value |
---|---|---|
Summary | Broken inheritance hierarchy when using generic parent class | Expose Type.actualTypeArguments and add JavaClass.typeParameters |
Robert Scholte
made changes -
Assignee | Robert Scholte [ rfscholte ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.11 [ 16104 ] |
getParentClass() is used for innerClasses. You'll have to use getSuperClass() to get it's ... well, super class.
Hope this will solve your problem.