diff --git a/litho-annotations/src/main/java/com/facebook/litho/annotations/MountSpec.java b/litho-annotations/src/main/java/com/facebook/litho/annotations/MountSpec.java index 4e4503f9bda..502f4a914c3 100644 --- a/litho-annotations/src/main/java/com/facebook/litho/annotations/MountSpec.java +++ b/litho-annotations/src/main/java/com/facebook/litho/annotations/MountSpec.java @@ -116,7 +116,9 @@ */ int poolSize() default 3; - /** @return whether the component generated from this MountSpec will be preallocated. */ + /** + * @return whether the component generated from this MountSpec will be preallocated. + */ boolean canPreallocate() default false; /** diff --git a/litho-annotations/src/main/java/com/facebook/litho/annotations/OnCalculateCachedValue.java b/litho-annotations/src/main/java/com/facebook/litho/annotations/OnCalculateCachedValue.java index bbb923e1c5a..caf02fdc340 100644 --- a/litho-annotations/src/main/java/com/facebook/litho/annotations/OnCalculateCachedValue.java +++ b/litho-annotations/src/main/java/com/facebook/litho/annotations/OnCalculateCachedValue.java @@ -26,6 +26,8 @@ @Retention(RetentionPolicy.RUNTIME) public @interface OnCalculateCachedValue { - /** @return the name of the {@link CachedValue} that is being calculated. */ + /** + * @return the name of the {@link CachedValue} that is being calculated. + */ String name(); } diff --git a/litho-annotations/src/main/java/com/facebook/litho/annotations/Prop.java b/litho-annotations/src/main/java/com/facebook/litho/annotations/Prop.java index c5e708e98d4..04d057431a1 100644 --- a/litho-annotations/src/main/java/com/facebook/litho/annotations/Prop.java +++ b/litho-annotations/src/main/java/com/facebook/litho/annotations/Prop.java @@ -131,7 +131,9 @@ */ ResType resType() default ResType.NONE; - /** @return The documentation for the annotated parameter. */ + /** + * @return The documentation for the annotated parameter. + */ String docString() default ""; /** @@ -155,7 +157,9 @@ */ String varArg() default ""; - /** @return {@code true} if the name of the prop conflicts with a common prop. */ + /** + * @return {@code true} if the name of the prop conflicts with a common prop. + */ boolean isCommonProp() default false; /** diff --git a/litho-annotations/src/main/java/com/facebook/litho/annotations/PropSetter.java b/litho-annotations/src/main/java/com/facebook/litho/annotations/PropSetter.java index 7607bd02ece..a092808b961 100644 --- a/litho-annotations/src/main/java/com/facebook/litho/annotations/PropSetter.java +++ b/litho-annotations/src/main/java/com/facebook/litho/annotations/PropSetter.java @@ -25,8 +25,13 @@ */ @Retention(RetentionPolicy.CLASS) public @interface PropSetter { - /** @return {@link Prop} name that method with this annotation sets. */ + /** + * @return {@link Prop} name that method with this annotation sets. + */ String value(); - /** @return true if the {@link Prop} is required, false if is optional. */ + + /** + * @return true if the {@link Prop} is required, false if is optional. + */ boolean required(); } diff --git a/litho-annotations/src/main/java/com/facebook/litho/annotations/RequiredProp.java b/litho-annotations/src/main/java/com/facebook/litho/annotations/RequiredProp.java index 759452b273e..38f2f779a3d 100644 --- a/litho-annotations/src/main/java/com/facebook/litho/annotations/RequiredProp.java +++ b/litho-annotations/src/main/java/com/facebook/litho/annotations/RequiredProp.java @@ -25,6 +25,8 @@ */ @Retention(RetentionPolicy.CLASS) public @interface RequiredProp { - /** @return required {@link Prop} name method with this annotation sets. */ + /** + * @return required {@link Prop} name method with this annotation sets. + */ String value(); } diff --git a/litho-core/src/main/java/com/facebook/litho/Component.java b/litho-core/src/main/java/com/facebook/litho/Component.java index 91769547192..59a6d87a5e9 100644 --- a/litho-core/src/main/java/com/facebook/litho/Component.java +++ b/litho-core/src/main/java/com/facebook/litho/Component.java @@ -693,7 +693,9 @@ final void setErrorEventHandlerDuringRender(EventHandler errorHandle mErrorEventHandler = errorHandler; } - /** @return a handle that is unique to this component. */ + /** + * @return a handle that is unique to this component. + */ @Nullable public final Handle getHandle() { return mHandle; @@ -708,7 +710,9 @@ final void setHandle(@Nullable Handle handle) { mHandle = handle; } - /** @return a key that is local to the component's parent. */ + /** + * @return a key that is local to the component's parent. + */ final String getKey() { if (mKey == null) { if (mHasManualKey) { @@ -733,12 +737,16 @@ final void setKey(String key) { mKey = key; } - /** @return if has a handle set */ + /** + * @return if has a handle set + */ final boolean hasHandle() { return mHandle != null; } - /** @return if has a manually set key */ + /** + * @return if has a manually set key + */ final boolean hasManualKey() { return mHasManualKey; } @@ -826,7 +834,9 @@ static boolean hasCachedNode(final ResolveContext context, final Component compo return component.hasCachedNode(context); } - /** @return whether the given component is a pure render component. */ + /** + * @return whether the given component is a pure render component. + */ @VisibleForTesting public static boolean isPureRender(@Nullable Component component) { return component != null && component.isPureRender(); @@ -1214,17 +1224,23 @@ public T flex(float flex) { return getThis(); } - /** @see #flexBasisPx */ + /** + * @see #flexBasisPx + */ public T flexBasisAttr(@AttrRes int resId, @DimenRes int defaultResId) { return flexBasisPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #flexBasisPx */ + /** + * @see #flexBasisPx + */ public T flexBasisAttr(@AttrRes int resId) { return flexBasisAttr(resId, 0); } - /** @see #flexBasisPx */ + /** + * @see #flexBasisPx + */ public T flexBasisDip(@Dimension(unit = DP) float flexBasis) { return flexBasisPx(mResourceResolver.dipsToPixels(flexBasis)); } @@ -1255,7 +1271,9 @@ public T flexBasisPx(@Px int flexBasis) { return getThis(); } - /** @see #flexBasisPx */ + /** + * @see #flexBasisPx + */ public T flexBasisRes(@DimenRes int resId) { return flexBasisPx(mResourceResolver.resolveDimenSizeRes(resId)); } @@ -1371,17 +1389,23 @@ public boolean hasClickHandlerSet() { return mComponent.hasClickHandlerSet(); } - /** @see #heightPx */ + /** + * @see #heightPx + */ public T heightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return heightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #heightPx */ + /** + * @see #heightPx + */ public T heightAttr(@AttrRes int resId) { return heightAttr(resId, 0); } - /** @see #heightPx */ + /** + * @see #heightPx + */ public T heightDip(@Dimension(unit = DP) float height) { return heightPx(mResourceResolver.dipsToPixels(height)); } @@ -1409,7 +1433,9 @@ public T heightPx(@Px int height) { return getThis(); } - /** @see #heightPx */ + /** + * @see #heightPx + */ public T heightRes(@DimenRes int resId) { return heightPx(mResourceResolver.resolveDimenSizeRes(resId)); } @@ -1470,23 +1496,31 @@ public T longClickHandler(@Nullable EventHandler longClickHandle return getThis(); } - /** @see #marginPx */ + /** + * @see #marginPx + */ public T marginAttr(YogaEdge edge, @AttrRes int resId, @DimenRes int defaultResId) { return marginPx(edge, mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #marginPx */ + /** + * @see #marginPx + */ public T marginAttr(YogaEdge edge, @AttrRes int resId) { return marginAttr(edge, resId, 0); } - /** @see #marginPx */ + /** + * @see #marginPx + */ public T marginAuto(YogaEdge edge) { mComponent.getOrCreateCommonProps().marginAuto(edge); return getThis(); } - /** @see #marginPx */ + /** + * @see #marginPx + */ public T marginDip(YogaEdge edge, @Dimension(unit = DP) float margin) { return marginPx(edge, mResourceResolver.dipsToPixels(margin)); } @@ -1511,22 +1545,30 @@ public T marginPx(YogaEdge edge, @Px int margin) { return getThis(); } - /** @see #marginPx */ + /** + * @see #marginPx + */ public T marginRes(YogaEdge edge, @DimenRes int resId) { return marginPx(edge, mResourceResolver.resolveDimenSizeRes(resId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxHeightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return maxHeightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxHeightAttr(@AttrRes int resId) { return maxHeightAttr(resId, 0); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxHeightDip(@Dimension(unit = DP) float maxHeight) { return maxHeightPx(mResourceResolver.dipsToPixels(maxHeight)); } @@ -1540,28 +1582,38 @@ public T maxHeightPercent(float percent) { return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxHeightPx(@Px int maxHeight) { mComponent.getOrCreateCommonProps().maxHeightPx(maxHeight); return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxHeightRes(@DimenRes int resId) { return maxHeightPx(mResourceResolver.resolveDimenSizeRes(resId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxWidthAttr(@AttrRes int resId, @DimenRes int defaultResId) { return maxWidthPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxWidthAttr(@AttrRes int resId) { return maxWidthAttr(resId, 0); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxWidthDip(@Dimension(unit = DP) float maxWidth) { return maxWidthPx(mResourceResolver.dipsToPixels(maxWidth)); } @@ -1575,28 +1627,38 @@ public T maxWidthPercent(float percent) { return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxWidthPx(@Px int maxWidth) { mComponent.getOrCreateCommonProps().maxWidthPx(maxWidth); return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T maxWidthRes(@DimenRes int resId) { return maxWidthPx(mResourceResolver.resolveDimenSizeRes(resId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minHeightAttr(@AttrRes int resId, @DimenRes int defaultResId) { return minHeightPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minHeightAttr(@AttrRes int resId) { return minHeightAttr(resId, 0); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minHeightDip(@Dimension(unit = DP) float minHeight) { return minHeightPx(mResourceResolver.dipsToPixels(minHeight)); } @@ -1610,28 +1672,38 @@ public T minHeightPercent(float percent) { return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minHeightPx(@Px int minHeight) { mComponent.getOrCreateCommonProps().minHeightPx(minHeight); return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minHeightRes(@DimenRes int resId) { return minHeightPx(mResourceResolver.resolveDimenSizeRes(resId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minWidthAttr(@AttrRes int resId, @DimenRes int defaultResId) { return minWidthPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minWidthAttr(@AttrRes int resId) { return minWidthAttr(resId, 0); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minWidthDip(@Dimension(unit = DP) float minWidth) { return minWidthPx(mResourceResolver.dipsToPixels(minWidth)); } @@ -1655,7 +1727,9 @@ public T minWidthPx(@Px int minWidth) { return getThis(); } - /** @see #minWidthPx */ + /** + * @see #minWidthPx + */ public T minWidthRes(@DimenRes int resId) { return minWidthPx(mResourceResolver.resolveDimenSizeRes(resId)); } @@ -1704,17 +1778,23 @@ public T outlineProvider(@Nullable ViewOutlineProvider outlineProvider) { return getThis(); } - /** @see #paddingPx */ + /** + * @see #paddingPx + */ public T paddingAttr(YogaEdge edge, @AttrRes int resId, @DimenRes int defaultResId) { return paddingPx(edge, mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #paddingPx */ + /** + * @see #paddingPx + */ public T paddingAttr(YogaEdge edge, @AttrRes int resId) { return paddingAttr(edge, resId, 0); } - /** @see #paddingPx */ + /** + * @see #paddingPx + */ public T paddingDip(YogaEdge edge, @Dimension(unit = DP) float padding) { return paddingPx(edge, mResourceResolver.dipsToPixels(padding)); } @@ -1739,7 +1819,9 @@ public T paddingPx(YogaEdge edge, @Px int padding) { return getThis(); } - /** @see #paddingPx */ + /** + * @see #paddingPx + */ public T paddingRes(YogaEdge edge, @DimenRes int resId) { return paddingPx(edge, mResourceResolver.resolveDimenSizeRes(resId)); } @@ -1752,17 +1834,23 @@ public T performAccessibilityActionHandler( return getThis(); } - /** @see #positionPx */ + /** + * @see #positionPx + */ public T positionAttr(YogaEdge edge, @AttrRes int resId, @DimenRes int defaultResId) { return positionPx(edge, mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #positionPx */ + /** + * @see #positionPx + */ public T positionAttr(YogaEdge edge, @AttrRes int resId) { return positionAttr(edge, resId, 0); } - /** @see #positionPx */ + /** + * @see #positionPx + */ public T positionDip(YogaEdge edge, @Dimension(unit = DP) float position) { return positionPx(edge, mResourceResolver.dipsToPixels(position)); } @@ -1787,7 +1875,9 @@ public T positionPx(YogaEdge edge, @Px int position) { return getThis(); } - /** @see #positionPx */ + /** + * @see #positionPx + */ public T positionRes(YogaEdge edge, @DimenRes int resId) { return positionPx(edge, mResourceResolver.resolveDimenSizeRes(resId)); } @@ -2115,17 +2205,23 @@ public T visibleWidthRatio(float visibleWidthRatio) { return getThis(); } - /** @see #widthPx */ + /** + * @see #widthPx + */ public T widthAttr(@AttrRes int resId, @DimenRes int defaultResId) { return widthPx(mResourceResolver.resolveDimenSizeAttr(resId, defaultResId)); } - /** @see #widthPx */ + /** + * @see #widthPx + */ public T widthAttr(@AttrRes int resId) { return widthAttr(resId, 0); } - /** @see #widthPx */ + /** + * @see #widthPx + */ public T widthDip(@Dimension(unit = DP) float width) { return widthPx(mResourceResolver.dipsToPixels(width)); } @@ -2152,7 +2248,9 @@ public T widthPx(@Px int width) { return getThis(); } - /** @see #widthPx */ + /** + * @see #widthPx + */ public T widthRes(@DimenRes int resId) { return widthPx(mResourceResolver.resolveDimenSizeRes(resId)); } diff --git a/litho-core/src/main/java/com/facebook/litho/ComponentContext.java b/litho-core/src/main/java/com/facebook/litho/ComponentContext.java index a5aeeeb0e29..df0efb6ad84 100644 --- a/litho-core/src/main/java/com/facebook/litho/ComponentContext.java +++ b/litho-core/src/main/java/com/facebook/litho/ComponentContext.java @@ -197,7 +197,9 @@ static ComponentContext withComponentScope( return componentContext; } - /** @deprecated introduced for legacy test cases - don't add new callers */ + /** + * @deprecated introduced for legacy test cases - don't add new callers + */ @VisibleForTesting @Deprecated public static ComponentContext createScopedComponentContextWithStateForTest( @@ -564,7 +566,8 @@ public ComponentsLogger getLogger() { if (mLithoTree == null) { throw new RuntimeException( - "Calling findViewWithTag on a ComponentContext which isn't associated with a Tree. Make sure it's one received in `render` or `onCreateLayout`"); + "Calling findViewWithTag on a ComponentContext which isn't associated with a Tree. Make" + + " sure it's one received in `render` or `onCreateLayout`"); } final View mountedView = mLithoTree.getMountedViewReference().getMountedView(); // The tree isn't mounted diff --git a/litho-core/src/main/java/com/facebook/litho/ComponentHost.java b/litho-core/src/main/java/com/facebook/litho/ComponentHost.java index 7376f151074..e676cd3bd59 100644 --- a/litho-core/src/main/java/com/facebook/litho/ComponentHost.java +++ b/litho-core/src/main/java/com/facebook/litho/ComponentHost.java @@ -322,13 +322,17 @@ private void maybeUnregisterTouchExpansion(int index, MountItem item) { mTouchExpansionDelegate.unregisterTouchExpansion(index); } - /** @return number of {@link MountItem}s that are currently mounted in the host. */ + /** + * @return number of {@link MountItem}s that are currently mounted in the host. + */ @Override public int getMountItemCount() { return mMountItems.size(); } - /** @return the {@link MountItem} that was mounted with the given index. */ + /** + * @return the {@link MountItem} that was mounted with the given index. + */ @Override public MountItem getMountItemAt(int index) { return mMountItems.valueAt(index); @@ -353,7 +357,9 @@ MountItem getAccessibleMountItem() { return null; } - /** @return list of drawables that are mounted on this host. */ + /** + * @return list of drawables that are mounted on this host. + */ public List getDrawables() { final int size = mDrawableMountItems.size(); if (size == 0) { @@ -369,7 +375,9 @@ public List getDrawables() { return drawables; } - /** @return list of names of content mounted on this host. */ + /** + * @return list of names of content mounted on this host. + */ public List getContentNames() { final int contentSize = mMountItems.size(); if (contentSize == 0) { @@ -384,7 +392,9 @@ public List getContentNames() { return contentNames; } - /** @return the text content that is mounted on this host. */ + /** + * @return the text content that is mounted on this host. + */ @DoNotStrip public List getTextContent() { return ComponentHostUtils.extractTextContent(ComponentHostUtils.extractContent(mMountItems)); @@ -410,12 +420,16 @@ public List getTextContentText() { return textList; } - /** @return the image content that is mounted on this host. */ + /** + * @return the image content that is mounted on this host. + */ public ImageContent getImageContent() { return ComponentHostUtils.extractImageContent(ComponentHostUtils.extractContent(mMountItems)); } - /** @return the content descriptons that are set on content mounted on this host */ + /** + * @return the content descriptons that are set on content mounted on this host + */ @Nullable @Override public CharSequence getContentDescription() { @@ -569,7 +583,9 @@ void setComponentLongClickListener(ComponentLongClickListener listener) { setSafeViewModificationsEnabled(prevSafeModification); } - /** @return The previously set long click listener */ + /** + * @return The previously set long click listener + */ @Nullable ComponentLongClickListener getComponentLongClickListener() { return mOnLongClickListener; @@ -588,7 +604,9 @@ void setComponentFocusChangeListener(ComponentFocusChangeListener listener) { setSafeViewModificationsEnabled(prevSafeModification); } - /** @return The previously set focus change listener */ + /** + * @return The previously set focus change listener + */ ComponentFocusChangeListener getComponentFocusChangeListener() { return mOnFocusChangeListener; } @@ -626,7 +644,9 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { return super.onInterceptTouchEvent(ev); } - /** @return The previous set touch listener. */ + /** + * @return The previous set touch listener. + */ @Nullable public ComponentTouchListener getComponentTouchListener() { return mOnTouchListener; @@ -1553,7 +1573,8 @@ private void checkUnsafeViewModification() { break; case CRASH: throw new ComponentHostInvalidModification( - "Should not modify component host outside of the Litho View Attributes Extensions. Let us know if your use case is valid"); + "Should not modify component host outside of the Litho View Attributes Extensions." + + " Let us know if your use case is valid"); } } } diff --git a/litho-core/src/main/java/com/facebook/litho/ComponentUtils.java b/litho-core/src/main/java/com/facebook/litho/ComponentUtils.java index 8f71557622b..e07a57d0bfc 100644 --- a/litho-core/src/main/java/com/facebook/litho/ComponentUtils.java +++ b/litho-core/src/main/java/com/facebook/litho/ComponentUtils.java @@ -337,7 +337,8 @@ static String treeToString(@Nullable LithoNode root) { for (int index = 0; index < level - 1; index++) { isLast = iterator.next() == null; if (!isLast) { - while (iterator.next() != null) ; + while (iterator.next() != null) + ; } builder.append(isLast ? ' ' : "\u2502").append(' '); } diff --git a/litho-core/src/main/java/com/facebook/litho/DrawableMatrix.java b/litho-core/src/main/java/com/facebook/litho/DrawableMatrix.java index 9d93d9f7892..48dc18c0967 100644 --- a/litho-core/src/main/java/com/facebook/litho/DrawableMatrix.java +++ b/litho-core/src/main/java/com/facebook/litho/DrawableMatrix.java @@ -32,7 +32,9 @@ public final class DrawableMatrix extends Matrix { private DrawableMatrix() {} - /** @return True if this Matrix requires a clipRect() on the bounds of the drawable. */ + /** + * @return True if this Matrix requires a clipRect() on the bounds of the drawable. + */ public boolean shouldClipRect() { return mShouldClipRect; } diff --git a/litho-core/src/main/java/com/facebook/litho/Edges.java b/litho-core/src/main/java/com/facebook/litho/Edges.java index 551ce891ac6..00eacfe180c 100644 --- a/litho-core/src/main/java/com/facebook/litho/Edges.java +++ b/litho-core/src/main/java/com/facebook/litho/Edges.java @@ -137,7 +137,9 @@ public float getRaw(YogaEdge edge) { return mValues[edgeIndex]; } - /** @param edgeEnumValue This method can directly accept the YogaEdge.XXX.intValue(). */ + /** + * @param edgeEnumValue This method can directly accept the YogaEdge.XXX.intValue(). + */ // This duplicates the other getRaw instead of calling each other to save on method calls. public float getRaw(int edgeEnumValue) { final byte edgeIndex = getIndex(edgeEnumValue); diff --git a/litho-core/src/main/java/com/facebook/litho/LayoutState.java b/litho-core/src/main/java/com/facebook/litho/LayoutState.java index cd9fa6244f2..a1d1fb6d892 100644 --- a/litho-core/src/main/java/com/facebook/litho/LayoutState.java +++ b/litho-core/src/main/java/com/facebook/litho/LayoutState.java @@ -236,7 +236,9 @@ List getAttachables() { return mAttachables; } - /** @return true, means there are components marked as 'ExcludeFromIncrementalMount'. */ + /** + * @return true, means there are components marked as 'ExcludeFromIncrementalMount'. + */ boolean hasComponentsExcludedFromIncrementalMount() { return mHasComponentsExcludedFromIncrementalMount; } @@ -449,7 +451,9 @@ public int getTreeId() { return getComponentTreeId(); } - /** @return The id of the {@link ComponentTree} that generated this {@link LayoutState} */ + /** + * @return The id of the {@link ComponentTree} that generated this {@link LayoutState} + */ public int getComponentTreeId() { return mComponentTreeId; } diff --git a/litho-core/src/main/java/com/facebook/litho/LithoView.java b/litho-core/src/main/java/com/facebook/litho/LithoView.java index 20be7517c89..2b9be82e831 100644 --- a/litho-core/src/main/java/com/facebook/litho/LithoView.java +++ b/litho-core/src/main/java/com/facebook/litho/LithoView.java @@ -823,7 +823,8 @@ public void release() { ComponentsReporter.emitMessage( ComponentsReporter.LogLevel.WARNING, LITHO_LIFECYCLE_FOUND, - "Trying to release a LithoView but a LithoVisibilityEventsController was found, ignoring."); + "Trying to release a LithoView but a LithoVisibilityEventsController was found," + + " ignoring."); return; } diff --git a/litho-core/src/main/java/com/facebook/litho/SpecGeneratedComponent.java b/litho-core/src/main/java/com/facebook/litho/SpecGeneratedComponent.java index 4960e0c8d1a..7afc6b2647a 100644 --- a/litho-core/src/main/java/com/facebook/litho/SpecGeneratedComponent.java +++ b/litho-core/src/main/java/com/facebook/litho/SpecGeneratedComponent.java @@ -576,7 +576,9 @@ protected boolean hasOwnErrorHandler() { return false; } - /** @return true if the Component is using state, false otherwise. */ + /** + * @return true if the Component is using state, false otherwise. + */ protected boolean hasState() { return false; } @@ -627,7 +629,9 @@ protected boolean implementsKeyboardFocusChangeForVirtualViews() { return false; } - /** @return true if Mount uses @FromMeasure or @FromOnBoundsDefined parameters. */ + /** + * @return true if Mount uses @FromMeasure or @FromOnBoundsDefined parameters. + */ protected boolean isMountSizeDependent() { return false; } @@ -821,7 +825,9 @@ public MountItemsPool.ItemPool createRecyclingPool(int poolSize) { return onCreateMountContentPool(); } - /** @return true if this component can be preallocated. */ + /** + * @return true if this component can be preallocated. + */ @Override public boolean canPreallocate() { return false; diff --git a/litho-core/src/main/java/com/facebook/litho/TreeFuture.java b/litho-core/src/main/java/com/facebook/litho/TreeFuture.java index 62e30381253..d4692dbac1a 100644 --- a/litho-core/src/main/java/com/facebook/litho/TreeFuture.java +++ b/litho-core/src/main/java/com/facebook/litho/TreeFuture.java @@ -138,7 +138,9 @@ boolean isInterruptRequested() { return mInterruptState.get() == INTERRUPTED; } - /** @return {@code true} if this future is interruptible. */ + /** + * @return {@code true} if this future is interruptible. + */ boolean isInterruptible() { return mInterruptState.get() == INTERRUPTIBLE; } diff --git a/litho-core/src/main/java/com/facebook/litho/stats/LithoStats.java b/litho-core/src/main/java/com/facebook/litho/stats/LithoStats.java index 07fb8de3a7f..6abd9224853 100644 --- a/litho-core/src/main/java/com/facebook/litho/stats/LithoStats.java +++ b/litho-core/src/main/java/com/facebook/litho/stats/LithoStats.java @@ -83,32 +83,44 @@ public static long getComponentCalculateLayoutOnUICount() { return sComponentCalculateLayoutOnUICount.get(); } - /** @return the global count of all mount operations that have happened in the process. */ + /** + * @return the global count of all mount operations that have happened in the process. + */ public static long getComponentMountCount() { return sComponentMountCount.get(); } - /** @return the global count of all do resolve operations that have happened in the process. */ + /** + * @return the global count of all do resolve operations that have happened in the process. + */ public static long getResolveCount() { return sResolveCount.get(); } - /** @return the global count of all do resume operations that have happened in the process. */ + /** + * @return the global count of all do resume operations that have happened in the process. + */ public static long getResumeCount() { return sResumeCount.get(); } - /** @return the global count of all do layout operations that have happened in the process. */ + /** + * @return the global count of all do layout operations that have happened in the process. + */ public static long getLayoutCount() { return sLayoutCount.get(); } - /** @return the global count of all do resolve operations that have been avoided/cancelled. */ + /** + * @return the global count of all do resolve operations that have been avoided/cancelled. + */ public static long getResolveCancelledCount() { return sResolveCancelledCount.get(); } - /** @return the global count of all do layout operations that have been avoided/cancelled. */ + /** + * @return the global count of all do layout operations that have been avoided/cancelled. + */ public static long getLayoutCancelledCount() { return sLayoutCancelledCount.get(); } diff --git a/litho-espresso/src/main/java/com/facebook/litho/testing/espresso/rules/ComponentActivityTestRule.java b/litho-espresso/src/main/java/com/facebook/litho/testing/espresso/rules/ComponentActivityTestRule.java index 0c52a4e0ed3..2fd16d05d55 100644 --- a/litho-espresso/src/main/java/com/facebook/litho/testing/espresso/rules/ComponentActivityTestRule.java +++ b/litho-espresso/src/main/java/com/facebook/litho/testing/espresso/rules/ComponentActivityTestRule.java @@ -50,7 +50,9 @@ protected synchronized void afterActivityFinished() { mComponentContext = null; } - /** @return a ComponentContext associated with this Activity. */ + /** + * @return a ComponentContext associated with this Activity. + */ public synchronized ComponentContext getComponentContext() { if (mComponentContext == null) { throw new RuntimeException("Tried to access ComponentContext before Activity was created"); @@ -84,7 +86,9 @@ public void run() { instrumentation.waitForIdleSync(); } - /** @return the LithoView associated with the Activity. */ + /** + * @return the LithoView associated with the Activity. + */ public LithoView getLithoView() { return (LithoView) ((ViewGroup) getActivity().findViewById(android.R.id.content)).getChildAt(0); } diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/LithoPluginUtils.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/LithoPluginUtils.java index d8823b454d5..9a3ef9a2577 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/LithoPluginUtils.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/LithoPluginUtils.java @@ -110,7 +110,9 @@ && isSpecName(psiClass.getName()) && hasAnnotation(psiClass, startsWith("com.facebook.litho.sections.annotations")); } - /** @return true if given name ends with "Spec". */ + /** + * @return true if given name ends with "Spec". + */ @Contract("null -> false") public static boolean isSpecName(@Nullable String clsName) { return clsName != null && clsName.endsWith(SPEC_SUFFIX); @@ -181,7 +183,9 @@ public static String getLithoComponentSpecNameFromComponent(@Nullable String com return null; } - /** @return the Stream of unique parameters from all methods excluding current method. */ + /** + * @return the Stream of unique parameters from all methods excluding current method. + */ public static Stream getPsiParameterStream( @Nullable PsiMethod currentMethod, PsiMethod[] allMethods) { return Stream.of(allMethods) diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/navigation/BaseLithoComponentsDeclarationHandler.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/navigation/BaseLithoComponentsDeclarationHandler.java index 6eda98b9acb..dcbda37face 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/navigation/BaseLithoComponentsDeclarationHandler.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/navigation/BaseLithoComponentsDeclarationHandler.java @@ -102,7 +102,9 @@ static PsiElement getGotoDeclarationTarget( .orElse(null); } - /** @return true if the containing file of the given element is a Kotlin file. */ + /** + * @return true if the containing file of the given element is a Kotlin file. + */ private static boolean isKotlinFile(PsiElement sourceElement) { return sourceElement.getContainingFile().getLanguage() == KotlinLanguage.INSTANCE; } diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/GeneratedFilesListener.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/GeneratedFilesListener.java index 1260b9c64fc..94060376134 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/GeneratedFilesListener.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/GeneratedFilesListener.java @@ -78,7 +78,9 @@ public void after(List events) { } } - /** @param path path with "/" dividers. */ + /** + * @param path path with "/" dividers. + */ private static boolean isOutput(String path) { // Guessing if the path is build output return containsOrEndsWithSegment(path, BUCK_OUT_BASE) diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/RedSymbolsResolver.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/RedSymbolsResolver.java index bdaab66470c..32cb16560fd 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/RedSymbolsResolver.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/redsymbols/RedSymbolsResolver.java @@ -195,7 +195,8 @@ private static Map addToCache( final Map redSymbolToClass = new HashMap<>(); for (String redSymbol : allRedSymbols) { LithoGeneratedFileProvider.INSTANCE() - .guessQualifiedNames(project, symbolsScope, redSymbol, eventMetadata).stream() + .guessQualifiedNames(project, symbolsScope, redSymbol, eventMetadata) + .stream() .map( fqn -> { // Red symbol might exist for present but not-bind class @@ -216,7 +217,9 @@ private static Map addToCache( return redSymbolToClass; } - /** @return if the binding was finished before editor disposed. */ + /** + * @return if the binding was finished before editor disposed. + */ private static boolean bindExpressions( Map> resolved, VirtualFile virtualFile, diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/toolwindows/ComponentStructureView.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/toolwindows/ComponentStructureView.java index 79238a8587d..68388976c66 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/toolwindows/ComponentStructureView.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/intellij/toolwindows/ComponentStructureView.java @@ -64,7 +64,8 @@ class ComponentStructureView implements Disposable { static { final JTextArea text = new JTextArea( - "Spec structure will be shown here for a valid ComponentSpec file (LayoutSpec, MountSpec, GroupSectionSpec, DiffSectionSpec)"); + "Spec structure will be shown here for a valid ComponentSpec file (LayoutSpec," + + " MountSpec, GroupSectionSpec, DiffSectionSpec)"); text.setLineWrap(true); text.setEditable(false); text.setBackground(null); diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiMountSpecModelFactory.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiMountSpecModelFactory.java index a65ae01287a..6b367baa624 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiMountSpecModelFactory.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiMountSpecModelFactory.java @@ -57,7 +57,9 @@ public PsiMountSpecModelFactory( mMountSpecGenerator = mountSpecGenerator; } - /** @return a new {@link MountSpecModel} or null */ + /** + * @return a new {@link MountSpecModel} or null + */ @Nullable public MountSpecModel createWithPsi( Project project, diff --git a/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiTypeUtils.java b/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiTypeUtils.java index e6ae445d6c0..91cba53f021 100644 --- a/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiTypeUtils.java +++ b/litho-intellij-plugin/src/main/java/com/facebook/litho/specmodels/processor/PsiTypeUtils.java @@ -70,7 +70,9 @@ static TypeName getTypeName(PsiType type) { } } - /** @return Returns a {@link ClassName} for the given class name string. */ + /** + * @return Returns a {@link ClassName} for the given class name string. + */ static ClassName guessClassName(String typeName) { return ClassName.bestGuess(typeName); } diff --git a/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/LithoPluginIntellijTest.java b/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/LithoPluginIntellijTest.java index 09030e04c83..49d05f32d23 100644 --- a/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/LithoPluginIntellijTest.java +++ b/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/LithoPluginIntellijTest.java @@ -68,7 +68,9 @@ public static class TestHelper { private final String testPath; private CodeInsightTestFixture fixture; - /** @param testPath in the form "testdata/dir" */ + /** + * @param testPath in the form "testdata/dir" + */ TestHelper(String testPath) { this.testPath = new File(testPath).getAbsolutePath(); } diff --git a/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/inspections/SpecAnnotatorTest.java b/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/inspections/SpecAnnotatorTest.java index 1f7d8607cee..fa4746bbb74 100644 --- a/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/inspections/SpecAnnotatorTest.java +++ b/litho-intellij-plugin/src/test/java/com/facebook/litho/intellij/inspections/SpecAnnotatorTest.java @@ -66,7 +66,9 @@ private static void assertForLayoutSpecShowsErrorMessages(TestHolder holder) { assertThat(holder.errorMessages).hasSize(1); assertThat(holder.errorMessages) .containsExactly( - "You need to have a method annotated with either @OnCreateLayout or @OnCreateLayoutWithSizeSpec in your spec. In most cases, @OnCreateLayout is what you want."); + "You need to have a method annotated with either @OnCreateLayout or" + + " @OnCreateLayoutWithSizeSpec in your spec. In most cases, @OnCreateLayout is" + + " what you want."); } @Test @@ -95,7 +97,8 @@ private static void assertForMountSpecShowsErrorMessages(TestHolder holder) { .containsExactly( "All MountSpecs need to have a method annotated with @OnCreateMountContent.", "onCreateMountContent's return type should be either a View or a Drawable subclass.", - "MountSpecAnnotatorSpec does not define @OnCreateMountContent method which is required for all @MountSpecs."); + "MountSpecAnnotatorSpec does not define @OnCreateMountContent method which is required" + + " for all @MountSpecs."); } @Test @@ -152,6 +155,7 @@ private static void assertForDiffSectionSpecShowsErrorMessages(TestHolder holder assertThat(holder.errorMessages) .containsExactly( "Methods in a spec must be static.", - "A method annotated with @OnDiff needs to return void. Note that even if your return value is a subclass of void, you should still use void as the return type."); + "A method annotated with @OnDiff needs to return void. Note that even if your return" + + " value is a subclass of void, you should still use void as the return type."); } } diff --git a/litho-it/src/test/java/com/facebook/litho/processor/integration/ProcessorIntegrationTest.java b/litho-it/src/test/java/com/facebook/litho/processor/integration/ProcessorIntegrationTest.java index ea52c96c1ae..8af0f1ee01b 100644 --- a/litho-it/src/test/java/com/facebook/litho/processor/integration/ProcessorIntegrationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/processor/integration/ProcessorIntegrationTest.java @@ -202,7 +202,8 @@ public void failsToCompileNonEmptyTestSpecInterface() throws IOException { .failsToCompile() .withErrorCount(1) .withErrorContaining( - "TestSpec interfaces must not contain any members. Please remove these function declarations: ()void test, ()java.util.List list") + "TestSpec interfaces must not contain any members. Please remove these function" + + " declarations: ()void test, ()java.util.List list") .in(javaFileObject) .onLine(24); } diff --git a/litho-it/src/test/java/com/facebook/litho/sections/SectionTreeTest.java b/litho-it/src/test/java/com/facebook/litho/sections/SectionTreeTest.java index a4f520dfa05..bc074146a2c 100644 --- a/litho-it/src/test/java/com/facebook/litho/sections/SectionTreeTest.java +++ b/litho-it/src/test/java/com/facebook/litho/sections/SectionTreeTest.java @@ -593,10 +593,11 @@ public void call() throws Exception { }) .isInstanceOf(RuntimeException.class) .hasMessageMatching( - "Index out of bounds while applying a new section. This indicates a bad diff was sent " - + "to the RecyclerBinder. See https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception " - + "for more information. Debug info: Duplicates are " - + "\\[type:\\w+ hash:\\w+ position:\\d+] and \\[type:\\w+ hash:\\w+ position:\\d+] in the \\[\\w+]."); + "Index out of bounds while applying a new section. This indicates a bad diff was sent" + + " to the RecyclerBinder. See" + + " https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception" + + " for more information. Debug info: Duplicates are \\[type:\\w+ hash:\\w+" + + " position:\\d+] and \\[type:\\w+ hash:\\w+ position:\\d+] in the \\[\\w+]."); } @Test diff --git a/litho-it/src/test/java/com/facebook/litho/sections/specmodels/generator/GroupSectionSpecGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/sections/specmodels/generator/GroupSectionSpecGeneratorTest.java index b2cd159953a..a7c6bb497cb 100644 --- a/litho-it/src/test/java/com/facebook/litho/sections/specmodels/generator/GroupSectionSpecGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/sections/specmodels/generator/GroupSectionSpecGeneratorTest.java @@ -109,17 +109,21 @@ public void testGenerateDelegates() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected com.facebook.litho.sections.Children createChildren(com.facebook.litho.sections.SectionContext c) {\n" + + "protected com.facebook.litho.sections.Children" + + " createChildren(com.facebook.litho.sections.SectionContext c) {\n" + " com.facebook.litho.sections.Children _result;\n" - + " _result = (com.facebook.litho.sections.Children) TestGroupSectionSpec.onCreateChildren(\n" + + " _result = (com.facebook.litho.sections.Children)" + + " TestGroupSectionSpec.onCreateChildren(\n" + " (com.facebook.litho.sections.SectionContext) c);\n" + " return _result;\n" + "}\n"); assertThat(dataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected void dataRendered(com.facebook.litho.sections.SectionContext c, boolean isDataChanged,\n" - + " boolean isMounted, long uptimeMillis, int firstVisibleIndex, int lastVisibleIndex,\n" + + "protected void dataRendered(com.facebook.litho.sections.SectionContext c," + + " boolean isDataChanged,\n" + + " boolean isMounted, long uptimeMillis, int firstVisibleIndex, int" + + " lastVisibleIndex,\n" + " com.facebook.litho.sections.ChangesInfo changesInfo, int globalOffset) {\n" + " TestGroupSectionSpec.onDataRendered(\n" + " (com.facebook.litho.sections.SectionContext) c,\n" diff --git a/litho-it/src/test/java/com/facebook/litho/sections/specmodels/processor/DiffSectionSpecModelFactoryTest.java b/litho-it/src/test/java/com/facebook/litho/sections/specmodels/processor/DiffSectionSpecModelFactoryTest.java index fb0a99342a1..9ea667d7fdf 100644 --- a/litho-it/src/test/java/com/facebook/litho/sections/specmodels/processor/DiffSectionSpecModelFactoryTest.java +++ b/litho-it/src/test/java/com/facebook/litho/sections/specmodels/processor/DiffSectionSpecModelFactoryTest.java @@ -103,7 +103,8 @@ public void create_forGroupSectionSpec_populateGenericInfo() { public void testUpdateStateWithTransitionMethodsIsNotNull() { assertThat(mDiffSectionSpecModel.getUpdateStateWithTransitionMethods()) .describedAs( - "UpdateStateWithTransitionMethods cannot be null as otherwise the Litho Structure will not render") + "UpdateStateWithTransitionMethods cannot be null as otherwise the Litho Structure will" + + " not render") .isNotNull(); } } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/BuilderGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/BuilderGeneratorTest.java index fe205489e1a..f11cdae2752 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/BuilderGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/BuilderGeneratorTest.java @@ -190,7 +190,8 @@ public void testGenerate() { + "}\n"); assertThat(dataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( - "public static Builder create(com.facebook.litho.ComponentContext context, int defStyleAttr,\n" + "public static Builder create(com.facebook.litho.ComponentContext context, int" + + " defStyleAttr,\n" + " int defStyleRes) {\n" + " Test instance = new Test();\n" + " return new Builder(context, defStyleAttr, defStyleRes, instance);\n" @@ -201,18 +202,22 @@ public void testGenerate() { assertThat(dataHolder.getTypeSpecs().get(0).toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "public static final class Builder extends com.facebook.litho.Component.Builder {\n" + + "public static final class Builder extends" + + " com.facebook.litho.Component.Builder {\n" + " Test mTest;\n" + "\n" + " com.facebook.litho.ComponentContext mContext;\n" + "\n" - + " private final java.lang.String[] REQUIRED_PROPS_NAMES = new String[] {\"arg0\", \"section\"};\n" + + " private final java.lang.String[] REQUIRED_PROPS_NAMES = new String[]" + + " {\"arg0\", \"section\"};\n" + "\n" + " private final int REQUIRED_PROPS_COUNT = 2;\n" + "\n" - + " private final java.util.BitSet mRequired = new java.util.BitSet(REQUIRED_PROPS_COUNT);\n" + + " private final java.util.BitSet mRequired = new" + + " java.util.BitSet(REQUIRED_PROPS_COUNT);\n" + "\n" - + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr, int defStyleRes,\n" + + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr," + + " int defStyleRes,\n" + " Test testRef) {\n" + " super(context, defStyleAttr, defStyleRes, testRef);\n" + " mTest = testRef;\n" @@ -223,7 +228,8 @@ public void testGenerate() { + "\n" + " @java.lang.Override\n" + " protected void setComponent(com.facebook.litho.Component component) {\n" - + " mTest = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.Test) component;\n" + + " mTest = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.Test)" + + " component;\n" + " }\n" + "\n" + " void initPropDefaults() {\n" @@ -306,8 +312,10 @@ public void testGenerate() { + " required = true\n" + " )\n" + " @com.facebook.litho.annotations.RequiredProp(\"section\")\n" - + " public Builder section(com.facebook.litho.sections.Section.Builder sectionBuilder) {\n" - + " this.mTest.section = sectionBuilder == null ? null : sectionBuilder.build();\n" + + " public Builder section(com.facebook.litho.sections.Section.Builder" + + " sectionBuilder) {\n" + + " this.mTest.section = sectionBuilder == null ? null :" + + " sectionBuilder.build();\n" + " mRequired.set(1);\n" + " return this;\n" + " }\n" @@ -318,7 +326,8 @@ public void testGenerate() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.Test build() {\n" + + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.Test" + + " build() {\n" + " checkArgs(REQUIRED_PROPS_COUNT, mRequired, REQUIRED_PROPS_NAMES);\n" + " return mTest;\n" + " }\n" @@ -332,12 +341,14 @@ public void testResTypeWithVarArgs() { assertThat(dataHolder.getTypeSpecs().get(0).toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "public static final class Builder extends com.facebook.litho.Component.Builder {\n" + + "public static final class Builder extends" + + " com.facebook.litho.Component.Builder {\n" + " TestResTypeWithVarArgs mTestResTypeWithVarArgs;\n" + "\n" + " com.facebook.litho.ComponentContext mContext;\n" + "\n" - + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr, int defStyleRes,\n" + + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr," + + " int defStyleRes,\n" + " TestResTypeWithVarArgs testResTypeWithVarArgsRef) {\n" + " super(context, defStyleAttr, defStyleRes, testResTypeWithVarArgsRef);\n" + " mTestResTypeWithVarArgs = testResTypeWithVarArgsRef;\n" @@ -346,7 +357,9 @@ public void testResTypeWithVarArgs() { + "\n" + " @java.lang.Override\n" + " protected void setComponent(com.facebook.litho.Component component) {\n" - + " mTestResTypeWithVarArgs = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestResTypeWithVarArgs) component;\n" + + " mTestResTypeWithVarArgs =" + + " (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestResTypeWithVarArgs)" + + " component;\n" + " }\n" + "\n" + " @com.facebook.litho.annotations.PropSetter(\n" @@ -354,8 +367,10 @@ public void testResTypeWithVarArgs() { + " required = false\n" + " )\n" + " public Builder sizePx(@androidx.annotation.Px float size) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " final float res = size;\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" @@ -370,8 +385,10 @@ public void testResTypeWithVarArgs() { + " if (sizes == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < sizes.size(); i++) {\n" + " final float res = sizes.get(i);\n" @@ -385,9 +402,12 @@ public void testResTypeWithVarArgs() { + " required = false\n" + " )\n" + " public Builder sizeDip(\n" - + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.DP) float dip) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.DP)" + + " float dip) {\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " final float res = mResourceResolver.dipsToPixels(dip);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" @@ -402,8 +422,10 @@ public void testResTypeWithVarArgs() { + " if (dips == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < dips.size(); i++) {\n" + " final float res = mResourceResolver.dipsToPixels(dips.get(i));\n" @@ -417,9 +439,12 @@ public void testResTypeWithVarArgs() { + " required = false\n" + " )\n" + " public Builder sizeSp(\n" - + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.SP) float sip) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.SP)" + + " float sip) {\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " final float res = mResourceResolver.sipsToPixels(sip);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" @@ -434,8 +459,10 @@ public void testResTypeWithVarArgs() { + " if (sips == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < sips.size(); i++) {\n" + " final float res = mResourceResolver.sipsToPixels(sips.get(i));\n" @@ -449,8 +476,10 @@ public void testResTypeWithVarArgs() { + " required = false\n" + " )\n" + " public Builder sizeRes(@androidx.annotation.DimenRes int resId) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " final float res = mResourceResolver.resolveDimenSizeRes(resId);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" @@ -465,8 +494,10 @@ public void testResTypeWithVarArgs() { + " if (resIds == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < resIds.size(); i++) {\n" + " final float res = mResourceResolver.resolveDimenSizeRes(resIds.get(i));\n" @@ -481,10 +512,13 @@ public void testResTypeWithVarArgs() { + " )\n" + " public Builder sizeAttr(@androidx.annotation.AttrRes int attrResId,\n" + " @androidx.annotation.DimenRes int defResId) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" - + " final float res = mResourceResolver.resolveDimenSizeAttr(attrResId, defResId);\n" + + " final float res = mResourceResolver.resolveDimenSizeAttr(attrResId," + + " defResId);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" + " return this;\n" + " }\n" @@ -494,8 +528,10 @@ public void testResTypeWithVarArgs() { + " required = false\n" + " )\n" + " public Builder sizeAttr(@androidx.annotation.AttrRes int attrResId) {\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " final float res = mResourceResolver.resolveDimenSizeAttr(attrResId, 0);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" @@ -511,11 +547,14 @@ public void testResTypeWithVarArgs() { + " if (attrResIds == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < attrResIds.size(); i++) {\n" - + " final float res = mResourceResolver.resolveDimenSizeAttr(attrResIds.get(i), defResId);\n" + + " final float res =" + + " mResourceResolver.resolveDimenSizeAttr(attrResIds.get(i), defResId);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" + " }\n" + " return this;\n" @@ -529,11 +568,14 @@ public void testResTypeWithVarArgs() { + " if (attrResIds == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestResTypeWithVarArgs.sizes = new java.util.ArrayList();\n" + + " if (this.mTestResTypeWithVarArgs.sizes == java.util.Collections.EMPTY_LIST)" + + " {\n" + + " this.mTestResTypeWithVarArgs.sizes = new" + + " java.util.ArrayList();\n" + " }\n" + " for (int i = 0; i < attrResIds.size(); i++) {\n" - + " final float res = mResourceResolver.resolveDimenSizeAttr(attrResIds.get(i), 0);\n" + + " final float res =" + + " mResourceResolver.resolveDimenSizeAttr(attrResIds.get(i), 0);\n" + " this.mTestResTypeWithVarArgs.sizes.add(res);\n" + " }\n" + " return this;\n" @@ -545,7 +587,9 @@ public void testResTypeWithVarArgs() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestResTypeWithVarArgs build(\n" + + " public" + + " com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestResTypeWithVarArgs" + + " build(\n" + " ) {\n" + " return mTestResTypeWithVarArgs;\n" + " }\n" @@ -560,20 +604,25 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { assertThat(dataHolder.getTypeSpecs().get(0).toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "public static final class Builder extends com.facebook.litho.Component.Builder {\n" + + "public static final class Builder extends" + + " com.facebook.litho.Component.Builder {\n" + " TestDimenResTypeWithBoxFloatArg mTestDimenResTypeWithBoxFloatArg;\n" + "\n" + " com.facebook.litho.ComponentContext mContext;\n" + "\n" - + " private final java.lang.String[] REQUIRED_PROPS_NAMES = new String[] {\"size\"};\n" + + " private final java.lang.String[] REQUIRED_PROPS_NAMES = new String[]" + + " {\"size\"};\n" + "\n" + " private final int REQUIRED_PROPS_COUNT = 1;\n" + "\n" - + " private final java.util.BitSet mRequired = new java.util.BitSet(REQUIRED_PROPS_COUNT);\n" + + " private final java.util.BitSet mRequired = new" + + " java.util.BitSet(REQUIRED_PROPS_COUNT);\n" + "\n" - + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr, int defStyleRes,\n" + + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr," + + " int defStyleRes,\n" + " TestDimenResTypeWithBoxFloatArg testDimenResTypeWithBoxFloatArgRef) {\n" - + " super(context, defStyleAttr, defStyleRes, testDimenResTypeWithBoxFloatArgRef);\n" + + " super(context, defStyleAttr, defStyleRes," + + " testDimenResTypeWithBoxFloatArgRef);\n" + " mTestDimenResTypeWithBoxFloatArg = testDimenResTypeWithBoxFloatArgRef;\n" + " mContext = context;\n" + " mRequired.clear();\n" @@ -581,7 +630,9 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + "\n" + " @java.lang.Override\n" + " protected void setComponent(com.facebook.litho.Component component) {\n" - + " mTestDimenResTypeWithBoxFloatArg = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestDimenResTypeWithBoxFloatArg) component;\n" + + " mTestDimenResTypeWithBoxFloatArg =" + + " (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestDimenResTypeWithBoxFloatArg)" + + " component;\n" + " }\n" + "\n" + " @com.facebook.litho.annotations.PropSetter(\n" @@ -601,8 +652,10 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " )\n" + " @com.facebook.litho.annotations.RequiredProp(\"size\")\n" + " public Builder sizeDip(\n" - + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.DP) float dip) {\n" - + " this.mTestDimenResTypeWithBoxFloatArg.size = (float) mResourceResolver.dipsToPixels(dip);\n" + + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.DP)" + + " float dip) {\n" + + " this.mTestDimenResTypeWithBoxFloatArg.size = (float)" + + " mResourceResolver.dipsToPixels(dip);\n" + " mRequired.set(0);\n" + " return this;\n" + " }\n" @@ -613,8 +666,10 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " )\n" + " @com.facebook.litho.annotations.RequiredProp(\"size\")\n" + " public Builder sizeSp(\n" - + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.SP) float sip) {\n" - + " this.mTestDimenResTypeWithBoxFloatArg.size = (float) mResourceResolver.sipsToPixels(sip);\n" + + " @androidx.annotation.Dimension(unit = androidx.annotation.Dimension.SP)" + + " float sip) {\n" + + " this.mTestDimenResTypeWithBoxFloatArg.size = (float)" + + " mResourceResolver.sipsToPixels(sip);\n" + " mRequired.set(0);\n" + " return this;\n" + " }\n" @@ -625,7 +680,8 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " )\n" + " @com.facebook.litho.annotations.RequiredProp(\"size\")\n" + " public Builder sizeRes(@androidx.annotation.DimenRes int resId) {\n" - + " this.mTestDimenResTypeWithBoxFloatArg.size = (float) mResourceResolver.resolveDimenSizeRes(resId);\n" + + " this.mTestDimenResTypeWithBoxFloatArg.size = (float)" + + " mResourceResolver.resolveDimenSizeRes(resId);\n" + " mRequired.set(0);\n" + " return this;\n" + " }\n" @@ -637,7 +693,8 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " @com.facebook.litho.annotations.RequiredProp(\"size\")\n" + " public Builder sizeAttr(@androidx.annotation.AttrRes int attrResId,\n" + " @androidx.annotation.DimenRes int defResId) {\n" - + " this.mTestDimenResTypeWithBoxFloatArg.size = (float) mResourceResolver.resolveDimenSizeAttr(attrResId, defResId);\n" + + " this.mTestDimenResTypeWithBoxFloatArg.size = (float)" + + " mResourceResolver.resolveDimenSizeAttr(attrResId, defResId);\n" + " mRequired.set(0);\n" + " return this;\n" + " }\n" @@ -648,7 +705,8 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " )\n" + " @com.facebook.litho.annotations.RequiredProp(\"size\")\n" + " public Builder sizeAttr(@androidx.annotation.AttrRes int attrResId) {\n" - + " this.mTestDimenResTypeWithBoxFloatArg.size = (float) mResourceResolver.resolveDimenSizeAttr(attrResId, 0);\n" + + " this.mTestDimenResTypeWithBoxFloatArg.size = (float)" + + " mResourceResolver.resolveDimenSizeAttr(attrResId, 0);\n" + " mRequired.set(0);\n" + " return this;\n" + " }\n" @@ -659,7 +717,9 @@ public void testDimenResTypeWithBoxFloatArgSpecModel() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestDimenResTypeWithBoxFloatArg build(\n" + + " public" + + " com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestDimenResTypeWithBoxFloatArg" + + " build(\n" + " ) {\n" + " checkArgs(REQUIRED_PROPS_COUNT, mRequired, REQUIRED_PROPS_NAMES);\n" + " return mTestDimenResTypeWithBoxFloatArg;\n" @@ -674,12 +734,14 @@ public void testVarArgsWithDefaultValue() { assertThat(dataHolder.getTypeSpecs().get(0).toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "public static final class Builder extends com.facebook.litho.Component.Builder {\n" + + "public static final class Builder extends" + + " com.facebook.litho.Component.Builder {\n" + " TestVarArgsWithDefaultValue mTestVarArgsWithDefaultValue;\n" + "\n" + " com.facebook.litho.ComponentContext mContext;\n" + "\n" - + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr, int defStyleRes,\n" + + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr," + + " int defStyleRes,\n" + " TestVarArgsWithDefaultValue testVarArgsWithDefaultValueRef) {\n" + " super(context, defStyleAttr, defStyleRes, testVarArgsWithDefaultValueRef);\n" + " mTestVarArgsWithDefaultValue = testVarArgsWithDefaultValueRef;\n" @@ -688,7 +750,9 @@ public void testVarArgsWithDefaultValue() { + "\n" + " @java.lang.Override\n" + " protected void setComponent(com.facebook.litho.Component component) {\n" - + " mTestVarArgsWithDefaultValue = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestVarArgsWithDefaultValue) component;\n" + + " mTestVarArgsWithDefaultValue =" + + " (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestVarArgsWithDefaultValue)" + + " component;\n" + " }\n" + "\n" + " @com.facebook.litho.annotations.PropSetter(\n" @@ -699,8 +763,11 @@ public void testVarArgsWithDefaultValue() { + " if (item == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestVarArgsWithDefaultValue.list == null || this.mTestVarArgsWithDefaultValue.list == TestVarArgsWithDefaultValueSpec.list) {\n" - + " this.mTestVarArgsWithDefaultValue.list = new java.util.ArrayList();\n" + + " if (this.mTestVarArgsWithDefaultValue.list == null ||" + + " this.mTestVarArgsWithDefaultValue.list == TestVarArgsWithDefaultValueSpec.list)" + + " {\n" + + " this.mTestVarArgsWithDefaultValue.list = new" + + " java.util.ArrayList();\n" + " }\n" + " this.mTestVarArgsWithDefaultValue.list.add(item);\n" + " return this;\n" @@ -714,7 +781,10 @@ public void testVarArgsWithDefaultValue() { + " if (list == null) {\n" + " return this;\n" + " }\n" - + " if (this.mTestVarArgsWithDefaultValue.list == null || this.mTestVarArgsWithDefaultValue.list.isEmpty() || this.mTestVarArgsWithDefaultValue.list == TestVarArgsWithDefaultValueSpec.list) {\n" + + " if (this.mTestVarArgsWithDefaultValue.list == null ||" + + " this.mTestVarArgsWithDefaultValue.list.isEmpty() ||" + + " this.mTestVarArgsWithDefaultValue.list == TestVarArgsWithDefaultValueSpec.list)" + + " {\n" + " this.mTestVarArgsWithDefaultValue.list = list;\n" + " } else {\n" + " this.mTestVarArgsWithDefaultValue.list.addAll(list);\n" @@ -728,7 +798,9 @@ public void testVarArgsWithDefaultValue() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestVarArgsWithDefaultValue build(\n" + + " public" + + " com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestVarArgsWithDefaultValue" + + " build(\n" + " ) {\n" + " return mTestVarArgsWithDefaultValue;\n" + " }\n" @@ -743,12 +815,14 @@ public void testKotlinVarArgWildcardsGenerate() { assertThat(dataHolder.getTypeSpecs().get(0).toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "public static final class Builder extends com.facebook.litho.Component.Builder {\n" + + "public static final class Builder extends" + + " com.facebook.litho.Component.Builder {\n" + " TestKotlinVarArg mTestKotlinVarArg;\n" + "\n" + " com.facebook.litho.ComponentContext mContext;\n" + "\n" - + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr, int defStyleRes,\n" + + " private Builder(com.facebook.litho.ComponentContext context, int defStyleAttr," + + " int defStyleRes,\n" + " TestKotlinVarArg testKotlinVarArgRef) {\n" + " super(context, defStyleAttr, defStyleRes, testKotlinVarArgRef);\n" + " mTestKotlinVarArg = testKotlinVarArgRef;\n" @@ -757,7 +831,9 @@ public void testKotlinVarArgWildcardsGenerate() { + "\n" + " @java.lang.Override\n" + " protected void setComponent(com.facebook.litho.Component component) {\n" - + " mTestKotlinVarArg = (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestKotlinVarArg) component;\n" + + " mTestKotlinVarArg =" + + " (com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestKotlinVarArg)" + + " component;\n" + " }\n" + "\n" + " @com.facebook.litho.annotations.PropSetter(\n" @@ -769,7 +845,8 @@ public void testKotlinVarArgWildcardsGenerate() { + " return this;\n" + " }\n" + " if (this.mTestKotlinVarArg.numbers == java.util.Collections.EMPTY_LIST) {\n" - + " this.mTestKotlinVarArg.numbers = new java.util.ArrayList();\n" + + " this.mTestKotlinVarArg.numbers = new" + + " java.util.ArrayList();\n" + " }\n" + " this.mTestKotlinVarArg.numbers.add(number);\n" + " return this;\n" @@ -797,7 +874,9 @@ public void testKotlinVarArgWildcardsGenerate() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestKotlinVarArg build() {\n" + + " public" + + " com.facebook.litho.specmodels.generator.BuilderGeneratorTest.TestKotlinVarArg" + + " build() {\n" + " return mTestKotlinVarArg;\n" + " }\n" + "}\n"); diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/ComponentBodyGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/ComponentBodyGeneratorTest.java index 1ee2f6e6353..63ab5b35dd8 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/ComponentBodyGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/ComponentBodyGeneratorTest.java @@ -253,7 +253,8 @@ public void testGenerateStateContainerImplGetter() { .isEqualTo( "private com.facebook.litho.StateContainer getStateContainerImpl(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return (com.facebook.litho.StateContainer) c.getScopedComponentInfo().getStateContainer();\n" + + " return (com.facebook.litho.StateContainer)" + + " c.getScopedComponentInfo().getStateContainer();\n" + "}\n"); } @@ -294,7 +295,8 @@ public void testGenerateProps() { + "@com.facebook.litho.annotations.Comparable(\n" + " type = 5\n" + ")\n" - + "java.util.List arg9 = java.util.Collections.emptyList();\n"); + + "java.util.List arg9 =" + + " java.util.Collections.emptyList();\n"); assertThat(dataHolder.getFieldSpecs().get(5).toString()) .isEqualTo( "@com.facebook.litho.annotations.Prop(\n" @@ -392,7 +394,8 @@ public void testGeneratePropsForKotlinWildcards() { + "@com.facebook.litho.annotations.Comparable(\n" + " type = 5\n" + ")\n" - + "java.util.List numbers = java.util.Collections.emptyList();\n"); + + "java.util.List numbers =" + + " java.util.Collections.emptyList();\n"); } @Test @@ -452,15 +455,18 @@ public void testGenerateIsEquivalentMethod() { + " if (arg0 != mountTestRef.arg0) {\n" + " return false;\n" + " }\n" - + " if (arg4 != null ? !arg4.isEquivalentTo(mountTestRef.arg4, shouldCompareCommonProps) : mountTestRef.arg4 != null) {\n" + + " if (arg4 != null ? !arg4.isEquivalentTo(mountTestRef.arg4," + + " shouldCompareCommonProps) : mountTestRef.arg4 != null) {\n" + " return false;\n" + " }\n" + " if (arg5 != null) {\n" - + " if (mountTestRef.arg5 == null || arg5.size() != mountTestRef.arg5.size()) {\n" + + " if (mountTestRef.arg5 == null || arg5.size() != mountTestRef.arg5.size())" + + " {\n" + " return false;\n" + " }\n" + " java.util.Iterator _e1_1 = arg5.iterator();\n" - + " java.util.Iterator _e2_1 = mountTestRef.arg5.iterator();\n" + + " java.util.Iterator _e2_1 =" + + " mountTestRef.arg5.iterator();\n" + " while (_e1_1.hasNext() && _e2_1.hasNext()) {\n" + " if (!_e1_1.next().isEquivalentTo(_e2_1.next())) {\n" + " return false;\n" @@ -469,10 +475,12 @@ public void testGenerateIsEquivalentMethod() { + " } else if (mountTestRef.arg5 != null) {\n" + " return false;\n" + " }\n" - + " if (arg6 != null ? !arg6.equals(mountTestRef.arg6) : mountTestRef.arg6 != null) {\n" + + " if (arg6 != null ? !arg6.equals(mountTestRef.arg6) : mountTestRef.arg6 !=" + + " null) {\n" + " return false;\n" + " }\n" - + " if (arg9 != null ? !arg9.equals(mountTestRef.arg9) : mountTestRef.arg9 != null) {\n" + + " if (arg9 != null ? !arg9.equals(mountTestRef.arg9) : mountTestRef.arg9 !=" + + " null) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -546,7 +554,8 @@ public void testGenerateMakeShallowCopyWithStateUpdate() { "@java.lang.Override\n" + "public Test makeShallowCopy() {\n" + " Test component = (Test) super.makeShallowCopy();\n" - + " component.arg4 = component.arg4 != null ? component.arg4.makeShallowCopy() : null;\n" + + " component.arg4 = component.arg4 != null ? component.arg4.makeShallowCopy() :" + + " null;\n" + " return component;\n" + "}\n"); } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/DelegateMethodGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/DelegateMethodGeneratorTest.java index 0daf8b7e581..b8bc0af1508 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/DelegateMethodGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/DelegateMethodGeneratorTest.java @@ -140,7 +140,8 @@ public void testGenerateWithoutDependencyInjection() { assertThat(typeSpecDataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected com.facebook.litho.Component onCreateLayout(com.facebook.litho.ComponentContext c) {\n" + + "protected com.facebook.litho.Component" + + " onCreateLayout(com.facebook.litho.ComponentContext c) {\n" + " com.facebook.litho.Component _result;\n" + " TestStateContainer _state = getStateContainerImpl(c);\n" + " _result = (com.facebook.litho.Component) TestSpec.onCreateLayout(\n" @@ -217,7 +218,8 @@ public int compare(Class lhs, Class assertThat(typeSpecDataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected com.facebook.litho.Component onCreateLayout(com.facebook.litho.ComponentContext c) {\n" + + "protected com.facebook.litho.Component" + + " onCreateLayout(com.facebook.litho.ComponentContext c) {\n" + " com.facebook.litho.Component _result;\n" + " _result = (com.facebook.litho.Component) TestSpec.onCreateLayout(\n" + " (com.facebook.litho.ComponentContext) c,\n" diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/EventGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/EventGeneratorTest.java index e23dae2b8dc..b5fe67d8d8e 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/EventGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/EventGeneratorTest.java @@ -152,7 +152,8 @@ public void testGenerateEventMethods() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "private void testEventMethod1(\n" - + " com.facebook.litho.HasEventDispatcher _abstract, com.facebook.litho.ComponentContext c,\n" + + " com.facebook.litho.HasEventDispatcher _abstract," + + " com.facebook.litho.ComponentContext c,\n" + " java.lang.Object arg2, T arg3, @androidx.annotation.Nullable T arg6) {\n" + " Test _ref = (Test) _abstract;\n" + " TestStateContainer _state = getStateContainerImpl(c);\n" @@ -171,7 +172,8 @@ public void testGenerateEventMethods() { "private void testEventMethod2(com.facebook.litho.HasEventDispatcher _abstract,\n" + " com.facebook.litho.ComponentContext c) {\n" + " Test _ref = (Test) _abstract;\n" - + " TestStateContainer _state = getStateContainerWithLazyStateUpdatesApplied(c, _ref);\n" + + " TestStateContainer _state = getStateContainerWithLazyStateUpdatesApplied(c," + + " _ref);\n" + " TestSpec.testEventMethod2(\n" + " c,\n" + " (boolean) _ref.arg0,\n" @@ -188,7 +190,8 @@ public void testGenerateEventHandlerFactories() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( - "public static com.facebook.litho.EventHandler testEventMethod1(\n" + "public static " + + " com.facebook.litho.EventHandler testEventMethod1(\n" + " com.facebook.litho.ComponentContext c, java.lang.Object arg2, T arg3,\n" + " @androidx.annotation.Nullable T arg6) {\n" + " return newEventHandler(Test.class, \"Test\", c, -1400079064, new Object[] {\n" @@ -202,7 +205,8 @@ public void testGenerateEventHandlerFactories() { .isEqualTo( "public static com.facebook.litho.EventHandler testEventMethod2(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return newEventHandler(Test.class, \"Test\", c, -1400079063, null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + + " return newEventHandler(Test.class, \"Test\", c, -1400079063, null," + + " com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } @@ -211,7 +215,8 @@ public void testGenerateDispatchOnEvent() { assertThat(EventGenerator.generateDispatchOnEventImpl(mSpecModel).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected java.lang.Object dispatchOnEventImpl(final com.facebook.litho.EventHandler eventHandler,\n" + + "protected java.lang.Object dispatchOnEventImpl(final" + + " com.facebook.litho.EventHandler eventHandler,\n" + " final java.lang.Object eventState) {\n" + " int id = eventHandler.id;\n" + " switch (id) {\n" @@ -220,7 +225,8 @@ public void testGenerateDispatchOnEvent() { + " java.lang.Object _event = (java.lang.Object) eventState;\n" + " testEventMethod1(\n" + " eventHandler.dispatchInfo.hasEventDispatcher,\n" - + " (com.facebook.litho.ComponentContext) eventHandler.dispatchInfo.componentContext,\n" + + " (com.facebook.litho.ComponentContext)" + + " eventHandler.dispatchInfo.componentContext,\n" + " (java.lang.Object) eventHandler.params[0],\n" + " (java.lang.CharSequence) eventHandler.params[1],\n" + " (java.lang.CharSequence) eventHandler.params[2]);\n" @@ -231,12 +237,15 @@ public void testGenerateDispatchOnEvent() { + " java.lang.Object _event = (java.lang.Object) eventState;\n" + " testEventMethod2(\n" + " eventHandler.dispatchInfo.hasEventDispatcher,\n" - + " (com.facebook.litho.ComponentContext) eventHandler.dispatchInfo.componentContext);\n" + + " (com.facebook.litho.ComponentContext)" + + " eventHandler.dispatchInfo.componentContext);\n" + " return null;\n" + " }\n" + " // __internalOnErrorHandler\n" + " case -1048037474: {\n" - + " dispatchErrorEvent((com.facebook.litho.ComponentContext) eventHandler.dispatchInfo.componentContext, (com.facebook.litho.ErrorEvent) eventState);\n" + + " dispatchErrorEvent((com.facebook.litho.ComponentContext)" + + " eventHandler.dispatchInfo.componentContext, (com.facebook.litho.ErrorEvent)" + + " eventState);\n" + " return null;\n" + " }\n" + " default:\n" @@ -253,7 +262,8 @@ public void testGetEventHandlerMethods() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@androidx.annotation.Nullable\n" - + "public static com.facebook.litho.EventHandler getObjectHandler(\n" + + "public static com.facebook.litho.EventHandler" + + " getObjectHandler(\n" + " com.facebook.litho.ComponentContext context) {\n" + " if (context.getComponentScope() == null) {\n" + " return null;\n" @@ -269,7 +279,8 @@ public void testGenerateEventDispatchers() { assertThat(dataHolder.getMethodSpecs()).hasSize(1); assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( - "static java.lang.Object dispatchObject(com.facebook.litho.EventHandler _eventHandler, int field1,\n" + "static java.lang.Object dispatchObject(com.facebook.litho.EventHandler _eventHandler," + + " int field1,\n" + " int field2) {\n" + " final java.lang.Object _eventState = new java.lang.Object();\n" + " _eventState.field1 = field1;\n" @@ -298,7 +309,8 @@ public void testGenerateEventDispatchersIgnoresGenericTypesInFields() { TypeSpecDataHolder dataHolder = EventGenerator.generateEventDispatchers(mMockSpecModel); assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( - "static java.lang.Object dispatchObject(com.facebook.litho.EventHandler _eventHandler,\n" + "static java.lang.Object dispatchObject(com.facebook.litho.EventHandler" + + " _eventHandler,\n" + " java.util.List field1) {\n" + " final java.lang.Object _eventState = new java.lang.Object();\n" + " _eventState.field1 = field1;\n" @@ -322,8 +334,11 @@ public void testGenerateEventDispatchersIgnoresGenericTypesInFields() { assertThat(methodSpecs[0].toString()) .isEqualTo( "static void dispatchCustomEvent(com.facebook.litho.EventHandler _eventHandler,\n" - + " java.lang.Object nonnullObject, @androidx.annotation.Nullable java.lang.Object nullableObject) {\n" - + " final com.facebook.litho.specmodels.generator.EventGeneratorTest.CustomEvent _eventState = new com.facebook.litho.specmodels.generator.EventGeneratorTest.CustomEvent();\n" + + " java.lang.Object nonnullObject, @androidx.annotation.Nullable" + + " java.lang.Object nullableObject) {\n" + + " final com.facebook.litho.specmodels.generator.EventGeneratorTest.CustomEvent" + + " _eventState = new" + + " com.facebook.litho.specmodels.generator.EventGeneratorTest.CustomEvent();\n" + " _eventState.nonnullObject = nonnullObject;\n" + " _eventState.nullableObject = nullableObject;\n" + " _eventHandler.dispatchEvent(_eventState);\n" @@ -406,9 +421,11 @@ public void whenEventHandlerWithGenericTypedVariables_shouldGenerateTypedEventHa assertThat(method.toString()) .isEqualTo( - "public static com.facebook.litho.EventHandler> onEvent(\n" + "public static " + + " com.facebook.litho.EventHandler> onEvent(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029, null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029," + + " null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } @@ -484,9 +501,11 @@ public void whenEventHandlerWithSameGenericOnTwoFields_shouldGenerateTypedEventH assertThat(method.toString()) .isEqualTo( - "public static com.facebook.litho.EventHandler> onEvent(\n" + "public static com.facebook.litho.EventHandler>" + + " onEvent(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029, null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029," + + " null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } @@ -556,7 +575,8 @@ public void whenEventHandlerNoGenericTypedVariables_shouldGenerateTypedEventHand .isEqualTo( "public static com.facebook.litho.EventHandler> onEvent(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029, null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029," + + " null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } @@ -661,12 +681,13 @@ public void whenEventHandlerWithNamedTypedVariables_shouldGenerateTypedEventHand assertThat(method.toString()) .isEqualTo( - "public static com.facebook.litho.EventHandler> onEvent(\n" + "public static " + + " com.facebook.litho.EventHandler> onEvent(\n" + " com.facebook.litho.ComponentContext c, P param1) {\n" - + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029, new Object[] {\n" + + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029," + + " new Object[] {\n" + " param1,\n" - + " }, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND" - + ");\n" + + " }, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } @@ -734,9 +755,11 @@ public void whenEventHandlerWithPrimitiveTypedVariables_shouldGenerateTypedEvent assertThat(method.toString()) .isEqualTo( - "public static com.facebook.litho.EventHandler> onEvent(\n" + "public static " + + " com.facebook.litho.EventHandler> onEvent(\n" + " com.facebook.litho.ComponentContext c) {\n" - + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029, null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + + " return newEventHandler(TestComponent.class, \"TestComponent\", c, -1349761029," + + " null, com.facebook.litho.annotations.EventHandlerRebindMode.REBIND);\n" + "}\n"); } } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/InterStagePropsGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/InterStagePropsGeneratorTest.java index 8dc32936a60..412d6e5cae9 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/InterStagePropsGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/InterStagePropsGeneratorTest.java @@ -109,7 +109,8 @@ public void test_generate_container_impl() { assertThat(container.toString()) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "static class MountTestInterStagePropsContainer implements com.facebook.litho.InterStagePropsContainer {\n" + + "static class MountTestInterStagePropsContainer implements" + + " com.facebook.litho.InterStagePropsContainer {\n" + " java.lang.String stringOutput;\n" + "}\n"); } @@ -157,7 +158,8 @@ public void test_get_container_impl() { "private MountTestInterStagePropsContainer getInterStagePropsContainerImpl(\n" + " com.facebook.litho.ComponentContext c,\n" + " com.facebook.litho.InterStagePropsContainer interStageProps) {\n" - + " return (MountTestInterStagePropsContainer) super.getInterStagePropsContainer(c, interStageProps);\n" + + " return (MountTestInterStagePropsContainer)" + + " super.getInterStagePropsContainer(c, interStageProps);\n" + "}\n"); } @@ -223,9 +225,11 @@ public void test_usages() { "@java.lang.Override\n" + "protected void onMeasure(com.facebook.litho.ComponentContext c,\n" + " com.facebook.litho.ComponentLayout layout, int widthSpec, int heightSpec,\n" - + " com.facebook.litho.Size size, com.facebook.litho.InterStagePropsContainer _5) {\n" + + " com.facebook.litho.Size size, com.facebook.litho.InterStagePropsContainer" + + " _5) {\n" + " com.facebook.litho.InterStagePropsContainer _interStageProps = _5;\n" - + " com.facebook.litho.Output stringOutputTmp = new Output<>();\n" + + " com.facebook.litho.Output stringOutputTmp = new" + + " Output<>();\n" + " MountTestSpec.onMeasure(\n" + " (com.facebook.litho.ComponentContext) c,\n" + " (com.facebook.litho.ComponentLayout) layout,\n" @@ -233,22 +237,26 @@ public void test_usages() { + " (int) heightSpec,\n" + " (com.facebook.litho.Size) size,\n" + " (com.facebook.litho.Output) stringOutputTmp);\n" - + " getInterStagePropsContainerImpl(c, _interStageProps).stringOutput = stringOutputTmp.get();\n" + + " getInterStagePropsContainerImpl(c, _interStageProps).stringOutput =" + + " stringOutputTmp.get();\n" + "}\n"); assertThat(onBindMethod.toString()) .isEqualTo( "@java.lang.Override\n" - + "protected void onBind(com.facebook.litho.ComponentContext c, java.lang.Object lithoView,\n" + + "protected void onBind(com.facebook.litho.ComponentContext c, java.lang.Object" + + " lithoView,\n" + " com.facebook.litho.InterStagePropsContainer _2) {\n" + " com.facebook.litho.InterStagePropsContainer _interStageProps = _2;\n" - + " com.facebook.litho.Output stringOutputTmp = new Output<>();\n" + + " com.facebook.litho.Output stringOutputTmp = new" + + " Output<>();\n" + " MountTestSpec.onBind(\n" + " (com.facebook.litho.ComponentContext) c,\n" + " (com.facebook.litho.LithoView) lithoView,\n" + " (java.lang.Integer) getPrepareInterStagePropsContainerImpl(c).color,\n" + " (com.facebook.litho.Output) stringOutputTmp);\n" - + " getInterStagePropsContainerImpl(c, _interStageProps).stringOutput = stringOutputTmp.get();\n" + + " getInterStagePropsContainerImpl(c, _interStageProps).stringOutput =" + + " stringOutputTmp.get();\n" + "}\n"); } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateContainerGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateContainerGeneratorTest.java index d9b4a4a242d..72033e983b6 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateContainerGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateContainerGeneratorTest.java @@ -124,7 +124,8 @@ public void testGenerateStateContainerImpl() { + " otherwise = 2\n" + ")\n" + "@com.facebook.litho.annotations.Generated\n" - + "static class TestWithStateStateContainer extends com.facebook.litho.StateContainer {\n" + + "static class TestWithStateStateContainer" + + " extends com.facebook.litho.StateContainer {\n" + " @com.facebook.litho.annotations.State\n" + " @com.facebook.litho.annotations.Comparable(\n" + " type = 3\n" @@ -138,7 +139,8 @@ public void testGenerateStateContainerImpl() { + " boolean arg4;\n" + "\n" + " @java.lang.Override\n" - + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate stateUpdate) {\n" + + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate" + + " stateUpdate) {\n" + " com.facebook.litho.StateValue arg1;\n" + " com.facebook.litho.StateValue arg4;\n" + "\n" @@ -166,7 +168,9 @@ public void testGenerateStateContainerWithTransitionImpl() { + " otherwise = 2\n" + ")\n" + "@com.facebook.litho.annotations.Generated\n" - + "static class TestWithStateWithTransitionStateContainer extends com.facebook.litho.StateContainer implements com.facebook.litho.SpecGeneratedComponent.TransitionContainer {\n" + + "static class TestWithStateWithTransitionStateContainer extends com.facebook.litho.StateContainer implements" + + " com.facebook.litho.SpecGeneratedComponent.TransitionContainer {\n" + " @com.facebook.litho.annotations.State\n" + " @com.facebook.litho.annotations.Comparable(\n" + " type = 3\n" @@ -189,7 +193,8 @@ public void testGenerateStateContainerWithTransitionImpl() { + " com.facebook.litho.Transition _transition = null;\n" + " switch (stateUpdate.type) {\n" + " case 0:\n" - + " _transition = TestWithStateWithTransitionSpec.testUpdateStateWithTransition();\n" + + " _transition =" + + " TestWithStateWithTransitionSpec.testUpdateStateWithTransition();\n" + " break;\n" + "\n" + " case -2147483648:\n" @@ -200,7 +205,8 @@ public void testGenerateStateContainerWithTransitionImpl() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate stateUpdate) {\n" + + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate" + + " stateUpdate) {\n" + " if (applyStateUpdateWithTransition(stateUpdate) != null) {\n" + " throw new UnsupportedOperationException();\n" + " }\n" @@ -218,7 +224,9 @@ public void testGenerateStateContainerWithBothMethodsImpl() { + " otherwise = 2\n" + ")\n" + "@com.facebook.litho.annotations.Generated\n" - + "static class TestWithBothMethodsStateContainer extends com.facebook.litho.StateContainer implements com.facebook.litho.SpecGeneratedComponent.TransitionContainer {\n" + + "static class TestWithBothMethodsStateContainer" + + " extends com.facebook.litho.StateContainer implements" + + " com.facebook.litho.SpecGeneratedComponent.TransitionContainer {\n" + " @com.facebook.litho.annotations.State\n" + " @com.facebook.litho.annotations.Comparable(\n" + " type = 3\n" @@ -256,7 +264,8 @@ public void testGenerateStateContainerWithBothMethodsImpl() { + " }\n" + "\n" + " @java.lang.Override\n" - + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate stateUpdate) {\n" + + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate" + + " stateUpdate) {\n" + " if (applyStateUpdateWithTransition(stateUpdate) != null) {\n" + " throw new UnsupportedOperationException();\n" + " }\n" @@ -275,7 +284,8 @@ public void testGenerateStateContainerWithSameGenericMultipleTimesImpl() { + " otherwise = 2\n" + ")\n" + "@com.facebook.litho.annotations.Generated\n" - + "static class TestWithSameGenericMultipleTimesStateContainer extends com.facebook.litho.StateContainer {\n" + + "static class TestWithSameGenericMultipleTimesStateContainer extends" + + " com.facebook.litho.StateContainer {\n" + " @com.facebook.litho.annotations.State\n" + " @com.facebook.litho.annotations.Comparable(\n" + " type = 5\n" @@ -283,7 +293,8 @@ public void testGenerateStateContainerWithSameGenericMultipleTimesImpl() { + " java.util.List values;\n" + "\n" + " @java.lang.Override\n" - + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate stateUpdate) {\n" + + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate" + + " stateUpdate) {\n" + " com.facebook.litho.StateValue> values;\n" + "\n" + " final java.lang.Object[] params = stateUpdate.params;\n" @@ -291,7 +302,8 @@ public void testGenerateStateContainerWithSameGenericMultipleTimesImpl() { + " case 0:\n" + " values = new com.facebook.litho.StateValue>();\n" + " values.set(this.values);\n" - + " TestWithSameGenericMultipleTimesSpec.updateValues(values, (java.util.List) params[0]);\n" + + " TestWithSameGenericMultipleTimesSpec.updateValues(values," + + " (java.util.List) params[0]);\n" + " this.values = values.get();\n" + " break;\n" + " }\n" @@ -309,7 +321,8 @@ public void testGenerateStateContainerWithMultipleGenericsImpl() { + " otherwise = 2\n" + ")\n" + "@com.facebook.litho.annotations.Generated\n" - + "static class TestWithMultipleGenericsStateContainer extends com.facebook.litho.StateContainer {\n" + + "static class TestWithMultipleGenericsStateContainer extends" + + " com.facebook.litho.StateContainer {\n" + " @com.facebook.litho.annotations.State\n" + " @com.facebook.litho.annotations.Comparable(\n" + " type = 13\n" @@ -317,15 +330,19 @@ public void testGenerateStateContainerWithMultipleGenericsImpl() { + " java.util.function.Function functions;\n" + "\n" + " @java.lang.Override\n" - + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate stateUpdate) {\n" - + " com.facebook.litho.StateValue> functions;\n" + + " public void applyStateUpdate(com.facebook.litho.StateContainer.StateUpdate" + + " stateUpdate) {\n" + + " com.facebook.litho.StateValue>" + + " functions;\n" + "\n" + " final java.lang.Object[] params = stateUpdate.params;\n" + " switch (stateUpdate.type) {\n" + " case 0:\n" - + " functions = new com.facebook.litho.StateValue>();\n" + + " functions = new" + + " com.facebook.litho.StateValue>();\n" + " functions.set(this.functions);\n" - + " TestWithMultipleGenericsSpec.updateValues(functions, (java.util.function.Function) params[0]);\n" + + " TestWithMultipleGenericsSpec.updateValues(functions," + + " (java.util.function.Function) params[0]);\n" + " this.functions = functions.get();\n" + " break;\n" + " }\n" diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateGeneratorTest.java index 6b62098e260..26f7b1f1abe 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/StateGeneratorTest.java @@ -338,9 +338,12 @@ public void testGenerateStateContainerWithLazyStateUpdatesApplied_withLazyState( .isEqualTo( "private TestWithStateStateContainer getStateContainerWithLazyStateUpdatesApplied(\n" + " com.facebook.litho.ComponentContext c,\n" - + " com.facebook.litho.specmodels.generator.StateGeneratorTest.TestWithState component) {\n" - + " TestWithStateStateContainer _stateContainer = (TestWithStateStateContainer) getStateContainerImpl(c);\n" - + " return (TestWithStateStateContainer) c.applyLazyStateUpdatesForContainer(_stateContainer);\n" + + " com.facebook.litho.specmodels.generator.StateGeneratorTest.TestWithState" + + " component) {\n" + + " TestWithStateStateContainer _stateContainer = (TestWithStateStateContainer)" + + " getStateContainerImpl(c);\n" + + " return (TestWithStateStateContainer)" + + " c.applyLazyStateUpdatesForContainer(_stateContainer);\n" + "}\n"); } @@ -354,12 +357,15 @@ public void testGenerateOnStateUpdateMethods() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "protected static void updateCurrentState(com.facebook.litho.ComponentContext c,\n" - + " java.lang.Object nonnullObject, @androidx.annotation.Nullable java.lang.Object nulalbleObject) {\n" + + " java.lang.Object nonnullObject, @androidx.annotation.Nullable" + + " java.lang.Object nulalbleObject) {\n" + " com.facebook.litho.Component _component = c.getComponentScope();\n" + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject, nulalbleObject);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject," + + " nulalbleObject);\n" + " c.updateStateAsync(_stateUpdate, \"" + STATE_UPDATE_PREFIX + "TestWithState.updateCurrentState\");\n" @@ -368,12 +374,15 @@ public void testGenerateOnStateUpdateMethods() { assertThat(dataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "protected static void updateCurrentStateAsync(com.facebook.litho.ComponentContext c,\n" - + " java.lang.Object nonnullObject, @androidx.annotation.Nullable java.lang.Object nulalbleObject) {\n" + + " java.lang.Object nonnullObject, @androidx.annotation.Nullable" + + " java.lang.Object nulalbleObject) {\n" + " com.facebook.litho.Component _component = c.getComponentScope();\n" + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject, nulalbleObject);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject," + + " nulalbleObject);\n" + " c.updateStateAsync(_stateUpdate, \"" + STATE_UPDATE_PREFIX + "TestWithState.updateCurrentState\");\n" @@ -382,12 +391,15 @@ public void testGenerateOnStateUpdateMethods() { assertThat(dataHolder.getMethodSpecs().get(2).toString()) .isEqualTo( "protected static void updateCurrentStateSync(com.facebook.litho.ComponentContext c,\n" - + " java.lang.Object nonnullObject, @androidx.annotation.Nullable java.lang.Object nulalbleObject) {\n" + + " java.lang.Object nonnullObject, @androidx.annotation.Nullable" + + " java.lang.Object nulalbleObject) {\n" + " com.facebook.litho.Component _component = c.getComponentScope();\n" + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject, nulalbleObject);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(0, nonnullObject," + + " nulalbleObject);\n" + " c.updateStateSync(_stateUpdate, \"" + STATE_UPDATE_PREFIX + "TestWithState.updateCurrentState\");\n" @@ -403,12 +415,14 @@ public void testGenerateOnStateUpdateWithTransitionMethods() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( - "protected static void updateCurrentStateWithTransition(com.facebook.litho.ComponentContext c) {\n" + "protected static void" + + " updateCurrentStateWithTransition(com.facebook.litho.ComponentContext c) {\n" + " com.facebook.litho.Component _component = c.getComponentScope();\n" + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(0);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(0);\n" + " c.updateStateWithTransition(_stateUpdate, \"" + STATE_UPDATE_PREFIX + "TestWithStateWithTransition.updateCurrentState\");\n" @@ -430,7 +444,8 @@ public void testGenerateLazyStateUpdateMethods() { + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + " c.updateStateLazy(_stateUpdate);\n" + "}\n"); } @@ -450,7 +465,8 @@ public void testGenerateLazyStateUpdateMethodsForGenerics() { + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + " c.updateStateLazy(_stateUpdate);\n" + "}\n"); } @@ -470,7 +486,8 @@ public void testGenerateLazyStateUpdateMethodsForGenericMethod() { + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + " c.updateStateLazy(_stateUpdate);\n" + "}\n"); } @@ -490,7 +507,8 @@ public void testGenerateLazyStateUpdateMethodsForGenericMethodNullable() { + " if (_component == null) {\n" + " return;\n" + " }\n" - + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + + " com.facebook.litho.StateContainer.StateUpdate _stateUpdate = new" + + " com.facebook.litho.StateContainer.StateUpdate(-2147483648, lazyUpdateValue);\n" + " c.updateStateLazy(_stateUpdate);\n" + "}\n"); } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TreePropGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TreePropGeneratorTest.java index da47da0bd81..169df2e03da 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TreePropGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TreePropGeneratorTest.java @@ -207,7 +207,8 @@ public void testGenerate() { assertThat(typeSpecDataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected void populateTreePropContainer(com.facebook.litho.TreePropContainer treePropContainer) {\n" + + "protected void populateTreePropContainer(com.facebook.litho.TreePropContainer" + + " treePropContainer) {\n" + " if (treePropContainer == null) {\n" + " return;\n" + " }\n" @@ -217,10 +218,12 @@ public void testGenerate() { assertThat(typeSpecDataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected com.facebook.litho.TreePropContainer getTreePropContainerForChildren(\n" + + "protected com.facebook.litho.TreePropContainer" + + " getTreePropContainerForChildren(\n" + " com.facebook.litho.ComponentContext c,\n" + " com.facebook.litho.TreePropContainer parentTreePropContainer) {\n" - + " final com.facebook.litho.TreePropContainer childTreePropContainer = com.facebook.litho.TreePropContainer.acquire(parentTreePropContainer);\n" + + " final com.facebook.litho.TreePropContainer childTreePropContainer =" + + " com.facebook.litho.TreePropContainer.acquire(parentTreePropContainer);\n" + " TestStateContainer _state = getStateContainerImpl(c);\n" + " childTreePropContainer.put(boolean.class, TestSpec.onCreateTreeProp(\n" + " (com.facebook.litho.ComponentContext) c,\n" @@ -242,22 +245,27 @@ public void testGenericGenerate() { assertThat(typeSpecDataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected void populateTreePropContainer(com.facebook.litho.TreePropContainer treePropContainer) {\n" + + "protected void populateTreePropContainer(com.facebook.litho.TreePropContainer" + + " treePropContainer) {\n" + " if (treePropContainer == null) {\n" + " return;\n" + " }\n" - + " genericTreeProp = treePropContainer.get(com.facebook.litho.specmodels.generator.TreePropGeneratorTest.GenericObject.class);\n" + + " genericTreeProp =" + + " treePropContainer.get(com.facebook.litho.specmodels.generator.TreePropGeneratorTest.GenericObject.class);\n" + " treeProp = treePropContainer.get(int.class);\n" + "}\n"); assertThat(typeSpecDataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "@java.lang.Override\n" - + "protected com.facebook.litho.TreePropContainer getTreePropContainerForChildren(\n" + + "protected com.facebook.litho.TreePropContainer" + + " getTreePropContainerForChildren(\n" + " com.facebook.litho.ComponentContext c,\n" + " com.facebook.litho.TreePropContainer parentTreePropContainer) {\n" - + " final com.facebook.litho.TreePropContainer childTreePropContainer = com.facebook.litho.TreePropContainer.acquire(parentTreePropContainer);\n" - + " childTreePropContainer.put(com.facebook.litho.specmodels.generator.TreePropGeneratorTest.GenericObject.class, TestSpec.onCreateTreeProp(\n" + + " final com.facebook.litho.TreePropContainer childTreePropContainer =" + + " com.facebook.litho.TreePropContainer.acquire(parentTreePropContainer);\n" + + " childTreePropContainer.put(com.facebook.litho.specmodels.generator.TreePropGeneratorTest.GenericObject.class," + + " TestSpec.onCreateTreeProp(\n" + " (com.facebook.litho.ComponentContext) c,\n" + " prop));\n" + " return childTreePropContainer;\n" diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TriggerGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TriggerGeneratorTest.java index 0e92ebae163..7972c93738a 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TriggerGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/TriggerGeneratorTest.java @@ -94,14 +94,19 @@ public void testGenerateAcceptTriggerEvent() { .isEqualTo( "@java.lang.Override\n" + "protected java.lang.Object acceptTriggerEventImpl(\n" - + " final com.facebook.litho.EventTrigger eventTrigger, final java.lang.Object eventState,\n" + + " final com.facebook.litho.EventTrigger eventTrigger, final java.lang.Object" + + " eventState,\n" + " final java.lang.Object[] params) {\n" + " int id = eventTrigger.getId();\n" + " switch(id) {\n" + " case -773082596: {\n" - + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent _event = (com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent) eventState;\n" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent" + + " _event =" + + " (com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent)" + + " eventState;\n" + " return testTriggerMethod1(\n" - + " (com.facebook.litho.ComponentContext) eventTrigger.getComponentContext(),\n" + + " (com.facebook.litho.ComponentContext)" + + " eventTrigger.getComponentContext(),\n" + " eventTrigger.getTriggerTarget(),\n" + " (java.lang.Object) params[0],\n" + " (T) params[1],\n" @@ -111,7 +116,8 @@ public void testGenerateAcceptTriggerEvent() { + " case 969727739: {\n" + " java.lang.Object _event = (java.lang.Object) eventState;\n" + " testTriggerMethod2(\n" - + " (com.facebook.litho.ComponentContext) eventTrigger.getComponentContext(),\n" + + " (com.facebook.litho.ComponentContext)" + + " eventTrigger.getComponentContext(),\n" + " eventTrigger.getTriggerTarget());\n" + " return null;\n" + " }\n" @@ -132,9 +138,9 @@ public void testGenerateOnTriggerMethods() { assertThat(result) .isEqualTo( "private java.lang.Object testTriggerMethod1(com.facebook.litho.ComponentContext c,\n" - + " com.facebook.litho.EventTriggerTarget _abstract," - + " java.lang.Object arg2,\n" - + " @androidx.annotation.Nullable T arg3, long arg4, @androidx.annotation.Nullable T arg5) {\n" + + " com.facebook.litho.EventTriggerTarget _abstract, java.lang.Object arg2,\n" + + " @androidx.annotation.Nullable T arg3, long arg4," + + " @androidx.annotation.Nullable T arg5) {\n" + " Test _ref = (Test) _abstract;\n" + " java.lang.Object _result = (java.lang.Object) TestSpec.testTriggerMethod1(\n" + " c,\n" @@ -170,21 +176,30 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( "/**\n" - + " * This will send the testTriggerMethod1 trigger to the component with the given handle.\n" - + " * For more information about using triggers, see https://fblitho.com/docs/trigger-events\n" + + " * This will send the testTriggerMethod1 trigger to the component with the given" + + " handle.\n" + + " * For more information about using triggers, see" + + " https://fblitho.com/docs/trigger-events\n" + " */\n" - + "public static java.lang.Object testTriggerMethod1(\n" - + " com.facebook.litho.ComponentContext c, com.facebook.litho.Handle handle, java.lang.Object arg2,\n" - + " @androidx.annotation.Nullable T arg3, long arg4, @androidx.annotation.Nullable T arg5) {\n" + + "public static java.lang.Object" + + " testTriggerMethod1(\n" + + " com.facebook.litho.ComponentContext c, com.facebook.litho.Handle handle," + + " java.lang.Object arg2,\n" + + " @androidx.annotation.Nullable T arg3, long arg4," + + " @androidx.annotation.Nullable T arg5) {\n" + " int methodId = -773082596;\n" - + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId, handle);\n" + + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId," + + " handle);\n" + " if (trigger == null) {\n" + " return null;\n" + " }\n" - + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent _eventState = new com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent" + + " _eventState = new" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + " _eventState.arg4 = arg4;\n" + " _eventState.arg5 = arg5;\n" - + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[] {\n" + + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[]" + + " {\n" + " arg2,\n" + " arg3,\n" + " });\n" @@ -193,21 +208,28 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static java.lang.Object testTriggerMethod1(\n" - + " com.facebook.litho.ComponentContext c, java.lang.String key, java.lang.Object arg2,\n" - + " @androidx.annotation.Nullable T arg3, long arg4, @androidx.annotation.Nullable T arg5) {\n" + + "public static java.lang.Object" + + " testTriggerMethod1(\n" + + " com.facebook.litho.ComponentContext c, java.lang.String key," + + " java.lang.Object arg2,\n" + + " @androidx.annotation.Nullable T arg3, long arg4," + + " @androidx.annotation.Nullable T arg5) {\n" + " int methodId = -773082596;\n" + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId, key);\n" + " if (trigger == null) {\n" + " return null;\n" + " }\n" - + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent _eventState = new com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent" + + " _eventState = new" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + " _eventState.arg4 = arg4;\n" + " _eventState.arg5 = arg5;\n" - + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[] {\n" + + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[]" + + " {\n" + " arg2,\n" + " arg3,\n" + " });\n" @@ -216,16 +238,22 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(2).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static java.lang.Object testTriggerMethod1(\n" + + "public static java.lang.Object" + + " testTriggerMethod1(\n" + " com.facebook.litho.EventTrigger trigger, java.lang.Object arg2,\n" - + " @androidx.annotation.Nullable T arg3, long arg4, @androidx.annotation.Nullable T arg5) {\n" - + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent _eventState = new com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + + " @androidx.annotation.Nullable T arg3, long arg4," + + " @androidx.annotation.Nullable T arg5) {\n" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent" + + " _eventState = new" + + " com.facebook.litho.specmodels.generator.TriggerGeneratorTest.TestEvent();\n" + " _eventState.arg4 = arg4;\n" + " _eventState.arg5 = arg5;\n" - + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[] {\n" + + " return (java.lang.Object) trigger.dispatchOnTrigger(_eventState, new Object[]" + + " {\n" + " arg2,\n" + " arg3,\n" + " });\n" @@ -234,12 +262,14 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(3).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod1(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" + "static java.lang.Object testTriggerMethod1(\n" + " com.facebook.litho.ComponentContext c, java.lang.Object arg2,\n" - + " @androidx.annotation.Nullable T arg3, long arg4, @androidx.annotation.Nullable T arg5) {\n" + + " @androidx.annotation.Nullable T arg3, long arg4," + + " @androidx.annotation.Nullable T arg5) {\n" + " Test component = (Test) c.getComponentScope();\n" + " return component.testTriggerMethod1(\n" + " c,\n" @@ -253,13 +283,16 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(4).toString()) .isEqualTo( "/**\n" - + " * This will send the testTriggerMethod2 trigger to the component with the given handle.\n" - + " * For more information about using triggers, see https://fblitho.com/docs/trigger-events\n" + + " * This will send the testTriggerMethod2 trigger to the component with the given" + + " handle.\n" + + " * For more information about using triggers, see" + + " https://fblitho.com/docs/trigger-events\n" + " */\n" + "public static void testTriggerMethod2(com.facebook.litho.ComponentContext c,\n" + " com.facebook.litho.Handle handle) {\n" + " int methodId = 969727739;\n" - + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId, handle);\n" + + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId," + + " handle);\n" + " if (trigger == null) {\n" + " return;\n" + " }\n" @@ -271,10 +304,12 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(5).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static void testTriggerMethod2(com.facebook.litho.ComponentContext c, java.lang.String key) {\n" + + "public static void testTriggerMethod2(com.facebook.litho.ComponentContext c," + + " java.lang.String key) {\n" + " int methodId = 969727739;\n" + " com.facebook.litho.EventTrigger trigger = getEventTrigger(c, methodId, key);\n" + " if (trigger == null) {\n" @@ -288,10 +323,12 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(6).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static void testTriggerMethod2(com.facebook.litho.EventTrigger trigger) {\n" + + "public static void testTriggerMethod2(com.facebook.litho.EventTrigger trigger)" + + " {\n" + " java.lang.Object _eventState = new java.lang.Object();\n" + " trigger.dispatchOnTrigger(_eventState, new Object[] {\n" + " });\n" @@ -300,7 +337,8 @@ public void testGenerateStaticTriggerMethod() { assertThat(dataHolder.getMethodSpecs().get(7).toString()) .isEqualTo( "/**\n" - + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)} instead.\n" + + " * @deprecated Use {@link #testTriggerMethod2(ComponentContext, Handle)}" + + " instead.\n" + " */\n" + "@java.lang.Deprecated\n" + "static void testTriggerMethod2(com.facebook.litho.ComponentContext c) {\n" @@ -319,8 +357,11 @@ public void testGenerateStaticGetTriggerMethods() { assertThat(dataHolder.getMethodSpecs().get(0).toString()) .isEqualTo( - "private static com.facebook.litho.EventTrigger createTestTriggerMethod1Trigger(\n" - + " com.facebook.litho.ComponentContext c, com.facebook.litho.Component component) {\n" + "private static" + + " com.facebook.litho.EventTrigger" + + " createTestTriggerMethod1Trigger(\n" + + " com.facebook.litho.ComponentContext c, com.facebook.litho.Component" + + " component) {\n" + " int methodId = -773082596;\n" + " return newEventTrigger(c, component, methodId);\n" + "}\n"); @@ -328,10 +369,14 @@ public void testGenerateStaticGetTriggerMethods() { assertThat(dataHolder.getMethodSpecs().get(1).toString()) .isEqualTo( "/**\n" - + " * @deprecated Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use {@link #testTriggerMethod1(ComponentContext, Handle)}.\n" + + " * @deprecated Do not use this method to get a EventTrigger to use later." + + " Instead give the component a Handle and use {@link" + + " #testTriggerMethod1(ComponentContext, Handle)}.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static com.facebook.litho.EventTrigger testTriggerMethod1Trigger(\n" + + "public static" + + " com.facebook.litho.EventTrigger" + + " testTriggerMethod1Trigger(\n" + " com.facebook.litho.ComponentContext c, java.lang.String key) {\n" + " int methodId = -773082596;\n" + " return newEventTrigger(c, key, methodId);\n" @@ -339,8 +384,10 @@ public void testGenerateStaticGetTriggerMethods() { assertThat(dataHolder.getMethodSpecs().get(2).toString()) .isEqualTo( - "private static com.facebook.litho.EventTrigger createTestTriggerMethod2Trigger(\n" - + " com.facebook.litho.ComponentContext c, com.facebook.litho.Component component) {\n" + "private static com.facebook.litho.EventTrigger" + + " createTestTriggerMethod2Trigger(\n" + + " com.facebook.litho.ComponentContext c, com.facebook.litho.Component" + + " component) {\n" + " int methodId = 969727739;\n" + " return newEventTrigger(c, component, methodId);\n" + "}\n"); @@ -348,10 +395,13 @@ public void testGenerateStaticGetTriggerMethods() { assertThat(dataHolder.getMethodSpecs().get(3).toString()) .isEqualTo( "/**\n" - + " * @deprecated Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use {@link #testTriggerMethod2(ComponentContext, Handle)}.\n" + + " * @deprecated Do not use this method to get a EventTrigger to use later." + + " Instead give the component a Handle and use {@link" + + " #testTriggerMethod2(ComponentContext, Handle)}.\n" + " */\n" + "@java.lang.Deprecated\n" - + "public static com.facebook.litho.EventTrigger testTriggerMethod2Trigger(\n" + + "public static com.facebook.litho.EventTrigger" + + " testTriggerMethod2Trigger(\n" + " com.facebook.litho.ComponentContext c, java.lang.String key) {\n" + " int methodId = 969727739;\n" + " return newEventTrigger(c, key, methodId);\n" diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/WorkingRangeGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/WorkingRangeGeneratorTest.java index 6df2691e550..d0b99ba4d0e 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/generator/WorkingRangeGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/generator/WorkingRangeGeneratorTest.java @@ -83,7 +83,8 @@ public void testGenerateDispatchOnEnteredRange() { assertThat(WorkingRangeGenerator.generateDispatchOnEnteredRangeMethod(mSpecModel).toString()) .isEqualTo( "@java.lang.Override\n" - + "public void dispatchOnEnteredRange(com.facebook.litho.ComponentContext c, java.lang.String name,\n" + + "public void dispatchOnEnteredRange(com.facebook.litho.ComponentContext c," + + " java.lang.String name,\n" + " com.facebook.litho.InterStagePropsContainer interStageProps) {\n" + " switch (name) {\n" + " case \"enter\": {\n" @@ -103,7 +104,8 @@ public void testGenerateDispatchOnExitedRange() { assertThat(WorkingRangeGenerator.generateDispatchOnExitedRangeMethod(mSpecModel).toString()) .isEqualTo( "@java.lang.Override\n" - + "public void dispatchOnExitedRange(com.facebook.litho.ComponentContext c, java.lang.String name,\n" + + "public void dispatchOnExitedRange(com.facebook.litho.ComponentContext c," + + " java.lang.String name,\n" + " com.facebook.litho.InterStagePropsContainer interStageProps) {\n" + " switch (name) {\n" + " case \"exit\": {\n" @@ -180,7 +182,8 @@ public void testGenerateStaticRegisterMethods() { + " return;\n" + " }\n" + " com.facebook.litho.Component component = c.getComponentScope();\n" - + " registerWorkingRange(c, \"enter\", workingRange, component, c.getGlobalKey());\n" + + " registerWorkingRange(c, \"enter\", workingRange, component," + + " c.getGlobalKey());\n" + "}\n"); assertThat(dataHolder.getMethodSpecs().get(1).toString()) @@ -191,7 +194,8 @@ public void testGenerateStaticRegisterMethods() { + " return;\n" + " }\n" + " com.facebook.litho.Component component = c.getComponentScope();\n" - + " registerWorkingRange(c, \"exit\", workingRange, component, c.getGlobalKey());\n" + + " registerWorkingRange(c, \"exit\", workingRange, component," + + " c.getGlobalKey());\n" + "}\n"); assertThat(dataHolder.getMethodSpecs().get(2).toString()) @@ -202,7 +206,8 @@ public void testGenerateStaticRegisterMethods() { + " return;\n" + " }\n" + " com.facebook.litho.Component component = c.getComponentScope();\n" - + " registerWorkingRange(c, \"prefetch\", workingRange, component, c.getGlobalKey());\n" + + " registerWorkingRange(c, \"prefetch\", workingRange, component," + + " c.getGlobalKey());\n" + "}\n"); } } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueGeneratorTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueGeneratorTest.java index 43d2c276e36..f0ed2a7ce50 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueGeneratorTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueGeneratorTest.java @@ -183,7 +183,8 @@ public void testGenerateInputsClassNoParam() { + " return false;\n" + " }\n" + " ExpensiveValueInputs cachedValueInputs = (ExpensiveValueInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -214,7 +215,8 @@ public void testGenerateGetterNoParam() { "private java.lang.String getExpensiveValue(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" + " final ExpensiveValueInputs inputs = new ExpensiveValueInputs(globalKey);\n" - + " java.lang.String expensiveValue = (java.lang.String) c.getCachedValue(globalKey, 0, inputs);\n" + + " java.lang.String expensiveValue = (java.lang.String)" + + " c.getCachedValue(globalKey, 0, inputs);\n" + " if (expensiveValue == null) {\n" + " expensiveValue = CachedValueTestSpec.onCreateExpensiveValue();\n" + " c.putCachedValue(globalKey, 0, inputs, expensiveValue);\n" @@ -259,11 +261,14 @@ public void testGenerateInputsClassWithContextParam() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof ExpensiveValueWithContextInputs)) {\n" + + " if (other == null || !(other instanceof ExpensiveValueWithContextInputs))" + + " {\n" + " return false;\n" + " }\n" - + " ExpensiveValueWithContextInputs cachedValueInputs = (ExpensiveValueWithContextInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " ExpensiveValueWithContextInputs cachedValueInputs =" + + " (ExpensiveValueWithContextInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -292,12 +297,16 @@ public void testGenerateGetterWithContextParam() { .toString(); assertThat(expensiveValue) .isEqualTo( - "private java.lang.String getExpensiveValueWithContext(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String" + + " getExpensiveValueWithContext(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final ExpensiveValueWithContextInputs inputs = new ExpensiveValueWithContextInputs(globalKey);\n" - + " java.lang.String expensiveValueWithContext = (java.lang.String) c.getCachedValue(globalKey, 1, inputs);\n" + + " final ExpensiveValueWithContextInputs inputs = new" + + " ExpensiveValueWithContextInputs(globalKey);\n" + + " java.lang.String expensiveValueWithContext = (java.lang.String)" + + " c.getCachedValue(globalKey, 1, inputs);\n" + " if (expensiveValueWithContext == null) {\n" - + " expensiveValueWithContext = CachedValueTestSpec.onCreateExpensiveValueWithContext(c);\n" + + " expensiveValueWithContext =" + + " CachedValueTestSpec.onCreateExpensiveValueWithContext(c);\n" + " c.putCachedValue(globalKey, 1, inputs, expensiveValueWithContext);\n" + " }\n" + " return expensiveValueWithContext;\n" @@ -323,7 +332,8 @@ public void testGenerateInputsClassGenericParam() { assertThat(inputsClassWithGenericParam) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "private static class ExpensiveValueWithGenericInputs {\n" + + "private static class ExpensiveValueWithGenericInputs {\n" + " private final String globalKey;\n" + "\n" + " private final E genericArg;\n" @@ -335,7 +345,8 @@ public void testGenerateInputsClassGenericParam() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg," + + " getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -343,14 +354,18 @@ public void testGenerateInputsClassGenericParam() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof ExpensiveValueWithGenericInputs)) {\n" + + " if (other == null || !(other instanceof ExpensiveValueWithGenericInputs))" + + " {\n" + " return false;\n" + " }\n" - + " ExpensiveValueWithGenericInputs cachedValueInputs = (ExpensiveValueWithGenericInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " ExpensiveValueWithGenericInputs cachedValueInputs =" + + " (ExpensiveValueWithGenericInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" - + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) : cachedValueInputs.genericArg != null) {\n" + + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) :" + + " cachedValueInputs.genericArg != null) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -378,12 +393,16 @@ public void testGenerateGetterGenericParam() { .toString(); assertThat(valueWithGeneric) .isEqualTo( - "private java.lang.String getExpensiveValueWithGeneric(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String" + + " getExpensiveValueWithGeneric(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final ExpensiveValueWithGenericInputs inputs = new ExpensiveValueWithGenericInputs(globalKey,genericArg);\n" - + " java.lang.String expensiveValueWithGeneric = (java.lang.String) c.getCachedValue(globalKey, 4, inputs);\n" + + " final ExpensiveValueWithGenericInputs inputs = new" + + " ExpensiveValueWithGenericInputs(globalKey,genericArg);\n" + + " java.lang.String expensiveValueWithGeneric = (java.lang.String)" + + " c.getCachedValue(globalKey, 4, inputs);\n" + " if (expensiveValueWithGeneric == null) {\n" - + " expensiveValueWithGeneric = CachedValueTestSpec.onCreateExpensiveValueWithGeneric(genericArg);\n" + + " expensiveValueWithGeneric =" + + " CachedValueTestSpec.onCreateExpensiveValueWithGeneric(genericArg);\n" + " c.putCachedValue(globalKey, 4, inputs, expensiveValueWithGeneric);\n" + " }\n" + " return expensiveValueWithGeneric;\n" @@ -409,14 +428,16 @@ public void testGenerateInputsClassMultipleGenericsParams() { assertThat(inputsClassWithGenericParam) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "private static class ExpensiveValueWithMoreGenericsInputs {\n" + + "private static class ExpensiveValueWithMoreGenericsInputs {\n" + " private final String globalKey;\n" + "\n" + " private final E genericArg;\n" + "\n" + " private final E genericArg2;\n" + "\n" - + " ExpensiveValueWithMoreGenericsInputs(String globalKey, E genericArg, E genericArg2) {\n" + + " ExpensiveValueWithMoreGenericsInputs(String globalKey, E genericArg, E" + + " genericArg2) {\n" + " this.globalKey = globalKey;\n" + " this.genericArg = genericArg;\n" + " this.genericArg2 = genericArg2;\n" @@ -424,7 +445,8 @@ public void testGenerateInputsClassMultipleGenericsParams() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg, genericArg2, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg," + + " genericArg2, getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -432,17 +454,22 @@ public void testGenerateInputsClassMultipleGenericsParams() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof ExpensiveValueWithMoreGenericsInputs)) {\n" + + " if (other == null || !(other instanceof" + + " ExpensiveValueWithMoreGenericsInputs)) {\n" + " return false;\n" + " }\n" - + " ExpensiveValueWithMoreGenericsInputs cachedValueInputs = (ExpensiveValueWithMoreGenericsInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " ExpensiveValueWithMoreGenericsInputs cachedValueInputs =" + + " (ExpensiveValueWithMoreGenericsInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" - + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) : cachedValueInputs.genericArg != null) {\n" + + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) :" + + " cachedValueInputs.genericArg != null) {\n" + " return false;\n" + " }\n" - + " if (genericArg2 != null ? !genericArg2.equals(cachedValueInputs.genericArg2) : cachedValueInputs.genericArg2 != null) {\n" + + " if (genericArg2 != null ? !genericArg2.equals(cachedValueInputs.genericArg2)" + + " : cachedValueInputs.genericArg2 != null) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -470,12 +497,16 @@ public void testGenerateGetterMultipleGenericsParams() { .toString(); assertThat(valueWithMoreGenerics) .isEqualTo( - "private java.lang.String getExpensiveValueWithMoreGenerics(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String" + + " getExpensiveValueWithMoreGenerics(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final ExpensiveValueWithMoreGenericsInputs inputs = new ExpensiveValueWithMoreGenericsInputs(globalKey,genericArg,genericArg2);\n" - + " java.lang.String expensiveValueWithMoreGenerics = (java.lang.String) c.getCachedValue(globalKey, 5, inputs);\n" + + " final ExpensiveValueWithMoreGenericsInputs inputs = new" + + " ExpensiveValueWithMoreGenericsInputs(globalKey,genericArg,genericArg2);\n" + + " java.lang.String expensiveValueWithMoreGenerics = (java.lang.String)" + + " c.getCachedValue(globalKey, 5, inputs);\n" + " if (expensiveValueWithMoreGenerics == null) {\n" - + " expensiveValueWithMoreGenerics = CachedValueTestSpec.onCreateExpensiveValueWithMoreGenerics(genericArg,genericArg2);\n" + + " expensiveValueWithMoreGenerics =" + + " CachedValueTestSpec.onCreateExpensiveValueWithMoreGenerics(genericArg,genericArg2);\n" + " c.putCachedValue(globalKey, 5, inputs, expensiveValueWithMoreGenerics);\n" + " }\n" + " return expensiveValueWithMoreGenerics;\n" @@ -502,14 +533,16 @@ public void testGenerateInputsClassMultipleGenericsParamsAndContext() { assertThat(inputsClassWithGenericParam) .isEqualTo( "@com.facebook.litho.annotations.Generated\n" - + "private static class ExpensiveValueWithMoreGenericsAndContextInputs {\n" + + "private static class ExpensiveValueWithMoreGenericsAndContextInputs {\n" + " private final String globalKey;\n" + "\n" + " private final E genericArg;\n" + "\n" + " private final E genericArg2;\n" + "\n" - + " ExpensiveValueWithMoreGenericsAndContextInputs(String globalKey, E genericArg, E genericArg2) {\n" + + " ExpensiveValueWithMoreGenericsAndContextInputs(String globalKey, E genericArg," + + " E genericArg2) {\n" + " this.globalKey = globalKey;\n" + " this.genericArg = genericArg;\n" + " this.genericArg2 = genericArg2;\n" @@ -517,7 +550,8 @@ public void testGenerateInputsClassMultipleGenericsParamsAndContext() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg, genericArg2, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, genericArg," + + " genericArg2, getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -525,17 +559,22 @@ public void testGenerateInputsClassMultipleGenericsParamsAndContext() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof ExpensiveValueWithMoreGenericsAndContextInputs)) {\n" + + " if (other == null || !(other instanceof" + + " ExpensiveValueWithMoreGenericsAndContextInputs)) {\n" + " return false;\n" + " }\n" - + " ExpensiveValueWithMoreGenericsAndContextInputs cachedValueInputs = (ExpensiveValueWithMoreGenericsAndContextInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " ExpensiveValueWithMoreGenericsAndContextInputs cachedValueInputs =" + + " (ExpensiveValueWithMoreGenericsAndContextInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" - + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) : cachedValueInputs.genericArg != null) {\n" + + " if (genericArg != null ? !genericArg.equals(cachedValueInputs.genericArg) :" + + " cachedValueInputs.genericArg != null) {\n" + " return false;\n" + " }\n" - + " if (genericArg2 != null ? !genericArg2.equals(cachedValueInputs.genericArg2) : cachedValueInputs.genericArg2 != null) {\n" + + " if (genericArg2 != null ? !genericArg2.equals(cachedValueInputs.genericArg2)" + + " : cachedValueInputs.genericArg2 != null) {\n" + " return false;\n" + " }\n" + " return true;\n" @@ -567,11 +606,15 @@ public void testGenerateGetterMultipleGenericsParamsAndContext() { "private java.lang.String getExpensiveValueWithMoreGenericsAndContext(\n" + " com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final ExpensiveValueWithMoreGenericsAndContextInputs inputs = new ExpensiveValueWithMoreGenericsAndContextInputs(globalKey,genericArg,genericArg2);\n" - + " java.lang.String expensiveValueWithMoreGenericsAndContext = (java.lang.String) c.getCachedValue(globalKey, 6, inputs);\n" + + " final ExpensiveValueWithMoreGenericsAndContextInputs inputs = new" + + " ExpensiveValueWithMoreGenericsAndContextInputs(globalKey,genericArg,genericArg2);\n" + + " java.lang.String expensiveValueWithMoreGenericsAndContext = (java.lang.String)" + + " c.getCachedValue(globalKey, 6, inputs);\n" + " if (expensiveValueWithMoreGenericsAndContext == null) {\n" - + " expensiveValueWithMoreGenericsAndContext = CachedValueTestSpec.onCreateExpensiveValueWithMoreGenericsAndContext(c,genericArg,genericArg2);\n" - + " c.putCachedValue(globalKey, 6, inputs, expensiveValueWithMoreGenericsAndContext);\n" + + " expensiveValueWithMoreGenericsAndContext =" + + " CachedValueTestSpec.onCreateExpensiveValueWithMoreGenericsAndContext(c,genericArg,genericArg2);\n" + + " c.putCachedValue(globalKey, 6, inputs," + + " expensiveValueWithMoreGenericsAndContext);\n" + " }\n" + " return expensiveValueWithMoreGenericsAndContext;\n" + "}\n"); @@ -611,7 +654,8 @@ public void testGenerateInputsClassWithParam() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg1, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg1," + + " getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -622,8 +666,10 @@ public void testGenerateInputsClassWithParam() { + " if (other == null || !(other instanceof MoreExpensiveValueInputs)) {\n" + " return false;\n" + " }\n" - + " MoreExpensiveValueInputs cachedValueInputs = (MoreExpensiveValueInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " MoreExpensiveValueInputs cachedValueInputs = (MoreExpensiveValueInputs)" + + " other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" + " if (arg0 != cachedValueInputs.arg0) {\n" @@ -657,12 +703,16 @@ public void testGenerateGetterWithParam() { .toString(); assertThat(moreExpensiveValue) .isEqualTo( - "private java.lang.String getMoreExpensiveValue(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String getMoreExpensiveValue(com.facebook.litho.ComponentContext c)" + + " {\n" + " String globalKey = c.getGlobalKey();\n" - + " final MoreExpensiveValueInputs inputs = new MoreExpensiveValueInputs(globalKey,arg0,getStateContainerImpl(c).arg1);\n" - + " java.lang.String moreExpensiveValue = (java.lang.String) c.getCachedValue(globalKey, 2, inputs);\n" + + " final MoreExpensiveValueInputs inputs = new" + + " MoreExpensiveValueInputs(globalKey,arg0,getStateContainerImpl(c).arg1);\n" + + " java.lang.String moreExpensiveValue = (java.lang.String)" + + " c.getCachedValue(globalKey, 2, inputs);\n" + " if (moreExpensiveValue == null) {\n" - + " moreExpensiveValue = CachedValueTestSpec.onCreateMoreExpensiveValue(arg0,getStateContainerImpl(c).arg1);\n" + + " moreExpensiveValue =" + + " CachedValueTestSpec.onCreateMoreExpensiveValue(arg0,getStateContainerImpl(c).arg1);\n" + " c.putCachedValue(globalKey, 2, inputs, moreExpensiveValue);\n" + " }\n" + " return moreExpensiveValue;\n" @@ -695,7 +745,8 @@ public void testGenerateInputsClassWithParamAndContext() { + "\n" + " private final int arg1;\n" + "\n" - + " MoreExpensiveValueWithContextInputs(String globalKey, boolean arg0, int arg1) {\n" + + " MoreExpensiveValueWithContextInputs(String globalKey, boolean arg0, int arg1)" + + " {\n" + " this.globalKey = globalKey;\n" + " this.arg0 = arg0;\n" + " this.arg1 = arg1;\n" @@ -703,7 +754,8 @@ public void testGenerateInputsClassWithParamAndContext() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg1, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg1," + + " getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -711,11 +763,14 @@ public void testGenerateInputsClassWithParamAndContext() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof MoreExpensiveValueWithContextInputs)) {\n" + + " if (other == null || !(other instanceof" + + " MoreExpensiveValueWithContextInputs)) {\n" + " return false;\n" + " }\n" - + " MoreExpensiveValueWithContextInputs cachedValueInputs = (MoreExpensiveValueWithContextInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " MoreExpensiveValueWithContextInputs cachedValueInputs =" + + " (MoreExpensiveValueWithContextInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" + " if (arg0 != cachedValueInputs.arg0) {\n" @@ -749,12 +804,16 @@ public void testGenerateGetterWithParamAndContext() { .toString(); assertThat(moreExpensiveValueWithContext) .isEqualTo( - "private java.lang.String getMoreExpensiveValueWithContext(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String" + + " getMoreExpensiveValueWithContext(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final MoreExpensiveValueWithContextInputs inputs = new MoreExpensiveValueWithContextInputs(globalKey,arg0,getStateContainerImpl(c).arg1);\n" - + " java.lang.String moreExpensiveValueWithContext = (java.lang.String) c.getCachedValue(globalKey, 3, inputs);\n" + + " final MoreExpensiveValueWithContextInputs inputs = new" + + " MoreExpensiveValueWithContextInputs(globalKey,arg0,getStateContainerImpl(c).arg1);\n" + + " java.lang.String moreExpensiveValueWithContext = (java.lang.String)" + + " c.getCachedValue(globalKey, 3, inputs);\n" + " if (moreExpensiveValueWithContext == null) {\n" - + " moreExpensiveValueWithContext = CachedValueTestSpec.onCreateMoreExpensiveValueWithContext(arg0,getStateContainerImpl(c).arg1,c);\n" + + " moreExpensiveValueWithContext =" + + " CachedValueTestSpec.onCreateMoreExpensiveValueWithContext(arg0,getStateContainerImpl(c).arg1,c);\n" + " c.putCachedValue(globalKey, 3, inputs, moreExpensiveValueWithContext);\n" + " }\n" + " return moreExpensiveValueWithContext;\n" @@ -787,7 +846,8 @@ public void testGenerateInputsClassWithTreeProp() { + "\n" + " private final long arg6;\n" + "\n" - + " ExpensiveValueWithTreePropInputs(String globalKey, boolean arg0, long arg6) {\n" + + " ExpensiveValueWithTreePropInputs(String globalKey, boolean arg0, long arg6)" + + " {\n" + " this.globalKey = globalKey;\n" + " this.arg0 = arg0;\n" + " this.arg6 = arg6;\n" @@ -795,7 +855,8 @@ public void testGenerateInputsClassWithTreeProp() { + "\n" + " @java.lang.Override\n" + " public int hashCode() {\n" - + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg6, getClass());\n" + + " return com.facebook.litho.CommonUtils.hash(globalKey, arg0, arg6," + + " getClass());\n" + " }\n" + "\n" + " @java.lang.Override\n" @@ -803,11 +864,14 @@ public void testGenerateInputsClassWithTreeProp() { + " if (this == other) {\n" + " return true;\n" + " }\n" - + " if (other == null || !(other instanceof ExpensiveValueWithTreePropInputs)) {\n" + + " if (other == null || !(other instanceof ExpensiveValueWithTreePropInputs))" + + " {\n" + " return false;\n" + " }\n" - + " ExpensiveValueWithTreePropInputs cachedValueInputs = (ExpensiveValueWithTreePropInputs) other;\n" - + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey, cachedValueInputs.globalKey)) {\n" + + " ExpensiveValueWithTreePropInputs cachedValueInputs =" + + " (ExpensiveValueWithTreePropInputs) other;\n" + + " if (!com.facebook.rendercore.utils.EquivalenceUtils.equals(globalKey," + + " cachedValueInputs.globalKey)) {\n" + " return false;\n" + " }\n" + " if (arg0 != cachedValueInputs.arg0) {\n" @@ -841,12 +905,16 @@ public void testGenerateGetterWithTreeProp() { .toString(); assertThat(expensiveValueWithTreeProp) .isEqualTo( - "private java.lang.String getExpensiveValueWithTreeProp(com.facebook.litho.ComponentContext c) {\n" + "private java.lang.String" + + " getExpensiveValueWithTreeProp(com.facebook.litho.ComponentContext c) {\n" + " String globalKey = c.getGlobalKey();\n" - + " final ExpensiveValueWithTreePropInputs inputs = new ExpensiveValueWithTreePropInputs(globalKey,arg0,(c.getParentTreeProp(long.class)));\n" - + " java.lang.String expensiveValueWithTreeProp = (java.lang.String) c.getCachedValue(globalKey, 7, inputs);\n" + + " final ExpensiveValueWithTreePropInputs inputs = new" + + " ExpensiveValueWithTreePropInputs(globalKey,arg0,(c.getParentTreeProp(long.class)));\n" + + " java.lang.String expensiveValueWithTreeProp = (java.lang.String)" + + " c.getCachedValue(globalKey, 7, inputs);\n" + " if (expensiveValueWithTreeProp == null) {\n" - + " expensiveValueWithTreeProp = CachedValueTestSpec.onCreateExpensiveValueWithTreeProp(arg0,(c.getParentTreeProp(long.class)));\n" + + " expensiveValueWithTreeProp =" + + " CachedValueTestSpec.onCreateExpensiveValueWithTreeProp(arg0,(c.getParentTreeProp(long.class)));\n" + " c.putCachedValue(globalKey, 7, inputs, expensiveValueWithTreeProp);\n" + " }\n" + " return expensiveValueWithTreeProp;\n" diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueValidationTest.java index 9bcb9976f39..726a85f8739 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/CachedValueValidationTest.java @@ -62,7 +62,8 @@ public void testCachedValueWithNoCorrespondingCalculateMethod() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "The cached value must have a corresponding @OnCalculateCachedValue method that has the same name."); + "The cached value must have a corresponding @OnCalculateCachedValue method that has the" + + " same name."); } @Test @@ -96,7 +97,8 @@ public Class annotationType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "CachedValue param types and the return type of the corresponding @OnCalculateCachedValue method must be the same."); + "CachedValue param types and the return type of the corresponding" + + " @OnCalculateCachedValue method must be the same."); } @Test @@ -136,7 +138,8 @@ public Class annotationType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "CachedValue param types and the return type of the corresponding @OnCalculateCachedValue method must be the same."); + "CachedValue param types and the return type of the corresponding" + + " @OnCalculateCachedValue method must be the same."); } @Test @@ -261,7 +264,8 @@ public Class annotationType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Cached values must not be Components, since Components are stateful. Just create the Component as normal."); + "Cached values must not be Components, since Components are stateful. Just create the" + + " Component as normal."); } @Test @@ -302,7 +306,8 @@ public Class annotationType() { assertThat(validationErrors.get(0).element).isEqualTo(paramObject); assertThat(validationErrors.get(0).message) .isEqualTo( - "@OnCalculateCachedValue methods may only take ComponentContext, @Prop, @TreeProp, @InjectProp and @State as params."); + "@OnCalculateCachedValue methods may only take ComponentContext, @Prop, @TreeProp," + + " @InjectProp and @State as params."); } @Test diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/DelegateMethodValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/DelegateMethodValidationTest.java index a03ff7f1c5a..aa75c8c2d57 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/DelegateMethodValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/DelegateMethodValidationTest.java @@ -217,10 +217,10 @@ public void testDelegateMethodDoesNotDefinedParamsOfCorrectType() { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Argument at index 0 (someBool) is not a valid parameter, should be one of the following: " - + "@Prop T somePropName. @TreeProp T someTreePropName. @State T someStateName. " - + "@InjectProp T someInjectPropName. @CachedValue T value, where the cached value " - + "has a corresponding @OnCalculateCachedValue method. "); + "Argument at index 0 (someBool) is not a valid parameter, should be one of the" + + " following: @Prop T somePropName. @TreeProp T someTreePropName. @State T" + + " someStateName. @InjectProp T someInjectPropName. @CachedValue T value, where" + + " the cached value has a corresponding @OnCalculateCachedValue method. "); } @Test @@ -438,10 +438,10 @@ public void testInterStageInputMethodDoesNotExist() { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject3); assertThat(validationErrors.get(0).message) .isEqualTo( - "To use interface com.facebook.litho.annotations.FromPrepare on param interStageInput " - + "you must have a method annotated with interface " - + "com.facebook.litho.annotations.OnPrepare that has a param Output " - + "interStageInput"); + "To use interface com.facebook.litho.annotations.FromPrepare on param interStageInput" + + " you must have a method annotated with interface" + + " com.facebook.litho.annotations.OnPrepare that has a param" + + " Output interStageInput"); } @Test @@ -494,9 +494,9 @@ public void testInterStageInputOutputDoesNotExist() { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject3); assertThat(validationErrors.get(0).message) .isEqualTo( - "To use interface com.facebook.litho.annotations.FromPrepare on param interStageInput " - + "your method annotated with interface com.facebook.litho.annotations.OnPrepare must " - + "have a param Output interStageInput"); + "To use interface com.facebook.litho.annotations.FromPrepare on param interStageInput" + + " your method annotated with interface com.facebook.litho.annotations.OnPrepare" + + " must have a param Output interStageInput"); } @Test @@ -541,12 +541,12 @@ public void testDelegateMethodWithOptionalParameters() throws Exception { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject3); assertThat(validationErrors.get(0).message) .isEqualTo( - "Argument at index 2 (unmatched) is not a valid parameter, should be one of the following: " - + "@Prop T somePropName. @TreeProp T someTreePropName. @State T someStateName. " - + "@InjectProp T someInjectPropName. @CachedValue T value, where the cached value " - + "has a corresponding @OnCalculateCachedValue method. Or one of the following, " - + "where no annotations should be added to the parameter: java.lang.Integer " - + "matched. char unmatched. "); + "Argument at index 2 (unmatched) is not a valid parameter, should be one of the" + + " following: @Prop T somePropName. @TreeProp T someTreePropName. @State T" + + " someStateName. @InjectProp T someInjectPropName. @CachedValue T value, where" + + " the cached value has a corresponding @OnCalculateCachedValue method. Or one of" + + " the following, where no annotations should be added to the parameter:" + + " java.lang.Integer matched. char unmatched. "); } @Test @@ -591,12 +591,12 @@ public void testDelegateMethodWithUnmatchedStateValue() throws Exception { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject3); assertThat(validationErrors.get(0).message) .isEqualTo( - "Argument at index 1 (unmatched) is not a valid parameter, should be one of the following: " - + "@Prop T somePropName. @TreeProp T someTreePropName. " - + "StateValue stateName, where a state param with type T and name stateName is " - + "declared elsewhere in the spec. @InjectProp T someInjectPropName. Or one of the " - + "following, where no annotations should be added to the parameter: " - + "com.facebook.litho.StateValue unmatched. "); + "Argument at index 1 (unmatched) is not a valid parameter, should be one of the" + + " following: @Prop T somePropName. @TreeProp T someTreePropName. StateValue" + + " stateName, where a state param with type T and name stateName is declared" + + " elsewhere in the spec. @InjectProp T someInjectPropName. Or one of the" + + " following, where no annotations should be added to the parameter:" + + " com.facebook.litho.StateValue unmatched. "); } @Test @@ -642,12 +642,12 @@ public void testDelegateMethodWithUnmatchedStateValueKotlin() throws Exception { assertThat(validationErrors.get(0).element).isEqualTo(mMethodParamObject3); assertThat(validationErrors.get(0).message) .isEqualTo( - "Argument at index 1 (unmatched) is not a valid parameter, should be one of the following: " - + "@Prop T somePropName. @TreeProp T someTreePropName. " - + "StateValue stateName, where a state param with type T and name stateName is " - + "declared elsewhere in the spec. @InjectProp T someInjectPropName. Or one of the " - + "following, where no annotations should be added to the parameter: " - + "com.facebook.litho.StateValue unmatched. "); + "Argument at index 1 (unmatched) is not a valid parameter, should be one of the" + + " following: @Prop T somePropName. @TreeProp T someTreePropName. StateValue" + + " stateName, where a state param with type T and name stateName is declared" + + " elsewhere in the spec. @InjectProp T someInjectPropName. Or one of the" + + " following, where no annotations should be added to the parameter:" + + " com.facebook.litho.StateValue unmatched. "); } @Test diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/EventValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/EventValidationTest.java index df93d14e32d..61518d70679 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/EventValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/EventValidationTest.java @@ -264,7 +264,8 @@ public void testEventMethodsWithWrongParams() { assertThat(validationErrors.get(1).element).isEqualTo(mRepresentedObject3); assertThat(validationErrors.get(1).message) .isEqualTo( - "Param must be annotated with one of @FromEvent, @Prop, @InjectProp, @TreeProp, @CachedValue, @State or @Param."); + "Param must be annotated with one of @FromEvent, @Prop, @InjectProp, @TreeProp," + + " @CachedValue, @State or @Param."); } @Test @@ -371,7 +372,8 @@ public void testEventMethodsWithExtraAnnotationsLogsError() { assertThat(validationErrors.size()).isEqualTo(1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Param must be annotated with one of @FromEvent, @Prop, @InjectProp, @TreeProp, @CachedValue, @State, @Param, @TestAnnotation"); + "Param must be annotated with one of @FromEvent, @Prop, @InjectProp, @TreeProp," + + " @CachedValue, @State, @Param, @TestAnnotation"); } @Test diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/PropValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/PropValidationTest.java index bf0ff614c10..854534cce6e 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/PropValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/PropValidationTest.java @@ -80,9 +80,10 @@ public void testTwoPropsWithSameNameButDifferentType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "The prop sameName is defined differently in different methods. Ensure that each " - + "instance of this prop is declared in the same way (this means having the same type, " - + "resType and values for isOptional, isCommonProp and overrideCommonPropBehavior)."); + "The prop sameName is defined differently in different methods. Ensure that each" + + " instance of this prop is declared in the same way (this means having the same" + + " type, resType and values for isOptional, isCommonProp and" + + " overrideCommonPropBehavior)."); } @Test @@ -103,9 +104,10 @@ public void testTwoPropsWithSameNameButDifferentIsOptional() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "The prop sameName is defined differently in different methods. Ensure that each " - + "instance of this prop is declared in the same way (this means having the same type, " - + "resType and values for isOptional, isCommonProp and overrideCommonPropBehavior)."); + "The prop sameName is defined differently in different methods. Ensure that each" + + " instance of this prop is declared in the same way (this means having the same" + + " type, resType and values for isOptional, isCommonProp and" + + " overrideCommonPropBehavior)."); } @Test @@ -126,9 +128,10 @@ public void testTwoPropsWithSameNameButDifferentResType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "The prop sameName is defined differently in different methods. Ensure that each " - + "instance of this prop is declared in the same way (this means having the same type, " - + "resType and values for isOptional, isCommonProp and overrideCommonPropBehavior)."); + "The prop sameName is defined differently in different methods. Ensure that each" + + " instance of this prop is declared in the same way (this means having the same" + + " type, resType and values for isOptional, isCommonProp and" + + " overrideCommonPropBehavior)."); } @Test @@ -164,7 +167,8 @@ public void testPropMarkedCommonWithoutCommonName() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Prop with isCommonProp and name badName is incorrectly defined - see PropValidation.java for a list of common props that may be used."); + "Prop with isCommonProp and name badName is incorrectly defined - see" + + " PropValidation.java for a list of common props that may be used."); } @Test @@ -223,7 +227,8 @@ public void testPropWithReservedType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Props may not be declared with argument type: com.facebook.litho.Component.Builder or its inherited types."); + "Props may not be declared with argument type: com.facebook.litho.Component.Builder or" + + " its inherited types."); } @Test @@ -253,8 +258,9 @@ public void testPropInheritedFromReservedType() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject1); assertThat(validationErrors.get(0).message) .isEqualTo( - "Props may not be declared with argument type: com.facebook.litho.Component.Builder or its inherited types. " - + "com.facebook.litho.Text.Builder is an inherited type of com.facebook.litho.Component.Builder"); + "Props may not be declared with argument type: com.facebook.litho.Component.Builder or" + + " its inherited types. com.facebook.litho.Text.Builder is an inherited type of" + + " com.facebook.litho.Component.Builder"); } @Test diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/StateValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/StateValidationTest.java index 0cd7afcae51..c5526048dab 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/StateValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/StateValidationTest.java @@ -542,8 +542,9 @@ public void testStateWithCovariantDifferentReturnTypesForKotlinSpec() { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject2); assertThat(validationErrors.get(0).message) .isEqualTo( - "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and StateValue types."); + "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as" + + " CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and" + + " StateValue types."); } @Test @@ -576,8 +577,9 @@ public void testStateWithCovariantDifferentReturnTypesForKotlinSpecFirstStateNot assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject2); assertThat(validationErrors.get(0).message) .isEqualTo( - "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and StateValue types."); + "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as" + + " CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and" + + " StateValue types."); } @Test @@ -616,8 +618,9 @@ public void testStateWithCovariantDifferentReturnTypesTwoTypeARgumentsForKotlinS assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject2); assertThat(validationErrors.get(0).message) .isEqualTo( - "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and StateValue types."); + "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as" + + " CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and" + + " StateValue types."); } @Test @@ -650,8 +653,9 @@ public void testStateWithCovariantDifferentReturnTypesForKotlinSpecAndMismatchLa assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject2); assertThat(validationErrors.get(0).message) .isEqualTo( - "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and StateValue types."); + "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as" + + " CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and" + + " StateValue types."); assertThat(validationErrors.get(1).element).isEqualTo(mRepresentedObject2); assertThat(validationErrors.get(1).message) .isEqualTo( diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/TagValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/TagValidationTest.java index 20f6c907033..8bcaf325187 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/TagValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/TagValidationTest.java @@ -43,7 +43,8 @@ public void testNotEmpty() throws Exception { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject); assertThat(validationErrors.get(0).message) .isEqualTo( - "MyTestSpec: Spec classes use interfaces as component tags. Tags cannot be non-empty interfaces like 'java.lang.Object'."); + "MyTestSpec: Spec classes use interfaces as component tags. Tags cannot be non-empty" + + " interfaces like 'java.lang.Object'."); } @Test @@ -58,6 +59,7 @@ public void testExtendInterface() throws Exception { assertThat(validationErrors.get(0).element).isEqualTo(mRepresentedObject); assertThat(validationErrors.get(0).message) .isEqualTo( - "MyTestSpec: Spec classes use interfaces as component tags. Tags cannot extend other interfaces like 'java.lang.Object'."); + "MyTestSpec: Spec classes use interfaces as component tags. Tags cannot extend other" + + " interfaces like 'java.lang.Object'."); } } diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/model/WorkingRangeValidationTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/model/WorkingRangeValidationTest.java index a25de85c7c7..26a27fcd8a5 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/model/WorkingRangeValidationTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/model/WorkingRangeValidationTest.java @@ -156,10 +156,12 @@ public void testValidateDuplicateName() { assertThat(validationErrors.get(3).annotation).isEqualTo(mRepresentedObject8); assertThat(validationErrors.get(0).message) .isEqualTo( - "The name \"prefetch\" is duplicated, it's must be unique across @OnEnteredRange methods."); + "The name \"prefetch\" is duplicated, it's must be unique across @OnEnteredRange" + + " methods."); assertThat(validationErrors.get(1).message) .isEqualTo( - "The name \"prefetch\" is duplicated, it's must be unique across @OnEnteredRange methods."); + "The name \"prefetch\" is duplicated, it's must be unique across @OnEnteredRange" + + " methods."); assertThat(validationErrors.get(2).message) .isEqualTo( "The name \"purge\" is duplicated, it's must be unique across @OnExitedRange methods."); diff --git a/litho-it/src/test/java/com/facebook/litho/specmodels/processor/MountSpecModelFactoryTest.java b/litho-it/src/test/java/com/facebook/litho/specmodels/processor/MountSpecModelFactoryTest.java index f47dfb63c73..2038a14aeac 100644 --- a/litho-it/src/test/java/com/facebook/litho/specmodels/processor/MountSpecModelFactoryTest.java +++ b/litho-it/src/test/java/com/facebook/litho/specmodels/processor/MountSpecModelFactoryTest.java @@ -103,9 +103,11 @@ static class TestTriggerEvent { int integer; } - static class ColorDrawable {}; + static class ColorDrawable {} + ; - static class Context {}; + static class Context {} + ; @MountSpec( value = "TestMountComponentName", diff --git a/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderManualRangeTest.java b/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderManualRangeTest.java index 3a97063855a..58912321d48 100644 --- a/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderManualRangeTest.java +++ b/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderManualRangeTest.java @@ -184,7 +184,8 @@ public void testAddItemsAfterMeasure() { public void testCanMeasureIsUnsupported() { mExpectedException.expect(RuntimeException.class); mExpectedException.expectMessage( - "Cannot use manual estimated viewport count when the RecyclerBinder needs an item to determine its size!"); + "Cannot use manual estimated viewport count when the RecyclerBinder needs an item to" + + " determine its size!"); final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder() diff --git a/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderTest.java b/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderTest.java index 86c5fc074f8..44b98862a06 100644 --- a/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderTest.java +++ b/litho-it/src/test/java/com/facebook/litho/widget/RecyclerBinderTest.java @@ -5292,7 +5292,8 @@ public void testDoNotApplyReadyBatchesWhileRecyclerViewIsInScrollOrLayout() { public void testApplyReadyBatchesInfiniteLoop() { mExpectedException.expect(RuntimeException.class); mExpectedException.expectMessage( - "Too many retries -- RecyclerView is stuck in layout. Batch size: 1, isSubAdapter: false, isAttachedToWindow: false"); + "Too many retries -- RecyclerView is stuck in layout. Batch size: 1, isSubAdapter: false," + + " isAttachedToWindow: false"); ShadowLooper.pauseMainLooper(); @@ -5509,7 +5510,8 @@ public void binder_changeViewPort_onAttachedAndOnDetachedAreCalled() { } assertThat(steps) .describedAs( - "Should call @OnDetached for components not in visible range and call @OnAttached method for components in visible range") + "Should call @OnDetached for components not in visible range and call @OnAttached" + + " method for components in visible range") .isEqualTo(expectedSteps); } diff --git a/litho-it/src/test/java/com/facebook/litho/widget/TextSpecTest.java b/litho-it/src/test/java/com/facebook/litho/widget/TextSpecTest.java index 2af480f24ba..5a3d30467b0 100644 --- a/litho-it/src/test/java/com/facebook/litho/widget/TextSpecTest.java +++ b/litho-it/src/test/java/com/facebook/litho/widget/TextSpecTest.java @@ -59,7 +59,8 @@ public class TextSpecTest { private static final int FULL_TEXT_WIDTH = 100; private static final int MINIMAL_TEXT_WIDTH = 95; private static final String ARABIC_RTL_TEST_STRING = - "\u0645\u0646 \u0627\u0644\u064A\u0645\u064A\u0646 \u0627\u0644\u0649 \u0627\u0644\u064A\u0633\u0627\u0631"; + "\u0645\u0646 \u0627\u0644\u064A\u0645\u064A\u0646 \u0627\u0644\u0649" + + " \u0627\u0644\u064A\u0633\u0627\u0631"; @Rule public final LithoViewRule mLithoViewRule = new LithoViewRule(); diff --git a/litho-it/src/test/resources/processor/BasicTestSample.java b/litho-it/src/test/resources/processor/BasicTestSample.java index c9013efe4ad..b98a2b87367 100644 --- a/litho-it/src/test/resources/processor/BasicTestSample.java +++ b/litho-it/src/test/resources/processor/BasicTestSample.java @@ -169,7 +169,8 @@ public boolean matches(InspectableComponent value) { com.facebook.litho.processor.integration.resources.BasicLayout.class)) { as( new TextDescription( - "Sub-component of type \"com.facebook.litho.processor.integration.resources.BasicLayout\"")); + "Sub-component of type" + + " \"com.facebook.litho.processor.integration.resources.BasicLayout\"")); return false; } final com.facebook.litho.processor.integration.resources.BasicLayout impl = @@ -186,7 +187,8 @@ public boolean matches(InspectableComponent value) { if (mChildMatcher != null && !mChildMatcher.matches(propValueChild)) { as( new TextDescription( - "Sub-component of type with prop %s (doesn't match %s)", + "Sub-component of type with prop %s (doesn't match" + + " %s)", mChildMatcher, propValueChild)); return false; } @@ -195,7 +197,8 @@ public boolean matches(InspectableComponent value) { && !mMyDimenSizePropMatcher.matches(propValueMyDimenSizeProp)) { as( new TextDescription( - "Sub-component of type with prop %s (doesn't match %s)", + "Sub-component of type with prop %s" + + " (doesn't match %s)", mMyDimenSizePropMatcher, propValueMyDimenSizeProp)); return false; } @@ -204,7 +207,8 @@ public boolean matches(InspectableComponent value) { && !mMyRequiredColorPropMatcher.matches(propValueMyRequiredColorProp)) { as( new TextDescription( - "Sub-component of type with prop %s (doesn't match %s)", + "Sub-component of type with prop %s" + + " (doesn't match %s)", mMyRequiredColorPropMatcher, propValueMyRequiredColorProp)); return false; } @@ -213,7 +217,8 @@ public boolean matches(InspectableComponent value) { && !mMyStringPropMatcher.matches(propValueMyStringProp)) { as( new TextDescription( - "Sub-component of type with prop %s (doesn't match %s)", + "Sub-component of type with prop %s (doesn't" + + " match %s)", mMyStringPropMatcher, propValueMyStringProp)); return false; } diff --git a/litho-it/src/test/resources/processor/TestLayout.java b/litho-it/src/test/resources/processor/TestLayout.java index 625a637d33c..20161d5b448 100644 --- a/litho-it/src/test/resources/processor/TestLayout.java +++ b/litho-it/src/test/resources/processor/TestLayout.java @@ -367,7 +367,9 @@ public static void onClickEventTrigger(ComponentContext c, Handle handle, View v trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated public static void onClickEventTrigger(ComponentContext c, String key, View view) { int methodId = -1670292499; @@ -380,7 +382,9 @@ public static void onClickEventTrigger(ComponentContext c, String key, View view trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated public static void onClickEventTrigger(EventTrigger trigger, View view) { ClickEvent _eventState = new ClickEvent(); @@ -388,7 +392,9 @@ public static void onClickEventTrigger(EventTrigger trigger, View view) { trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated static void onClickEventTrigger(ComponentContext c, View view) { TestLayout component = (TestLayout) c.getComponentScope(); diff --git a/litho-it/src/test/resources/processor/TestMount.java b/litho-it/src/test/resources/processor/TestMount.java index b82abd87fa4..834fb8e5e3a 100644 --- a/litho-it/src/test/resources/processor/TestMount.java +++ b/litho-it/src/test/resources/processor/TestMount.java @@ -626,7 +626,9 @@ public static void onClickEventTrigger(ComponentContext c, Handle handle, View v trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated public static void onClickEventTrigger(ComponentContext c, String key, View view) { int methodId = -830639048; @@ -639,7 +641,9 @@ public static void onClickEventTrigger(ComponentContext c, String key, View view trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated public static void onClickEventTrigger(EventTrigger trigger, View view) { ClickEvent _eventState = new ClickEvent(); @@ -647,7 +651,9 @@ public static void onClickEventTrigger(EventTrigger trigger, View view) { trigger.dispatchOnTrigger(_eventState, new Object[] {}); } - /** @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. */ + /** + * @deprecated Use {@link #onClickEventTrigger(ComponentContext, Handle)} instead. + */ @Deprecated static void onClickEventTrigger(ComponentContext c, View view) { TestMount component = (TestMount) c.getComponentScope(); diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/EventGenerator.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/EventGenerator.java index 4dde2c3a7d5..f6fe71ed1ae 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/EventGenerator.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/EventGenerator.java @@ -329,7 +329,9 @@ static MethodSpec generateEventMethod( return methodSpec.build(); } - /** @return the name of the defined ComponentContext param on this event method. */ + /** + * @return the name of the defined ComponentContext param on this event method. + */ static String getContextParamName(SpecModel specModel, SpecMethodModel eventMethodModel) { for (int i = 0, size = eventMethodModel.methodParams.size(); i < size; i++) { final ImmutableList models = eventMethodModel.methodParams; diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/TriggerGenerator.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/TriggerGenerator.java index fefb0b96764..e8105022fd5 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/TriggerGenerator.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/generator/TriggerGenerator.java @@ -307,7 +307,8 @@ private static MethodSpec generateDeprecatedStaticGetTrigger( triggerMethod .addJavadoc( - "@deprecated Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use {@link #$L(ComponentContext, Handle)}.\n", + "@deprecated Do not use this method to get a EventTrigger to use later. Instead give" + + " the component a Handle and use {@link #$L(ComponentContext, Handle)}.\n", eventMethodModel.name.toString()) .addAnnotation(java.lang.Deprecated.class) .addParameter(contextClassName, "c") @@ -427,7 +428,9 @@ private static MethodSpec generateStaticTriggerMethod( .addAnnotation(java.lang.Deprecated.class); } else if (triggerLookup == TriggerLookup.HANDLE) { triggerMethod.addJavadoc( - "This will send the $L trigger to the component with the given handle.\nFor more information about using triggers, see https://fblitho.com/docs/trigger-events\n", + "This will send the $L trigger to the component with the given handle.\n" + + "For more information about using triggers, see" + + " https://fblitho.com/docs/trigger-events\n", eventMethodModel.name.toString()); } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/CachedValueValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/CachedValueValidation.java index 957dbb41ee6..9be1d2b921a 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/CachedValueValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/CachedValueValidation.java @@ -38,9 +38,9 @@ static List validate(SpecModel specModel) { cachedValues.get(i).getRepresentedObject(), "The cached value " + cachedValues.get(i).getName() - + " is defined differently in different " - + "methods. Ensure that each instance of this cached value is declared in the same " - + "way (this means having the same type).")); + + " is defined differently in different methods. Ensure that each instance of" + + " this cached value is declared in the same way (this means having the same" + + " type).")); } } } @@ -53,7 +53,8 @@ static List validate(SpecModel specModel) { validationErrors.add( new SpecModelValidationError( cachedValue.getRepresentedObject(), - "Cached values must not be Components, since Components are stateful. Just create the Component as normal.")); + "Cached values must not be Components, since Components are stateful. Just create" + + " the Component as normal.")); } final SpecMethodModel onCalculateCachedValueMethod = @@ -71,8 +72,9 @@ static List validate(SpecModel specModel) { final String errorMessage = SpecModelUtils.areTypesEqualIgnoringKotlinCovariance( specModel, cachedValue.getTypeName(), onCalculateCachedValueMethod.returnType) - ? "CachedValue params for collections in Kotlin Specs need to add @JvmSuppressWildCards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for @CachedValue params." + ? "CachedValue params for collections in Kotlin Specs need to add" + + " @JvmSuppressWildCards such as CollectionType<@JvmSuppressWildcards T>." + + " Add the annotation for @CachedValue params." : "CachedValue param types and the return type of the corresponding " + "@OnCalculateCachedValue method must be the same."; @@ -93,7 +95,8 @@ static List validate(SpecModel specModel) { validationErrors.add( new SpecModelValidationError( param.getRepresentedObject(), - "@OnCalculateCachedValue methods may only take ComponentContext, @Prop, @TreeProp, @InjectProp and @State as params.")); + "@OnCalculateCachedValue methods may only take ComponentContext, @Prop," + + " @TreeProp, @InjectProp and @State as params.")); } } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/DynamicPropsValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/DynamicPropsValidation.java index 628669b2134..37cee504b3c 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/DynamicPropsValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/DynamicPropsValidation.java @@ -54,7 +54,8 @@ static List validate(SpecModel specModel) { new SpecModelValidationError( specModel.getRepresentedObject(), specModel.getSpecName() - + " does not define @OnCreateMountContent method which is required for all @MountSpecs.")); + + " does not define @OnCreateMountContent method which is required for all" + + " @MountSpecs.")); return validationErrors; } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/InjectPropModel.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/InjectPropModel.java index eaacad44f08..2e02433ab41 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/InjectPropModel.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/InjectPropModel.java @@ -89,7 +89,9 @@ public String getName() { }; } - /** @return a new {@link PropModel} instance with the given name overridden. */ + /** + * @return a new {@link PropModel} instance with the given name overridden. + */ public InjectPropModel withName(String name) { return new InjectPropModel(mParamModel) { @Override diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/MethodParamModel.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/MethodParamModel.java index 89510b53267..6ef97d90203 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/MethodParamModel.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/MethodParamModel.java @@ -24,21 +24,33 @@ /** Model that is an abstract representation of a method param. */ public interface MethodParamModel { - /** @return the {@link TypeSpec} of the param. */ + /** + * @return the {@link TypeSpec} of the param. + */ TypeSpec getTypeSpec(); - /** @return the typeName of the param. */ + /** + * @return the typeName of the param. + */ TypeName getTypeName(); - /** @return the name of the param. */ + /** + * @return the name of the param. + */ String getName(); - /** @return all components library annotations that are on the param. */ + /** + * @return all components library annotations that are on the param. + */ List getAnnotations(); - /** @return all non-library annotations that are on the param. */ + /** + * @return all non-library annotations that are on the param. + */ List getExternalAnnotations(); - /** @return the object that this model represents. */ + /** + * @return the object that this model represents. + */ Object getRepresentedObject(); } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropModel.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropModel.java index 6104796b11c..0c18149055d 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropModel.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropModel.java @@ -132,7 +132,9 @@ public PropDefaultModel getDefault(ImmutableList propDefaults) return null; } - /** @return a new {@link PropModel} instance with the given name overridden. */ + /** + * @return a new {@link PropModel} instance with the given name overridden. + */ public PropModel withName(String name) { return new PropModel( mParamModel, diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropValidation.java index 67308241525..92aa1af1420 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/PropValidation.java @@ -327,9 +327,10 @@ static List validate( props.get(i).getRepresentedObject(), "The prop " + props.get(i).getName() - + " is defined differently in different " - + "methods. Ensure that each instance of this prop is declared in the same " - + "way (this means having the same type, resType and values for isOptional, isCommonProp and overrideCommonPropBehavior).")); + + " is defined differently in different methods. Ensure that each instance of" + + " this prop is declared in the same way (this means having the same type," + + " resType and values for isOptional, isCommonProp and" + + " overrideCommonPropBehavior).")); } } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SimpleNameDelegateValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SimpleNameDelegateValidation.java index 6fb669be111..00973e9a700 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SimpleNameDelegateValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SimpleNameDelegateValidation.java @@ -38,7 +38,8 @@ static List validate(LayoutSpecModel specModel) { validationErrors.add( new SpecModelValidationError( specModel.getRepresentedObject(), - "simpleNameDelegate on a LayoutSpec must be a prop name for an @Prop that is a Component. @Prop '" + "simpleNameDelegate on a LayoutSpec must be a prop name for an @Prop that is a" + + " Component. @Prop '" + delegate + "' has type " + prop.getTypeName())); @@ -52,7 +53,8 @@ static List validate(LayoutSpecModel specModel) { validationErrors.add( new SpecModelValidationError( specModel.getRepresentedObject(), - "simpleNameDelegate on a LayoutSpec must be a prop name for an @Prop that is a Component. Did not find a @Prop named '" + "simpleNameDelegate on a LayoutSpec must be a prop name for an @Prop that is a" + + " Component. Did not find a @Prop named '" + delegate + "'.")); } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModel.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModel.java index 8c702dd73e7..970e10ca5f5 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModel.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModel.java @@ -30,13 +30,19 @@ /** A model that represents a ComponentSpec. */ public interface SpecModel { - /** @return the name of the spec. */ + /** + * @return the name of the spec. + */ String getSpecName(); - /** @return the {@link TypeName} representing the name of the Spec. */ + /** + * @return the {@link TypeName} representing the name of the Spec. + */ ClassName getSpecTypeName(); - /** @return the name of the component that will be generated from this model. */ + /** + * @return the name of the component that will be generated from this model. + */ String getComponentName(); /** @@ -45,7 +51,9 @@ public interface SpecModel { */ TypeName getComponentTypeName(); - /** @return the list of fields defined in the spec. */ + /** + * @return the list of fields defined in the spec. + */ ImmutableList getFields(); /** @@ -54,19 +62,29 @@ public interface SpecModel { */ ImmutableList> getDelegateMethods(); - /** @return the list of event methods defined by the spec. */ + /** + * @return the list of event methods defined by the spec. + */ ImmutableList> getEventMethods(); - /** @return the list of trigger methods defined by the spec. */ + /** + * @return the list of trigger methods defined by the spec. + */ ImmutableList> getTriggerMethods(); - /** @return the working range register method defined by the spec. */ + /** + * @return the working range register method defined by the spec. + */ SpecMethodModel getWorkingRangeRegisterMethod(); - /** @return the list of working ranges methods defined by the spec. */ + /** + * @return the list of working ranges methods defined by the spec. + */ ImmutableList getWorkingRangeMethods(); - /** @return the list of methods defined in the spec for updating state. */ + /** + * @return the list of methods defined in the spec for updating state. + */ ImmutableList> getUpdateStateMethods(); /** @@ -79,64 +97,104 @@ public interface SpecModel { */ ImmutableList getRawProps(); - /** @return the set of props that are defined by the spec. */ + /** + * @return the set of props that are defined by the spec. + */ ImmutableList getProps(); - /** @return the list of injected props without name cache adjustments. */ + /** + * @return the list of injected props without name cache adjustments. + */ ImmutableList getRawInjectProps(); - /** @return the set of injected props that are defined by the spec. */ + /** + * @return the set of injected props that are defined by the spec. + */ ImmutableList getInjectProps(); - /** @return the set of prop defaults defined by the spec. */ + /** + * @return the set of prop defaults defined by the spec. + */ ImmutableList getPropDefaults(); - /** @return the type variables that are defined by the spec. */ + /** + * @return the type variables that are defined by the spec. + */ ImmutableList getTypeVariables(); - /** @return the set of state values that are defined by the spec. */ + /** + * @return the set of state values that are defined by the spec. + */ ImmutableList getStateValues(); - /** @return the set of cached values that are defined by the spec. */ + /** + * @return the set of cached values that are defined by the spec. + */ ImmutableList getCachedValues(); - /** @return the set of inter-stage inputs that are defined by the spec. */ + /** + * @return the set of inter-stage inputs that are defined by the spec. + */ ImmutableList getInterStageInputs(); - /** @return the set of inter-stage inputs that are defined by the spec. */ + /** + * @return the set of inter-stage inputs that are defined by the spec. + */ ImmutableList getPrepareInterStageInputs(); - /** @return the set of tree props that are defined by the spec. */ + /** + * @return the set of tree props that are defined by the spec. + */ ImmutableList getTreeProps(); - /** @return the set of events that are defined by the spec. */ + /** + * @return the set of events that are defined by the spec. + */ ImmutableList getEventDeclarations(); - /** @return the set of methods that are implicitly added to the builder. */ + /** + * @return the set of methods that are implicitly added to the builder. + */ ImmutableList getExtraBuilderMethods(); - /** @return the set of diff params used within lifecycle methods in the spec. */ + /** + * @return the set of diff params used within lifecycle methods in the spec. + */ ImmutableList getRenderDataDiffs(); - /** @return the set of annotations that should be added to the generated class. */ + /** + * @return the set of annotations that should be added to the generated class. + */ ImmutableList getClassAnnotations(); - /** @return the set of empty interface tags that should be implemented by the generated class */ + /** + * @return the set of empty interface tags that should be implemented by the generated class + */ ImmutableList getTags(); - /** @return the javadoc for this spec. */ + /** + * @return the javadoc for this spec. + */ String getClassJavadoc(); - /** @return the javadoc for the props defined by the spec. */ + /** + * @return the javadoc for the props defined by the spec. + */ ImmutableList getPropJavadocs(); - /** @return whether the generated class should be public or not. */ + /** + * @return whether the generated class should be public or not. + */ boolean isPublic(); - /** @return the {@link ClassName} of the context that is used in the generated class. */ + /** + * @return the {@link ClassName} of the context that is used in the generated class. + */ ClassName getContextClass(); - /** @return the {@link ClassName} of the component that is used in the generated class. */ + /** + * @return the {@link ClassName} of the component that is used in the generated class. + */ ClassName getComponentClass(); /** @@ -144,7 +202,9 @@ public interface SpecModel { */ ClassName getStateContainerClass(); - /** @return the {@link ClassName} of the transition that is used in the generated class. */ + /** + * @return the {@link ClassName} of the transition that is used in the generated class. + */ ClassName getTransitionClass(); /** @@ -153,28 +213,44 @@ public interface SpecModel { */ ClassName getTransitionContainerClass(); - /** @return the scope method name on the Context class. */ + /** + * @return the scope method name on the Context class. + */ String getScopeMethodName(); - /** @return true if the generated class supports styling, false otherwise. */ + /** + * @return true if the generated class supports styling, false otherwise. + */ boolean isStylingSupported(); - /** @return whether this spec uses dependency injection. */ + /** + * @return whether this spec uses dependency injection. + */ boolean hasInjectedDependencies(); - /** @return whether or not to check component id in isEquivalentTo() method. */ + /** + * @return whether or not to check component id in isEquivalentTo() method. + */ boolean shouldCheckIdInIsEquivalentToMethod(); - /** @return whether or not to deep copy this component. */ + /** + * @return whether or not to deep copy this component. + */ boolean hasDeepCopy(); - /** @return whether or not to generate a hasState method. */ + /** + * @return whether or not to generate a hasState method. + */ boolean shouldGenerateHasState(); - /** @return whether or not to generate a transferState method. */ + /** + * @return whether or not to generate a transferState method. + */ boolean shouldGenerateTransferState(); - /** @return whether or not this component is stateful. */ + /** + * @return whether or not this component is stateful. + */ boolean isStateful(); /** @@ -185,10 +261,14 @@ public interface SpecModel { @Nullable DependencyInjectionHelper getDependencyInjectionHelper(); - /** @return The source type this spec is generated from, e.g. class or singleton. */ + /** + * @return The source type this spec is generated from, e.g. class or singleton. + */ SpecElementType getSpecElementType(); - /** @return the element that this model represents. */ + /** + * @return the element that this model represents. + */ Object getRepresentedObject(); /** @@ -197,10 +277,14 @@ public interface SpecModel { */ List validate(EnumSet runMode); - /** @return a {@link TypeSpec} representing the class that is generated by this model. */ + /** + * @return a {@link TypeSpec} representing the class that is generated by this model. + */ TypeSpec generate(EnumSet runMode); - /** @return whether this spec requires deep copy and interstage copy methdods to be generated. */ + /** + * @return whether this spec requires deep copy and interstage copy methdods to be generated. + */ boolean shouldGenerateCopyMethod(); /** diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelImpl.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelImpl.java index 220d07f4984..b0f3d9b5f73 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelImpl.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelImpl.java @@ -280,7 +280,9 @@ public ImmutableList getProps() { return mProps; } - /** @return the list of injected props without name cache adjustments. */ + /** + * @return the list of injected props without name cache adjustments. + */ @Override public ImmutableList getRawInjectProps() { return mRawInjectProps; diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelUtils.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelUtils.java index 49bc0188d50..e75c6d15d71 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelUtils.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/SpecModelUtils.java @@ -215,7 +215,9 @@ public static boolean areTypesEqualIgnoringKotlinCovariance( return typeName1WithoutWildcards.box().equals(typeName2WithoutWildcards.box()); } - /** @return the model for state/prop that this Diff is refering to. */ + /** + * @return the model for state/prop that this Diff is refering to. + */ public static MethodParamModel getReferencedParamModelForDiff( SpecModel specModel, RenderDataDiffModel diffModel) { if (MethodParamModelUtils.isAnnotatedWith(diffModel, Prop.class)) { diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/StateValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/StateValidation.java index 1ef7e5bdcf7..e7a46507051 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/StateValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/StateValidation.java @@ -59,8 +59,9 @@ static List validateStateValues(SpecModel specModel) { final String errorMessage = SpecModelUtils.areTypesEqualIgnoringKotlinCovariance( specModel, thisStateValue.getTypeName(), thatStateValue.getTypeName()) - ? "State values for collections in Kotlin specs need to add @JvmSuppressWildcards such as " - + "CollectionType<@JvmSuppressWildcards T>. Add the annotation for both @State and StateValue types." + ? "State values for collections in Kotlin specs need to add" + + " @JvmSuppressWildcards such as CollectionType<@JvmSuppressWildcards" + + " T>. Add the annotation for both @State and StateValue types." : "State values with the same name must have the same type."; validationErrors.add( @@ -235,7 +236,8 @@ private static void validateInterStagePropsDuplicateName( model.getRepresentedObject(), "The parameter with name " + model.getName() - + " annotated with @State is colliding with another inter-stage prop param with the same name.")); + + " annotated with @State is colliding with another inter-stage prop param with" + + " the same name.")); } } } @@ -252,7 +254,8 @@ private static void validatePrepareInterStagePropsDuplicateName( model.getRepresentedObject(), "The parameter with name " + model.getName() - + " annotated with @State is colliding with another inter-stage prop param with the same name.")); + + " annotated with @State is colliding with another inter-stage prop param with" + + " the same name.")); } } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/TagValidation.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/TagValidation.java index 082c2973924..c1b8b636de7 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/model/TagValidation.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/model/TagValidation.java @@ -24,11 +24,13 @@ public class TagValidation { @VisibleForTesting static final String NON_EMPTY_ERROR_MESSAGE = - "%s: Spec classes use interfaces as component tags. Tags cannot be non-empty interfaces like '%s'."; + "%s: Spec classes use interfaces as component tags. Tags cannot be non-empty interfaces like" + + " '%s'."; @VisibleForTesting static final String EXTEND_INTERFACE_ERROR_MESSAGE = - "%s: Spec classes use interfaces as component tags. Tags cannot extend other interfaces like '%s'."; + "%s: Spec classes use interfaces as component tags. Tags cannot extend other interfaces like" + + " '%s'."; static List validate(SpecModel specModel) { final List validationErrors = new ArrayList<>(); diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MethodExtractorUtils.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MethodExtractorUtils.java index ea131f6b8ff..e043b98b982 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MethodExtractorUtils.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MethodExtractorUtils.java @@ -43,7 +43,9 @@ public final class MethodExtractorUtils { private MethodExtractorUtils() {} - /** @return a list of params for a method. */ + /** + * @return a list of params for a method. + */ static List getMethodParams( ExecutableElement method, Messager messager, @@ -89,7 +91,8 @@ static List getMethodParams( throw new ComponentsProcessingException( param, String.format( - "Error processing the param '%s'. Are your imports set up correctly? The causing error was: %s", + "Error processing the param '%s'. Are your imports set up correctly? The causing" + + " error was: %s", param, e)); } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MountSpecModelFactory.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MountSpecModelFactory.java index e31c055e95d..de2415be1a3 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MountSpecModelFactory.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/MountSpecModelFactory.java @@ -217,7 +217,8 @@ private static TypeName getMountType( throw new ComponentsProcessingException( "Mount type cannot be correctly inferred from the name of " + element - + ". Please specify `@OnCreateMountContent(mountingType = MountingType.VIEW)`."); + + ". Please specify `@OnCreateMountContent(mountingType =" + + " MountingType.VIEW)`."); } else { return ClassNames.COMPONENT_MOUNT_TYPE_VIEW; } @@ -228,7 +229,8 @@ private static TypeName getMountType( throw new ComponentsProcessingException( "Mount type cannot be correctly inferred from the name of " + element - + ". Please specify `@OnCreateMountContent(mountingType = MountingType.DRAWABLE)`."); + + ". Please specify `@OnCreateMountContent(mountingType =" + + " MountingType.DRAWABLE)`."); } } @@ -238,7 +240,8 @@ private static TypeName getMountType( throw new ComponentsProcessingException( "Failed to get mount type for " + element - + ". Try specifying `@OnCreateMountContent(mountingType = MountingType.VIEW)` (or DRAWABLE)."); + + ". Try specifying `@OnCreateMountContent(mountingType = MountingType.VIEW)`" + + " (or DRAWABLE)."); } } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/ProcessorUtils.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/ProcessorUtils.java index cecf0bff4a2..b904cd00c46 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/ProcessorUtils.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/ProcessorUtils.java @@ -73,7 +73,8 @@ public class ProcessorUtils { element, mirror, String.format( - "Error processing the annotation '%s'. Are your imports set up correctly? The causing error was: %s", + "Error processing the annotation '%s'. Are your imports set up correctly? The" + + " causing error was: %s", annotationType.getCanonicalName(), e)); } } diff --git a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/testing/TestSpecModelFactory.java b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/testing/TestSpecModelFactory.java index f3beda4bda6..7dcd650b908 100644 --- a/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/testing/TestSpecModelFactory.java +++ b/litho-processor/src/main/java/com/facebook/litho/specmodels/processor/testing/TestSpecModelFactory.java @@ -167,7 +167,9 @@ private void validateElementIsInterface(TypeElement element) { } } - /** @return List of props for the original, annotated Spec. */ + /** + * @return List of props for the original, annotated Spec. + */ @Nullable private static SpecModel getEnclosedSpecModel( Elements elements, diff --git a/litho-processor/src/test/java/com/facebook/litho/specmodels/processor/MethodExtractorUtilsTestHelper.java b/litho-processor/src/test/java/com/facebook/litho/specmodels/processor/MethodExtractorUtilsTestHelper.java index 087b75b6e92..c17b1477860 100644 --- a/litho-processor/src/test/java/com/facebook/litho/specmodels/processor/MethodExtractorUtilsTestHelper.java +++ b/litho-processor/src/test/java/com/facebook/litho/specmodels/processor/MethodExtractorUtilsTestHelper.java @@ -23,7 +23,8 @@ import java.util.List; public final class MethodExtractorUtilsTestHelper { - private MethodExtractorUtilsTestHelper() {}; + private MethodExtractorUtilsTestHelper() {} + ; public static void assertOnDetachedHasNoParams(List onDetachedMethodParams) { assertThat(onDetachedMethodParams).isEmpty(); diff --git a/litho-rendercore-testing/src/main/java/com/facebook/rendercore/testing/RendercoreTestDriver.java b/litho-rendercore-testing/src/main/java/com/facebook/rendercore/testing/RendercoreTestDriver.java index a297995de3a..cd2969aa91c 100644 --- a/litho-rendercore-testing/src/main/java/com/facebook/rendercore/testing/RendercoreTestDriver.java +++ b/litho-rendercore-testing/src/main/java/com/facebook/rendercore/testing/RendercoreTestDriver.java @@ -128,7 +128,8 @@ public RenderBuilderPart layoutWithBounds(int widthPx, int heightPx) { public void render() { if (mRootHost == null) { throw new IllegalArgumentException( - "RootHost is null. If you're using RenderTreeHost, call renderWithRenderTree() instead."); + "RootHost is null. If you're using RenderTreeHost, call renderWithRenderTree()" + + " instead."); } View rootHostAsView = (View) mRootHost; diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/Transition.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/Transition.java index cbf06aab37f..27d874223b3 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/Transition.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/Transition.java @@ -680,7 +680,9 @@ static float getRootAppearFromValue( .resolve(resolver, new PropertyHandle(rootTransitionId, property)); } - /** @return {@code true} iff a and b are equal. */ + /** + * @return {@code true} iff a and b are equal. + */ static boolean equals(@Nullable Object a, @Nullable Object b) { if (a == b) { return true; diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/TransitionsExtension.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/TransitionsExtension.java index 4667d988a83..2b08e169aac 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/TransitionsExtension.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/TransitionsExtension.java @@ -445,7 +445,9 @@ private static void regenerateAnimationLockedIndices( } } - /** @return whether we should animate transitions. */ + /** + * @return whether we should animate transitions. + */ private static boolean shouldAnimateTransitions( final TransitionsExtensionState state, TransitionsExtensionInput input) { return input != null @@ -454,7 +456,9 @@ private static boolean shouldAnimateTransitions( || state.mInput.needsToRerunTransitions()); } - /** @return whether we have any transitions to animate for the current mount */ + /** + * @return whether we have any transitions to animate for the current mount + */ private static boolean hasTransitionsToAnimate(final TransitionsExtensionState state) { return state.mRootTransition != null; } diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/WorkContinuationInstrumenter.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/WorkContinuationInstrumenter.java index 73305663ae6..c41a62e1d87 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/WorkContinuationInstrumenter.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/WorkContinuationInstrumenter.java @@ -43,6 +43,7 @@ public interface Instrumenter { */ @Nullable Object onAskForWorkToContinue(String tag); + /** * Tracks when some work is ready to offered for continuation. * diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperties.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperties.java index d3232d7e37f..c5158528db5 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperties.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperties.java @@ -218,7 +218,8 @@ public void reset(Object mountContent) { // No-op: x/y are always properly set for Drawables } } - }; + } + ; private static class WidthAnimatedProperty implements AnimatedProperty { @Override diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperty.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperty.java index 04dd1e500fa..3667d5a33d0 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperty.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimatedProperty.java @@ -27,10 +27,14 @@ public interface AnimatedProperty { */ String getName(); - /** @return the current value of this property on the given mount content (View or Drawable). */ + /** + * @return the current value of this property on the given mount content (View or Drawable). + */ float get(Object mountContent); - /** @return the current value of this property on the given {@link AnimatableItem}. */ + /** + * @return the current value of this property on the given {@link AnimatableItem}. + */ float get(AnimatableItem animatableItem); /** Updates the value of this property on the given mount content to the given value. */ diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimationBinding.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimationBinding.java index 3b6e5364051..bb286cb9909 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimationBinding.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/AnimationBinding.java @@ -42,7 +42,9 @@ public interface AnimationBinding { /** Stops this animation. */ void stop(); - /** @return whether this animation is running */ + /** + * @return whether this animation is running + */ boolean isActive(); /** diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/DimensionValue.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/DimensionValue.java index 84e5f23aa9a..87a5761f7e5 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/DimensionValue.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/DimensionValue.java @@ -22,7 +22,9 @@ /** A {@link RuntimeValue} for dimension properties like x/y/width/height. */ public class DimensionValue implements RuntimeValue { - /** @return a RuntimeValue that resolves to an absolute value. */ + /** + * @return a RuntimeValue that resolves to an absolute value. + */ public static DimensionValue absolute(float value) { return new DimensionValue(Type.ABSOLUTE, value); } diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/Resolver.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/Resolver.java index 15ce9bd0e4b..933dac1107a 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/Resolver.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/Resolver.java @@ -25,7 +25,9 @@ */ public interface Resolver { - /** @return the current value of this property before the next mount state is applied. */ + /** + * @return the current value of this property before the next mount state is applied. + */ float getCurrentState(PropertyHandle propertyHandle); /** diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/TransitionAnimationBinding.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/TransitionAnimationBinding.java index 39357743ba2..2ba818f6173 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/TransitionAnimationBinding.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/animation/TransitionAnimationBinding.java @@ -46,12 +46,16 @@ public void onAllNodesFinished(GraphBinding binding) { }); } - /** @see GraphBinding#addBinding(ValueNode, ValueNode, String) */ + /** + * @see GraphBinding#addBinding(ValueNode, ValueNode, String) + */ public void addBinding(ValueNode fromNode, ValueNode toNode, String inputName) { mGraphBinding.addBinding(fromNode, toNode, inputName); } - /** @see GraphBinding#addBinding(ValueNode, ValueNode) */ + /** + * @see GraphBinding#addBinding(ValueNode, ValueNode) + */ public void addBinding(ValueNode fromNode, ValueNode toNode) { mGraphBinding.addBinding(fromNode, toNode); } diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/DataFlowBinding.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/DataFlowBinding.java index 1ec0210915c..45cfa5d7f00 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/DataFlowBinding.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/DataFlowBinding.java @@ -42,7 +42,9 @@ public interface DataFlowBinding { */ void deactivate(); - /** @return whether this binding has been activated and not yet deactivated. */ + /** + * @return whether this binding has been activated and not yet deactivated. + */ boolean isActive(); /** Sets the {@link BindingListener}. */ diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/GraphBinding.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/GraphBinding.java index 772b3e52a07..436c6cb7736 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/GraphBinding.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/GraphBinding.java @@ -68,7 +68,9 @@ public void addBinding(ValueNode fromNode, ValueNode toNode) { addBinding(fromNode, toNode, ValueNode.DEFAULT_INPUT); } - /** @return all nodes that have a binding defined in this {@link GraphBinding}. */ + /** + * @return all nodes that have a binding defined in this {@link GraphBinding}. + */ ArrayList getAllNodes() { return mAllNodes; } @@ -102,7 +104,9 @@ public void deactivate() { mBindings.removeBindings(); } - /** @return whether this binding has been activated and not yet deactivated. */ + /** + * @return whether this binding has been activated and not yet deactivated. + */ public boolean isActive() { return mIsActive; } diff --git a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/ValueNode.java b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/ValueNode.java index b0b0c3db445..829c3ebe951 100644 --- a/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/ValueNode.java +++ b/litho-rendercore-transitions/src/main/java/com/facebook/litho/dataflow/ValueNode.java @@ -47,7 +47,9 @@ public abstract class ValueNode { private float mValue; private long mTimeNs = 0; - /** @return the most recently calculated value from {@link #calculateValue}. */ + /** + * @return the most recently calculated value from {@link #calculateValue}. + */ public float getValue() { return mValue; } @@ -64,7 +66,9 @@ public void setValue(float value) { */ protected abstract float calculateValue(long frameTimeNanos); - /** @return the input node for the given input name */ + /** + * @return the input node for the given input name + */ protected ValueNode getInput(String name) { final ValueNode input = getInputUnsafe(name); if (input == null) { @@ -87,7 +91,9 @@ protected ValueNode getInput() { return getInput(DEFAULT_INPUT); } - /** @return whether this node has an input with the given name */ + /** + * @return whether this node has an input with the given name + */ protected boolean hasInput(String name) { if (mInputs == null) { return false; diff --git a/litho-rendercore-visibility/src/main/java/com/facebook/litho/VisibilityChangedEvent.java b/litho-rendercore-visibility/src/main/java/com/facebook/litho/VisibilityChangedEvent.java index 3e8862aed62..94f040e0f5b 100644 --- a/litho-rendercore-visibility/src/main/java/com/facebook/litho/VisibilityChangedEvent.java +++ b/litho-rendercore-visibility/src/main/java/com/facebook/litho/VisibilityChangedEvent.java @@ -36,13 +36,16 @@ public class VisibilityChangedEvent { public int visibleHeight; public int visibleWidth; + /** Between 0 and 100, indicates percentage of item width that is visible on screen. */ public float percentVisibleWidth; + /** Between 0 and 100, indicates percentage of item height that is visible on screen. */ public float percentVisibleHeight; /** Indicates the height of the RootHost view, if applicable. */ public int rootHostViewHeight; + /** Indicates the width of the RootHost view, if applicable. */ public int rootHostViewWidth; } diff --git a/litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityMountExtension.java b/litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityMountExtension.java index e82402913ca..ab19126aaac 100644 --- a/litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityMountExtension.java +++ b/litho-rendercore-visibility/src/main/java/com/facebook/rendercore/visibility/VisibilityMountExtension.java @@ -168,7 +168,9 @@ public static void clearVisibilityItems( state.mPreviousLocalVisibleRect.setEmpty(); } - /** @deprecated Only used for Litho's integration. Marked for removal. */ + /** + * @deprecated Only used for Litho's integration. Marked for removal. + */ @Deprecated public static void setRootHost( ExtensionState extensionState, Host root) { @@ -650,7 +652,9 @@ public static class VisibilityMountExtensionState { private @Nullable VisibilityBoundsTransformer mVisibilityBoundsTransformer; private @Nullable VisibilityExtensionInput mInput; - /** @deprecated Only used for Litho's integration. Marked for removal. */ + /** + * @deprecated Only used for Litho's integration. Marked for removal. + */ @Deprecated private @Nullable Host mRootHost; private VisibilityMountExtensionState() {} diff --git a/litho-rendercore-yoga/src/main/java/com/facebook/rendercore/Edges.java b/litho-rendercore-yoga/src/main/java/com/facebook/rendercore/Edges.java index 80feced43c0..99ac1abaf22 100644 --- a/litho-rendercore-yoga/src/main/java/com/facebook/rendercore/Edges.java +++ b/litho-rendercore-yoga/src/main/java/com/facebook/rendercore/Edges.java @@ -135,7 +135,9 @@ public float getRaw(YogaEdge edge) { return mValues[edgeIndex]; } - /** @param edgeEnumValue This method can directly accept the YogaEdge.XXX.intValue(). */ + /** + * @param edgeEnumValue This method can directly accept the YogaEdge.XXX.intValue(). + */ // This duplicates the other getRaw instead of calling each other to save on method calls. public float getRaw(int edgeEnumValue) { final byte edgeIndex = getIndex(edgeEnumValue); diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/Change.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/Change.java index 3468da83613..7e98357d93c 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/Change.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/Change.java @@ -209,13 +209,17 @@ static Change move(int fromIndex, int toIndex, @Nullable Object data) { return acquireMoveChange(fromIndex, toIndex, data); } - /** @return the type of this Change. */ + /** + * @return the type of this Change. + */ @Type public int getType() { return mType; } - /** @return the index at which this change will be applied. */ + /** + * @return the index at which this change will be applied. + */ public int getIndex() { return mIndex; } @@ -227,7 +231,9 @@ public int getToIndex() { return mToIndex; } - /** @return the number of changes to be made. This is only valid if type is *_RANGE. */ + /** + * @return the number of changes to be made. This is only valid if type is *_RANGE. + */ public int getCount() { return mCount; } diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSet.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSet.java index c28006422e4..8098f213ad8 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSet.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSet.java @@ -57,12 +57,16 @@ private ChangeSet() { mChanges = new ArrayList<>(); } - /** @return the {@link Change} at index. */ + /** + * @return the {@link Change} at index. + */ public Change getChangeAt(int index) { return mChanges.get(index); } - /** @return the number of {@link Change}s in this ChangeSet. */ + /** + * @return the number of {@link Change}s in this ChangeSet. + */ public int getChangeCount() { return mChanges.size(); } @@ -236,13 +240,17 @@ public ChangeSetStats getChangeSetStats() { return mChangeSetStats; } - /** @return an empty ChangeSet. */ + /** + * @return an empty ChangeSet. + */ @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public static ChangeSet acquireChangeSet(@Nullable Section section, boolean enableStats) { return acquireChangeSet(0, section, enableStats); } - /** @return an empty ChangeSet starting from count startCount. */ + /** + * @return an empty ChangeSet starting from count startCount. + */ static ChangeSet acquireChangeSet( int startCount, @Nullable Section section, boolean enableStats) { final ChangeSet changeSet = new ChangeSet(); diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetCalculationState.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetCalculationState.java index 04159bf9122..ba646b4a09f 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetCalculationState.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetCalculationState.java @@ -31,7 +31,9 @@ public class ChangeSetCalculationState { private @Nullable State mState = new State(); - /** @return whether the associated changeset calculation is still in progress. */ + /** + * @return whether the associated changeset calculation is still in progress. + */ boolean isActive() { return mState != null; } diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetState.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetState.java index 8b32a7c1828..db3507ad0f2 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetState.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangeSetState.java @@ -481,13 +481,17 @@ ChangeSet getChangeSet() { return mChangeSet; } - /** @return the {@link Section} that was used as current root for this ChangeSet computation. */ + /** + * @return the {@link Section} that was used as current root for this ChangeSet computation. + */ @Nullable Section getCurrentRoot() { return mCurrentRoot; } - /** @return the {@link Section} that was used as new root for this ChangeSet computation. */ + /** + * @return the {@link Section} that was used as new root for this ChangeSet computation. + */ @Nullable Section getNewRoot() { return mNewRoot; diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesInfo.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesInfo.java index f31dff4d387..4ea681038b8 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesInfo.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesInfo.java @@ -33,7 +33,9 @@ public ChangesInfo(List changes) { mChanges = Collections.unmodifiableList(changes); } - /** @return a list of change in the visible range. */ + /** + * @return a list of change in the visible range. + */ public List getVisibleChanges( int firstVisibleIndex, int lastVisibleIndex, int globalOffset) { int globalFirstVisibleIndex = globalOffset + (firstVisibleIndex >= 0 ? firstVisibleIndex : 0); diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesetDebugConfiguration.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesetDebugConfiguration.java index 22dd641da94..3d3feebaa6f 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesetDebugConfiguration.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/ChangesetDebugConfiguration.java @@ -109,7 +109,9 @@ public static void setListener(ChangesetDebugListener listener) { return sListener; } - /** @return a list with the names of the RenderInfos for this change. */ + /** + * @return a list with the names of the RenderInfos for this change. + */ public static List getRenderInfoNames(Change change) { final List names = new ArrayList<>(); final List renderInfos = change.getRenderInfos(); diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/FocusDispatcher.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/FocusDispatcher.java index ea556766bca..1bcb96c7691 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/FocusDispatcher.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/FocusDispatcher.java @@ -125,7 +125,9 @@ void waitForDataBound(boolean waitForDataBound) { mWaitForDataBound = waitForDataBound; } - /** @return true if the data fetching has been completed. */ + /** + * @return true if the data fetching has been completed. + */ @UiThread boolean isLoadingCompleted() { return mLoadingState == null diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/Section.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/Section.java index fadc2cc9ea2..f04528cf163 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/Section.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/Section.java @@ -127,7 +127,9 @@ public T shouldCompareCommonProps(boolean shouldCompareCommonProps) { public abstract T getThis(); - /** @return The immutable {@link Section}. */ + /** + * @return The immutable {@link Section}. + */ public abstract Section build(); /** @@ -164,7 +166,9 @@ protected static void checkArgs( @Nullable private Handle mHandle; @Nullable private boolean mShouldCompareCommonProps; - /** @return a unique key for this {@link Section} within its tree. */ + /** + * @return a unique key for this {@link Section} within its tree. + */ @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public String getGlobalKey() { return mGlobalKey; @@ -176,7 +180,9 @@ public void setGlobalKey(String key) { mGlobalKey = key; } - /** @return get the {@link Handle} associated with this section. */ + /** + * @return get the {@link Handle} associated with this section. + */ @Nullable Handle getHandle() { return mHandle; @@ -227,14 +233,18 @@ public void setCount(int count) { mCount = count; } - /** @return the direct children of this {@link Section}. */ + /** + * @return the direct children of this {@link Section}. + */ @Nullable @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public List
getChildren() { return mChildren; } - /** @return the parent of this {@link Section} in the tree. */ + /** + * @return the parent of this {@link Section} in the tree. + */ @Nullable public Section getParent() { return mParent; @@ -261,7 +271,9 @@ private static void invalidateInternal(Section section) { } } - /** @return true if this Section or any of its children were invalidated. */ + /** + * @return true if this Section or any of its children were invalidated. + */ boolean isInvalidated() { return mInvalidated; } diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionLifecycle.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionLifecycle.java index ddf8a0a81e8..a2f5dd79ff2 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionLifecycle.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionLifecycle.java @@ -43,6 +43,7 @@ public abstract class SectionLifecycle implements EventDispatcher, EventTriggerTarget { static final String WRONG_CONTEXT_FOR_EVENT_HANDLER = "SectionLifecycle:WrongContextForEventHandler"; + /** * This methods will delegate to the {@link GroupSectionSpec} method annotated with {@link * com.facebook.litho.sections.annotations.OnCreateChildren} diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionTree.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionTree.java index 20cbb66ff94..e5ef9ec4fa3 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionTree.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/SectionTree.java @@ -148,7 +148,9 @@ void notifyChangeSetComplete( /** Request focus on the item with the given id, plus some additional offset. */ void requestFocusWithOffset(Object id, int offset); - /** @return whether this target supports applying change sets from a background thread. */ + /** + * @return whether this target supports applying change sets from a background thread. + */ boolean supportsBackgroundChangeSets(); /** Notify this target that a new set of configurations is applied. */ @@ -166,7 +168,10 @@ public DynamicConfig(@CommitPolicy int changeSetsCommitPolicy) { private static final String EMPTY_STRING = ""; private static final String INDEX_OUT_OF_BOUNDS_DEBUG_MESSAGE = - "Index out of bounds while applying a new section. This indicates a bad diff was sent to the RecyclerBinder. See https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception for more information. Debug info: "; + "Index out of bounds while applying a new section. This indicates a bad diff was sent to the" + + " RecyclerBinder. See" + + " https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception" + + " for more information. Debug info: "; @GuardedBy("SectionTree.class") private static volatile Looper sDefaultChangeSetThreadLooper; @@ -1109,7 +1114,8 @@ private void logStateUpdateWhenChangeSetInProgress() { ComponentsReporter.emitMessage( ComponentsReporter.LogLevel.FATAL, STATE_UPDATES_IN_LOOP_EXCEED_THRESHOLD, - "Large number of state updates detected which indicates an infinite loop leading to unresponsive apps"); + "Large number of state updates detected which indicates an infinite loop leading to" + + " unresponsive apps"); } } @@ -2009,7 +2015,9 @@ public Builder postToFrontOfQueueForFirstChangeset( return this; } - /** @return the {@link SectionTree}. */ + /** + * @return the {@link SectionTree}. + */ public SectionTree build() { return new SectionTree(this); } diff --git a/litho-sections-core/src/main/java/com/facebook/litho/sections/common/DataDiffSectionSpec.java b/litho-sections-core/src/main/java/com/facebook/litho/sections/common/DataDiffSectionSpec.java index 2ee530eb618..d13839b5b88 100644 --- a/litho-sections-core/src/main/java/com/facebook/litho/sections/common/DataDiffSectionSpec.java +++ b/litho-sections-core/src/main/java/com/facebook/litho/sections/common/DataDiffSectionSpec.java @@ -113,7 +113,8 @@ public class DataDiffSectionSpec { public static final String DUPLICATES_EXIST_MSG = - "Detected duplicates in data passed to DataDiffSection. Read more here: https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception"; + "Detected duplicates in data passed to DataDiffSection. Read more here:" + + " https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception"; public static final String RENDER_INFO_RETURNS_NULL_MSG = "RenderInfo has returned null. Returning ComponentRenderInfo.createEmpty() as default."; diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/LithoStatsRule.java b/litho-testing/src/main/java/com/facebook/litho/testing/LithoStatsRule.java index 1aaa1faa6e9..ed324831e22 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/LithoStatsRule.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/LithoStatsRule.java @@ -82,7 +82,9 @@ public long getComponentCalculateLayoutOnUICount() { return LithoStats.getComponentCalculateLayoutOnUICount(); } - /** @return the global count of all mount operations that have happened in the process. */ + /** + * @return the global count of all mount operations that have happened in the process. + */ public long getComponentMountCount() { return LithoStats.getComponentMountCount(); } diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/TestComponent.java b/litho-testing/src/main/java/com/facebook/litho/testing/TestComponent.java index c51b2eca2e3..29419c77748 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/TestComponent.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/TestComponent.java @@ -90,37 +90,51 @@ synchronized void onDetachedCalled() { mOnDetachedCalled = true; } - /** @return Whether onMount has been called. */ + /** + * @return Whether onMount has been called. + */ public boolean wasOnMountCalled() { return mOnMountCalled; } - /** @return Whether the component is currently mounted. */ + /** + * @return Whether the component is currently mounted. + */ public boolean isMounted() { return mMounted; } - /** @return Whether onUnmount has been called. */ + /** + * @return Whether onUnmount has been called. + */ public boolean wasOnUnmountCalled() { return mOnUnmountCalled; } - /** @return Whether onBoundsDefined has been called. */ + /** + * @return Whether onBoundsDefined has been called. + */ public boolean wasOnBoundsDefinedCalled() { return mOnBoundsDefinedCalled; } - /** @return Whether onBind has been called. */ + /** + * @return Whether onBind has been called. + */ public boolean wasOnBindCalled() { return mOnBindCalled; } - /** @return Whether the component is bound. */ + /** + * @return Whether the component is bound. + */ public boolean isBound() { return mBound; } - /** @return Whether onUnbind has been called. */ + /** + * @return Whether onUnbind has been called. + */ public boolean wasOnUnbindCalled() { return mOnUnbindCalled; } @@ -129,12 +143,16 @@ public boolean wasMeasureCalled() { return mOnMeasureCalled; } - /** @return Whether onAttached has been called. */ + /** + * @return Whether onAttached has been called. + */ public synchronized boolean wasOnAttachedCalled() { return mOnAttachedCalled; } - /** @return Whether onDetached has been called. */ + /** + * @return Whether onDetached has been called. + */ public synchronized boolean wasOnDetachedCalled() { return mOnDetachedCalled; } diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentAssert.java b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentAssert.java index fe24252806d..a30f4cc658f 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentAssert.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentAssert.java @@ -449,7 +449,9 @@ public ComponentAssert hasPropsMatching( return this; } - /** @deprecated see {@link #wontRender()} */ + /** + * @deprecated see {@link #wontRender()} + */ @Deprecated public ComponentAssert willNotRender() { return wontRender(); diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentConditions.java b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentConditions.java index da86ed49c94..73f490a6034 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentConditions.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/ComponentConditions.java @@ -114,7 +114,9 @@ public static Condition textEquals(final CharSequence text return text(is(text.toString())); } - /** @see #textEquals(CharSequence) */ + /** + * @see #textEquals(CharSequence) + */ public static Condition textEquals(final String text) { return text(is(text)); } diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/LithoViewSubComponentExtractor.java b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/LithoViewSubComponentExtractor.java index a47f2e42628..ac2aa01d519 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/assertj/LithoViewSubComponentExtractor.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/assertj/LithoViewSubComponentExtractor.java @@ -23,7 +23,9 @@ import org.assertj.core.api.iterable.Extractor; import org.assertj.core.util.Preconditions; -/** @deprecated Use {@link LithoViewAssert#containsComponent)} instead. */ +/** + * @deprecated Use {@link LithoViewAssert#containsComponent)} instead. + */ @Deprecated public class LithoViewSubComponentExtractor implements Extractor> { diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/subcomponents/InspectableComponent.java b/litho-testing/src/main/java/com/facebook/litho/testing/subcomponents/InspectableComponent.java index 24148fae9e3..58a23cfa65f 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/subcomponents/InspectableComponent.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/subcomponents/InspectableComponent.java @@ -47,7 +47,9 @@ private InspectableComponent(DebugComponent component) { mComponent = component; } - /** @return The root {@link InspectableComponent} of a LithoView. */ + /** + * @return The root {@link InspectableComponent} of a LithoView. + */ @Nullable public static InspectableComponent getRootInstance(LithoView view) { final DebugComponent rootInstance = DebugComponent.getRootInstance(view); @@ -77,17 +79,23 @@ public InspectableComponent getNestedInstance(Component component) { return null; } - /** @return A canonical name for this component. Suitable to present to the user. */ + /** + * @return A canonical name for this component. Suitable to present to the user. + */ public String getName() { return mComponent.getComponent().getClass().getName(); } - /** @return A simpler canonical name for this component. Suitable to present to the user. */ + /** + * @return A simpler canonical name for this component. Suitable to present to the user. + */ public String getSimpleName() { return mComponent.getComponent().getSimpleName(); } - /** @return The class of the underlying Component. */ + /** + * @return The class of the underlying Component. + */ public Class getComponentClass() { return mComponent.getComponent().getClass(); } @@ -110,35 +118,47 @@ public List getChildComponents() { return res; } - /** @return A mounted view or null if this component does not mount a view. */ + /** + * @return A mounted view or null if this component does not mount a view. + */ @Nullable public View getMountedView() { return mComponent.getMountedView(); } - /** @return A mounted drawable or null if this component does not mount a drawable. */ + /** + * @return A mounted drawable or null if this component does not mount a drawable. + */ @Nullable public Drawable getMountedDrawable() { return mComponent.getMountedDrawable(); } - /** @return The litho view hosting this component. */ + /** + * @return The litho view hosting this component. + */ @Nullable public BaseMountingView getLithoView() { return mComponent.getLithoView(); } - /** @return The bounds of this component relative to its hosting {@link LithoView}. */ + /** + * @return The bounds of this component relative to its hosting {@link LithoView}. + */ public Rect getBoundsInLithoView() { return mComponent.getBoundsInLithoView(); } - /** @return The bounds of this component relative to its parent. */ + /** + * @return The bounds of this component relative to its parent. + */ public Rect getBounds() { return mComponent.getBounds(); } - /** @return This component's testKey or null if none is set. */ + /** + * @return This component's testKey or null if none is set. + */ @Nullable public String getTestKey() { return mComponent.getTestKey(); @@ -155,7 +175,9 @@ public String getComponentTestKey() { return mComponent.getComponentTestKey(); } - /** @return This component's componentTag or null if none is set. */ + /** + * @return This component's componentTag or null if none is set. + */ @Nullable public Object getComponentTag() { return mComponent.getComponentTag(); @@ -170,51 +192,67 @@ public String getTextContent() { return mComponent.getTextContent(); } - /** @return The {@link ComponentHost} that wraps this component or null if one cannot be found. */ + /** + * @return The {@link ComponentHost} that wraps this component or null if one cannot be found. + */ @Nullable public ComponentHost getComponentHost() { return mComponent.getComponentHost(); } - /** @return This component's key or null if none is set. */ + /** + * @return This component's key or null if none is set. + */ @Nullable public String getKey() { return mComponent.getKey(); } - /** @return The Component instance this debug component wraps. */ + /** + * @return The Component instance this debug component wraps. + */ public Component getComponent() { return mComponent.getComponent(); } - /** @return The foreground drawable asscociated with this debug component. May be null. */ + /** + * @return The foreground drawable asscociated with this debug component. May be null. + */ @Nullable public Drawable getForeground() { final DebugLayoutNode layout = mComponent.getLayoutNode(); return layout == null ? null : layout.getForeground(); } - /** @return The background drawable asscociated with this debug component. May be null. */ + /** + * @return The background drawable asscociated with this debug component. May be null. + */ @Nullable public Drawable getBackground() { final DebugLayoutNode layout = mComponent.getLayoutNode(); return layout == null ? null : layout.getBackground(); } - /** @return The int value of the importantForAccessibility property on this debug component. */ + /** + * @return The int value of the importantForAccessibility property on this debug component. + */ @Nullable public Integer getImportantForAccessibility() { final DebugLayoutNode layout = mComponent.getLayoutNode(); return layout == null ? null : layout.getImportantForAccessibility(); } - /** @return The boolean value of the focusable property on this debug component. */ + /** + * @return The boolean value of the focusable property on this debug component. + */ public boolean getFocusable() { final DebugLayoutNode layout = mComponent.getLayoutNode(); return layout == null ? false : layout.getFocusable(); } - /** @return The content description CharSequence on this debug component. May be null. */ + /** + * @return The content description CharSequence on this debug component. May be null. + */ @Nullable public CharSequence getContentDescription() { final DebugLayoutNode layout = mComponent.getLayoutNode(); diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewPredicates.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewPredicates.java index e162628a5b1..befae43a90b 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewPredicates.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewPredicates.java @@ -194,7 +194,9 @@ public static Predicate hasVisibleDrawable(final Drawable drawable) { return Predicates.and(isVisible(), hasDrawable(drawable)); } - /** @return A Predicate which is true if the view is visible and has the given id. */ + /** + * @return A Predicate which is true if the view is visible and has the given id. + */ public static Predicate hasVisibleId(final int viewId) { return Predicates.and(isVisible(), hasId(viewId)); } diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTree.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTree.java index 0d9e8961c69..515f36147a1 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTree.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTree.java @@ -40,7 +40,9 @@ private ViewTree(View view) { mView = view; } - /** @return the view group used to generate this tree */ + /** + * @return the view group used to generate this tree + */ public View getRoot() { return mView; } diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeAssert.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeAssert.java index c5912feb92c..47a5190c4e8 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeAssert.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeAssert.java @@ -185,7 +185,8 @@ public ViewTreeAssert hasNoContentDescription(final String contentDescription) { Assertions.assertThat(path) .overridingErrorMessage( - "Found content description \"%s\" in view hierarchy:%n%s while the content description should not exist. ", + "Found content description \"%s\" in view hierarchy:%n%s while the content description" + + " should not exist. ", contentDescription, actual.makeString(ViewExtractors.GET_CONTENT_DESCRIPTION_FUNCTION), path) diff --git a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeUtil.java b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeUtil.java index d271d93788b..b47462a3bbc 100644 --- a/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeUtil.java +++ b/litho-testing/src/main/java/com/facebook/litho/testing/viewtree/ViewTreeUtil.java @@ -22,7 +22,9 @@ /** Utility methods for {@link ViewTreeAssert}. */ public final class ViewTreeUtil { - /** @return the resource name or "" */ + /** + * @return the resource name or "" + */ public static String getResourceName(final int resourceId) { try { return ApplicationProvider.getApplicationContext() diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/CardSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/CardSpec.java index 8528faa43a5..6925e4af9dc 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/CardSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/CardSpec.java @@ -109,11 +109,16 @@ static Component onCreateLayout( @Prop( optional = true, docString = - "[UNPERFORMANT WARNING] if you do not need to render your corners transparently please set to false. It is more expensive to perform rounded corners with transparent\n" + "[UNPERFORMANT WARNING] if you do not need to render your corners transparently" + + " please set to false. It is more expensive to perform rounded corners with" + + " transparent\n" + "clipping due to antialiasing operations.\n\n" - + "

A component that renders a given component into a card border with shadow, and allows for\n" - + "transparent corners. With transparencyEnabled(false) {@link * com.facebook.litho.widget.Card} uses imitation clipped corners that\n" - + "draw in a solid color to mimic the background. transparencyEnabled(true) is useful if you are\n" + + "

A component that renders a given component into a card border with" + + " shadow, and allows for\n" + + "transparent corners. With transparencyEnabled(false) {@link *" + + " com.facebook.litho.widget.Card} uses imitation clipped corners that\n" + + "draw in a solid color to mimic the background. transparencyEnabled(true)" + + " is useful if you are\n" + "rendering your pill over a gradient or dynamic background.\n") boolean transparencyEnabled, @Prop(optional = true) boolean disableClipTopLeft, diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/ComponentTreeHolder.java b/litho-widget/src/main/java/com/facebook/litho/widget/ComponentTreeHolder.java index 4fe0697c3af..e3496c4b17f 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/ComponentTreeHolder.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/ComponentTreeHolder.java @@ -366,7 +366,9 @@ public synchronized boolean hasCompletedLatestLayout() { mLastRequestedWidthSpec, mLastRequestedHeightSpec)); } - /** @return whether this ComponentTreeHolder has been inserted into the adapter yet. */ + /** + * @return whether this ComponentTreeHolder has been inserted into the adapter yet. + */ public synchronized boolean isInserted() { return mIsInserted; } diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/ComponentWarmer.java b/litho-widget/src/main/java/com/facebook/litho/widget/ComponentWarmer.java index ffdb82801c6..2adf929936b 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/ComponentWarmer.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/ComponentWarmer.java @@ -324,7 +324,8 @@ public void prepare( ComponentsReporter.emitMessage( ComponentsReporter.LogLevel.WARNING, COMPONENT_WARMER_LOG_TAG, - "ComponentWarmer not ready: unable to prepare sync. This will be executed asynchronously when the ComponentWarmer is ready."); + "ComponentWarmer not ready: unable to prepare sync. This will be executed asynchronously" + + " when the ComponentWarmer is ready."); addToPending(tag, componentRenderInfo, handler); diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/DataDiffModelName.java b/litho-widget/src/main/java/com/facebook/litho/widget/DataDiffModelName.java index afadc1063d2..fbd0b9b53f8 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/DataDiffModelName.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/DataDiffModelName.java @@ -19,6 +19,8 @@ /** Interface to provide name of the model used for tracing purposes. */ public interface DataDiffModelName { - /** @return name of the data model. */ + /** + * @return name of the data model. + */ String getName(); } diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/HorizontalScrollLithoView.java b/litho-widget/src/main/java/com/facebook/litho/widget/HorizontalScrollLithoView.java index c9dcdd355c8..35a1e2d28f6 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/HorizontalScrollLithoView.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/HorizontalScrollLithoView.java @@ -37,7 +37,8 @@ public class HorizontalScrollLithoView extends HorizontalScrollView private final LithoView mLithoView; private int mComponentWidth; - private int mComponentHeight;; + private int mComponentHeight; + ; @Nullable private ScrollPosition mScrollPosition; @Nullable private OnScrollChangeListener mOnScrollChangeListener; diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/LayoutInfo.java b/litho-widget/src/main/java/com/facebook/litho/widget/LayoutInfo.java index 3e0063b01b9..3360e287cd4 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/LayoutInfo.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/LayoutInfo.java @@ -35,10 +35,14 @@ public interface LayoutInfo extends ViewportInfo { */ int getScrollDirection(); - /** @return The {@link LayoutManager} to be used with the {@link RecyclerView}. */ + /** + * @return The {@link LayoutManager} to be used with the {@link RecyclerView}. + */ LayoutManager getLayoutManager(); - /** @param renderInfoCollection */ + /** + * @param renderInfoCollection + */ void setRenderInfoCollection(RenderInfoCollection renderInfoCollection); /** diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java index 24885f66454..ed43f16112d 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerBinder.java @@ -276,6 +276,7 @@ public void doFrame(long frameTimeNanos) { private int mLastHeightSpec = LayoutManagerOverrideParams.UNINITIALIZED; private Size mMeasuredSize; private @Nullable RecyclerView mMountedView; + /** * Can be set for RecyclerBinder instances which do not have control over the RecyclerView which * the adapter sends operations to, and it does not mount or measure it. Only for subadapter mode. @@ -569,7 +570,9 @@ public Builder lithoLifecycleProvider( return this; } - /** @param c The {@link ComponentContext} the RecyclerBinder will use. */ + /** + * @param c The {@link ComponentContext} the RecyclerBinder will use. + */ public RecyclerBinder build(ComponentContext c) { if (mRecyclerBinderConfig == null) { mRecyclerBinderConfig = new RecyclerBinderConfig(); @@ -923,7 +926,8 @@ private boolean isRecyclerViewTargetComputingLayout() { public void setSubAdapterModeRecyclerView(RecyclerView recyclerView) { if (!mIsSubAdapter) { throw new IllegalStateException( - "Cannot set a subadapter RecyclerView on a RecyclerBinder which is not in subadapter mode."); + "Cannot set a subadapter RecyclerView on a RecyclerBinder which is not in subadapter" + + " mode."); } registerDrawListener(recyclerView); @@ -934,7 +938,8 @@ public void setSubAdapterModeRecyclerView(RecyclerView recyclerView) { public void removeSubAdapterModeRecyclerView(RecyclerView recyclerView) { if (!mIsSubAdapter) { throw new IllegalStateException( - "Cannot remove a subadapter RecyclerView on a RecyclerBinder which is not in subadapter mode."); + "Cannot remove a subadapter RecyclerView on a RecyclerBinder which is not in subadapter" + + " mode."); } unregisterDrawListener(recyclerView); @@ -1498,9 +1503,12 @@ public final void updateItemAt(int position, RenderInfo renderInfo) { + position + ", size=" + mComponentTreeHolders.size() - + "). This likely means data passed to the section had duplicates or a mutable data model. Component involved in the error whose backing data model may have duplicates: " + + "). This likely means data passed to the section had duplicates or a mutable data" + + " model. Component involved in the error whose backing data model may have" + + " duplicates: " + renderInfo.getName() - + ". Read more here: https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception"); + + ". Read more here:" + + " https://fblitho.com/docs/sections/best-practices/#avoiding-indexoutofboundsexception"); } holder = mComponentTreeHolders.get(position); @@ -2158,7 +2166,8 @@ public void measure( shouldMeasureItemForSize(widthSpec, heightSpec, scrollDirection, canRemeasure); if (mHasManualEstimatedViewportCount && shouldMeasureItemForSize) { throw new RuntimeException( - "Cannot use manual estimated viewport count when the RecyclerBinder needs an item to determine its size!"); + "Cannot use manual estimated viewport count when the RecyclerBinder needs an item to" + + " determine its size!"); } mIsInMeasure.set(true); @@ -2269,7 +2278,9 @@ public void measure( } } - /** @return true if the view is measured and doesn't need remeasuring. */ + /** + * @return true if the view is measured and doesn't need remeasuring. + */ private boolean isMeasured() { return mIsMeasured.get() && !mRequiresRemeasure.get(); } @@ -3241,7 +3252,9 @@ public boolean process(int index) { traverser.traverse(0, treeHoldersSize, firstVisible, lastVisible, processor); } - /** @return Whether or not to continue layout computation for current range */ + /** + * @return Whether or not to continue layout computation for current range + */ private boolean computeRangeLayoutAt( int index, int rangeStart, int rangeEnd, int treeHoldersSize) { @@ -3276,7 +3289,9 @@ private boolean computeRangeLayoutAt( return true; } - /** @return Whether or not to continue layout computation for current range */ + /** + * @return Whether or not to continue layout computation for current range + */ private boolean computeRangeLayoutWithRetainMaximumRange( int index, int rangeStart, int rangeEnd, int treeHoldersSize, boolean allowDeletions) { @@ -4095,7 +4110,9 @@ private static boolean isVisibleToUser(View view) { return view.getGlobalVisibleRect(sDummyRect); } - /** @return a list of view's visibility, iterating from given view to its ancestor views. */ + /** + * @return a list of view's visibility, iterating from given view to its ancestor views. + */ private static List getVisibleHierarchy(View view) { final List hierarchy = new ArrayList<>(); Object current = view; diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerRangeTraverser.java b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerRangeTraverser.java index 034cc697fdc..bc639a3352d 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerRangeTraverser.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/RecyclerRangeTraverser.java @@ -118,7 +118,9 @@ void traverse( int rangeStart, int rangeEnd, int firstVisible, int lastVisible, Processor processor); interface Processor { - /** @return Whether or not to continue */ + /** + * @return Whether or not to continue + */ boolean process(int index); } } diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/SectionsRecyclerView.java b/litho-widget/src/main/java/com/facebook/litho/widget/SectionsRecyclerView.java index d97473771d8..2fd84e0e080 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/SectionsRecyclerView.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/SectionsRecyclerView.java @@ -54,6 +54,7 @@ public class SectionsRecyclerView extends SwipeRefreshLayout implements HasLitho * relayout its children eventually. */ private boolean mHasBeenDetachedFromWindow = false; + /** * When we set an ItemAnimator during mount, we want to store the one that was already set on the * RecyclerView so that we can reset it during unmount. diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/StartSnapHelper.java b/litho-widget/src/main/java/com/facebook/litho/widget/StartSnapHelper.java index 491cded0954..089863d4fdc 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/StartSnapHelper.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/StartSnapHelper.java @@ -223,7 +223,9 @@ private static View findViewClosestToStart( return closestChild; } - /** @return the first View whose start is before the start of this recycler view */ + /** + * @return the first View whose start is before the start of this recycler view + */ @Nullable private static View findFirstViewBeforeStart( LayoutManager layoutManager, OrientationHelper helper) { diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java index e0ddca77c8e..97bc71b6267 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextInputSpec.java @@ -240,6 +240,7 @@ class TextInputSpec { /** UI thread only; used in OnMount. */ private static final Rect sBackgroundPaddingRect = new Rect(); + /** UI thread only; used in OnMount. */ private static final InputFilter[] NO_FILTERS = new InputFilter[0]; diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/TextureWarmer.java b/litho-widget/src/main/java/com/facebook/litho/widget/TextureWarmer.java index 754de59222b..a532f57ddc6 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/TextureWarmer.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/TextureWarmer.java @@ -61,7 +61,9 @@ public WarmDrawable(Drawable drawable, int width, int height) { } } - /** @return the global {@link TextureWarmer} instance. */ + /** + * @return the global {@link TextureWarmer} instance. + */ public static synchronized TextureWarmer getInstance() { if (sInstance == null) { sInstance = new TextureWarmer(); diff --git a/litho-widget/src/main/java/com/facebook/litho/widget/ViewportInfo.java b/litho-widget/src/main/java/com/facebook/litho/widget/ViewportInfo.java index 189c37d739a..446085a02b4 100644 --- a/litho-widget/src/main/java/com/facebook/litho/widget/ViewportInfo.java +++ b/litho-widget/src/main/java/com/facebook/litho/widget/ViewportInfo.java @@ -25,19 +25,29 @@ */ public interface ViewportInfo { - /** @return the adapter position of the first visible view. */ + /** + * @return the adapter position of the first visible view. + */ int findFirstVisibleItemPosition(); - /** @return the adapter position of the last visible view. */ + /** + * @return the adapter position of the last visible view. + */ int findLastVisibleItemPosition(); - /** @return the adapter position of the first fully visible view. */ + /** + * @return the adapter position of the first fully visible view. + */ int findFirstFullyVisibleItemPosition(); - /** @return the adapter position of the last fully visible view. */ + /** + * @return the adapter position of the last fully visible view. + */ int findLastFullyVisibleItemPosition(); - /** @return total number of items in the adapter */ + /** + * @return total number of items in the adapter + */ int getItemCount(); /** Implement this interface to be notified of Viewport changes from the {@link Binder} */ diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/animatedbadge/AnimatedBadgeSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/animatedbadge/AnimatedBadgeSpec.java index 5a39a6528d6..3c9c69662a6 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/animatedbadge/AnimatedBadgeSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/animatedbadge/AnimatedBadgeSpec.java @@ -178,6 +178,7 @@ static Transition onCreateTransition(ComponentContext c) { .disappearTo(0f) .animator(ANIMATOR)); } + // end private static Drawable buildRoundedRect(ComponentContext c, int color, int cornerRadiusDp) { diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/ParallelTransitionWithAnimatorsComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/ParallelTransitionWithAnimatorsComponentSpec.java index a30eccabdb7..78231eb3ce8 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/ParallelTransitionWithAnimatorsComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/ParallelTransitionWithAnimatorsComponentSpec.java @@ -84,6 +84,7 @@ static Transition onCreateTransition(ComponentContext c) { .animate(AnimatedProperties.Y) .animator(Transition.timing(1000, new BounceInterpolator()))); } + // end @OnEvent(ClickEvent.class) diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SequenceTransitionLoopComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SequenceTransitionLoopComponentSpec.java index 05632750b12..f8e37abf8a6 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SequenceTransitionLoopComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SequenceTransitionLoopComponentSpec.java @@ -73,6 +73,7 @@ static Component onCreateLayout(ComponentContext c, @State boolean shown) { .alignItems(shown ? YogaAlign.FLEX_END : YogaAlign.FLEX_START) .build(); } + // start @OnEvent(TransitionEndEvent.class) static void onTransitionEndEvent( @@ -92,6 +93,7 @@ static Transition onCreateTransition(ComponentContext c) { .animate(AnimatedProperties.Y) .transitionEndHandler(SequenceTransitionLoopComponent.onTransitionEndEvent(c))); } + // end @OnEvent(ClickEvent.class) static void onClickEvent(ComponentContext c, @FromEvent View view) { diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SimpleAllLayoutTransitionComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SimpleAllLayoutTransitionComponentSpec.java index 8c4cde5abb4..413a1cfcc86 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SimpleAllLayoutTransitionComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/docs/SimpleAllLayoutTransitionComponentSpec.java @@ -57,6 +57,7 @@ static void onClickEvent(ComponentContext c, @FromEvent View view) { static void onUpdateState(StateValue toRight) { toRight.set(!toRight.get()); } + // no_animation @OnCreateTransition static Transition onCreateTransition(ComponentContext c) { diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/expandableelement/ExpandableElementActivity.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/expandableelement/ExpandableElementActivity.java index b707e802558..1fcf5594b18 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/expandableelement/ExpandableElementActivity.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/expandableelement/ExpandableElementActivity.java @@ -28,9 +28,9 @@ public class ExpandableElementActivity extends NavigatableDemoActivity { new Message[] { new Message( true, - "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque " - + "laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi " - + "architecto beatae vitae dicta sunt explicabo", + "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque" + + " laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et" + + " quasi architecto beatae vitae dicta sunt explicabo", true, "DEC 25 AT 9:55"), new Message( diff --git a/sample/src/main/java/com/facebook/samples/litho/java/animations/sharedelements/DetailActivity.java b/sample/src/main/java/com/facebook/samples/litho/java/animations/sharedelements/DetailActivity.java index 0239f9e0539..cb1f467c2e5 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/animations/sharedelements/DetailActivity.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/animations/sharedelements/DetailActivity.java @@ -117,9 +117,30 @@ private static Component getContent(ComponentContext c, int color, Spannable tit .textSizeSp(12) .transitionName("DESCRIPTION") .text( - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent egestas augue venenatis suscipit maximus. Maecenas vel volutpat nunc. Etiam volutpat ultricies ante a iaculis. Fusce ultrices eleifend ligula in maximus. Fusce commodo, mauris vitae consequat tincidunt, nunc massa pharetra ante, non interdum magna sapien vel tortor. Aliquam in ultrices odio. Phasellus ac ante sit amet purus efficitur tempus fermentum in erat. Nullam auctor lorem ut justo convallis vestibulum. Fusce consequat velit eget pharetra consequat. Integer vulputate nisl eu libero luctus, id consequat ipsum eleifend. Nam quis sodales neque. Nullam nec velit sed leo feugiat imperdiet.\n" + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent egestas" + + " augue venenatis suscipit maximus. Maecenas vel volutpat nunc. Etiam" + + " volutpat ultricies ante a iaculis. Fusce ultrices eleifend ligula in" + + " maximus. Fusce commodo, mauris vitae consequat tincidunt, nunc massa" + + " pharetra ante, non interdum magna sapien vel tortor. Aliquam in" + + " ultrices odio. Phasellus ac ante sit amet purus efficitur tempus" + + " fermentum in erat. Nullam auctor lorem ut justo convallis vestibulum." + + " Fusce consequat velit eget pharetra consequat. Integer vulputate nisl" + + " eu libero luctus, id consequat ipsum eleifend. Nam quis sodales neque." + + " Nullam nec velit sed leo feugiat imperdiet.\n" + "\n" - + "Praesent lacinia lorem quis mauris molestie, ut placerat nisi ultricies. Sed a fringilla mi. Ut ornare a lorem quis consectetur. Pellentesque id leo id odio accumsan egestas. Proin sollicitudin turpis orci, in tempus dolor eleifend dapibus. Aenean facilisis fringilla orci, vel facilisis nunc commodo in. Sed scelerisque lectus ac diam feugiat, sit amet condimentum enim imperdiet. Integer urna arcu, aliquet quis facilisis quis, faucibus quis lorem. Nam congue augue est, ac porttitor mauris vehicula ut. Phasellus sapien tortor, euismod non dui quis, vulputate auctor orci. Maecenas a lectus in felis tincidunt pulvinar. Praesent nec laoreet ante, in sollicitudin quam. Vestibulum convallis, ante sit amet consequat varius, urna dui sagittis odio, suscipit rutrum ipsum nisi non eros. Cras interdum mattis libero at posuere. Phasellus venenatis dui massa, sed egestas mauris porta id.")) + + "Praesent lacinia lorem quis mauris molestie, ut placerat nisi ultricies." + + " Sed a fringilla mi. Ut ornare a lorem quis consectetur. Pellentesque id" + + " leo id odio accumsan egestas. Proin sollicitudin turpis orci, in tempus" + + " dolor eleifend dapibus. Aenean facilisis fringilla orci, vel facilisis" + + " nunc commodo in. Sed scelerisque lectus ac diam feugiat, sit amet" + + " condimentum enim imperdiet. Integer urna arcu, aliquet quis facilisis" + + " quis, faucibus quis lorem. Nam congue augue est, ac porttitor mauris" + + " vehicula ut. Phasellus sapien tortor, euismod non dui quis, vulputate" + + " auctor orci. Maecenas a lectus in felis tincidunt pulvinar. Praesent" + + " nec laoreet ante, in sollicitudin quam. Vestibulum convallis, ante sit" + + " amet consequat varius, urna dui sagittis odio, suscipit rutrum ipsum" + + " nisi non eros. Cras interdum mattis libero at posuere. Phasellus" + + " venenatis dui massa, sed egestas mauris porta id.")) .build(); } } diff --git a/sample/src/main/java/com/facebook/samples/litho/java/communicating/ParentComponentSendsEventToChildSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/communicating/ParentComponentSendsEventToChildSpec.java index b231dcb904a..b45ae42d08c 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/communicating/ParentComponentSendsEventToChildSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/communicating/ParentComponentSendsEventToChildSpec.java @@ -95,6 +95,7 @@ static void onClickCounter(ComponentContext c) { static void onUpdateCounterForChildComponent(StateValue counterForChildComponentText) { counterForChildComponentText.set(counterForChildComponentText.get() + 1); } + // end_update_prop // start_trigger diff --git a/sample/src/main/java/com/facebook/samples/litho/java/editor/SimpleEditorComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/editor/SimpleEditorComponentSpec.java index 33fb9aa0887..78e0c87cfd2 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/editor/SimpleEditorComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/editor/SimpleEditorComponentSpec.java @@ -66,7 +66,8 @@ static Component onCreateLayout( Text.create(c) .textSizeSp(20) .text( - "Use Flipper (fbflipper.com) to experiment\nchanging Prop and State at runtime")) + "Use Flipper (fbflipper.com) to experiment\n" + + "changing Prop and State at runtime")) .child( Text.create(c) .textSizeSp(12) diff --git a/sample/src/main/java/com/facebook/samples/litho/java/stateupdates/StateUpdateFromOutsideTreeWithListenerComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/stateupdates/StateUpdateFromOutsideTreeWithListenerComponentSpec.java index 5f0be882ebf..164ff3d1af5 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/stateupdates/StateUpdateFromOutsideTreeWithListenerComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/stateupdates/StateUpdateFromOutsideTreeWithListenerComponentSpec.java @@ -50,6 +50,7 @@ public void onMyEvent() { } }); } + // end_implement_observer @OnUpdateState diff --git a/sample/src/main/java/com/facebook/samples/litho/java/viewpager/ViewPagerDemoComponentSpec.java b/sample/src/main/java/com/facebook/samples/litho/java/viewpager/ViewPagerDemoComponentSpec.java index 596ebf2cb09..452ad06a7e1 100644 --- a/sample/src/main/java/com/facebook/samples/litho/java/viewpager/ViewPagerDemoComponentSpec.java +++ b/sample/src/main/java/com/facebook/samples/litho/java/viewpager/ViewPagerDemoComponentSpec.java @@ -53,14 +53,16 @@ public class ViewPagerDemoComponentSpec { new Model("This is a ViewPager Demo", "You can swipe to navigate", hsvToColor(0, .5f, 1)), new Model( "You can also tap left/right", - "This isn't built into ViewPagerComponent but you can use a GestureDetector like in this demo!", + "This isn't built into ViewPagerComponent but you can use a GestureDetector like in" + + " this demo!", hsvToColor(60, .5f, 1)), new Model( "A ViewPagerComponent lets you specify only the *initial* page index as a prop", null, hsvToColor(120, .5f, 1)), new Model( - "RecyclerCollectionEventsController will let you change the page once the ViewPager is on screen", + "RecyclerCollectionEventsController will let you change the page once the ViewPager" + + " is on screen", "Check out the code for this demo to see how", hsvToColor(180, .5f, 1)), new Model(