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()]
|
[@Final= true() and @Static= false()]
|
||||||
[VariableDeclarator/VariableInitializer/Expression
|
[VariableDeclarator/VariableInitializer/Expression
|
||||||
/PrimaryExpression[not(PrimarySuffix)]/PrimaryPrefix/Literal]
|
/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>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
@ -103,7 +103,7 @@ public @interface MetricType {
|
|||||||
</test-code>
|
</test-code>
|
||||||
|
|
||||||
<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>
|
<expected-problems>0</expected-problems>
|
||||||
<code><![CDATA[
|
<code><![CDATA[
|
||||||
package com.example;
|
package com.example;
|
||||||
@ -111,6 +111,25 @@ package com.example;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
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
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
public class ExampleClass {
|
public class ExampleClass {
|
||||||
|
Reference in New Issue
Block a user