Removes no longer needed parentheses in @Composable() annotations
-Enables the NonParenthesizedAnnotationsOnFunctionalTypes flag to disable the IDE warning
-Temporarily disables the 'paren-spacing' lint in ktlint, due to: https://github.com/pinterest/ktlint/issues/737
-Turns unnecessary parentheses into a 'warning', and stops ignoring this IDE inspection in the UI project
Bug: b/155391691
Test: ./gradlew bOS, Studio
Change-Id: Ib4af53591b82a0d56ae0733ff2561196c2d49635
diff --git a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/ListDemos.kt b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/ListDemos.kt
index b3082ec..c1d73bc 100644
--- a/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/ListDemos.kt
+++ b/ui/ui-foundation/integration-tests/foundation-demos/src/main/java/androidx/ui/foundation/demos/ListDemos.kt
@@ -82,7 +82,7 @@
}
@Composable
-fun Button(modifier: Modifier, onClick: () -> Unit, children: @Composable() () -> Unit) {
+fun Button(modifier: Modifier, onClick: () -> Unit, children: @Composable () -> Unit) {
Clickable( {
Box(
modifier = modifier,
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
index db92c21..e324658 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
@@ -423,7 +423,7 @@
}
}
- private fun setDraggableContent(draggableFactory: @Composable() () -> Modifier) {
+ private fun setDraggableContent(draggableFactory: @Composable () -> Modifier) {
composeTestRule.setContent {
Stack {
val draggable = draggableFactory()
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
index 91ef177..27dfc12 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
@@ -572,7 +572,7 @@
}
}
- private fun setScrollableContent(scrollableModifierFactory: @Composable() () -> Modifier) {
+ private fun setScrollableContent(scrollableModifierFactory: @Composable () -> Modifier) {
composeTestRule.setContent {
Stack {
val scrollable = scrollableModifierFactory()
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
index 351344c..42934f8 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt
@@ -64,7 +64,7 @@
private class ListState<T> {
lateinit var recomposer: Recomposer
- lateinit var itemCallback: @Composable() (T) -> Unit
+ lateinit var itemCallback: @Composable (T) -> Unit
lateinit var data: List<T>
var forceRecompose = false
@@ -513,7 +513,7 @@
fun <T> AdapterList(
data: List<T>,
modifier: Modifier = Modifier,
- itemCallback: @Composable() (T) -> Unit
+ itemCallback: @Composable (T) -> Unit
) {
val state = remember { ListState<T>() }
state.recomposer = currentComposer.recomposer
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
index 62b3fcb..14508cc 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Box.kt
@@ -77,7 +77,7 @@
paddingEnd: Dp = Dp.Unspecified,
paddingBottom: Dp = Dp.Unspecified,
gravity: ContentGravity = ContentGravity.TopStart,
- children: @Composable() () -> Unit = emptyContent()
+ children: @Composable () -> Unit = emptyContent()
) {
val borderModifier =
if (border != null) Modifier.drawBorder(border, shape) else Modifier
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
index 95b4e25..59fe9002 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
@@ -60,7 +60,7 @@
enabled: Boolean = true,
onClickLabel: String? = null,
interactionState: InteractionState? = null,
- children: @Composable() () -> Unit
+ children: @Composable () -> Unit
) {
Semantics(
container = true,
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
index a4744cd..c459dfe 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/DeterminateProgressIndicator.kt
@@ -38,7 +38,7 @@
@Composable
fun DeterminateProgressIndicator(
@FloatRange(from = 0.0, to = 1.0) progress: Float,
- children: @Composable() () -> Unit
+ children: @Composable () -> Unit
) {
if (progress !in 0f..1f) {
throw IllegalArgumentException("Progress must be between 0.0 and 1.0")
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
index 697dec6..06a1553 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
@@ -48,7 +48,7 @@
* @param children The content to be displayed inside the dialog.
*/
@Composable
-fun Dialog(onCloseRequest: () -> Unit, children: @Composable() () -> Unit) {
+fun Dialog(onCloseRequest: () -> Unit, children: @Composable () -> Unit) {
val context = ContextAmbient.current
val recomposer = currentComposer.recomposer
@@ -87,7 +87,7 @@
setContentView(frameLayout)
}
- fun setContent(children: @Composable() () -> Unit) {
+ fun setContent(children: @Composable () -> Unit) {
// TODO: This should probably create a child composition of the original
composition = frameLayout.setContent(recomposer, children)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
index fe81619..c569616 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
@@ -207,7 +207,7 @@
scrollerPosition: ScrollerPosition = ScrollerPosition(),
modifier: Modifier = Modifier,
isScrollable: Boolean = true,
- child: @Composable() () -> Unit
+ child: @Composable () -> Unit
) {
Scroller(scrollerPosition, modifier, true, isScrollable, child)
}
@@ -237,7 +237,7 @@
scrollerPosition: ScrollerPosition = ScrollerPosition(),
modifier: Modifier = Modifier,
isScrollable: Boolean = true,
- child: @Composable() () -> Unit
+ child: @Composable () -> Unit
) {
Scroller(scrollerPosition, modifier, false, isScrollable, child)
}
@@ -248,7 +248,7 @@
modifier: Modifier,
isVertical: Boolean,
isScrollable: Boolean,
- child: @Composable() () -> Unit
+ child: @Composable () -> Unit
) {
val direction =
if (isVertical) DragDirection.Vertical else DragDirection.Horizontal
@@ -282,7 +282,7 @@
scrollerPosition: ScrollerPosition,
modifier: Modifier,
isVertical: Boolean,
- child: @Composable() () -> Unit
+ child: @Composable () -> Unit
) {
Layout(
modifier = modifier.clipToBounds(),
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Text.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Text.kt
index a06b87c..8d09b84 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Text.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Text.kt
@@ -217,7 +217,7 @@
* styled explicitly.
*/
@Composable
-fun ProvideTextStyle(value: TextStyle, children: @Composable() () -> Unit) {
+fun ProvideTextStyle(value: TextStyle, children: @Composable () -> Unit) {
val mergedStyle = currentTextStyle().merge(value)
Providers(TextStyleAmbient provides mergedStyle, children = children)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
index cdc3d5b..fb96bc9 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/MutuallyExclusiveSetItem.kt
@@ -44,7 +44,7 @@
selected: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier,
- children: @Composable() () -> Unit
+ children: @Composable () -> Unit
) {
// TODO: when semantics can be merged, we should make this use Clickable internally rather
// than duplicating logic
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
index d179f52..074ac96 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
@@ -53,7 +53,7 @@
onValueChange: (Boolean) -> Unit,
enabled: Boolean = true,
modifier: Modifier = Modifier,
- children: @Composable() () -> Unit
+ children: @Composable () -> Unit
) {
TriStateToggleable(
state = ToggleableState(value),
@@ -91,7 +91,7 @@
onClick: () -> Unit,
enabled: Boolean = true,
modifier: Modifier = Modifier,
- children: @Composable() () -> Unit
+ children: @Composable () -> Unit
) {
// TODO(pavlis): Handle multiple states for Semantics
Semantics(container = true, properties = {