Skip to content

Commit cd61b17

Browse files
authored
Cleanup redundant specification of type parameters (#320)
Signed-off-by: Sven Strickroth <[email protected]>
1 parent 3c86741 commit cd61b17

16 files changed

+28
-28
lines changed

src/main/java/org/owasp/html/CssTokens.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ void lex() {
427427
sb.setLength(0);
428428
if (pos == cssLimit) { return; }
429429

430-
tokenTypes = new ArrayList<TokenType>();
430+
tokenTypes = new ArrayList<>();
431431

432432
@SuppressWarnings("hiding") // final
433433
String css = this.css;

src/main/java/org/owasp/html/Handler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public interface Handler<T> {
4343
void handle(T x);
4444

4545
/** A handler that does nothing given any input. */
46-
public static final Handler<Object> DO_NOTHING = new Handler<Object>() {
46+
public static final Handler<Object> DO_NOTHING = new Handler<>() {
4747
public void handle(Object x) {
4848
// Really, do nothing.
4949
}

src/main/java/org/owasp/html/HtmlChangeReporter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public HtmlChangeReporter(
6262
HtmlStreamEventReceiver renderer,
6363
HtmlChangeListener<? super T> listener, @Nullable T context) {
6464
this.output = new OutputChannel(renderer);
65-
this.input = new InputChannel<T>(output, listener, context);
65+
this.input = new InputChannel<>(output, listener, context);
6666
}
6767

6868
/**
@@ -149,7 +149,7 @@ public void text(String textChunk) {
149149
private static final class OutputChannel implements HtmlStreamEventReceiver {
150150
private final HtmlStreamEventReceiver renderer;
151151
String expectedElementName;
152-
Set<String> expectedAttrNames = new LinkedHashSet<String>();
152+
Set<String> expectedAttrNames = new LinkedHashSet<>();
153153

154154
OutputChannel(HtmlStreamEventReceiver renderer) {
155155
this.renderer = renderer;

src/main/java/org/owasp/html/HtmlElementTables.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ public enum TextContentModelBit {
721721
}
722722

723723
static final Comparator<int[]> COMPARE_BY_ZEROTH =
724-
new Comparator<int[]>() {
724+
new Comparator<>() {
725725
public int compare(int[] a, int[] b) {
726726
return Integer.compare(a[0], b[0]);
727727
}

src/main/java/org/owasp/html/HtmlEntities.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2293,7 +2293,7 @@ final class HtmlEntities {
22932293

22942294
final Map<String, String> entityNameToCodePointMap = Collections.unmodifiableMap(builder);
22952295

2296-
ENTITY_TRIE = new Trie<String>(entityNameToCodePointMap);
2296+
ENTITY_TRIE = new Trie<>(entityNameToCodePointMap);
22972297
LONGEST_ENTITY_NAME = longestEntityName;
22982298
}
22992299

src/main/java/org/owasp/html/HtmlPolicyBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ public String apply(String elementName, List<String> attrs) {
10381038
relValue = DEFAULT_RELS_ON_TARGETTED_LINKS_STR;
10391039
} else {
10401040
StringBuilder sb = new StringBuilder();
1041-
Set<String> present = new HashSet<String>();
1041+
Set<String> present = new HashSet<>();
10421042
if (relIndex >= 0) {
10431043
// Preserve values that are not explicitly skipped.
10441044
String rels = attrs.get(relIndex);

src/main/java/org/owasp/html/Joinable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static abstract class JoinHelper<T, SJ extends Joinable<SJ>> {
4343
final T zeroValue;
4444
final T identityValue;
4545
private Map<JoinStrategy<SJ>, Set<SJ>> requireSpecialJoining;
46-
private Set<T> uniq = new LinkedHashSet<T>();
46+
private Set<T> uniq = new LinkedHashSet<>();
4747

4848
JoinHelper(
4949
Class<T> baseType,
@@ -74,11 +74,11 @@ void unroll(T x) {
7474
JoinStrategy<SJ> strategy = sj.getJoinStrategy();
7575

7676
if (requireSpecialJoining == null) {
77-
requireSpecialJoining = new LinkedHashMap<Joinable.JoinStrategy<SJ>, Set<SJ>>();
77+
requireSpecialJoining = new LinkedHashMap<>();
7878
}
7979
Set<SJ> toJoinTogether = requireSpecialJoining.get(strategy);
8080
if (toJoinTogether == null) {
81-
toJoinTogether = new LinkedHashSet<SJ>();
81+
toJoinTogether = new LinkedHashSet<>();
8282
requireSpecialJoining.put(strategy, toJoinTogether);
8383
}
8484

src/main/java/org/owasp/html/PolicyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public <CTX> HtmlSanitizer.Policy apply(
9696
if (listener == null) {
9797
return apply(out);
9898
} else {
99-
HtmlChangeReporter<CTX> r = new HtmlChangeReporter<CTX>(
99+
HtmlChangeReporter<CTX> r = new HtmlChangeReporter<>(
100100
out, listener, context);
101101
r.setPolicy(apply(r.getWrappedRenderer()));
102102
return r.getWrappedPolicy();

src/main/java/org/owasp/html/Trie.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ private Trie(
106106
char ch = elements.get(i).getKey().charAt(depth);
107107
if (ch != lastCh) {
108108
childMap[childIndex] = lastCh;
109-
children[childIndex++] = new Trie<T>(
109+
children[childIndex++] = new Trie<>(
110110
elements, depth + 1, childStart, i);
111111
childStart = i;
112112
lastCh = ch;
113113
}
114114
}
115115
childMap[childIndex] = lastCh;
116-
children[childIndex++] = new Trie<T>(elements, depth + 1, childStart, end);
116+
children[childIndex++] = new Trie<>(elements, depth + 1, childStart, end);
117117
}
118118

119119
/** Does this node correspond to a complete string in the input set. */
@@ -151,8 +151,8 @@ public boolean contains(char ch) {
151151

152152
private static <U> List<Map.Entry<String, U>> sortedUniqEntries(
153153
Map<String, U> m) {
154-
return new ArrayList<Map.Entry<String, U>>(
155-
new TreeMap<String, U>(m).entrySet());
154+
return new ArrayList<>(
155+
new TreeMap<>(m).entrySet());
156156
}
157157

158158
private static final char[] ZERO_CHARS = new char[0];

src/main/java/org/owasp/html/examples/UrlTextExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class UrlTextExample {
4949

5050
/** An event receiver that emits the domain of a link or image after it. */
5151
static class AppendDomainAfterText extends HtmlStreamEventReceiverWrapper {
52-
private final List<String> pendingText = new ArrayList<String>();
52+
private final List<String> pendingText = new ArrayList<>();
5353

5454
AppendDomainAfterText(HtmlStreamEventReceiver underlying) {
5555
super(underlying);

0 commit comments

Comments
 (0)