Skip to content

Commit

Permalink
Use the shaded CF dataflow jar
Browse files Browse the repository at this point in the history
Fixes #1499

GOOGLE:

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=294723271
  • Loading branch information
cushon authored and kluever committed Feb 17, 2020
1 parent 0435d28 commit b81bf44
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 159 deletions.
2 changes: 1 addition & 1 deletion check_api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dependency>
<!-- GPLv2 with Classpath Exception -->
<groupId>org.checkerframework</groupId>
<artifactId>dataflow</artifactId>
<artifactId>dataflow-shaded</artifactId>
<version>${dataflow.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import org.checkerframework.javacutil.AnnotationUtils;

/** An Error Prone compiler that implements {@link javax.tools.JavaCompiler}. */
public class BaseErrorProneJavaCompiler implements JavaCompiler {
Expand Down Expand Up @@ -91,7 +90,6 @@ public CompilationTask getTask(
if (refactoringCollection[0] != null) {
task.addTaskListener(new RefactoringTask(task.getContext(), refactoringCollection[0]));
}
task.addTaskListener(new CFCacheClearingListener());
return task;
}

Expand Down Expand Up @@ -268,21 +266,4 @@ public void finished(TaskEvent event) {
}
}
}

/**
* A listener that clears out a global Checker Framework cache at the end of compilation. This
* prevents a memory leak in cases where the compiler is being run in memory as part of a daemon
* process.
*
* <p>See https://github.com/typetools/checker-framework/issues/1482
*/
private static class CFCacheClearingListener implements TaskListener {

@Override
public void finished(TaskEvent e) {
if (e.getKind() == Kind.COMPILATION) {
AnnotationUtils.clear();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public MaskedClassLoader(ClassLoader parent) {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (name.startsWith("com.google.errorprone.")
|| name.startsWith("org.checkerframework.dataflow.")) {
|| name.startsWith("org.checkerframework.shaded.dataflow.")) {
return Class.forName(name);
} else {
throw new ClassNotFoundException(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.Modifier;
import org.checkerframework.dataflow.cfg.node.AssignmentNode;
import org.checkerframework.dataflow.cfg.node.FieldAccessNode;
import org.checkerframework.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.dataflow.cfg.node.Node;
import org.checkerframework.dataflow.cfg.node.VariableDeclarationNode;
import org.checkerframework.javacutil.TreeUtils;
import org.checkerframework.shaded.dataflow.cfg.node.AssignmentNode;
import org.checkerframework.shaded.dataflow.cfg.node.FieldAccessNode;
import org.checkerframework.shaded.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.shaded.dataflow.cfg.node.Node;
import org.checkerframework.shaded.dataflow.cfg.node.VariableDeclarationNode;
import org.checkerframework.shaded.javacutil.TreeUtils;

/**
* A sequence of field names or autovalue accessors, along with a receiver: either a variable or a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Nullable;
import org.checkerframework.dataflow.analysis.AbstractValue;
import org.checkerframework.dataflow.analysis.FlowExpressions;
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.dataflow.cfg.CFGVisualizer;
import org.checkerframework.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.shaded.dataflow.analysis.AbstractValue;
import org.checkerframework.shaded.dataflow.analysis.FlowExpressions;
import org.checkerframework.shaded.dataflow.analysis.Store;
import org.checkerframework.shaded.dataflow.cfg.CFGVisualizer;
import org.checkerframework.shaded.dataflow.cfg.node.LocalVariableNode;

/**
* Immutable map from local variables or heap access paths to their {@link AbstractValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import com.sun.source.util.TreePath;
import com.sun.tools.javac.util.Context;
import javax.annotation.Nullable;
import org.checkerframework.dataflow.constantpropagation.Constant;
import org.checkerframework.dataflow.constantpropagation.ConstantPropagationTransfer;
import org.checkerframework.shaded.dataflow.constantpropagation.Constant;
import org.checkerframework.shaded.dataflow.constantpropagation.ConstantPropagationTransfer;

/** An interface to the constant propagation analysis. */
public final class ConstantPropagationAnalysis {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@
import com.sun.tools.javac.util.Context;
import javax.annotation.Nullable;
import javax.annotation.processing.ProcessingEnvironment;
import org.checkerframework.dataflow.analysis.AbstractValue;
import org.checkerframework.dataflow.analysis.Analysis;
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.dataflow.analysis.TransferFunction;
import org.checkerframework.dataflow.cfg.CFGBuilder;
import org.checkerframework.dataflow.cfg.ControlFlowGraph;
import org.checkerframework.dataflow.cfg.UnderlyingAST;
import org.checkerframework.shaded.dataflow.analysis.AbstractValue;
import org.checkerframework.shaded.dataflow.analysis.Analysis;
import org.checkerframework.shaded.dataflow.analysis.Store;
import org.checkerframework.shaded.dataflow.analysis.TransferFunction;
import org.checkerframework.shaded.dataflow.cfg.CFGBuilder;
import org.checkerframework.shaded.dataflow.cfg.ControlFlowGraph;
import org.checkerframework.shaded.dataflow.cfg.UnderlyingAST;

/**
* Provides a wrapper around {@link org.checkerframework.dataflow.analysis.Analysis}.
* Provides a wrapper around {@link org.checkerframework.shaded.dataflow.analysis.Analysis}.
*
* @author [email protected] (Konstantin Weitz)
*/
Expand Down Expand Up @@ -76,12 +76,11 @@ public static interface Result<
new CacheLoader<AnalysisParams, Analysis<?, ?, ?>>() {
@Override
public Analysis<?, ?, ?> load(AnalysisParams key) {
final ProcessingEnvironment env = key.environment();
final ControlFlowGraph cfg = key.cfg();
final TransferFunction<?, ?> transfer = key.transferFunction();

@SuppressWarnings({"unchecked", "rawtypes"})
final Analysis<?, ?, ?> analysis = new Analysis(transfer, env);
final Analysis<?, ?, ?> analysis = new Analysis(transfer);
analysis.performAnalysis(cfg);
return analysis;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
import java.util.Map;
import javax.annotation.Nullable;
import javax.lang.model.element.Element;
import org.checkerframework.dataflow.analysis.AbstractValue;
import org.checkerframework.dataflow.analysis.FlowExpressions;
import org.checkerframework.dataflow.analysis.Store;
import org.checkerframework.dataflow.cfg.CFGVisualizer;
import org.checkerframework.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.javacutil.trees.DetachedVarSymbol;
import org.checkerframework.shaded.dataflow.analysis.AbstractValue;
import org.checkerframework.shaded.dataflow.analysis.FlowExpressions;
import org.checkerframework.shaded.dataflow.analysis.Store;
import org.checkerframework.shaded.dataflow.cfg.CFGVisualizer;
import org.checkerframework.shaded.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.shaded.javacutil.trees.DetachedVarSymbol;

/**
* Immutable map from each local variable to its {@link AbstractValue}. Note that, while the
Expand Down Expand Up @@ -72,8 +72,8 @@ public V valueOfLocalVariable(LocalVariableNode node, V defaultValue) {
/**
* Returns the value for the given variable. {@code element} must come from a call to {@link
* LocalVariableNode#getElement()} or {@link
* org.checkerframework.javacutil.TreeUtils#elementFromDeclaration} ({@link
* org.checkerframework.dataflow.cfg.node.VariableDeclarationNode#getTree()}).
* org.checkerframework.shaded.javacutil.TreeUtils#elementFromDeclaration} ({@link
* org.checkerframework.shaded.dataflow.cfg.node.VariableDeclarationNode#getTree()}).
*/
@Nullable
private V getInformation(Element element) {
Expand All @@ -100,8 +100,8 @@ public static final class Builder<V extends AbstractValue<V>> {
/**
* Sets the value for the given variable. {@code element} must come from a call to {@link
* LocalVariableNode#getElement()} or {@link
* org.checkerframework.javacutil.TreeUtils#elementFromDeclaration} ({@link
* org.checkerframework.dataflow.cfg.node.VariableDeclarationNode#getTree()}).
* org.checkerframework.shaded.javacutil.TreeUtils#elementFromDeclaration} ({@link
* org.checkerframework.shaded.dataflow.cfg.node.VariableDeclarationNode#getTree()}).
*/
public Builder<V> setInformation(Element element, V value) {
checkElementType(element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.errorprone.dataflow;

import org.checkerframework.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.shaded.dataflow.cfg.node.LocalVariableNode;

/** Read-only access to {@link LocalStore} for convenience. */
public interface LocalVariableValues<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,82 +29,82 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.checkerframework.dataflow.analysis.ConditionalTransferResult;
import org.checkerframework.dataflow.analysis.RegularTransferResult;
import org.checkerframework.dataflow.analysis.TransferFunction;
import org.checkerframework.dataflow.analysis.TransferInput;
import org.checkerframework.dataflow.analysis.TransferResult;
import org.checkerframework.dataflow.cfg.UnderlyingAST;
import org.checkerframework.dataflow.cfg.node.ArrayAccessNode;
import org.checkerframework.dataflow.cfg.node.ArrayCreationNode;
import org.checkerframework.dataflow.cfg.node.ArrayTypeNode;
import org.checkerframework.dataflow.cfg.node.AssertionErrorNode;
import org.checkerframework.dataflow.cfg.node.AssignmentNode;
import org.checkerframework.dataflow.cfg.node.BitwiseAndNode;
import org.checkerframework.dataflow.cfg.node.BitwiseComplementNode;
import org.checkerframework.dataflow.cfg.node.BitwiseOrNode;
import org.checkerframework.dataflow.cfg.node.BitwiseXorNode;
import org.checkerframework.dataflow.cfg.node.BooleanLiteralNode;
import org.checkerframework.dataflow.cfg.node.CaseNode;
import org.checkerframework.dataflow.cfg.node.CharacterLiteralNode;
import org.checkerframework.dataflow.cfg.node.ClassDeclarationNode;
import org.checkerframework.dataflow.cfg.node.ClassNameNode;
import org.checkerframework.dataflow.cfg.node.ConditionalAndNode;
import org.checkerframework.dataflow.cfg.node.ConditionalNotNode;
import org.checkerframework.dataflow.cfg.node.ConditionalOrNode;
import org.checkerframework.dataflow.cfg.node.DoubleLiteralNode;
import org.checkerframework.dataflow.cfg.node.EqualToNode;
import org.checkerframework.dataflow.cfg.node.ExplicitThisLiteralNode;
import org.checkerframework.dataflow.cfg.node.FieldAccessNode;
import org.checkerframework.dataflow.cfg.node.FloatLiteralNode;
import org.checkerframework.dataflow.cfg.node.FloatingDivisionNode;
import org.checkerframework.dataflow.cfg.node.FloatingRemainderNode;
import org.checkerframework.dataflow.cfg.node.FunctionalInterfaceNode;
import org.checkerframework.dataflow.cfg.node.GreaterThanNode;
import org.checkerframework.dataflow.cfg.node.GreaterThanOrEqualNode;
import org.checkerframework.dataflow.cfg.node.ImplicitThisLiteralNode;
import org.checkerframework.dataflow.cfg.node.InstanceOfNode;
import org.checkerframework.dataflow.cfg.node.IntegerDivisionNode;
import org.checkerframework.dataflow.cfg.node.IntegerLiteralNode;
import org.checkerframework.dataflow.cfg.node.IntegerRemainderNode;
import org.checkerframework.dataflow.cfg.node.LambdaResultExpressionNode;
import org.checkerframework.dataflow.cfg.node.LeftShiftNode;
import org.checkerframework.dataflow.cfg.node.LessThanNode;
import org.checkerframework.dataflow.cfg.node.LessThanOrEqualNode;
import org.checkerframework.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.dataflow.cfg.node.LongLiteralNode;
import org.checkerframework.dataflow.cfg.node.MarkerNode;
import org.checkerframework.dataflow.cfg.node.MethodAccessNode;
import org.checkerframework.dataflow.cfg.node.MethodInvocationNode;
import org.checkerframework.dataflow.cfg.node.NarrowingConversionNode;
import org.checkerframework.dataflow.cfg.node.Node;
import org.checkerframework.dataflow.cfg.node.NotEqualNode;
import org.checkerframework.dataflow.cfg.node.NullChkNode;
import org.checkerframework.dataflow.cfg.node.NullLiteralNode;
import org.checkerframework.dataflow.cfg.node.NumericalAdditionNode;
import org.checkerframework.dataflow.cfg.node.NumericalMinusNode;
import org.checkerframework.dataflow.cfg.node.NumericalMultiplicationNode;
import org.checkerframework.dataflow.cfg.node.NumericalPlusNode;
import org.checkerframework.dataflow.cfg.node.NumericalSubtractionNode;
import org.checkerframework.dataflow.cfg.node.ObjectCreationNode;
import org.checkerframework.dataflow.cfg.node.PackageNameNode;
import org.checkerframework.dataflow.cfg.node.ParameterizedTypeNode;
import org.checkerframework.dataflow.cfg.node.PrimitiveTypeNode;
import org.checkerframework.dataflow.cfg.node.ReturnNode;
import org.checkerframework.dataflow.cfg.node.ShortLiteralNode;
import org.checkerframework.dataflow.cfg.node.SignedRightShiftNode;
import org.checkerframework.dataflow.cfg.node.StringConcatenateAssignmentNode;
import org.checkerframework.dataflow.cfg.node.StringConcatenateNode;
import org.checkerframework.dataflow.cfg.node.StringConversionNode;
import org.checkerframework.dataflow.cfg.node.StringLiteralNode;
import org.checkerframework.dataflow.cfg.node.SuperNode;
import org.checkerframework.dataflow.cfg.node.SynchronizedNode;
import org.checkerframework.dataflow.cfg.node.TernaryExpressionNode;
import org.checkerframework.dataflow.cfg.node.ThrowNode;
import org.checkerframework.dataflow.cfg.node.TypeCastNode;
import org.checkerframework.dataflow.cfg.node.UnsignedRightShiftNode;
import org.checkerframework.dataflow.cfg.node.VariableDeclarationNode;
import org.checkerframework.dataflow.cfg.node.WideningConversionNode;
import org.checkerframework.shaded.dataflow.analysis.ConditionalTransferResult;
import org.checkerframework.shaded.dataflow.analysis.RegularTransferResult;
import org.checkerframework.shaded.dataflow.analysis.TransferFunction;
import org.checkerframework.shaded.dataflow.analysis.TransferInput;
import org.checkerframework.shaded.dataflow.analysis.TransferResult;
import org.checkerframework.shaded.dataflow.cfg.UnderlyingAST;
import org.checkerframework.shaded.dataflow.cfg.node.ArrayAccessNode;
import org.checkerframework.shaded.dataflow.cfg.node.ArrayCreationNode;
import org.checkerframework.shaded.dataflow.cfg.node.ArrayTypeNode;
import org.checkerframework.shaded.dataflow.cfg.node.AssertionErrorNode;
import org.checkerframework.shaded.dataflow.cfg.node.AssignmentNode;
import org.checkerframework.shaded.dataflow.cfg.node.BitwiseAndNode;
import org.checkerframework.shaded.dataflow.cfg.node.BitwiseComplementNode;
import org.checkerframework.shaded.dataflow.cfg.node.BitwiseOrNode;
import org.checkerframework.shaded.dataflow.cfg.node.BitwiseXorNode;
import org.checkerframework.shaded.dataflow.cfg.node.BooleanLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.CaseNode;
import org.checkerframework.shaded.dataflow.cfg.node.CharacterLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.ClassDeclarationNode;
import org.checkerframework.shaded.dataflow.cfg.node.ClassNameNode;
import org.checkerframework.shaded.dataflow.cfg.node.ConditionalAndNode;
import org.checkerframework.shaded.dataflow.cfg.node.ConditionalNotNode;
import org.checkerframework.shaded.dataflow.cfg.node.ConditionalOrNode;
import org.checkerframework.shaded.dataflow.cfg.node.DoubleLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.EqualToNode;
import org.checkerframework.shaded.dataflow.cfg.node.ExplicitThisLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.FieldAccessNode;
import org.checkerframework.shaded.dataflow.cfg.node.FloatLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.FloatingDivisionNode;
import org.checkerframework.shaded.dataflow.cfg.node.FloatingRemainderNode;
import org.checkerframework.shaded.dataflow.cfg.node.FunctionalInterfaceNode;
import org.checkerframework.shaded.dataflow.cfg.node.GreaterThanNode;
import org.checkerframework.shaded.dataflow.cfg.node.GreaterThanOrEqualNode;
import org.checkerframework.shaded.dataflow.cfg.node.ImplicitThisLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.InstanceOfNode;
import org.checkerframework.shaded.dataflow.cfg.node.IntegerDivisionNode;
import org.checkerframework.shaded.dataflow.cfg.node.IntegerLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.IntegerRemainderNode;
import org.checkerframework.shaded.dataflow.cfg.node.LambdaResultExpressionNode;
import org.checkerframework.shaded.dataflow.cfg.node.LeftShiftNode;
import org.checkerframework.shaded.dataflow.cfg.node.LessThanNode;
import org.checkerframework.shaded.dataflow.cfg.node.LessThanOrEqualNode;
import org.checkerframework.shaded.dataflow.cfg.node.LocalVariableNode;
import org.checkerframework.shaded.dataflow.cfg.node.LongLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.MarkerNode;
import org.checkerframework.shaded.dataflow.cfg.node.MethodAccessNode;
import org.checkerframework.shaded.dataflow.cfg.node.MethodInvocationNode;
import org.checkerframework.shaded.dataflow.cfg.node.NarrowingConversionNode;
import org.checkerframework.shaded.dataflow.cfg.node.Node;
import org.checkerframework.shaded.dataflow.cfg.node.NotEqualNode;
import org.checkerframework.shaded.dataflow.cfg.node.NullChkNode;
import org.checkerframework.shaded.dataflow.cfg.node.NullLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.NumericalAdditionNode;
import org.checkerframework.shaded.dataflow.cfg.node.NumericalMinusNode;
import org.checkerframework.shaded.dataflow.cfg.node.NumericalMultiplicationNode;
import org.checkerframework.shaded.dataflow.cfg.node.NumericalPlusNode;
import org.checkerframework.shaded.dataflow.cfg.node.NumericalSubtractionNode;
import org.checkerframework.shaded.dataflow.cfg.node.ObjectCreationNode;
import org.checkerframework.shaded.dataflow.cfg.node.PackageNameNode;
import org.checkerframework.shaded.dataflow.cfg.node.ParameterizedTypeNode;
import org.checkerframework.shaded.dataflow.cfg.node.PrimitiveTypeNode;
import org.checkerframework.shaded.dataflow.cfg.node.ReturnNode;
import org.checkerframework.shaded.dataflow.cfg.node.ShortLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.SignedRightShiftNode;
import org.checkerframework.shaded.dataflow.cfg.node.StringConcatenateAssignmentNode;
import org.checkerframework.shaded.dataflow.cfg.node.StringConcatenateNode;
import org.checkerframework.shaded.dataflow.cfg.node.StringConversionNode;
import org.checkerframework.shaded.dataflow.cfg.node.StringLiteralNode;
import org.checkerframework.shaded.dataflow.cfg.node.SuperNode;
import org.checkerframework.shaded.dataflow.cfg.node.SynchronizedNode;
import org.checkerframework.shaded.dataflow.cfg.node.TernaryExpressionNode;
import org.checkerframework.shaded.dataflow.cfg.node.ThrowNode;
import org.checkerframework.shaded.dataflow.cfg.node.TypeCastNode;
import org.checkerframework.shaded.dataflow.cfg.node.UnsignedRightShiftNode;
import org.checkerframework.shaded.dataflow.cfg.node.VariableDeclarationNode;
import org.checkerframework.shaded.dataflow.cfg.node.WideningConversionNode;

/**
* A default implementation of a transfer function for nullability analysis with more convenient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.errorprone.dataflow.nullnesspropagation;

import org.checkerframework.dataflow.analysis.AbstractValue;
import org.checkerframework.shaded.dataflow.analysis.AbstractValue;

/**
* Represents one of the possible nullness values in our nullness analysis.
Expand Down
Loading

0 comments on commit b81bf44

Please sign in to comment.