diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-07-08 12:04:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 12:04:58 +0300 |
commit | 3afe45849edc79f0e7b371a7fd3ef209292dce79 (patch) | |
tree | 2934d3ca30286b3480d7c6b4c5d5bfc99aa196db /client-compiler | |
parent | 347d36dcbccb07f1dd46f17ea5be6fceecc755cb (diff) | |
download | vaadin-framework-3afe45849edc79f0e7b371a7fd3ef209292dce79.tar.gz vaadin-framework-3afe45849edc79f0e7b371a7fd3ef209292dce79.zip |
Code cleanup (#12333)
- removed unused private methods
- removed unused private variables
- removed unnecessary initializations
- removed unnecessary substring(0)
- removed inner assignments
- renamed private methods that started with upper case
- renamed static final variables to use upper case
- converted to use non-deprecated options
- suppressed unavoidable warnings
- divided long Strings to multiple lines
- added missing types
- added missing JavaDoc parameters
- formatting
- updated comments & JavaDocs
Diffstat (limited to 'client-compiler')
3 files changed, 17 insertions, 17 deletions
diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java index 1a86cb8099..2a517ba07d 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/AcceptCriteriaFactoryGenerator.java @@ -39,6 +39,7 @@ import com.vaadin.shared.ui.dd.AcceptCriterion; * classpath. * */ +@SuppressWarnings("deprecation") public class AcceptCriteriaFactoryGenerator extends Generator { private String packageName; @@ -75,8 +76,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator { */ private void generateClass(TreeLogger logger, GeneratorContext context) { // get print writer that receives the source code - PrintWriter printWriter = null; - printWriter = context.tryCreate(logger, packageName, className); + PrintWriter printWriter = context.tryCreate(logger, packageName, + className); // print writer if null, source code has ALREADY been generated, // return (WidgetMap is equal to all permutations atm) if (printWriter == null) { @@ -86,8 +87,8 @@ public class AcceptCriteriaFactoryGenerator extends Generator { Date date = new Date(); // init composer, set class properties, create source writer - ClassSourceFileComposerFactory composer = null; - composer = new ClassSourceFileComposerFactory(packageName, className); + ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory( + packageName, className); composer.addImport("com.google.gwt.core.client.GWT"); composer.setSuperclass( "com.vaadin.client.ui.dd.VAcceptCriterionFactory"); diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java index 2943a00173..342149ac70 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/ConnectorBundleLoaderFactory.java @@ -511,16 +511,16 @@ public class ConnectorBundleLoaderFactory extends Generator { writeInvokers(logger, w, bundle); writeParamTypes(w, bundle); writeProxys(w, bundle); - writeMethodAttributes(logger, w, bundle); + writeMethodAttributes(w, bundle); w.println("%s(store);", loadNativeJsMethodName); // Must use Java code to generate Type data (because of Type[]), doing // this after the JS property data has been initialized - writePropertyTypes(logger, w, bundle); + writePropertyTypes(w, bundle); writeSerializers(logger, w, bundle); writePresentationTypes(w, bundle); - writeDelegateToWidget(logger, w, bundle); + writeDelegateToWidget(w, bundle); writeOnStateChangeHandlers(logger, w, bundle); } @@ -652,8 +652,8 @@ public class ConnectorBundleLoaderFactory extends Generator { } } - private void writeDelegateToWidget(TreeLogger logger, - SplittingSourceWriter w, ConnectorBundle bundle) { + private void writeDelegateToWidget(SplittingSourceWriter w, + ConnectorBundle bundle) { Map<JClassType, Set<Property>> needsDelegateToWidget = bundle .getNeedsDelegateToWidget(); for (Entry<JClassType, Set<Property>> entry : needsDelegateToWidget @@ -713,7 +713,7 @@ public class ConnectorBundleLoaderFactory extends Generator { } } - private void writePropertyTypes(TreeLogger logger, SplittingSourceWriter w, + private void writePropertyTypes(SplittingSourceWriter w, ConnectorBundle bundle) { Set<Property> properties = bundle.getNeedsProperty(); for (Property property : properties) { @@ -729,8 +729,8 @@ public class ConnectorBundleLoaderFactory extends Generator { } } - private void writeMethodAttributes(TreeLogger logger, - SplittingSourceWriter w, ConnectorBundle bundle) { + private void writeMethodAttributes(SplittingSourceWriter w, + ConnectorBundle bundle) { for (Entry<JClassType, Map<JMethod, Set<MethodAttribute>>> typeEntry : bundle .getMethodAttributes().entrySet()) { JClassType type = typeEntry.getKey(); @@ -879,7 +879,7 @@ public class ConnectorBundleLoaderFactory extends Generator { TreeLogger methodLogger = typeLogger.branch(Type.DEBUG, "Invoking " + method.getName() + " using jsni"); // Must use JSNI to access non-public methods - writeJsniInvoker(methodLogger, w, type, method); + writeJsniInvoker(methodLogger, w, method); } w.println(");"); @@ -890,7 +890,7 @@ public class ConnectorBundleLoaderFactory extends Generator { } private void writeJsniInvoker(TreeLogger logger, SplittingSourceWriter w, - JClassType type, JMethod method) throws UnableToCompleteException { + JMethod method) throws UnableToCompleteException { w.println("new JsniInvoker() {"); w.indent(); diff --git a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java index 910e1f87f2..b4a3fdc613 100644 --- a/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java +++ b/client-compiler/src/main/java/com/vaadin/server/widgetsetutils/metadata/MethodProperty.java @@ -53,7 +53,7 @@ public class MethodProperty extends Property { Set<String> getters = new HashSet<>(); List<JMethod> setters = getSetters(type, getters); for (JMethod setter : setters) { - String getter = findGetter(type, setter); + String getter = findGetter(setter); properties.add(new MethodProperty(setter.getEnclosingType(), setter, getters.contains(getter) ? getter : null)); } @@ -118,8 +118,7 @@ public class MethodProperty extends Property { } - private static String findGetter(JClassType beanType, - JMethod setterMethod) { + private static String findGetter(JMethod setterMethod) { JType setterParameterType = setterMethod.getParameterTypes()[0]; String fieldName = setterMethod.getName().substring(3); if (setterParameterType.getQualifiedSourceName() |