Trigger for non lombok Builder.Default
This commit is contained in:
@ -742,7 +742,8 @@ in each object at runtime.
|
||||
[@Final= true() and @Static= false()]
|
||||
[VariableDeclarator/VariableInitializer/Expression
|
||||
/PrimaryExpression[not(PrimarySuffix)]/PrimaryPrefix/Literal]
|
||||
[not(preceding-sibling::Annotation/MarkerAnnotation/Name[@Image="Builder.Default"])]
|
||||
[not(preceding-sibling::Annotation/MarkerAnnotation/Name[@Image="Builder.Default"]
|
||||
and //ImportDeclaration/Name[@Image="lombok.Builder"])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -103,7 +103,7 @@ public @interface MetricType {
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#2708 - False positive with @Builder.Default fields</description>
|
||||
<description>#2708 - False positive with lombok @Builder.Default fields</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
package com.example;
|
||||
@ -111,6 +111,25 @@ package com.example;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ExampleClass {
|
||||
|
||||
@Builder.Default
|
||||
private final long exampleField = 0L;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#2708 - Should trigger with non-lombok @Builder.Default fields</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
package com.example;
|
||||
|
||||
import not.lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ExampleClass {
|
||||
|
Reference in New Issue
Block a user