Skip to content

Commit 46e957b

Browse files
committed
checkstyle upgrade
1 parent c3e28cf commit 46e957b

File tree

23 files changed

+72
-105
lines changed

23 files changed

+72
-105
lines changed

handlebars-helpers/src/main/java/com/github/jknack/handlebars/helper/JodaHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ public Object apply(final ReadableInstant time, final Options options) throws IO
9696
* Any formatting options, such as the Pattern, Style, or ISO format.
9797
* @return The String result.
9898
*/
99-
protected abstract CharSequence safeApply(final ReadableInstant time, final Options options);
99+
protected abstract CharSequence safeApply(ReadableInstant time, Options options);
100100

101101
}

handlebars-helpers/src/main/java/com/github/jknack/handlebars/helper/NumberHelper.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ public Object apply(final Object context, final Options options)
101101
* The options object.
102102
* @return A string result.
103103
*/
104-
protected abstract CharSequence safeApply(final Number value,
105-
final Options options);
104+
protected abstract CharSequence safeApply(Number value, Options options);
106105

107106
/**
108107
* Apply the helper to the context.

handlebars-proto/src/main/java/com/github/jknack/handlebars/server/HbsServlet.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,16 @@ private void fancyError(final Object error, final int firstLine, final String la
296296

297297
Template template = handlebars.compile("/error-pages/error");
298298

299-
PrintWriter writer = null;
300-
writer = response.getWriter();
299+
PrintWriter writer = response.getWriter();
301300
template.apply(
302301
Context
303302
.newBuilder(error)
304303
.resolver(MapValueResolver.INSTANCE, FieldValueResolver.INSTANCE,
305304
JavaBeanValueResolver.INSTANCE)
306305
.combine("lang", lang)
307306
.combine("version", HbsServer.version)
308-
.combine("firstLine", firstLine).build()
309-
, writer);
307+
.combine("firstLine", firstLine).build(),
308+
writer);
310309

311310
IOUtils.closeQuietly(writer);
312311
}

handlebars/src/main/java/com/github/jknack/handlebars/Context.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static class CompositeValueResolver implements ValueResolver {
188188
*
189189
* @param resolvers The value resolvers.
190190
*/
191-
public CompositeValueResolver(final ValueResolver... resolvers) {
191+
CompositeValueResolver(final ValueResolver... resolvers) {
192192
this.resolvers = resolvers;
193193
}
194194

@@ -350,7 +350,7 @@ private static class PathExpressionChain implements PathExpression.Chain {
350350
*
351351
* @param path Expression path.
352352
*/
353-
public PathExpressionChain(final List<PathExpression> path) {
353+
PathExpressionChain(final List<PathExpression> path) {
354354
this.path = path;
355355
}
356356

handlebars/src/main/java/com/github/jknack/handlebars/HelperRegistry.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public interface HelperRegistry {
8686
* @param helper The helper object. Required.
8787
* @return This handlebars.
8888
*/
89-
<H> HelperRegistry registerHelperMissing(final Helper<H> helper);
89+
<H> HelperRegistry registerHelperMissing(Helper<H> helper);
9090

9191
/**
9292
* <p>

handlebars/src/main/java/com/github/jknack/handlebars/ParserFactory.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ public interface ParserFactory {
3333
* @param endDelimiter The end delimiter.
3434
* @return A new {@link Parser}.
3535
*/
36-
Parser create(final Handlebars handlebars, final String startDelimiter,
37-
final String endDelimiter);
36+
Parser create(Handlebars handlebars, String startDelimiter, String endDelimiter);
3837
}

handlebars/src/main/java/com/github/jknack/handlebars/Template.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public List<String> collectReferenceParameters() {
167167
* @param <S> The template type.
168168
* @return A new {@link TypeSafeTemplate}.
169169
*/
170-
<T, S extends TypeSafeTemplate<T>> S as(final Class<S> type);
170+
<T, S extends TypeSafeTemplate<T>> S as(Class<S> type);
171171

172172
/**
173173
* Creates a new {@link TypeSafeTemplate}.

handlebars/src/main/java/com/github/jknack/handlebars/context/FieldValueResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private static class FieldMember extends AccessibleObject implements FieldWrappe
106106
/**
107107
* @param field The field object.
108108
*/
109-
public FieldMember(final Field field) {
109+
FieldMember(final Field field) {
110110
this.field = field;
111111
}
112112

handlebars/src/main/java/com/github/jknack/handlebars/helper/I18nHelper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static class UTF8Control extends ResourceBundle.Control {
368368
*
369369
* @param charset Charset.
370370
*/
371-
public UTF8Control(final Charset charset) {
371+
UTF8Control(final Charset charset) {
372372
this.charset = charset;
373373
}
374374
@Override
@@ -402,7 +402,7 @@ public ResourceBundle newBundle(final String baseName, final Locale locale, fina
402402
* @param locale The locale.
403403
* @param classLoader The classloader.
404404
*/
405-
public DefI18nSource(final Charset charset, final String baseName, final Locale locale,
405+
DefI18nSource(final Charset charset, final String baseName, final Locale locale,
406406
final ClassLoader classLoader) {
407407
bundle = ResourceBundle.getBundle(baseName, locale, classLoader, new UTF8Control(charset));
408408
}

handlebars/src/main/java/com/github/jknack/handlebars/helper/StringHelpers.java

+11-13
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717
*/
1818
package com.github.jknack.handlebars.helper;
1919

20-
import static org.apache.commons.lang3.Validate.isTrue;
21-
import static org.apache.commons.lang3.Validate.notNull;
22-
import static org.apache.commons.lang3.Validate.validIndex;
20+
import com.github.jknack.handlebars.Handlebars;
21+
import com.github.jknack.handlebars.Helper;
22+
import com.github.jknack.handlebars.Options;
23+
import org.apache.commons.lang3.LocaleUtils;
24+
import org.apache.commons.lang3.StringUtils;
25+
import org.apache.commons.text.WordUtils;
2326

2427
import java.io.IOException;
2528
import java.math.RoundingMode;
@@ -37,13 +40,9 @@
3740
import java.util.regex.Matcher;
3841
import java.util.regex.Pattern;
3942

40-
import org.apache.commons.lang3.LocaleUtils;
41-
import org.apache.commons.lang3.StringUtils;
42-
43-
import com.github.jknack.handlebars.Handlebars;
44-
import com.github.jknack.handlebars.Helper;
45-
import com.github.jknack.handlebars.Options;
46-
import org.apache.commons.text.WordUtils;
43+
import static org.apache.commons.lang3.Validate.isTrue;
44+
import static org.apache.commons.lang3.Validate.notNull;
45+
import static org.apache.commons.lang3.Validate.validIndex;
4746

4847
/**
4948
* Commons string function helpers.
@@ -521,8 +520,7 @@ protected CharSequence safeApply(final Object context, final Options options) {
521520
* The default date styles.
522521
*/
523522
@SuppressWarnings("serial")
524-
private Map<String, Integer> styles = new HashMap<String, Integer>()
525-
{
523+
private Map<String, Integer> styles = new HashMap<String, Integer>() {
526524
{
527525
put("full", DateFormat.FULL);
528526
put("long", DateFormat.LONG);
@@ -718,7 +716,7 @@ public Object apply(final Object context, final Options options) throws IOExcept
718716
* @param options The options object.
719717
* @return A string result.
720718
*/
721-
protected abstract CharSequence safeApply(final Object context, final Options options);
719+
protected abstract CharSequence safeApply(Object context, Options options);
722720

723721
/**
724722
* Register the helper in a handlebars instance.

handlebars/src/main/java/com/github/jknack/handlebars/internal/BaseTemplate.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ abstract class BaseTemplate implements Template {
8686
*
8787
* @param handlebars A handlebars instance.
8888
*/
89-
public BaseTemplate(final Handlebars handlebars) {
89+
BaseTemplate(final Handlebars handlebars) {
9090
this.handlebars = notNull(handlebars, "The handlebars can't be null.");
9191
}
9292

@@ -184,7 +184,7 @@ public void after(final Context context, final Writer writer) throws IOException
184184
* @param writer The writer.
185185
* @throws IOException If a resource cannot be loaded.
186186
*/
187-
protected abstract void merge(final Context context, Writer writer) throws IOException;
187+
protected abstract void merge(Context context, Writer writer) throws IOException;
188188

189189
@Override
190190
public String toString() {

handlebars/src/main/java/com/github/jknack/handlebars/internal/Block.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Block extends HelperResolver {
124124
* @param hash The hash.
125125
* @param blockParams The block param names.
126126
*/
127-
public Block(final Handlebars handlebars, final String name,
127+
Block(final Handlebars handlebars, final String name,
128128
final boolean inverted, final String type, final List<Param> params,
129129
final Map<String, Param> hash, final List<String> blockParams) {
130130
super(handlebars);

handlebars/src/main/java/com/github/jknack/handlebars/internal/ForwardingTemplate.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ForwardingTemplate implements Template {
4646
*
4747
* @param template The original template. Required.
4848
*/
49-
public ForwardingTemplate(final Template template) {
49+
ForwardingTemplate(final Template template) {
5050
this.template = notNull(template, "The template is required.");
5151
}
5252

handlebars/src/main/java/com/github/jknack/handlebars/internal/HbsErrorStrategy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private class ErrorStrategyVisitor extends HbsParserBaseVisitor<String> {
7272
* @param startDelimiter The start delimiter.
7373
* @param endDelimiter The end delimiter.
7474
*/
75-
public ErrorStrategyVisitor(final String startDelimiter, final String endDelimiter) {
75+
ErrorStrategyVisitor(final String startDelimiter, final String endDelimiter) {
7676
this.startDelimiter = notEmpty(startDelimiter, "The startDelimiter can't be empty/null.");
7777
this.endDelimiter = notEmpty(endDelimiter, "The end delimiter can't be empty/null.");
7878
}

handlebars/src/main/java/com/github/jknack/handlebars/internal/HelperResolver.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ abstract class HelperResolver extends BaseTemplate {
6969
*
7070
* @param handlebars The handlebars object. Required.
7171
*/
72-
public HelperResolver(final Handlebars handlebars) {
72+
HelperResolver(final Handlebars handlebars) {
7373
super(handlebars);
7474
}
7575

handlebars/src/main/java/com/github/jknack/handlebars/internal/Partial.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Partial extends HelperResolver {
103103
* @param context The template context.
104104
* @param hash Template params
105105
*/
106-
public Partial(final Handlebars handlebars, final Template path, final String context,
106+
Partial(final Handlebars handlebars, final Template path, final String context,
107107
final Map<String, Param> hash) {
108108
super(handlebars);
109109
this.path = notNull(path, "The path is required.");

handlebars/src/main/java/com/github/jknack/handlebars/internal/TemplateBuilder.java

+20-31
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@
1717
*/
1818
package com.github.jknack.handlebars.internal;
1919

20-
import static org.apache.commons.lang3.StringUtils.isEmpty;
21-
import static org.apache.commons.lang3.Validate.notNull;
22-
23-
import java.util.ArrayList;
24-
import java.util.Collections;
25-
import java.util.LinkedHashMap;
26-
import java.util.LinkedList;
27-
import java.util.List;
28-
import java.util.Map;
29-
30-
import org.antlr.v4.runtime.CommonToken;
31-
import org.antlr.v4.runtime.Token;
32-
import org.antlr.v4.runtime.tree.ParseTree;
33-
import org.antlr.v4.runtime.tree.TerminalNode;
34-
import org.apache.commons.lang3.StringUtils;
35-
import org.apache.commons.lang3.math.NumberUtils;
36-
3720
import com.github.jknack.handlebars.Context;
3821
import com.github.jknack.handlebars.Decorator;
3922
import com.github.jknack.handlebars.Handlebars;
@@ -74,6 +57,22 @@
7457
import com.github.jknack.handlebars.internal.HbsParser.UnlessContext;
7558
import com.github.jknack.handlebars.internal.HbsParser.VarContext;
7659
import com.github.jknack.handlebars.io.TemplateSource;
60+
import org.antlr.v4.runtime.CommonToken;
61+
import org.antlr.v4.runtime.Token;
62+
import org.antlr.v4.runtime.tree.ParseTree;
63+
import org.antlr.v4.runtime.tree.TerminalNode;
64+
import org.apache.commons.lang3.StringUtils;
65+
import org.apache.commons.lang3.math.NumberUtils;
66+
67+
import java.util.ArrayList;
68+
import java.util.Collections;
69+
import java.util.LinkedHashMap;
70+
import java.util.LinkedList;
71+
import java.util.List;
72+
import java.util.Map;
73+
74+
import static org.apache.commons.lang3.StringUtils.isEmpty;
75+
import static org.apache.commons.lang3.Validate.notNull;
7776

7877
/**
7978
* Traverse the parse tree and build templates.
@@ -144,7 +143,7 @@ private static class PartialInfo {
144143
* @param handlebars A handlebars object. required.
145144
* @param source The template source. required.
146145
*/
147-
public TemplateBuilder(final Handlebars handlebars, final TemplateSource source) {
146+
TemplateBuilder(final Handlebars handlebars, final TemplateSource source) {
148147
this.handlebars = notNull(handlebars, "The handlebars can't be null.");
149148
this.source = notNull(source, "The template source is required.");
150149
}
@@ -551,6 +550,7 @@ protected void beforeApply(final Context context) {
551550
LinkedList<TemplateSource> invocationStack = context.data(Context.INVOCATION_STACK);
552551
invocationStack.addLast(source);
553552
}
553+
554554
@Override
555555
protected void afterApply(final Context context) {
556556
LinkedList<TemplateSource> invocationStack = context.data(Context.INVOCATION_STACK);
@@ -772,17 +772,6 @@ private void destroy() {
772772
this.currentText = null;
773773
}
774774

775-
/**
776-
* Report a semantic error.
777-
*
778-
* @param offendingToken The offending token.
779-
* @param message An error message.
780-
*/
781-
protected void reportError(final CommonToken offendingToken, final String message) {
782-
reportError(offendingToken, offendingToken.getLine(), offendingToken.getCharPositionInLine(),
783-
message);
784-
}
785-
786775
/**
787776
* Report a semantic error.
788777
*
@@ -791,6 +780,6 @@ protected void reportError(final CommonToken offendingToken, final String messag
791780
* @param column The offending column.
792781
* @param message An error message.
793782
*/
794-
protected abstract void reportError(final CommonToken offendingToken, final int line,
795-
final int column, final String message);
783+
protected abstract void reportError(CommonToken offendingToken, int line,
784+
int column, String message);
796785
}

handlebars/src/main/java/com/github/jknack/handlebars/internal/TemplateList.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
*/
1818
package com.github.jknack.handlebars.internal;
1919

20+
import com.github.jknack.handlebars.Context;
21+
import com.github.jknack.handlebars.Handlebars;
22+
import com.github.jknack.handlebars.TagType;
23+
import com.github.jknack.handlebars.Template;
24+
2025
import java.io.IOException;
2126
import java.io.Writer;
2227
import java.util.ArrayList;
@@ -25,11 +30,6 @@
2530
import java.util.List;
2631
import java.util.Set;
2732

28-
import com.github.jknack.handlebars.Context;
29-
import com.github.jknack.handlebars.Handlebars;
30-
import com.github.jknack.handlebars.TagType;
31-
import com.github.jknack.handlebars.Template;
32-
3333
/**
3434
* A list of templates.
3535
*
@@ -54,7 +54,7 @@ class TemplateList extends BaseTemplate implements Iterable<Template> {
5454
*
5555
* @param handlebars A handlebars instance. Required.
5656
*/
57-
public TemplateList(final Handlebars handlebars) {
57+
TemplateList(final Handlebars handlebars) {
5858
super(handlebars);
5959
}
6060

handlebars/src/main/java/com/github/jknack/handlebars/internal/Text.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Text extends BaseTemplate {
4646
* @param text The text content. Required.
4747
* @param escapeChar The escape char or empty.
4848
*/
49-
public Text(final Handlebars handlebars, final String text, final String escapeChar) {
49+
Text(final Handlebars handlebars, final String text, final String escapeChar) {
5050
super(handlebars);
5151
int length = text.length();
5252
this.text = new char[length];
@@ -60,7 +60,7 @@ public Text(final Handlebars handlebars, final String text, final String escapeC
6060
* @param handlebars A handlebars instance. Required.
6161
* @param text The text content. Required.
6262
*/
63-
public Text(final Handlebars handlebars, final String text) {
63+
Text(final Handlebars handlebars, final String text) {
6464
this(handlebars, text, "");
6565
}
6666

handlebars/src/main/java/com/github/jknack/handlebars/internal/Variable.java

+2-16
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ class Variable extends HelperResolver {
106106
* @param params The variable's parameters. Required.
107107
* @param hash The variable's hash. Required.
108108
*/
109-
public Variable(final Handlebars handlebars, final String name,
110-
final TagType type, final List<Param> params,
111-
final Map<String, Param> hash) {
109+
Variable(final Handlebars handlebars, final String name,
110+
final TagType type, final List<Param> params, final Map<String, Param> hash) {
112111
super(handlebars);
113112
this.name = name.trim();
114113
this.path = PathCompiler.compile(name, handlebars.parentScopeResolution());
@@ -124,19 +123,6 @@ public Variable(final Handlebars handlebars, final String name,
124123
postInit();
125124
}
126125

127-
/**
128-
* Creates a new {@link Variable}.
129-
*
130-
* @param handlebars The handlebars instance.
131-
* @param name The variable's name. Required.
132-
* @param type The variable's type. Required.
133-
*/
134-
@SuppressWarnings("unchecked")
135-
public Variable(final Handlebars handlebars, final String name, final TagType type) {
136-
this(handlebars, name, type, Collections.EMPTY_LIST,
137-
Collections.EMPTY_MAP);
138-
}
139-
140126
/**
141127
* Apply any pending initialization.
142128
*/

0 commit comments

Comments
 (0)