Skip to content
Merged
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
13 changes: 11 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
<parent>
<groupId>com.hubspot</groupId>
<artifactId>basepom</artifactId>
<version>59.11</version>
<version>63.4</version>
</parent>

<groupId>com.hubspot.jinjava</groupId>
<artifactId>jinjava</artifactId>
<version>2.8.1-SNAPSHOT</version>

<name>${project.groupId}:${project.artifactId}</name>
<description>Jinja templating engine implemented in Java</description>

<properties>
Expand Down Expand Up @@ -339,6 +341,13 @@

<url>https://github.com/HubSpot/jinjava</url>

<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

<developers>
<developer>
<id>jaredstehler</id>
Expand All @@ -359,7 +368,7 @@

<profiles>
<profile>
<id>basepom.oss-release</id>
<id>basepom.central-release</id>
<properties>
<basepom.check.skip-pom-lint>true</basepom.check.skip-pom-lint>
<basepom.check.skip-dependency-management>true</basepom.check.skip-dependency-management>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/hubspot/jinjava/el/ext/ExtendedScanner.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.hubspot.jinjava.el.ext;

import de.odysseus.el.tree.impl.Scanner;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
Expand Down Expand Up @@ -58,6 +59,10 @@ protected boolean isWhitespace(char c) {
}
}

@SuppressFBWarnings(
value = "HSM_HIDING_METHOD",
justification = "Purposefully overriding to use static method instance of this class."
)
protected static void addKeyToken(Token token) {
try {
ADD_KEY_TOKEN_METHOD.invoke(null, token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import com.hubspot.jinjava.util.RenderLimitUtils;
import com.hubspot.jinjava.util.Variable;
import com.hubspot.jinjava.util.WhitespaceUtils;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -541,10 +540,6 @@ private boolean isEagerExtendsTag(TagNode node) {
);
}

@SuppressFBWarnings(
justification = "Iterables#getFirst DOES allow null for default value",
value = "NP_NONNULL_PARAM_VIOLATION"
)
private void resolveBlockStubs(OutputList output, Stack<String> blockNames) {
for (BlockPlaceholderOutputNode blockPlaceholder : output.getBlocks()) {
if (!blockNames.contains(blockPlaceholder.getBlockName())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.hubspot.jinjava.doc.annotations.JinjavaParam;
import com.hubspot.jinjava.interpret.InvalidInputException;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -69,10 +68,6 @@ public Object filter(Object var, JinjavaInterpreter interpreter, String... args)
return filter(var, interpreter, args, Collections.emptyMap());
}

@SuppressFBWarnings(
value = "UC_USELESS_OBJECT",
justification = "FB bug prevents forEach() method call counting `namedArgs` as used (fixed in next release)"
)
public Object filter(
Object var,
JinjavaInterpreter interpreter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Map.Entry;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.function.Supplier;
Expand All @@ -38,7 +39,7 @@
public class EagerMacroFunction extends MacroFunction {

private AtomicInteger callCount = new AtomicInteger();
private boolean reconstructing = false;
private AtomicBoolean reconstructing = new AtomicBoolean();

public EagerMacroFunction(
List<Node> content,
Expand Down Expand Up @@ -70,7 +71,7 @@ public Object doEvaluate(
List<Object> varArgs
) {
JinjavaInterpreter interpreter = JinjavaInterpreter.getCurrent();
if (reconstructing) {
if (reconstructing.get()) {
try (
InterpreterScopeClosable c = interpreter.enterScope();
AutoCloseableImpl<Optional<String>> importFile = getImportFileWithWrapper(
Expand Down Expand Up @@ -282,7 +283,7 @@ public String reconstructImage(String fullName) {
}

try (InterpreterScopeClosable c = interpreter.enterScope()) {
reconstructing = true;
reconstructing.set(true);
String evaluation = (String) evaluate(
getArguments().stream().map(arg -> DeferredMacroValueImpl.instance()).toArray()
);
Expand All @@ -300,7 +301,7 @@ public String reconstructImage(String fullName) {
}
result.append(super.reconstructImage());
} finally {
reconstructing = false;
reconstructing.set(false);
interpreter
.getContext()
.put(Context.DEFERRED_IMPORT_RESOURCE_PATH_KEY, currentDeferredImportResource);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.hubspot.jinjava.mode;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class NonRevertingEagerExecutionMode extends EagerExecutionMode {

private static final ExecutionMode INSTANCE = new NonRevertingEagerExecutionMode();

protected NonRevertingEagerExecutionMode() {}

@SuppressFBWarnings(
value = "HSM_HIDING_METHOD",
justification = "Purposefully overriding to return static instance of this class."
)
public static ExecutionMode instance() {
return INSTANCE;
}
Expand Down