do not search for lambda parameter javadoc

This commit is contained in:
Anna Kozlova
2014-11-18 18:36:38 +01:00
parent 98c34507af
commit f52ceb369b
4 changed files with 32 additions and 4 deletions
@@ -854,13 +854,13 @@ public class JavaDocInfoGenerator {
buffer.append("</b>");
buffer.append("</PRE>");
final PsiMethod method = PsiTreeUtil.getParentOfType(parameter, PsiMethod.class);
final PsiElement method = PsiTreeUtil.getParentOfType(parameter, PsiMethod.class, PsiLambdaExpression.class);
if (method != null) {
final PsiDocComment docComment = getDocComment(method);
if (method instanceof PsiMethod) {
final PsiDocComment docComment = getDocComment((PsiMethod)method);
if (docComment != null) {
final Pair<PsiDocTag, InheritDocProvider<PsiDocTag>> tagInfoProvider =
findDocTag(docComment.getTags(), parameter.getName(), method);
findDocTag(docComment.getTags(), parameter.getName(), (PsiMethod)method);
if (tagInfoProvider != null) {
PsiElement[] elements = tagInfoProvider.first.getDataElements();
@@ -0,0 +1 @@
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><PRE>int <b>a</b></PRE></body></html>
@@ -0,0 +1,16 @@
class Test {
interface I {
String m(int a);
}
/**
* @param a not my wrong javadoc
*/
public String getY() {
I i = (a) -> {
return null;
};
return null;
}
}
@@ -165,6 +165,10 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
assertEquals(exampleHtmlFileText(getTestName(true)), StringUtil.convertLineSeparators(docInfo.trim()));
}
public void testLambdaParameter() throws Exception {
doTestLamabdaParameter();
}
private void doTestField() throws Exception {
PsiClass psiClass = getTestClass();
PsiField field = psiClass.getFields() [0];
@@ -177,6 +181,13 @@ public class JavaDocInfoGeneratorTest extends CodeInsightTestCase {
verifyJavaDoc(method);
}
private void doTestLamabdaParameter() throws Exception {
PsiClass psiClass = getTestClass();
final PsiLambdaExpression lambdaExpression = PsiTreeUtil.findChildOfType(psiClass, PsiLambdaExpression.class);
assertNotNull(lambdaExpression);
verifyJavaDoc(lambdaExpression.getParameterList().getParameters()[0]);
}
private PsiClass getTestClass() throws Exception{
configureByFile("/codeInsight/javadocIG/" + getTestName(true) + ".java");
return ((PsiJavaFile)myFile).getClasses() [0];