use of org.checkerframework.checker.nullness.qual.Nullable in project universa by UniversaBlockchain.
the class UnikeyFactory method rsaOaepPKFromUnikey.
/**
* Given the .unikey-format byte array with the private key, create the {@link RSAOAEPPrivateKey}.
*/
@Nullable
static RSAOAEPPrivateKey rsaOaepPKFromUnikey(@NonNull byte[] bytes) {
assert bytes != null;
try {
final ArrayList unpackedFromBoss = Boss.load(bytes);
assert ((Integer) unpackedFromBoss.get(0)) == 0;
final byte[] e = ((Bytes) unpackedFromBoss.get(1)).toArray(), p = ((Bytes) unpackedFromBoss.get(2)).toArray(), q = ((Bytes) unpackedFromBoss.get(3)).toArray();
return new RSAOAEPPrivateKey(e, p, q, RSAOAEPPrivateKey.DEFAULT_OAEP_HASH, RSAOAEPPrivateKey.DEFAULT_MGF1_HASH, new SecureRandom());
} catch (Throwable e) {
return null;
}
}
use of org.checkerframework.checker.nullness.qual.Nullable in project checker-framework by typetools.
the class Analysis method getValue.
/**
* @return the abstract value for {@link Tree} {@code t}, or {@code null} if no information is
* available. Note that if the analysis has not finished yet, this value might not represent
* the final value for this node.
*/
@Nullable
public A getValue(Tree t) {
// we do not yet have a org.checkerframework.dataflow fact about the current node
if (t == currentTree) {
return null;
}
Set<Node> nodesCorrespondingToTree = getNodesForTree(t);
if (nodesCorrespondingToTree == null) {
return null;
}
A merged = null;
for (Node aNode : nodesCorrespondingToTree) {
if (aNode.isLValue()) {
return null;
}
A a = getValue(aNode);
if (merged == null) {
merged = a;
} else if (a != null) {
merged = merged.leastUpperBound(a);
}
}
return merged;
}
use of org.checkerframework.checker.nullness.qual.Nullable in project checker-framework by typetools.
the class AnalysisResult method getValue.
/**
* @return the abstract value for {@link Tree} {@code t}, or {@code null} if no information is
* available.
*/
@Nullable
public A getValue(Tree t) {
Set<Node> nodes = treeLookup.get(t);
if (nodes == null) {
return null;
}
if (nodes.size() == 1) {
Node aNode = nodes.iterator().next();
A val = getValue(aNode);
return val;
} else {
A merged = null;
for (Node aNode : nodes) {
A a = getValue(aNode);
if (merged == null) {
merged = a;
} else if (a != null) {
merged = merged.leastUpperBound(a);
}
}
return merged;
}
}
use of org.checkerframework.checker.nullness.qual.Nullable in project checker-framework by typetools.
the class DOTCFGVisualizer method visualize.
/**
* {@inheritDoc}
*/
@Override
@Nullable
public Map<String, Object> visualize(ControlFlowGraph cfg, Block entry, @Nullable Analysis<A, S, T> analysis) {
String dotgraph = generateDotGraph(cfg, entry, analysis);
String dotfilename = dotOutputFileName(cfg.underlyingAST);
try {
FileWriter fstream = new FileWriter(dotfilename);
BufferedWriter out = new BufferedWriter(fstream);
out.write(dotgraph);
out.close();
} catch (IOException e) {
ErrorReporter.errorAbort("Error creating dot file: " + dotfilename + "; ensure the path is valid", e);
}
Map<String, Object> res = new HashMap<>();
res.put("dotFileName", dotfilename);
return res;
}
use of org.checkerframework.checker.nullness.qual.Nullable in project checker-framework by typetools.
the class SourceChecker method isAnnotatedForThisCheckerOrUpstreamChecker.
private boolean isAnnotatedForThisCheckerOrUpstreamChecker(@Nullable Element elt) {
if (elt == null || !useUncheckedCodeDefault("source")) {
return false;
}
@Nullable AnnotatedFor anno = elt.getAnnotation(AnnotatedFor.class);
String[] userAnnotatedFors = (anno == null ? null : anno.value());
if (userAnnotatedFors != null) {
List<String> upstreamCheckerNames = getUpstreamCheckerNames();
for (String userAnnotatedFor : userAnnotatedFors) {
if (CheckerMain.matchesCheckerOrSubcheckerFromList(userAnnotatedFor, upstreamCheckerNames)) {
return true;
}
}
}
return false;
}
Aggregations