Skip to content

Commit

Permalink
Switch to Set.of(...) and move the "new HashSet(...)" to the check me…
Browse files Browse the repository at this point in the history
…thod in the TemplateCompiler.

"new HashSet(...)" is needed because "Set.of(...)" is immutable.

Fixes: SE-13618
  • Loading branch information
oolscireum committed Oct 1, 2024
1 parent 779d6d0 commit d01ce41
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private void parseAttributes(TagHandler handler) {
* @param attributes the set of attributes which were parsed
*/
private void checkMissingAttributes(TagHandler handler, Set<String> attributes) {
Set<String> missingAttributes = handler.getRequiredAttributeNames();
Set<String> missingAttributes = new HashSet<>(handler.getRequiredAttributeNames());
missingAttributes.removeAll(attributes);
if (!missingAttributes.isEmpty()) {
missingAttributes.forEach(attr -> context.error(reader.current(),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/ArgTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME, PARAM_TYPE));
return Set.of(PARAM_NAME, PARAM_TYPE);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/BlockTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME));
return Set.of(PARAM_NAME);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/DefineTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME));
return Set.of(PARAM_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(ATTR_TEMPLATE));
return Set.of(ATTR_TEMPLATE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(ATTR_TARGET));
return Set.of(ATTR_TARGET);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME));
return Set.of(PARAM_NAME);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/ForTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_ITEMS, PARAM_TYPE, PARAM_VAR));
return Set.of(PARAM_ITEMS, PARAM_TYPE, PARAM_VAR);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/IfTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of("test"));
return Set.of("test");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(ATTR_NAME));
return Set.of(ATTR_NAME);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/LocalTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME, PARAM_VALUE));
return Set.of(PARAM_NAME, PARAM_VALUE);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/PragmaTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME));
return Set.of(PARAM_NAME);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/RenderTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(PARAM_NAME));
return Set.of(PARAM_NAME);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/SassTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of(SOURCE_ATTRIBUTE));
return Set.of(SOURCE_ATTRIBUTE);
}
}
2 changes: 1 addition & 1 deletion src/main/java/sirius/pasta/tagliatelle/tags/SwitchTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ public Class<?> getExpectedAttributeType(String name) {

@Override
public Set<String> getRequiredAttributeNames() {
return new HashSet<>(List.of("test"));
return Set.of("test");
}
}

0 comments on commit d01ce41

Please sign in to comment.