Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
230f842
add the ownership rules
PiIsRational Jun 1, 2025
6a195dd
added the new rules
PiIsRational Jun 4, 2025
415f9db
extend the javac extension
PiIsRational Jun 8, 2025
f37d143
change the way the universe rules are treated
PiIsRational Jun 8, 2025
c337d49
update to add the latest changes
PiIsRational Jun 16, 2025
82f0bcc
do some bugfixes in the recoder parsers
PiIsRational Jul 2, 2025
912cc8c
the last changes
PiIsRational Jul 21, 2025
94763f1
update the match conditions
PiIsRational Jul 23, 2025
19f98e9
add support for args and results in contracts
PiIsRational Jul 26, 2025
0d932a9
some changes
PiIsRational Aug 9, 2025
a82c2c2
the new rule files
PiIsRational Sep 22, 2025
2f35dcf
add the proofs
PiIsRational Sep 27, 2025
85a0e6d
update the rules
PiIsRational Oct 6, 2025
902c17c
remove unneeded assertion
PiIsRational Oct 6, 2025
3f0dea8
remove logs in the default lemma generator
PiIsRational Oct 6, 2025
29dabd9
all the universe lemmas have a corresponding runnable proof
PiIsRational Oct 7, 2025
ac9124d
remove factorypaths
PiIsRational Oct 24, 2025
88187a0
add support for dom references
PiIsRational Oct 30, 2025
4812836
Merge commit '88187a0debb466f31e974a64e2049293160d7319' into ut-integ…
PiIsRational Jan 11, 2026
16e29d2
update the heuristics
PiIsRational Jan 11, 2026
519a11c
update the heap simplification macro with universe rules
PiIsRational Jan 11, 2026
2cb864d
apply spotless
PiIsRational Jan 30, 2026
33d1e5e
Merge branch 'main' into ut-integration
PiIsRational Mar 30, 2026
eae3d25
refactoring
PiIsRational Apr 18, 2026
86d605e
a first try with the new parser
PiIsRational Apr 19, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ bin/
.settings
.project
.classpath
.factorypath

# Files generated by IntelliJ ANTLR plugin
key.core/src/main/gen
Expand Down
1 change: 1 addition & 0 deletions key.core/src/main/antlr4/KeYLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ MAXEXPANDMETHOD : '\\mayExpandMethod';
STRICT : '\\strict';
TYPEOF : '\\typeof';
INSTANTIATE_GENERIC : '\\instantiateGeneric';
HAS_ANNOTATION: '\\hasAnnotation';

// Quantifiers, binding, substitution
FORALL : '\\forall' | '\u2200';
Expand Down
1 change: 1 addition & 0 deletions key.core/src/main/antlr4/KeYParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ varexpId: // weigl, 2021-03-12: This will be later just an arbitrary identifier.
| GET_VARIANT
| IS_LABELED
| ISINSTRICTFP
| HAS_ANNOTATION
;

varexp_argument
Expand Down
6 changes: 5 additions & 1 deletion key.core/src/main/java/de/uka/ilkd/key/java/JavaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,12 @@ public ImmutableList<KeYJavaType> getCommonSubtypes(KeYJavaType k1, KeYJavaType
*/
public LocationVariable getArrayLength() {
if (length == null) {
final KeYJavaType sadKjt = rec2key().getSuperArrayType();

if (sadKjt == null) return null;

final SuperArrayDeclaration sad =
(SuperArrayDeclaration) rec2key().getSuperArrayType().getJavaType();
(SuperArrayDeclaration) sadKjt.getJavaType();
length = (LocationVariable) sad.length().getVariables().get(0).getProgramVariable();
assert "length".equals(length.name().toString()) : "Wrong array length";
}
Expand Down
24 changes: 22 additions & 2 deletions key.core/src/main/java/de/uka/ilkd/key/java/KeYProgModelInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import com.github.javaparser.resolution.types.ResolvedType;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.DefaultConstructorDeclaration;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserAnnotationDeclaration;
import com.github.javaparser.symbolsolver.javaparsermodel.declarations.JavaParserMethodDeclaration;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
Expand Down Expand Up @@ -93,7 +94,11 @@ public Collection<KeYJavaType> allTypes() {
private List<ResolvedMethodDeclaration> getAllMethods(KeYJavaType kjt) {
var type = rec2key().resolveType(kjt);
if (type.isReferenceType()) {
return type.asReferenceType().getAllMethods();
var tr = type.asReferenceType();

if (!tr.getTypeDeclaration().orElseThrow().isAnnotation()) {
return tr.getAllMethods();
}
}
return Collections.emptyList();
}
Expand Down Expand Up @@ -166,6 +171,10 @@ public boolean isFinal(KeYJavaType kjt) {
// Interfaces can't be final
return false;
}
if (td.isAnnotation()) {
// Interfaces can't be final
return false;
}
if (td instanceof ResolvedLogicalType) {
// Logic types are not final? Just following primitive types here
return false;
Expand Down Expand Up @@ -226,7 +235,18 @@ public List<ProgramMethod> getAllProgramMethodsLocallyDeclared(KeYJavaType ct) {
if (!type.isReferenceType()) {
return result;
}
var rml = type.asReferenceType().getDeclaredMethods();

var refType = type.asReferenceType();

// methods for annotation declarations are currently not implemented in
// javaparser
if (refType.getTypeDeclaration()
.map(d -> d instanceof JavaParserAnnotationDeclaration)
.orElse(false)) {
return result;
}

var rml = refType.getDeclaredMethods();
result.ensureCapacity(rml.size());
for (MethodUsage methodUsage : rml) {
if (methodUsage.getDeclaration() instanceof JavaParserMethodDeclaration) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.java.ast.declaration;

import java.util.List;
import de.uka.ilkd.key.logic.ProgramElementName;
import de.uka.ilkd.key.java.ast.*;
import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType;

import org.key_project.util.collection.ImmutableArray;
import org.key_project.util.collection.ImmutableList;
import org.jspecify.annotations.NonNull;
import de.uka.ilkd.key.speclang.jml.pretranslation.TextualJMLConstruct;
import de.uka.ilkd.key.java.visitor.Visitor;


public class AnnotationInterfaceDeclaration extends TypeDeclaration {
public AnnotationInterfaceDeclaration(
PositionInfo pi, List<Comment> comments,
@NonNull ImmutableArray<Modifier> modArray,
ProgramElementName name, ProgramElementName fullName,
ImmutableArray<MemberDeclaration> members, boolean parentIsInterfaceDeclaration,
boolean isLibrary, List<TextualJMLConstruct> jmlAttachments) {
super(pi, comments, modArray, name, fullName, members, parentIsInterfaceDeclaration,
isLibrary, ImmutableList.fromList(jmlAttachments));
}

/**
* returns the local declared supertypes
*/
public ImmutableList<KeYJavaType> getSupertypes() {
return ImmutableList.of();
}

/**
* calls the corresponding method of a visitor in order to
* perform some action/transformation on this element
*
* @param v the Visitor
*/
public void visit(Visitor v) {
v.performActionOnAnnotationInterfaceDeclaration(this);
}

/**
* Returns the number of children of this node.
*
* @return an int giving the number of children of this node
*/
public int getChildCount() {
int result = 0;
if (modArray != null) result += modArray.size();
if (name != null) result++;
if (members != null) result += members.size();
return result;
}

/**
* Returns the child at the specified index in this node's "virtual" child array
*
* @param index an index into this node's "virtual" child array
* @return the program element at the given position
* @throws ArrayIndexOutOfBoundsException if <tt>index</tt> is out of bounds
*/
public ProgramElement getChildAt(int index) {
int len;
if (modArray != null) {
len = modArray.size();
if (len > index) return modArray.get(index);
index -= len;
}
if (name != null) {
if (index == 0) return name;
index--;
}
if (members != null) return members.get(index);
throw new ArrayIndexOutOfBoundsException();
}

public boolean isInterface() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* KeY used to model arrays using only the {@link ArrayType}. As
* the only attribute of an array has been the length attribute, it has been handled in a different
Expand All @@ -27,6 +30,7 @@

public class ArrayDeclaration extends TypeDeclaration implements ArrayType {

private static final Logger LOGGER = LoggerFactory.getLogger(ArrayDeclaration.class);

/**
* reference to the type the elements of this array must subclass
Expand Down Expand Up @@ -213,13 +217,14 @@ public static ProgramElementName createName(TypeReference basetype) {
return null;
}


public String getAlternativeNameRepresentation() {
if (altNameRepresentation == null) {
final StringBuilder alt = new StringBuilder();
Type baseType = this.baseType.getKeYJavaType().getJavaType();

if (baseType instanceof ArrayType) {
if (baseType == null) {
alt.append(this.baseType.getKeYJavaType().getName());
} else if (baseType instanceof ArrayType) {
alt.append(((ArrayType) baseType).getAlternativeNameRepresentation());
} else {
if (baseType instanceof ClassType) {
Expand All @@ -234,7 +239,6 @@ public String getAlternativeNameRepresentation() {
return altNameRepresentation;
}


/**
* returns the local declared supertypes
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/**
* This package collects all Java modifiers. The sole abstraction beneath
* the parent {@link recoder.java.declaration.Modifier} is the
* {@link recoder.java.declaration.modifier.VisibilityModifier}.
* This package collects all Java modifiers.
*/
package de.uka.ilkd.key.java.declaration.modifier;
package de.uka.ilkd.key.java.ast.declaration.modifier;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* This file is part of KeY - https://key-project.org
* KeY is licensed under the GNU General Public License Version 2
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.java.ast.expression;

import de.uka.ilkd.key.java.*;
import de.uka.ilkd.key.java.ast.*;
import de.uka.ilkd.key.java.ast.reference.ExecutionContext;
import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType;
import de.uka.ilkd.key.java.visitor.Visitor;

public abstract class AnnotationExpression extends JavaNonTerminalProgramElement
implements Expression, ExpressionContainer {

protected final KeYJavaType kjt;

public AnnotationExpression(KeYJavaType kjt) {
this.kjt = kjt;
}

@Override
public void visit(Visitor v) {
v.performActionOnAnnotationExpression(this);
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
return ((AnnotationExpression) o).kjt.equals(kjt) && super.equals(o);
}

@Override
public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) {
return kjt;
}

public KeYJavaType getKeYJavaType() {
return kjt;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package de.uka.ilkd.key.java.ast.expression.annotation;

import de.uka.ilkd.key.java.ast.*;
import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType;
import de.uka.ilkd.key.java.ast.expression.*;

public class MarkerAnnotation extends AnnotationExpression {
public MarkerAnnotation(KeYJavaType kjt) {
super(kjt);
}

@Override
public int getChildCount() {
return 0;
}

@Override
public ProgramElement getChildAt(int index) {
throw new ArrayIndexOutOfBoundsException();
}

@Override
public int getExpressionCount() {
return 0;
}

@Override
public Expression getExpressionAt(int index) {
throw new ArrayIndexOutOfBoundsException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public New(ExtList children, ReferencePrefix rp, PositionInfo pi) {
accessPath = rp;
}


/**
* Constructor for the transformation of COMPOST ASTs to KeY.
*
Expand Down Expand Up @@ -210,6 +209,7 @@ public ProgramElement getChildAt(int index) {
if (index == 0) {
return anonymousClass;
}
index--;
}
throw new ArrayIndexOutOfBoundsException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public ProgramElement getChildAt(int index) {
if (index == 0) {
return arrayInitializer;
}
index--;
}
throw new ArrayIndexOutOfBoundsException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public abstract class TypeOperator extends Operator implements TypeReferenceCont
*/
protected final TypeReference typeReference;


/**
* Constructor for the transformation of COMPOST ASTs to KeY.
*
Expand Down Expand Up @@ -121,6 +120,4 @@ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) {
public KeYJavaType getKeYJavaType(Services javaServ) {
return getTypeReference().getKeYJavaType();
}


}
Loading
Loading