Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove unused declarations in flow-server and flow-data #20778

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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 @@ -254,12 +254,6 @@ private void assertPublishedMethods(Element element, String[] expected) {
expected);
}

private void assertPolymerMethods(Element element, String[] expected) {
ServerEventObject object = WidgetUtil.crazyJsoCast(element);
assertEventHandlerMethods(() -> getPublishedServerMethods(object),
expected);
}

private void assertEventHandlerMethods(
Supplier<JsArray<String>> methodsProvider, String... expected) {
JsArray<String> publishedServerMethods = methodsProvider.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* Callback which allows to handle request to map a client side DOM element to
* the server {@link Element} instance.
*
* @see Node#attachExistingElement(String, Element, ChildElementConsumer)
*
* @author Vaadin Ltd
* @since 1.0
*
Expand Down
36 changes: 0 additions & 36 deletions flow-server/src/main/java/com/vaadin/flow/dom/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,40 +596,4 @@ protected void ensureChildHasParent(Element child, boolean internalCheck) {
}
}
}

/**
* Attaches a child element with the given {@code tagName} which is the next
* sibling for the {@code previousSibling}.
* <p>
* The {@code previousSibling} parameter value can be {@code null} which
* means that the very first child with the given {@code tagName} will be
* used to attach (if any).
* <p>
* This method may be used to get a server side element for the client side
* DOM element which has been created on the client side aside of the
* server.
* <p>
* The element is not returned right away since it may not exist at all on
* the client side and its index in the children list is unknown. The
* provided {@code callback} is used instead to provide the mapped
* server-side element in case it has been found or report an error if it
* doesn't exist.
* <p>
* This API is experimental and disabled for public usage.
*
* @param tagName
* the tag name of the element to attach, not {@code null}
* @param previousSibling
* previous sibling, may be {@code null}
* @param callback
* the callback which will be invoked with a server side element
* instance or an error will be reported, not {@code null}
* @return this element
*/
private N attachExistingElement(String tagName, Element previousSibling,
ChildElementConsumer callback) {
getStateProvider().attachExistingElement(getNode(), tagName,
previousSibling, callback);
return getSelf();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@
*/
public class MenuRegistry {

private static final Logger log = LoggerFactory
.getLogger(MenuRegistry.class);

/**
* File routes lazy loading and caching.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected Serializable remove(String key) {

@Override
protected boolean mayUpdateFromClient(String key, Serializable value) {
return allowUpdateFromClient(key, value);
return allowUpdateFromClient(key);
}

@Override
Expand All @@ -212,7 +212,7 @@ protected boolean producePutChange(String key, boolean hadValueEarlier,
return super.producePutChange(key, hadValueEarlier, newValue);
}

private boolean allowUpdateFromClient(String key, Serializable value) {
private boolean allowUpdateFromClient(String key) {
AllowUpdate isAllowed = isUpdateFromClientAllowedBeforeFilter(key);
if (!AllowUpdate.NO_EXPLICIT_STATUS.equals(isAllowed)) {
return AllowUpdate.EXPLICITLY_ALLOW.equals(isAllowed);
Expand Down Expand Up @@ -476,19 +476,18 @@ private static Logger getLogger() {

/**
* The method first checks whether the update from client is allowed using
* the method {@link #allowUpdateFromClient(String, Serializable)}. Then if
* it's not allowed then it either throws or returns NO OPERATION runnable
* in case if {@link #updateFromClientFilter} disallows the update (in this
* case it's just an application business logic and we should not throw).
* the method {@link #allowUpdateFromClient(String)}. Then if it's not
* allowed then it either throws or returns NO OPERATION runnable in case if
* {@link #updateFromClientFilter} disallows the update (in this case it's
* just an application business logic and we should not throw).
*
* The logic inside the {@link #allowUpdateFromClient(String, Serializable)}
* check block repeats its own logic to make sure that:
* The logic inside the {@link #allowUpdateFromClient(String)} check block
* repeats its own logic to make sure that:
* <ul>
* <li>It's in sync with
* {@link #allowUpdateFromClient(String, Serializable)} (and
* <li>It's in sync with {@link #allowUpdateFromClient(String)} (and
* {@link #mayUpdateFromClient(String, Serializable)}
* <li>The update is disallowed by the filter (and not some other checks
* that are inside {@link #allowUpdateFromClient(String, Serializable)}
* that are inside {@link #allowUpdateFromClient(String)}
* <ul>
*
* Here is the logic flow:
Expand Down Expand Up @@ -555,7 +554,7 @@ private Runnable doDeferredUpdateFromClient(String key, Serializable value)
// Use private <code>allowUpdateFromClient</code> method instead of
// <code>mayUpdateFromClient</code> which may be overridden
// The logic below
if (!allowUpdateFromClient(key, value)) {
if (!allowUpdateFromClient(key)) {
if (isDisallowedByFilter(key)) {
return () -> {
// nop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ private String getRoutes(BeforeEnterEvent event) {
routeTemplates.forEach(
(k, v) -> routeElements.add(routeTemplateToHtml(k, v)));

routeElements.addAll(getClientRoutes(event));
routeElements.addAll(getClientRoutes());
return routeElements.stream().map(Element::outerHtml)
.collect(Collectors.joining());
}

private List<Element> getClientRoutes(BeforeEnterEvent event) {
private List<Element> getClientRoutes() {
return FrontendUtils.getClientRoutes().stream()
.filter(route -> !route.contains("$layout"))
.map(route -> route.replace("$index", ""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import com.vaadin.flow.component.page.Push;
import com.vaadin.flow.component.page.TargetElement;
import com.vaadin.flow.component.page.Viewport;
import com.vaadin.flow.di.Lookup;
import com.vaadin.flow.router.PageTitle;
import com.vaadin.flow.theme.Theme;

Expand Down Expand Up @@ -72,8 +71,6 @@ public class AppShellRegistry implements Serializable {

private Class<? extends AppShellConfigurator> appShellClass;

private final Lookup lookup;

/**
* A wrapper class for storing the {@link AppShellRegistry} instance in the
* servlet context.
Expand All @@ -92,8 +89,7 @@ public AppShellRegistryWrapper(AppShellRegistry registry) {
}
}

private AppShellRegistry(VaadinContext context) {
this.lookup = context.getAttribute(Lookup.class);
private AppShellRegistry() {
}

/**
Expand All @@ -109,8 +105,7 @@ public static AppShellRegistry getInstance(VaadinContext context) {
AppShellRegistryWrapper attribute = context
.getAttribute(AppShellRegistryWrapper.class);
if (attribute == null) {
attribute = new AppShellRegistryWrapper(
new AppShellRegistry(context));
attribute = new AppShellRegistryWrapper(new AppShellRegistry());
context.setAttribute(attribute);
}
return attribute.registry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,11 @@ protected Properties createInitParameters(Class<?> systemPropertyBaseClass,
}
}

readBuildInfo(initParameters, vaadinConfig.getVaadinContext());
readBuildInfo(initParameters);
return initParameters;
}

private void readBuildInfo(Properties initParameters,
VaadinContext context) {
private void readBuildInfo(Properties initParameters) {
String json = getTokenFileContent(initParameters::getProperty);
// Read the json and set the appropriate system properties if not
// already set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private static void addDevBundleTheme(Document document,
}

private void applyThemeVariant(Document indexDocument,
VaadinContext context) throws IOException {
VaadinContext context) {
ThemeUtils.getThemeAnnotation(context).ifPresent(theme -> {
String variant = theme.variant();
if (!variant.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,7 @@ private static UI findUiUsingResource(AtmosphereResource resource,
* The atmosphere resource to send refresh to
*
*/
private static void sendRefreshAndDisconnect(AtmosphereResource resource)
throws IOException {
private static void sendRefreshAndDisconnect(AtmosphereResource resource) {
sendNotificationAndDisconnect(resource, VaadinService
.createCriticalNotificationJSON(null, null, null, null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,13 @@ protected Optional<Runnable> handleNode(StateNode node,
.reduce(DisabledUpdateMode::mostPermissive).orElse(null);

if (isEnabled) {
return enqueuePropertyUpdate(node, invocationJson, feature,
property);
return enqueuePropertyUpdate(node, invocationJson, property);
} else if (DisabledUpdateMode.ALWAYS.equals(updateMode)) {
LoggerFactory.getLogger(MapSyncRpcHandler.class).trace(
"Property update request for disabled element is received from the client side. "
+ "Change will be applied since the property '{}' always allows its update.",
property);
return enqueuePropertyUpdate(node, invocationJson, feature,
property);
return enqueuePropertyUpdate(node, invocationJson, property);
} else {
final Logger logger = LoggerFactory
.getLogger(MapSyncRpcHandler.class);
Expand All @@ -124,8 +122,7 @@ protected Optional<Runnable> handleNode(StateNode node,
}

private Optional<Runnable> enqueuePropertyUpdate(StateNode node,
JsonObject invocationJson, Class<? extends NodeFeature> feature,
String property) {
JsonObject invocationJson, String property) {
Serializable value = JsonCodec.decodeWithoutTypeInfo(
invocationJson.get(JsonConstants.RPC_PROPERTY_VALUE));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class DAUVaadinRequestInterceptor implements VaadinRequestInterceptor,

private final String applicationName;
private final UserIdentitySupplier userIdentitySupplier;
private final DAUCustomizer dauCustomizer;

public DAUVaadinRequestInterceptor(
DeploymentConfiguration deploymentConfiguration,
Expand All @@ -34,7 +33,6 @@ public DAUVaadinRequestInterceptor(
this.userIdentitySupplier = dauCustomizer != null
? dauCustomizer.getUserIdentitySupplier()
: null;
this.dauCustomizer = dauCustomizer;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,11 +583,8 @@ protected void generateVersionsJson(JsonObject packageJson)
* defined packages.
*
* @return versions Json based on package.json
* @throws IOException
* If reading package.json fails
*/
private JsonObject generateVersionsFromPackageJson(JsonObject packageJson)
throws IOException {
private JsonObject generateVersionsFromPackageJson(JsonObject packageJson) {
JsonObject versionsJson = Json.createObject();
// if we don't have versionsJson lock package dependency versions.
final JsonObject dependencies = packageJson.getObject(DEPENDENCIES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,4 @@ private String getJsModuleAnnotationValue(Annotation jsmAnnotation)
throw new ExecutionFailedException(e);
}
}

Logger log() {
return LoggerFactory.getLogger(getClass());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ private CompletableFuture<?> generateIcon(InternalPwaIcon icon) {
});
}

private BufferedImage getBaseImage(URL logo) throws IOException {
URLConnection logoResource = logo != null ? logo.openConnection()
: BootstrapHandler.class.getResource("default-logo.png")
.openConnection();
return ImageIO.read(logoResource.getInputStream());
}

private static class InternalPwaIcon extends PwaIcon {
private final BufferedImage baseImage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected boolean shouldGenerate() {
return !getGeneratedFile().exists();
}

private void overrideIfObsolete() throws ExecutionFailedException {
private void overrideIfObsolete() {
try {
// Project's TS config
File projectTsConfigFile = new File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -98,8 +96,7 @@ public void execute() throws ExecutionFailedException {
getLogger().info(
"Creating a new development mode bundle. This can take a while but will only run when the project setup is changed, addons are added or frontend files are modified");

runFrontendBuildTool("Vite", "vite/bin/vite.js", Collections.emptyMap(),
"build");
runFrontendBuildTool("Vite", "vite/bin/vite.js", "build");

copyPackageLockToBundleFolder();

Expand All @@ -111,8 +108,7 @@ private static Logger getLogger() {
}

private void runFrontendBuildTool(String toolName, String executable,
Map<String, String> environment, String... params)
throws ExecutionFailedException {
String... params) throws ExecutionFailedException {
Logger logger = getLogger();

FrontendToolsSettings settings = new FrontendToolsSettings(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
class VersionsJsonFilter {

private final JsonObject userManagedDependencies;
private final JsonObject vaadinVersions;

private final String dependenciesKey;

Expand All @@ -42,7 +41,6 @@ class VersionsJsonFilter {
VersionsJsonFilter(JsonObject packageJson, String dependenciesKey) {
this.dependenciesKey = dependenciesKey;
userManagedDependencies = collectUserManagedDependencies(packageJson);
vaadinVersions = collectFrameworkVersions(packageJson);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,6 @@ class FullDependenciesScanner extends AbstractDependenciesScanner {

private final SerializableBiFunction<Class<?>, Class<? extends Annotation>, List<? extends Annotation>> annotationFinder;

/**
* Creates a new scanner instance which discovers all dependencies in the
* classpath.
*
* @param finder
* a class finder
* @param featureFlags
* available feature flags and their status
*/
FullDependenciesScanner(ClassFinder finder, FeatureFlags featureFlags) {
this(finder, AnnotationReader::getAnnotationsFor, featureFlags, true);
}

/**
* Creates a new scanner instance which discovers all dependencies in the
* classpath.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ private void logServletCreation(VaadinServletCreation servletCreation,
logger.warn(servletCreationMessage);
} else {
logger.info(servletCreationMessage);
ServletRegistration vaadinServlet = findVaadinServlet(
servletContext);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class WebComponentGenerator {
private static final String TOKEN_ATTRIBUTE_NAME = "_AttributeName_";
private static final String TOKEN_CHANGE_EVENT_NAME = "_ChangeEventName_";
private static final String TOKEN_PROPERTY_NAME = "_PropertyName_";
private static final String HTML_TEMPLATE = "webcomponent-template.html";
private static final String JS_TEMPLATE = "webcomponent-template.js";
private static final String SCRIPT_TEMPLATE = "webcomponent-script-template.js";
private static final String CODE_PROPERTY_DEFAULT = "webcomponent-property-default.js";
Expand Down
Loading
Loading