Skip to content

Commit

Permalink
fix: Take care of PsiMethod which can be a constructor (#1057)
Browse files Browse the repository at this point in the history
Fixes #1057

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Jul 28, 2023
1 parent 256f05b commit e966804
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private static void collectJaxRsMethodInfo(PsiElement[] elements, String rootPat
}
continue;
} else if (element instanceof PsiMethod) {
if (utils.isHiddenGeneratedElement(element)) {
PsiMethod method = (PsiMethod) element;
if (method.isConstructor() || utils.isHiddenGeneratedElement(element)) {
continue;
}
// ignore element if method range overlaps the type range,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,18 @@ private String getJavadoc(PsiClass type, DocumentFormat documentFormat, String m
// 2) Check the methods for the member
PsiMethod[] methods = type.getMethods();
for (PsiMethod method : methods) {
try {
if (signature.equals(typeResolver.resolveMethodSignature(method))) {
String javadoc = utils.getJavadoc(method, documentFormat);
if (javadoc != null) {
return javadoc;
if (!method.isConstructor()) {
try {
if (signature.equals(typeResolver.resolveMethodSignature(method))) {
String javadoc = utils.getJavadoc(method, documentFormat);
if (javadoc != null) {
return javadoc;
}
}
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Error while getting method signature of '" + method.getName() + "'.",
e);
}
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Error while getting method signature of '" + method.getName() + "'.",
e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public List<JaxRsMethodInfo> getJaxRsMethodInfo(PsiFile typeRoot, JaxRsContext j
List<JaxRsMethodInfo> methodInfos = new ArrayList<>();
for (PsiMethod method : type.getMethods()) {

if (utils.isHiddenGeneratedElement(method)) {
if (method.isConstructor() || utils.isHiddenGeneratedElement(method)) {
continue;
}
// ignore element if method range overlaps the type range,
Expand Down

0 comments on commit e966804

Please sign in to comment.