#1422 UselessQualifiedThis: False positive with Java 8 Function
This commit is contained in:
@ -297,10 +297,12 @@ public class Foo {
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//PrimaryExpression[
|
||||
PrimaryPrefix/Name[@Image] and PrimarySuffix[@Arguments='false']
|
||||
and ancestor::ClassOrInterfaceBodyDeclaration[1][@AnonymousInnerClass='false']
|
||||
]/PrimaryPrefix/Name[@Image = ancestor::ClassOrInterfaceDeclaration[1]/@Image]
|
||||
//PrimaryExpression
|
||||
[PrimaryPrefix/Name[@Image]]
|
||||
[PrimarySuffix[@Arguments='false']]
|
||||
[not(PrimarySuffix/MemberSelector)]
|
||||
[ancestor::ClassOrInterfaceBodyDeclaration[1][@AnonymousInnerClass='false']]
|
||||
/PrimaryPrefix/Name[@Image = ancestor::ClassOrInterfaceDeclaration[1]/@Image]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -130,4 +130,23 @@ public class Foo {
|
||||
</code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#1422 UselessQualifiedThis: False positive with Java 8 Function</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class ApiExceptionCtrlAdvice {
|
||||
public final List<ApiError> handleApiAggregateException(final ApiAggregateException e) {
|
||||
return e.getCauses().stream().map(
|
||||
ApiExceptionCtrlAdvice::toApiError
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
private static ApiError toApiError(final Throwable e) {
|
||||
return new ApiError()
|
||||
.withException(e.getClass().getName())
|
||||
.withCause(Optional.ofNullable(e.getCause()).map(Throwable::getClass).map(Class::getName).orElse(EMPTY))
|
||||
.withMessage(Optional.ofNullable(e.getMessage()).orElse(EMPTY));
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
Reference in New Issue
Block a user