Skip to content

Commit

Permalink
Remove generic from Component
Browse files Browse the repository at this point in the history
Summary:
This is no longer being used at all so it can go.

Done using intellij refactor and then running `hg grep "import com.facebook.litho.Component;" -l | xargs -L1 ~/Documents/script.py` where `script.py` is P58735335

Reviewed By: passy, muraziz

Differential Revision: D6474158

fbshipit-source-id: 488c0c50b4ed1824dfa9f1203f745a9bcb4f236b
  • Loading branch information
IanChilds authored and facebook-github-bot committed Dec 5, 2017
1 parent b32db2e commit 7d38668
Show file tree
Hide file tree
Showing 88 changed files with 274 additions and 287 deletions.
38 changes: 19 additions & 19 deletions litho-core/src/main/java/com/facebook/litho/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* {@code create()} method in the generated subclass which returns a builder that allows you to set
* values for individual props. {@link Component} instances are immutable after creation.
*/
public abstract class Component<L extends Component> extends ComponentLifecycle
public abstract class Component extends ComponentLifecycle
implements Cloneable, HasEventDispatcher, HasEventTrigger {

private static final AtomicInteger sIdGenerator = new AtomicInteger(0);
Expand Down Expand Up @@ -112,7 +112,7 @@ public ComponentLifecycle getLifecycle() {
* @param other the component to compare to
* @return true if the components are of the same type and have the same props
*/
public boolean isEquivalentTo(Component<?> other) {
public boolean isEquivalentTo(Component other) {
return this == other;
}

Expand Down Expand Up @@ -248,19 +248,19 @@ private String generateUniqueGlobalKeyForChild(Component component, String key)
return uniqueKey;
}

Component<L> makeCopyWithNullContext() {
Component makeCopyWithNullContext() {
try {
final Component<L> component = (Component<L>) super.clone();
final Component component = (Component) super.clone();
component.mScopedContext = null;
return component;
} catch (CloneNotSupportedException e) {
throw new RuntimeException(e);
}
}

public Component<L> makeShallowCopy() {
public Component makeShallowCopy() {
try {
final Component<L> component = (Component<L>) super.clone();
final Component component = (Component) super.clone();
component.mIsLayoutStarted = false;
if (!ComponentsConfiguration.lazyInitializeComponent) {
component.mChildCounters = new HashMap<>();
Expand All @@ -274,8 +274,8 @@ public Component<L> makeShallowCopy() {
}
}

Component<L> makeShallowCopyWithNewId() {
final Component<L> component = makeShallowCopy();
Component makeShallowCopyWithNewId() {
final Component component = makeShallowCopy();
component.mId = sIdGenerator.incrementAndGet();
return component;
}
Expand Down Expand Up @@ -334,35 +334,35 @@ public void measure(ComponentContext c, int widthSpec, int heightSpec, Size outp
outputSize.height = mLastMeasuredLayout.getHeight();
}

protected void copyInterStageImpl(Component<L> component) {
protected void copyInterStageImpl(Component component) {

}

static boolean isHostSpec(Component<?> component) {
static boolean isHostSpec(Component component) {
return (component instanceof HostComponent);
}

static boolean isLayoutSpec(Component<?> component) {
static boolean isLayoutSpec(Component component) {
return (component != null && component.getMountType() == MountType.NONE);
}

static boolean isMountSpec(Component<?> component) {
static boolean isMountSpec(Component component) {
return (component != null && component.getMountType() != MountType.NONE);
}

static boolean isMountDrawableSpec(Component<?> component) {
static boolean isMountDrawableSpec(Component component) {
return (component != null && component.getMountType() == MountType.DRAWABLE);
}

static boolean isMountViewSpec(Component<?> component) {
static boolean isMountViewSpec(Component component) {
return (component != null && component.getMountType() == MountType.VIEW);
}

static boolean isLayoutSpecWithSizeSpec(Component<?> component) {
static boolean isLayoutSpecWithSizeSpec(Component component) {
return (isLayoutSpec(component) && component.canMeasure());
}

static boolean isNestedTree(Component<?> component) {
static boolean isNestedTree(Component component) {
return (isLayoutSpecWithSizeSpec(component)
|| (component != null && component.hasCachedLayout()));
}
Expand Down Expand Up @@ -392,7 +392,7 @@ public static boolean willRender(ComponentContext c, ComponentLayout componentLa

void generateKey(ComponentContext c) {
if (ComponentsConfiguration.useGlobalKeys) {
final Component<?> parentScope = c.getComponentScope();
final Component parentScope = c.getComponentScope();
final String key = getKey();
setGlobalKey(
parentScope == null ? key : parentScope.generateUniqueGlobalKeyForChild(this, key));
Expand Down Expand Up @@ -463,7 +463,7 @@ protected void init(
ComponentContext c,
@AttrRes int defStyleAttr,
@StyleRes int defStyleRes,
Component<L> component) {
Component component) {
super.init(c, c.getResourceCache());

mComponent = component;
Expand Down Expand Up @@ -537,7 +537,7 @@ public final ComponentLayout.Builder withLayout() {
}

@ReturnsOwnership
public abstract Component<L> build();
public abstract Component build();

public T layoutDirection(YogaDirection layoutDirection) {
mComponent.getOrCreateCommonProps().layoutDirection(layoutDirection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onInitializeAccessibilityNodeInfo(
// Coalesce the accessible mount item's information with the
// the root host view's as they are meant to behave as a single
// node in the accessibility framework.
final Component<?> component = mountItem.getComponent();
final Component component = mountItem.getComponent();
component.getLifecycle().onPopulateAccessibilityNode(node, component);
} else {
super.onInitializeAccessibilityNodeInfo(host, node);
Expand All @@ -89,7 +89,7 @@ protected void getVisibleVirtualViews(List<Integer> virtualViewIds) {
return;
}

final Component<?> component = mountItem.getComponent();
final Component component = mountItem.getComponent();

final int extraAccessibilityNodesCount =
component.getLifecycle().getExtraAccessibilityNodesCount(component);
Expand Down Expand Up @@ -119,7 +119,7 @@ protected void onPopulateNodeForVirtualView(
final Drawable drawable = (Drawable) mountItem.getContent();
final Rect bounds = drawable.getBounds();

final Component<?> component = mountItem.getComponent();
final Component component = mountItem.getComponent();
final ComponentLifecycle lifecycle = component.getLifecycle();

node.setClassName(lifecycle.getClass().getName());
Expand Down Expand Up @@ -152,7 +152,7 @@ protected int getVirtualViewAt(float x, float y) {
return INVALID_ID;
}

final Component<?> component = mountItem.getComponent();
final Component component = mountItem.getComponent();
final ComponentLifecycle lifecycle = component.getLifecycle();

if (lifecycle.getExtraAccessibilityNodesCount(component) == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class ComponentContext extends ContextWrapper {

// Hold a reference to the component which scope we are currently within.
@ThreadConfined(ThreadConfined.ANY)
private Component<?> mComponentScope;
private Component mComponentScope;
@ThreadConfined(ThreadConfined.ANY)
private final ResourceCache mResourceCache;
@ThreadConfined(ThreadConfined.ANY)
Expand Down Expand Up @@ -268,7 +268,7 @@ InternalNode newLayoutBuilder(
}

ComponentLayout.Builder newLayoutBuilder(
Component<?> component,
Component component,
@AttrRes int defStyleAttr,
@StyleRes int defStyleRes) {
component.generateKey(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ ContainerBuilder touchExpansionAttr(
ContainerBuilder child(ComponentLayout.Builder childBuilder);

@ReturnsOwnership
ContainerBuilder child(Component<?> component);
ContainerBuilder child(Component component);

@ReturnsOwnership
ContainerBuilder child(Component.Builder<?, ?> componentBuilder);
Expand Down
Loading

0 comments on commit 7d38668

Please sign in to comment.