Skip to content

Commit f0b1ec3

Browse files
committed
Unable to detect hyperlink on property value of @Result annotation if the return type is List
1 parent 44b8d7f commit f0b1ec3

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

mybatipse/src/net/harawata/mybatipse/hyperlink/JavaHyperlinkDetector.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import net.harawata.mybatipse.mybatis.JavaMapperUtil.ResultsAnnotationWithId;
6060
import net.harawata.mybatipse.mybatis.MapperNamespaceCache;
6161
import net.harawata.mybatipse.mybatis.MybatipseXmlUtil;
62+
import net.harawata.mybatipse.util.NameUtil;
6263
import net.harawata.mybatipse.util.XpathUtil;
6364

6465
/**
@@ -279,33 +280,33 @@ private void parseResults(Annotation anno)
279280
}
280281
for (Expression resultAnno : resultAnnos)
281282
{
282-
if (isInRange(resultAnno, offset))
283+
if (!isInRange(resultAnno, offset))
284+
continue;
285+
createHyperlink("select",
286+
expressionAt(annotationValueAt((Annotation)annotationValueAt((Annotation)resultAnno,
287+
Arrays.asList("one", "many"), offset), "select", offset), offset));
288+
if (hyperlink == null)
283289
{
284-
createHyperlink("select",
285-
expressionAt(annotationValueAt((Annotation)annotationValueAt((Annotation)resultAnno,
286-
Arrays.asList("one", "many"), offset), "select", offset), offset));
287-
if (hyperlink == null)
290+
Expression propertyName = annotationValueAt((Annotation)resultAnno, "property",
291+
offset);
292+
if (propertyName == null)
293+
return;
294+
String returnType = method.resolveBinding().getReturnType().getQualifiedName();
295+
if (returnType == null || "void".equals(returnType))
296+
return;
297+
try
288298
{
289-
Expression propertyName = annotationValueAt((Annotation)resultAnno, "property",
290-
offset);
291-
if (propertyName == null)
292-
return;
293-
String returnType = method.resolveBinding().getReturnType().getQualifiedName();
294-
if (returnType == null || "void".equals(returnType))
295-
return;
296-
try
297-
{
298-
hyperlink = linkToJavaProperty(project, returnType,
299-
(String)propertyName.resolveConstantExpressionValue(),
300-
new Region(propertyName.getStartPosition(), propertyName.getLength()));
301-
}
302-
catch (JavaModelException e)
303-
{
304-
Activator.log(Status.ERROR, e.getMessage(), e);
305-
}
299+
hyperlink = linkToJavaProperty(project,
300+
NameUtil.manageableReturnType(project, returnType),
301+
(String)propertyName.resolveConstantExpressionValue(),
302+
new Region(propertyName.getStartPosition(), propertyName.getLength()));
303+
}
304+
catch (JavaModelException e)
305+
{
306+
Activator.log(Status.ERROR, e.getMessage(), e);
306307
}
307-
break;
308308
}
309+
break;
309310
}
310311
}
311312

0 commit comments

Comments
 (0)