Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f8d5a1c
wip
wadoon May 3, 2024
07420b8
Merge branch 'refs/heads/main' into eisop/keycore2
wadoon May 9, 2024
c0eafcc
Merge branch 'main' into weigl/key-javaparser3
wadoon May 9, 2024
c45eb7b
Merge branch 'main' into weigl/key-javaparser3
wadoon May 9, 2024
453d496
package-infos
wadoon May 9, 2024
ab26344
Merge branch 'refs/heads/main' into eisop/keycore2
wadoon May 23, 2024
82ef399
reenable sonarqube, disable the crappy things
wadoon Jun 21, 2024
04dbc1a
Merge branch 'main' into weigl/codequality
wadoon Jun 25, 2024
9e0ce25
Merge branch 'main' into eisop/keycore2
wadoon Jun 26, 2024
baf08e8
Merge branch 'refs/heads/weigl/codequality' into eisop/keycore2
wadoon Jun 26, 2024
6c4a4ba
spotless
wadoon Jul 5, 2024
42b7039
Merge branch 'main' into eisop/keycore2
wadoon Aug 4, 2024
ab38a7b
Merge remote-tracking branch 'origin/main' into eisop/keycore2
wadoon Jan 22, 2025
12eed73
more nullness annotation
wadoon Jan 22, 2025
b821a0e
adding more annotations
wadoon Jan 23, 2025
962e497
more annotations
wadoon Jan 23, 2025
20099f7
disable nullness for CI
wadoon Jan 23, 2025
60c5e97
missing files
wadoon Jan 23, 2025
359c395
wip
wadoon Jan 25, 2025
62681d2
wip
wadoon Jan 25, 2025
a15f420
wip
wadoon Jan 29, 2025
f103ed9
wip
wadoon Feb 7, 2025
ff1a5e2
Revert "wip"
flo2702 Feb 18, 2025
764c1f1
Make checker framework assume assertions
flo2702 Feb 19, 2025
273fea4
Ldt & proof
flo2702 Feb 19, 2025
03c2771
@Nullable and more at KachKeYthon
as2-0 Feb 19, 2025
3af4dca
Merge remote-tracking branch 'upstream/eisop/keycore2' into eisop/key…
as2-0 Feb 19, 2025
4dbbee8
some more nullable annotations
lks9 Feb 20, 2025
0ba5722
Rafctored createFormulae(...) in AbstractBlastingMacro
as2-0 Feb 20, 2025
b2f45f4
nullness annotations in ProofMacro
as2-0 Feb 20, 2025
6fcf265
nullness annotations in Macro - ProofScriptCommand
as2-0 Feb 20, 2025
5179371
nullness annotations in AbstractProofMacro
as2-0 Feb 20, 2025
7ba1872
nullness annotations in EngineState.java
as2-0 Feb 20, 2025
2f7730f
nullness annotations in Package Macro
as2-0 Feb 20, 2025
08ec3f2
unsupported operations for LocVarReplUniqueMap
lks9 Feb 20, 2025
d96257f
more nullable annotations
lks9 Feb 20, 2025
01a334f
adding SuppressWarnings("nullness") for not fully NonNull-verified cl…
mattulbrich May 9, 2025
6d1449f
disabling use of the checker framework for all situations ...
mattulbrich May 9, 2025
1c45871
resolving null issues in utils.
mattulbrich May 9, 2025
73adc1b
fixing nullness issues in util package.
mattulbrich May 10, 2025
5b696e6
Merge branch 'main' into eisop/keycore2
wadoon May 10, 2025
0714472
adding nullness annotations
mattulbrich May 10, 2025
a8a121b
Merge branch 'main' into eisop/keycore2
wadoon May 11, 2025
54ec0d0
intellij infer nullity for key.core
wadoon May 11, 2025
7201a16
intellij infer nullity over all modules
wadoon May 11, 2025
06c2b3d
fixing annotations and compile errors
wadoon May 11, 2025
9fb54f5
spotless
wadoon May 11, 2025
9e4781b
RAC for nonnull tested
wadoon May 14, 2025
3264058
Merge branch 'main' into eisop/keycore2
wadoon May 15, 2025
867d72e
add checkerframework to runtime classpath
wadoon May 15, 2025
5954073
fix null reference
wadoon May 15, 2025
e0738ad
update nonnull checker.
mattulbrich May 20, 2025
103d283
Merge branch 'main' into eisop/keycore2
wadoon Jun 7, 2025
ce58cde
Merge branch 'main' into eisop/keycore2
wadoon Jun 7, 2025
3c34fa3
Merge remote-tracking branch 'origin/main' into eisop/keycore2
wadoon Jun 15, 2025
d448bd0
fix merge error
wadoon Jun 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ subprojects {
//compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.12.0'
//compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.0'

compileOnly("org.jspecify:jspecify:1.0.0")
implementation("org.jspecify:jspecify:1.0.0")
testCompileOnly("org.jspecify:jspecify:1.0.0")
def eisop_version = "3.49.3-eisop1"
compileOnly "io.github.eisop:checker-qual:$eisop_version"
compileOnly "io.github.eisop:checker-util:$eisop_version"
implementation "io.github.eisop:checker-qual:$eisop_version"
implementation "io.github.eisop:checker-util:$eisop_version"
testCompileOnly "io.github.eisop:checker-qual:$eisop_version"
checkerFramework "io.github.eisop:checker-qual:$eisop_version"
checkerFramework "io.github.eisop:checker:$eisop_version"
Expand Down Expand Up @@ -138,6 +138,10 @@ subprojects {
systemProperty "key.disregardSettings", "true"
maxHeapSize = "4g"

// RAC non-null references.
jvmArgs("-javaagent:$rootDir/nonnull-0.1.0-SNAPSHOT-all.jar=VERBOSE,org.key_project,de.uka")


forkEvery = 0 //default
maxParallelForks = 1 // weigl: test on master
}
Expand Down
27 changes: 12 additions & 15 deletions key.core.example/src/main/java/org/key_project/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import org.key_project.util.collection.ImmutableSet;

import org.jspecify.annotations.NullMarked;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -31,6 +32,7 @@
*
* @author Martin Hentschel
*/
@NullMarked
public class Main {
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class);

Expand All @@ -52,14 +54,12 @@ public static void main(String[] args) {
}
}

/**
* sets up the environment with the Java project described by its location
*
* @param location the Path with the path to the source directory of the Java project
* to be verified
* @return the {@KeYEnvironment} that provides the context for all following verification tasks
* @throws ProblemLoaderException if the setup fails
*/
/// sets up the environment with the Java project described by its location
///
/// @param location the Path with the path to the source directory of the Java project
/// to be verified
/// @return the [KeYEnvironment] that provides the context for all following verification tasks
/// @throws ProblemLoaderException if the setup fails
private static KeYEnvironment<?> setupEnvironment(Path location) throws ProblemLoaderException {
List<Path> classPaths = null; // Optionally: Additional specifications for API classes
Path bootClassPath = null; // Optionally: Different default specifications for Java API
Expand All @@ -77,10 +77,8 @@ private static KeYEnvironment<?> setupEnvironment(Path location) throws ProblemL
newSettings.putAll(MiscTools.getDefaultTacletOptions());
choiceSettings.setDefaultChoices(newSettings);
// Load source code
KeYEnvironment<?> env =
KeYEnvironment.load(location, classPaths, bootClassPath, includes);
return KeYEnvironment.load(location, classPaths, bootClassPath, includes);
// env.getLoadedProof() returns performed proof if a *.proof file is loaded
return env;
}

/**
Expand All @@ -93,7 +91,7 @@ private static void proveEnvironmemt(KeYEnvironment<?> env) {
final List<Contract> proofContracts = getContracts(env);

for (Contract contract : proofContracts) {
LOGGER.info("Found contract '" + contract.getDisplayName());
LOGGER.info("Found contract '{}'", contract.getDisplayName());
proveContract(env, contract);
}
} finally {
Expand Down Expand Up @@ -166,9 +164,8 @@ private static void proveContract(KeYEnvironment<?> env, Contract contract) {
env.getUi().getProofControl().startAndWaitForAutoMode(proof);
// Show proof result
boolean closed = proof.openGoals().isEmpty();
LOGGER.info("Contract '" + contract.getDisplayName() + "' of "
+ contract.getTarget() + " is " + (closed ? "verified" : "still open")
+ ".");
LOGGER.info("Contract '{}' of {} is {}.", contract.getDisplayName(),
contract.getTarget(), closed ? "verified" : "still open");
} catch (ProofInputException e) {
LOGGER.error("Exception at {} of {}", contract.getDisplayName(),
contract.getTarget());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@org.jspecify.annotations.NullMarked
package org.key_project;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package de.uka.ilkd.key.proof_references;

import java.util.LinkedHashSet;
import java.util.Set;

import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.proof.Node;
Expand Down Expand Up @@ -174,7 +175,7 @@ public static LinkedHashSet<IProofReference<?>> computeProofReferences(Node node
LinkedHashSet<IProofReference<?>> result = new LinkedHashSet<>();
if (node != null && analysts != null) {
for (IProofReferencesAnalyst analyst : analysts) {
LinkedHashSet<IProofReference<?>> analystResult =
Set<IProofReference<?>> analystResult =
analyst.computeReferences(node, services);
if (analystResult != null) {
merge(result, analystResult);
Expand All @@ -190,8 +191,7 @@ public static LinkedHashSet<IProofReference<?>> computeProofReferences(Node node
* @param target The target to add to.
* @param toAdd The {@link IProofReference}s to add.
*/
public static void merge(LinkedHashSet<IProofReference<?>> target,
LinkedHashSet<IProofReference<?>> toAdd) {
public static void merge(Set<IProofReference<?>> target, Set<IProofReference<?>> toAdd) {
for (IProofReference<?> reference : toAdd) {
merge(target, reference);
}
Expand All @@ -203,7 +203,7 @@ public static void merge(LinkedHashSet<IProofReference<?>> target,
* @param target The target to add to.
* @param reference The {@link IProofReference} to add.
*/
public static void merge(LinkedHashSet<IProofReference<?>> target,
public static void merge(Set<IProofReference<?>> target,
final IProofReference<?> reference) {
if (!target.add(reference)) {
// Reference exists before, so merge nodes of both references.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.key_project.util.collection.ImmutableSet;
import org.key_project.util.collection.Pair;

import org.jspecify.annotations.Nullable;

/**
* Extracts used {@link ClassAxiom} and {@link ClassInvariant}s.
*
Expand All @@ -36,7 +38,8 @@ public class ClassAxiomAndInvariantProofReferencesAnalyst implements IProofRefer
* {@inheritDoc}
*/
@Override
public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services) {
public @Nullable LinkedHashSet<IProofReference<?>> computeReferences(Node node,
Services services) {
String name = MiscTools.getRuleName(node);
if (name != null
&& (name.toLowerCase().contains("axiom_for")
Expand Down Expand Up @@ -102,7 +105,7 @@ public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services s
* @return The {@link KeYJavaType} which provides the proof obligation or {@code null} if it was
* not possible to compute it.
*/
protected KeYJavaType findProofsKeYJavaType(Services services) {
protected @Nullable KeYJavaType findProofsKeYJavaType(Services services) {
ProofOblInput problem =
services.getSpecificationRepository().getProofOblInput(services.getProof());
if (problem != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import de.uka.ilkd.key.rule.AbstractContractRuleApp;
import de.uka.ilkd.key.speclang.Contract;

import org.jspecify.annotations.Nullable;

/**
* Extracts used contracts.
*
Expand All @@ -22,7 +24,8 @@ public class ContractProofReferencesAnalyst implements IProofReferencesAnalyst {
* {@inheritDoc}
*/
@Override
public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services) {
public @Nullable LinkedHashSet<IProofReference<?>> computeReferences(Node node,
Services services) {
if (node.getAppliedRuleApp() instanceof AbstractContractRuleApp contractRuleApp) {
DefaultProofReference<Contract> reference = new DefaultProofReference<>(
IProofReference.USE_CONTRACT, node, contractRuleApp.getInstantiation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.proof_references.analyst;

import java.util.LinkedHashSet;
import java.util.Set;

import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.proof.Node;
import de.uka.ilkd.key.proof_references.ProofReferenceUtil;
import de.uka.ilkd.key.proof_references.reference.IProofReference;

import org.jspecify.annotations.Nullable;

/**
* <p>
* Instances of this class are used to compute {@link IProofReference} for a given {@link Node}
Expand All @@ -34,5 +36,6 @@ public interface IProofReferencesAnalyst {
* @return The found {@link IProofReference} or {@code null}/empty set if the applied rule is
* not supported.
*/
LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services);
@Nullable
Set<IProofReference<?>> computeReferences(Node node, Services services);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import de.uka.ilkd.key.proof_references.reference.DefaultProofReference;
import de.uka.ilkd.key.proof_references.reference.IProofReference;

import org.jspecify.annotations.Nullable;

/**
* Extracts inlined methods.
*
Expand All @@ -23,8 +25,9 @@ public class MethodBodyExpandProofReferencesAnalyst implements IProofReferencesA
* {@inheritDoc}
*/
@Override
public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services) {
if (node.getAppliedRuleApp() != null && node.getNodeInfo() != null) {
public @Nullable LinkedHashSet<IProofReference<?>> computeReferences(Node node,
Services services) {
if (node.getAppliedRuleApp() != null) {
NodeInfo info = node.getNodeInfo();
if (info.getActiveStatement() instanceof MethodBodyStatement mbs) {
IProgramMethod pm = mbs.getProgramMethod(services);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.key_project.util.collection.ImmutableArray;
import org.key_project.util.collection.ImmutableSLList;

import org.jspecify.annotations.Nullable;

/**
* Extracts called methods.
*
Expand All @@ -43,35 +45,32 @@ public class MethodCallProofReferencesAnalyst implements IProofReferencesAnalyst
* {@inheritDoc}
*/
@Override
public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services) {
public @Nullable LinkedHashSet<IProofReference<?>> computeReferences(Node node,
Services services) {
String name = MiscTools.getRuleName(node);
if (name != null && name.toLowerCase().contains("methodcall")) {
NodeInfo info = node.getNodeInfo();
if (info != null) {
if (info.getActiveStatement() instanceof MethodReference) {
ExecutionContext context = extractContext(node, services);
IProofReference<IProgramMethod> reference = createReference(node, services,
context, (MethodReference) info.getActiveStatement());
LinkedHashSet<IProofReference<?>> result =
new LinkedHashSet<>();
result.add(reference);
return result;
} else if (info.getActiveStatement() instanceof Assignment assignment) {
ExecutionContext context = extractContext(node, services);
LinkedHashSet<IProofReference<?>> result =
new LinkedHashSet<>();
for (int i = 0; i < assignment.getChildCount(); i++) {
ProgramElement child = assignment.getChildAt(i);
if (child instanceof MethodReference) {
IProofReference<IProgramMethod> reference =
createReference(node, services, context, (MethodReference) child);
ProofReferenceUtil.merge(result, reference);
}
if (info.getActiveStatement() instanceof MethodReference) {
ExecutionContext context = extractContext(node, services);
IProofReference<IProgramMethod> reference = createReference(node, services,
context, (MethodReference) info.getActiveStatement());
LinkedHashSet<IProofReference<?>> result =
new LinkedHashSet<>();
result.add(reference);
return result;
} else if (info.getActiveStatement() instanceof Assignment assignment) {
ExecutionContext context = extractContext(node, services);
LinkedHashSet<IProofReference<?>> result =
new LinkedHashSet<>();
for (int i = 0; i < assignment.getChildCount(); i++) {
ProgramElement child = assignment.getChildAt(i);
if (child instanceof MethodReference) {
IProofReference<IProgramMethod> reference =
createReference(node, services, context, (MethodReference) child);
ProofReferenceUtil.merge(result, reference);
}
return result;
} else {
return null;
}
return result;
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import de.uka.ilkd.key.proof_references.reference.DefaultProofReference;
import de.uka.ilkd.key.proof_references.reference.IProofReference;

import org.jspecify.annotations.Nullable;

/**
* Extracts read and write access to fields ({@link IProgramVariable}) via assignments.
*
Expand All @@ -30,8 +32,9 @@ public class ProgramVariableReferencesAnalyst implements IProofReferencesAnalyst
* {@inheritDoc}
*/
@Override
public LinkedHashSet<IProofReference<?>> computeReferences(Node node, Services services) {
if (node.getAppliedRuleApp() != null && node.getNodeInfo() != null) {
public @Nullable LinkedHashSet<IProofReference<?>> computeReferences(Node node,
Services services) {
if (node.getAppliedRuleApp() != null) {
SourceElement statement = node.getNodeInfo().getActiveStatement();
if (statement instanceof CopyAssignment) {
LinkedHashSet<IProofReference<?>> result = new LinkedHashSet<>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @author Alexander Weigl
* @version 1 (5/11/25)
*/
@NullMarked
package de.uka.ilkd.key.proof_references.analyst;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @author Alexander Weigl
* @version 1 (5/11/25)
*/
@NullMarked
package de.uka.ilkd.key.proof_references;

import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import org.key_project.util.Strings;

import org.jspecify.annotations.Nullable;

/**
* Default implementation of {@link IProofReference}.
*
Expand All @@ -26,7 +28,7 @@ public class DefaultProofReference<T> implements IProofReference<T> {
/**
* The source {@link Proof}.
*/
private final Proof source;
private final @Nullable Proof source;

/**
* The target source member.
Expand All @@ -45,7 +47,7 @@ public class DefaultProofReference<T> implements IProofReference<T> {
* @param node Node to access the source {@link Proof} (or null).
* @param target The target source member.
*/
public DefaultProofReference(String kind, Node node, T target) {
public DefaultProofReference(String kind, @Nullable Node node, T target) {
this.kind = kind;
this.source = node != null ? node.proof() : null;
this.target = target;
Expand Down Expand Up @@ -88,15 +90,15 @@ public String getKind() {
* {@inheritDoc}
*/
@Override
public Proof getSource() {
public @Nullable Proof getSource() {
return source;
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
public boolean equals(@org.jspecify.annotations.Nullable Object obj) {
if (obj instanceof IProofReference<?> other) {
return Objects.equals(getKind(), other.getKind())
&& Objects.equals(getSource(), other.getSource())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @author Alexander Weigl
* @version 1 (5/11/25)
*/
@NullMarked
package de.uka.ilkd.key.proof_references.reference;

import org.jspecify.annotations.NullMarked;
Loading
Loading