From 3618ef007ddf6d925c2dc5611919c257f2deb2de Mon Sep 17 00:00:00 2001 From: Arlo O'Keeffe Date: Fri, 20 Apr 2018 14:09:50 +0200 Subject: [PATCH] Use return type of ExecutableElement. Fixes #2296 --- .../main/java/com/querydsl/apt/jpa/JPAConfiguration.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java b/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java index bbc764987..e9c3152a7 100644 --- a/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java +++ b/querydsl-apt/src/main/java/com/querydsl/apt/jpa/JPAConfiguration.java @@ -113,7 +113,12 @@ public class JPAConfiguration extends DefaultConfiguration { } if (mirror != null) { TypeMirror typeArg = TypeUtils.getAnnotationValueAsTypeMirror(mirror, "targetEntity"); - TypeMirror erasure = types.erasure(element.asType()); + TypeMirror erasure; + if (element instanceof ExecutableElement) { + erasure = ((ExecutableElement) element).getReturnType(); + } else { + erasure = types.erasure(element.asType()); + } TypeElement typeElement = (TypeElement) types.asElement(erasure); if (typeElement != null && typeArg != null) { if (typeElement.getTypeParameters().size() == 1) {