@@ -165,21 +165,23 @@ private List<Method> getInstrumentableMethods(Class<?> parent) {
165165 return getDeclaredCallables (parent ).filter (method -> {
166166 boolean isCallable = method .isAnnotationPresent (ClientCallable .class );
167167 boolean isLegacyCallable = method .isAnnotationPresent (LegacyClientCallable .class );
168+ boolean hasJsonValueReturn = JsonValue .class .isAssignableFrom (method .getReturnType ());
169+ boolean hasJsonValueParams = hasJsonValueParameters (method );
170+
171+ if (isCallable && hasJsonValueParams ) {
172+ throw new IllegalArgumentException (String .format (
173+ "Instrumented method '%s' in class '%s' has JsonValue arguments and must be annotated with @%s instead of @ClientCallable" ,
174+ method .getName (), method .getDeclaringClass (),
175+ LegacyClientCallable .class .getSimpleName ()));
176+ }
168177
169178 if (hasLegacyVaadin ()) {
170179 return isLegacyCallable ;
171180 }
172181
173182 if (isCallable || isLegacyCallable ) {
174- boolean hasJsonValueReturn = JsonValue .class .isAssignableFrom (method .getReturnType ());
175- boolean hasJsonValueParams = hasJsonValueParameters (method );
176-
177- if (isCallable && hasJsonValueParams ) {
178- throw new IllegalArgumentException (String .format (
179- "Instrumented method '%s' in class '%s' has JsonValue arguments and must be annotated with @%s instead of @ClientCallable" ,
180- method .getName (), method .getDeclaringClass ().getName (),
181- LegacyClientCallable .class .getName ()));
182- } else if (isCallable && hasJsonValueReturn ) {
183+
184+ if (isCallable && hasJsonValueReturn ) {
183185 return true ;
184186 } else if (isLegacyCallable ) {
185187 return true ;
0 commit comments