Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,13 @@ private void generateMethodOverride(
null,
getExceptionInternalNames(method.getExceptionTypes()));

mv.visitAnnotation(Type.getDescriptor(ClientCallable.class), true);
mv.visitAnnotation(Type.getDescriptor(ClientCallable.class), true).visitEnd();
for (java.lang.annotation.Annotation annotation : method.getAnnotations()) {
if ("com.vaadin.flow.component.internal.AllowInert"
.equals(annotation.annotationType().getName())) {
mv.visitAnnotation(Type.getDescriptor(annotation.annotationType()), true).visitEnd();
}
}
mv.visitCode();

boolean isPrivate = Modifier.isPrivate(method.getModifiers());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*-
* #%L
* Json Migration Helper
* %%
* Copyright (C) 2025 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.flowingcode.vaadin.jsonmigration;

import com.vaadin.flow.component.internal.AllowInert;

public class LegacyClientCallable_AllowInert__V extends BaseClientCallable {

@LegacyClientCallable
@AllowInert
public void test() {
trace();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
package com.flowingcode.vaadin.jsonmigration;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import com.vaadin.flow.component.ClientCallable;
import com.vaadin.flow.component.Component;
import elemental.json.JsonValue;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import org.junit.Test;

Expand Down Expand Up @@ -346,4 +348,21 @@ public void test_JsonObjectVarargs__V() throws Exception {
assertTrue(instrumented.hasBeenTraced());
}

@Test
@SuppressWarnings("unchecked")
public void testAllowInert__V() throws Exception {
LegacyClientCallable_AllowInert__V instrumented =
instrumentClass(LegacyClientCallable_AllowInert__V.class)
.getDeclaredConstructor()
.newInstance();
Method testMethod = getClientCallableTestMethod(instrumented);
assertNotNull("instrumented method is not annotated with @ClientCallable", testMethod);
Class<? extends Annotation> allowInert =
(Class<? extends Annotation>)
Class.forName("com.vaadin.flow.component.internal.AllowInert");
assertTrue(
"instrumented method is not annotated with @AllowInert",
testMethod.isAnnotationPresent(allowInert));
}

}
32 changes: 32 additions & 0 deletions src/test/java/com/vaadin/flow/component/internal/AllowInert.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*-
* #%L
* Json Migration Helper
* %%
* Copyright (C) 2025 Flowing Code
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package com.vaadin.flow.component.internal;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** Stub for {@code com.vaadin.flow.component.internal.AllowInert} (available in Vaadin 24+). */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface AllowInert {}
Loading