[litho] Add test for replicating issue with null access path args

Summary: This diff adds a test replicating the issue fixed in D26975222 (7110c1ca3f) in [commit 7110c1c](7110c1ca3f)

Reviewed By: ngorogiannis

Differential Revision: D26978562

fbshipit-source-id: 41e41df8c
master
Ezgi Çiçek 4 years ago committed by Facebook GitHub Bot
parent 55e4108a35
commit 0599185fca

@ -228,6 +228,24 @@ public class RequiredProps {
builder.child(childBuilder); builder.child(childBuilder);
} }
Component.Builder getBuilder(MyComponent.Builder builder) {
if (builder == null) {
return null;
} else {
return builder.prop1(new Object());
}
}
public void buildWithColumnChildBadNullOk() {
Column.Builder builder = Column.create();
builder.child(getBuilder(null));
}
public void buildWithColumnChildBadCalleeBad() {
Column.Builder builder = Column.create();
builder.child(getBuilder(mMyComponent.create()));
}
public Component buildWithColumnChildOk() { public Component buildWithColumnChildOk() {
return Column.create() return Column.create()
.child(mMyComponent.create().prop1(new Object()).prop3(new Object())) .child(mMyComponent.create().prop1(new Object()).prop3(new Object()))

@ -11,6 +11,7 @@ codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.l
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildPropResWithPxDoubleBad():void, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop propPx** is required for component codetoanalyze.java.litho.ResPropDoubleComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.ResPropDoubleComponent.create(...),calls prop(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildPropResWithPxDoubleBad():void, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop propPx** is required for component codetoanalyze.java.litho.ResPropDoubleComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.ResPropDoubleComponent.create(...),calls prop(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildPropVarArgMissingBad():void, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**Either @Prop props or @Prop(varArg = prop)** is required for component codetoanalyze.java.litho.VarArgPropComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.VarArgPropComponent.create(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildPropVarArgMissingBad():void, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**Either @Prop props or @Prop(varArg = prop)** is required for component codetoanalyze.java.litho.VarArgPropComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.VarArgPropComponent.create(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithColumnChildBad():void, 2, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop3** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop1(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithColumnChildBad():void, 2, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop3** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop1(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithColumnChildBadCalleeBad():void, 2, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop3** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop1(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithout1Bad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop1** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop2(...),calls prop3(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithout1Bad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop1** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop2(...),calls prop3(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithout3Bad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop3** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop1(...),calls prop2(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.buildWithout3Bad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop3** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop1(...),calls prop2(...)]
codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.callBuildSuffixWithoutRequiredBad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop1** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop2(...),calls prop3(...)] codetoanalyze/java/litho-required-props/RequiredProps.java, codetoanalyze.java.litho.RequiredProps.callBuildSuffixWithoutRequiredBad():com.facebook.litho.Component, 1, MISSING_REQUIRED_PROP, no_bucket, ERROR, [**@Prop prop1** is required for component codetoanalyze.java.litho.MyComponent, but is not set before the call to build(). Either set the missing @Prop or make @Prop(optional = true).,calls codetoanalyze.java.litho.MyComponent.create(...),calls prop2(...),calls prop3(...)]

Loading…
Cancel
Save