Skip to content

Commit

Permalink
upgrade Groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Nov 13, 2024
1 parent a82826c commit c335a3e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 42 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ vaadin-v24next-core = { module = "com.vaadin:vaadin-core", version.ref = "vaadin
vaadin-v24next-spring = { module = "com.vaadin:vaadin-spring", version.ref = "vaadin24next_spring" }
classgraph = "io.github.classgraph:classgraph:4.8.151"
jetbrains-annotations = "org.jetbrains:annotations:24.1.0"
groovy = "org.codehaus.groovy:groovy:3.0.19"
groovy = "org.apache.groovy:groovy:4.0.24"
hibernate-validator = "org.hibernate.validator:hibernate-validator:8.0.1.Final"
jakarta-el-api = "jakarta.el:jakarta.el-api:5.0.1"
spring-boot-starter-test = "org.springframework.boot:spring-boot-starter-test:3.0.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,6 @@ class BasicUtils {
BasicUtilsKt._fireDomEvent(self, eventType, eventData)
}

/**
* Determines the component's `label` (usually it's the HTML element's `label` property,
* but it's {@link com.vaadin.flow.component.checkbox.Checkbox#getLabel()} for checkbox).
* Intended to be used for fields such as a TextField.
*/
@NotNull
static String getLabel(@NotNull Component self) {
return ComponentUtilsKt.getLabel(self)
}
static void setLabel(@NotNull Component self, @NotNull String label) {
ComponentUtilsKt.setLabel(self, label)
}

/**
* The Component's caption: {@link com.vaadin.flow.component.button.Button#getText()} for a Button,
* {@link #getLabel(com.vaadin.flow.component.Component)} for fields such as a TextField.
* <p></p>
* For FormItem: Concatenates texts from all elements placed in the `label` slot. This effectively
* returns whatever was provided in the String label via [FormLayout.addFormItem].
*/
@NotNull
static String getCaption(@NotNull Component self) {
return ComponentUtilsKt.getCaption(self)
}
static void setCaption(@NotNull Component self, @NotNull String caption) {
ComponentUtilsKt.setCaption(self, caption)
}

/**
* The same as {@link Component#getId()} but without Optional.
* <p></p>
Expand All @@ -93,15 +65,6 @@ class BasicUtils {
return BasicUtilsKt.getId_(self)
}

/**
* Checks whether the component is attached to the UI.
* <p></p>
* Returns true for attached components even if the UI itself is closed.
*/
static boolean isAttached(@NotNull Component self) {
return ComponentUtilsKt.isAttached(self)
}

/**
* Checks whether the component is visible (usually {@link Component#isVisible()} but for {@link com.vaadin.flow.component.Text}
* the text must be non-empty).
Expand Down Expand Up @@ -175,16 +138,19 @@ class BasicUtils {

// modify when this is fixed: https://github.com/vaadin/flow/issues/4068
@Nullable
@CompileDynamic // workaround for NPE bug in Groovy compiler
static String getPlaceholder(@NotNull Component self) {
return ComponentUtilsKt.getPlaceholder(self)
}
@CompileDynamic // workaround for NPE bug in Groovy compiler
static void setPlaceholder(@NotNull Component self, @Nullable String placeholder) {
ComponentUtilsKt.setPlaceholder(self, placeholder)
}

/**
* Removes the component from its parent. Does nothing if the component does not have a parent.
*/
@CompileDynamic // workaround for NPE bug in Groovy compiler
static void removeFromParent(@NotNull Component self) {
ComponentUtilsKt.removeFromParent(self)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ class BasicUtilsTest {
new Button()._fireDomEvent("foo")
new Checkbox().getLabel()
new Checkbox().setLabel("foo")
new Checkbox().getCaption()
new Checkbox().setCaption("foo")
new TextField().id_
UI.current.isAttached()
UI.current._isVisible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BinderUtilsTest {

def tf = new TextField()
tf.assertValid()
tf.invalid = true
tf.setInvalid(true)
tf.assertInvalid()
UI.getCurrent().assertAllFieldsValid()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class FormLayoutUtilsTest {
void apiTest() {
def tf = new TextField()
FormLayout.FormItem item = new FormLayout().addFormItem(tf, "foo")
assertEquals("foo", item.caption)
assertEquals(tf, item.field)
}
}

0 comments on commit c335a3e

Please sign in to comment.