Skip to content

Commit 65fd13c

Browse files
committed
Merge branch 'main' into weigl/recordsftw
# Conflicts: # keyext.slicing/src/main/java/org/key_project/slicing/graph/DependencyGraph.java
2 parents 8f6a0bf + 573c82c commit 65fd13c

File tree

81 files changed

+1655
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1655
-244
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For more information, refer to
1414
* [Verification of `java.util.IdentityHashMap`](https://doi.org/10.1007/978-3-031-07727-2_4),
1515
* [Google Award for analysing a bug in `LinkedList`](https://www.key-project.org/2023/07/23/cwi-researchers-win-google-award-for-finding-a-bug-in-javas-linkedlist-using-key/)
1616

17-
The current version of KeY is 2.12.0, licensed under GPL v2.
17+
The current version of KeY is 2.12.2, licensed under GPL v2.
1818

1919

2020
Feel free to use the project templates to get started using KeY:
@@ -26,7 +26,7 @@ Feel free to use the project templates to get started using KeY:
2626

2727
* Hardware: >=2 GB RAM
2828
* Operating System: Linux/Unix, MacOSX, Windows
29-
* Java SE 11 or newer
29+
* Java 17 or newer
3030
* Optionally, KeY can make use of the following binaries:
3131
* SMT Solvers:
3232
* [Z3](https://github.com/Z3Prover/z3#z3)
@@ -113,7 +113,7 @@ This is the KeY project - Integrated Deductive Software Design
113113
Copyright (C) 2001-2011 Universität Karlsruhe, Germany
114114
Universität Koblenz-Landau, Germany
115115
and Chalmers University of Technology, Sweden
116-
Copyright (C) 2011-2023 Karlsruhe Institute of Technology, Germany
116+
Copyright (C) 2011-2024 Karlsruhe Institute of Technology, Germany
117117
Technical University Darmstadt, Germany
118118
Chalmers University of Technology, Sweden
119119

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ subprojects {
7070
}
7171

7272
dependencies {
73-
implementation("org.slf4j:slf4j-api:2.0.11")
73+
implementation("org.slf4j:slf4j-api:2.0.12")
7474

75-
testImplementation("ch.qos.logback:logback-classic:1.4.14")
76-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.1'
77-
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.1'
75+
testImplementation("ch.qos.logback:logback-classic:1.5.0")
76+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
77+
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.2'
7878
testImplementation project(':key.util')
7979

8080
testCompileOnly 'junit:junit:4.13.2'
81-
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.10.1'
82-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
81+
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.10.2'
82+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
8383

8484
implementation("org.jspecify:jspecify:0.3.0")
8585
}

key.core/src/main/java/de/uka/ilkd/key/java/Comment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import de.uka.ilkd.key.java.visitor.Visitor;
77

8+
/**
9+
* Comment element of Java source code.
10+
*/
811
public class Comment extends JavaSourceElement {
912

1013
private final String text;

key.core/src/main/java/de/uka/ilkd/key/java/declaration/MethodDeclaration.java

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,35 @@
2222
public class MethodDeclaration extends JavaDeclaration implements MemberDeclaration,
2323
TypeReferenceContainer, NamedProgramElement, ParameterContainer, Method, VariableScope {
2424

25+
/**
26+
* The return type of the method.
27+
*/
2528
protected final TypeReference returnType;
29+
/**
30+
* In case of void return type: comments associated with the method.
31+
*/
2632
protected final Comment[] voidComments;
33+
/**
34+
* The name of the method.
35+
*/
2736
protected final ProgramElementName name;
37+
/**
38+
* Parameters of the method.
39+
*/
2840
protected final ImmutableArray<ParameterDeclaration> parameters;
41+
/**
42+
* 'throws' part of the method. Indicates which exceptions the method may throw.
43+
* May be null.
44+
*/
2945
protected final Throws exceptions;
46+
/**
47+
* Body of the method.
48+
* May be null, in which case the body is referenced in a file using {@link #posInfo}.
49+
*/
3050
protected final StatementBlock body;
51+
/**
52+
* JML modifiers of the referenced method. Includes e.g. {@code pure}.
53+
*/
3154
protected final JMLModifiers jmlModifiers;
3255

3356
/**
@@ -53,12 +76,14 @@ public record JMLModifiers(boolean pure, boolean strictlyPure, boolean helper,
5376
/**
5477
* Method declaration.
5578
*
56-
* @param children an ExtList of children. May include: a TypeReference (as a reference to the
57-
* return type), a de.uka.ilkd.key.logic.ProgramElementName (as Name of the method),
58-
* several ParameterDeclaration (as parameters of the declared method), a StatementBlock
59-
* (as body of the declared method), several Modifier (taken as modifiers of the
60-
* declaration), a Comment
79+
* @param children an ExtList of children. Must include: a TypeReference (as a reference to the
80+
* return type),
81+
* a {@link ProgramElementName} (as Name of the method),
82+
* one or more {@link ParameterDeclaration} (as parameters of the declared method),
83+
* optionally a {@link StatementBlock} (as body of the declared method),
84+
* optionally a {@link Throws} to indicate exceptional behaviour
6185
* @param parentIsInterfaceDeclaration a boolean set true iff parent is an InterfaceDeclaration
86+
* @param voidComments in case of void return type: comments associated with the method
6287
*/
6388
public MethodDeclaration(ExtList children, boolean parentIsInterfaceDeclaration,
6489
Comment[] voidComments) {
@@ -266,6 +291,12 @@ public TypeReference getTypeReference() {
266291
}
267292

268293

294+
/**
295+
* Get the "void comments" of this method declaration.
296+
* Only non-null if the method has void return type.
297+
*
298+
* @return the "void comments"
299+
*/
269300
public Comment[] getVoidComments() {
270301
return voidComments;
271302
}

key.core/src/main/java/de/uka/ilkd/key/java/declaration/Throws.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Throws extends JavaNonTerminalProgramElement implements TypeReferen
2323

2424

2525
/**
26-
* Exceptions.
26+
* Exceptions thrown.
2727
*/
2828
protected final ImmutableArray<TypeReference> exceptions;
2929

key.core/src/main/java/de/uka/ilkd/key/logic/Semisequent.java

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: GPL-2.0-only */
44
package de.uka.ilkd.key.logic;
55

6+
import java.util.Collection;
67
import java.util.Iterator;
78

89
import org.key_project.util.collection.ImmutableList;
@@ -27,11 +28,10 @@ private Semisequent() {
2728
seqList = ImmutableSLList.nil();
2829
}
2930

30-
3131
/**
32-
* creates a new Semisequent with the Semisequent elements in seqList; the provided list must be
33-
* redundancy free, i.e., the created sequent must be exactly the same as when creating the
34-
* sequent by subsequently inserting all formulas
32+
* Create a new Semisequent from an ordered collection of formulas.
33+
* The provided list must be redundancy free, i.e., the created sequent must be exactly
34+
* the same as when creating the sequent by subsequently inserting all formulas
3535
*
3636
* @param seqList list of sequent formulas
3737
*/
@@ -40,6 +40,33 @@ public Semisequent(ImmutableList<SequentFormula> seqList) {
4040
this.seqList = seqList;
4141
}
4242

43+
/**
44+
* Create a new Semisequent from an ordered collection of formulas.
45+
* The provided collection must be redundancy free, i.e., the created sequent must be exactly
46+
* the same as when creating the sequent by subsequently inserting all formulas
47+
*
48+
* @param seqList list of sequent formulas
49+
*/
50+
public Semisequent(Collection<SequentFormula> seqList) {
51+
assert !seqList.isEmpty();
52+
this.seqList = ImmutableList.fromList(seqList);
53+
}
54+
55+
/**
56+
* Create a new Semisequent from an ordered collection of formulas (possibly empty).
57+
* The provided collection must be redundancy free, i.e., the created sequent must be exactly
58+
* the same as when creating the
59+
* sequent by subsequently inserting all formulas.
60+
*
61+
* @param seqList list of sequent formulas
62+
*/
63+
public static Semisequent create(Collection<SequentFormula> seqList) {
64+
if (seqList.isEmpty()) {
65+
return EMPTY_SEMISEQUENT;
66+
}
67+
return new Semisequent(seqList);
68+
}
69+
4370

4471
/**
4572
* creates a new Semisequent with the Semisequent elements in seqList

key.core/src/main/java/de/uka/ilkd/key/logic/op/ProgramMethod.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,31 @@
2222
import org.key_project.util.collection.ImmutableArray;
2323
import org.key_project.util.collection.ImmutableList;
2424
import org.key_project.util.collection.ImmutableSLList;
25+
import org.key_project.util.collection.ImmutableSet;
2526

26-
import org.slf4j.Logger;
27-
import org.slf4j.LoggerFactory;
2827

2928
/**
3029
* The program method represents a (pure) method in the logic. In case of a non-static method the
3130
* first argument represents the object on which the method is invoked.
31+
* <p>
32+
* This data is used in
33+
* {@link de.uka.ilkd.key.speclang.QueryAxiom#getTaclets(ImmutableSet, Services)}.
3234
*/
3335
public final class ProgramMethod extends ObserverFunction
3436
implements ProgramInLogic, IProgramMethod {
3537

36-
private static final Logger LOGGER = LoggerFactory.getLogger(ProgramMethod.class);
3738

39+
/**
40+
* The referenced method.
41+
*/
3842
private final MethodDeclaration method;
3943
/**
4044
* Return type of the method. Must not be null. Use KeYJavaType.VOID_TYPE for void methods.
4145
*/
4246
private final KeYJavaType returnType;
47+
/**
48+
* Where the method is located in a .java file.
49+
*/
4350
private final PositionInfo pi;
4451

4552
// -------------------------------------------------------------------------
@@ -63,6 +70,12 @@ public ProgramMethod(MethodDeclaration method, KeYJavaType container, KeYJavaTyp
6370
// internal methods
6471
// -------------------------------------------------------------------------
6572

73+
/**
74+
* Get the java types of the parameters required by the method md.
75+
*
76+
* @param md some method declaration
77+
* @return java types of the parameters required by md
78+
*/
6679
private static ImmutableArray<KeYJavaType> getParamTypes(MethodDeclaration md) {
6780
KeYJavaType[] result = new KeYJavaType[md.getParameterDeclarationCount()];
6881
for (int i = 0; i < result.length; i++) {
@@ -80,11 +93,6 @@ private static ImmutableArray<KeYJavaType> getParamTypes(MethodDeclaration md) {
8093
// MethodDeclaration
8194
// in a direct way
8295

83-
/*
84-
* (non-Javadoc)
85-
*
86-
* @see de.uka.ilkd.key.logic.op.IProgramMethod#getMethodDeclaration()
87-
*/
8896
@Override
8997
public MethodDeclaration getMethodDeclaration() {
9098
return method;

key.core/src/main/java/de/uka/ilkd/key/nparser/builder/DeclarationBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Object visitDatatype_decl(KeYParser.Datatype_declContext ctx) {
6666
: null;
6767
var origin = BuilderHelpers.getPosition(ctx);
6868
var s = new SortImpl(new Name(name), ImmutableSet.empty(), false, doc, origin);
69-
sorts().add(s);
69+
sorts().addSafely(s);
7070
return null;
7171
}
7272

key.core/src/main/java/de/uka/ilkd/key/nparser/builder/FunctionPredicateBuilder.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import de.uka.ilkd.key.java.Services;
99
import de.uka.ilkd.key.logic.Name;
10+
import de.uka.ilkd.key.logic.Namespace;
1011
import de.uka.ilkd.key.logic.NamespaceSet;
1112
import de.uka.ilkd.key.logic.op.Function;
1213
import de.uka.ilkd.key.logic.op.SortDependingFunction;
@@ -52,16 +53,30 @@ public Object visitDatatype_decl(KeYParser.Datatype_declContext ctx) {
5253
// weigl: all datatypes are free ==> functions are unique!
5354
// boolean freeAdt = ctx.FREE() != null;
5455
var sort = sorts().lookup(ctx.name.getText());
56+
var dtNamespace = new Namespace<Function>();
5557
for (KeYParser.Datatype_constructorContext constructorContext : ctx
5658
.datatype_constructor()) {
5759
Name name = new Name(constructorContext.name.getText());
5860
Sort[] args = new Sort[constructorContext.sortId().size()];
61+
var argNames = constructorContext.argName;
5962
for (int i = 0; i < args.length; i++) {
60-
args[i] = accept(constructorContext.sortId(i));
63+
Sort argSort = accept(constructorContext.sortId(i));
64+
args[i] = argSort;
65+
var argName = argNames.get(i).getText();
66+
var alreadyDefinedFn = dtNamespace.lookup(argName);
67+
if (alreadyDefinedFn != null
68+
&& (!alreadyDefinedFn.sort().equals(argSort)
69+
|| !alreadyDefinedFn.argSort(0).equals(sort))) {
70+
throw new RuntimeException("Name already in namespace: " + argName);
71+
}
72+
Function fn = new Function(new Name(argName), argSort, new Sort[] { sort }, null,
73+
false, false);
74+
dtNamespace.add(fn);
6175
}
6276
Function function = new Function(name, sort, args, null, true, false);
63-
namespaces().functions().add(function);
77+
namespaces().functions().addSafely(function);
6478
}
79+
namespaces().functions().addSafely(dtNamespace.allElements());
6580
return null;
6681
}
6782

0 commit comments

Comments
 (0)