From 5facf158df97e8cb3ef47680f3d7895dab0bc25d Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Sun, 12 Apr 2026 14:24:46 +0200 Subject: [PATCH 1/7] make Modifier to an enum --- .../impl/InformationFlowContractImpl.java | 4 +- .../uka/ilkd/key/wd/BlockWellDefinedness.java | 4 +- .../uka/ilkd/key/wd/ClassWellDefinedness.java | 4 +- .../uka/ilkd/key/wd/LoopWellDefinedness.java | 4 +- .../ilkd/key/wd/MethodWellDefinedness.java | 4 +- .../key/wd/SpecificationRepositoryWD.java | 3 +- .../java/de/uka/ilkd/key/java/JavaInfo.java | 15 +- .../ast/declaration/ClassInitializer.java | 27 +- .../java/ast/declaration/JavaDeclaration.java | 44 +- .../key/java/ast/declaration/Modifier.java | 147 +++-- .../ast/declaration/modifier/Abstract.java | 44 -- .../modifier/AnnotationUseSpecification.java | 46 -- .../java/ast/declaration/modifier/Final.java | 45 -- .../java/ast/declaration/modifier/Ghost.java | 29 - .../java/ast/declaration/modifier/Model.java | 29 - .../ast/declaration/modifier/Modifiers.java | 582 ------------------ .../java/ast/declaration/modifier/Native.java | 44 -- .../ast/declaration/modifier/NoState.java | 29 - .../ast/declaration/modifier/Private.java | 63 -- .../ast/declaration/modifier/Protected.java | 64 -- .../java/ast/declaration/modifier/Public.java | 58 -- .../java/ast/declaration/modifier/Static.java | 46 -- .../ast/declaration/modifier/StrictFp.java | 48 -- .../declaration/modifier/Synchronized.java | 47 -- .../ast/declaration/modifier/Transient.java | 46 -- .../ast/declaration/modifier/TwoState.java | 29 - .../modifier/VisibilityModifier.java | 59 -- .../ast/declaration/modifier/Volatile.java | 45 -- .../declaration/modifier/package-info.java | 6 - .../java/loader/CreateArrayMethodBuilder.java | 19 +- .../ilkd/key/java/loader/JP2KeYConverter.java | 64 +- .../key/java/loader/JP2KeYTypeConverter.java | 12 +- .../proof/mgt/SpecificationRepository.java | 29 +- .../metaconstruct/EnhancedForElimination.java | 4 +- .../AbstractAuxiliaryContractImpl.java | 4 +- .../uka/ilkd/key/speclang/ClassAxiomImpl.java | 16 +- .../ilkd/key/speclang/ClassInvariantImpl.java | 10 +- .../uka/ilkd/key/speclang/ContractAxiom.java | 10 +- .../key/speclang/DependencyContractImpl.java | 4 +- .../speclang/FunctionalAuxiliaryContract.java | 4 +- .../FunctionalOperationContractImpl.java | 4 +- .../key/speclang/InitiallyClauseImpl.java | 8 +- .../uka/ilkd/key/speclang/LoopSpecImpl.java | 4 +- .../uka/ilkd/key/speclang/MergeContract.java | 4 +- .../key/speclang/ModelMethodExecution.java | 10 +- .../ilkd/key/speclang/PartialInvAxiom.java | 4 +- .../de/uka/ilkd/key/speclang/QueryAxiom.java | 7 +- .../ilkd/key/speclang/RepresentsAxiom.java | 16 +- .../key/speclang/SpecificationElement.java | 6 +- .../dl/translation/DLSpecFactory.java | 5 +- .../key/speclang/jml/JMLInfoExtractor.java | 40 +- .../key/speclang/jml/JMLSpecExtractor.java | 34 +- .../jml/translation/JMLResolverManager.java | 17 +- .../jml/translation/JMLSpecFactory.java | 41 +- .../translation/SLExpressionResolver.java | 22 +- .../translation/SLResolverManager.java | 4 +- 56 files changed, 345 insertions(+), 1672 deletions(-) delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Abstract.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/AnnotationUseSpecification.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Final.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Ghost.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Model.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Modifiers.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Native.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/NoState.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Private.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Protected.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Public.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Static.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/StrictFp.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Synchronized.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Transient.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/TwoState.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/VisibilityModifier.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Volatile.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/package-info.java diff --git a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/impl/InformationFlowContractImpl.java b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/impl/InformationFlowContractImpl.java index 93d8fac9320..ab41edd687a 100644 --- a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/impl/InformationFlowContractImpl.java +++ b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/impl/InformationFlowContractImpl.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.informationflow.po.InfFlowContractPO; import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.IObserverFunction; import de.uka.ilkd.key.logic.op.IProgramMethod; @@ -431,7 +431,7 @@ public String getPODisplayName() { @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { assert false; // this is currently not applicable for contracts return null; } diff --git a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/BlockWellDefinedness.java b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/BlockWellDefinedness.java index a3001cb6826..6db45ebc305 100644 --- a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/BlockWellDefinedness.java +++ b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/BlockWellDefinedness.java @@ -7,7 +7,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; import de.uka.ilkd.key.logic.TermServices; @@ -109,7 +109,7 @@ public String getTypeName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { return block.getVisibility(); } diff --git a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/ClassWellDefinedness.java b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/ClassWellDefinedness.java index adda3f4db10..2f92efcbda3 100644 --- a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/ClassWellDefinedness.java +++ b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/ClassWellDefinedness.java @@ -7,7 +7,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; import de.uka.ilkd.key.logic.TermServices; @@ -155,7 +155,7 @@ public String getTypeName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { return inv.getVisibility(); } diff --git a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/LoopWellDefinedness.java b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/LoopWellDefinedness.java index ac2a84c57a1..c63f386d303 100644 --- a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/LoopWellDefinedness.java +++ b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/LoopWellDefinedness.java @@ -7,7 +7,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; import de.uka.ilkd.key.logic.TermServices; @@ -99,7 +99,7 @@ public String getTypeName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { return inv.getVisibility(); } diff --git a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/MethodWellDefinedness.java b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/MethodWellDefinedness.java index 430e51112e6..a351a9c947d 100644 --- a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/MethodWellDefinedness.java +++ b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/MethodWellDefinedness.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; import de.uka.ilkd.key.logic.TermServices; @@ -468,7 +468,7 @@ public String getTypeName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { return contract.getVisibility(); } diff --git a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/SpecificationRepositoryWD.java b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/SpecificationRepositoryWD.java index 7d2fd5f31e1..7df19717e71 100644 --- a/key.core.wd/src/main/java/de/uka/ilkd/key/wd/SpecificationRepositoryWD.java +++ b/key.core.wd/src/main/java/de/uka/ilkd/key/wd/SpecificationRepositoryWD.java @@ -10,7 +10,6 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.IObserverFunction; import de.uka.ilkd.key.logic.op.ProgramVariable; @@ -363,7 +362,7 @@ public void addClassInvariant(ClassInvariant inv) { } // inherit non-private, non-static invariants - if (!inv.isStatic() && VisibilityModifier.allowsInheritance(inv.getVisibility())) { + if (!inv.isStatic() && inv.getVisibility().allowsInheritance()) { final ImmutableList subs = services.getJavaInfo().getAllSubtypes(kjt); for (KeYJavaType sub : subs) { ClassInvariant subInv = inv.setKJT(sub); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/JavaInfo.java b/key.core/src/main/java/de/uka/ilkd/key/java/JavaInfo.java index 4e780b7ca34..f1d378864c2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/JavaInfo.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/JavaInfo.java @@ -8,7 +8,6 @@ import de.uka.ilkd.key.java.ast.ProgramElement; import de.uka.ilkd.key.java.ast.abstraction.*; import de.uka.ilkd.key.java.ast.declaration.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.reference.TypeRef; @@ -35,6 +34,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind.*; + /** * an instance serves as representation of a Java model underlying a DL formula. This class provides * calls to access the elements of the Java model using the KeY data structures only. Implementation @@ -377,14 +378,18 @@ public static boolean isVisibleTo(SpecificationElement ax, KeYJavaType visibleTo // TODO: package information not yet available // BUGFIX: package-private is understood as private (see bug #1268) final boolean visibleToPackage = false; - final VisibilityModifier visibility = ax.getVisibility(); - if (VisibilityModifier.isPublic(visibility)) { + final Modifier.ModifierKind visibility = ax.getVisibility(); + assert visibility != null && visibility.isVisibility(); + + if (PUBLIC == visibility) { return true; } - if (VisibilityModifier.allowsInheritance(visibility)) { + + if (visibility.allowsInheritance()) { return visibleTo.getSort().extendsTrans(kjt.getSort()) || visibleToPackage; } - if (VisibilityModifier.isPackageVisible(visibility)) { + + if (visibility == PROTECTED || visibility == JML_PACKAGE) { return visibleToPackage; } else { return kjt.equals(visibleTo); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/ClassInitializer.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/ClassInitializer.java index 339b6ec564a..3a8c42526c2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/ClassInitializer.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/ClassInitializer.java @@ -6,17 +6,17 @@ import java.util.List; import de.uka.ilkd.key.java.ast.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.Static; import de.uka.ilkd.key.java.visitor.Visitor; import org.key_project.util.ExtList; +import static de.uka.ilkd.key.java.ast.declaration.Modifier.createModifierList; + public class ClassInitializer extends JavaDeclaration implements MemberDeclaration, StatementContainer { - protected final StatementBlock body; @@ -26,8 +26,10 @@ public ClassInitializer() { } - public ClassInitializer(Static modifier, StatementBlock body) { - super(new Modifier[] { modifier }); + public ClassInitializer(boolean isStatic, StatementBlock body) { + super( + isStatic ? createModifierList(Modifier.ModifierKind.STATIC) + : createModifierList()); this.body = body; } @@ -40,8 +42,7 @@ public ClassInitializer(Modifier[] modifier, StatementBlock body, PositionInfo p /** * Class initializer. * - * @param children - * list with all children. May include: a StatementBlock (taken as body of the + * @param children list with all children. May include: a StatementBlock (taken as body of the * ClassInitialiyer), several Modifier (taken as modifiers of the declaration), a Comment */ public ClassInitializer(ExtList children) { @@ -50,7 +51,6 @@ public ClassInitializer(ExtList children) { } - public StatementBlock getBody() { return body; } @@ -92,11 +92,9 @@ public int getChildCount() { /** * 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 + * @param index an index into this node's "virtual" child array * @return the program element at the given position - * @exception ArrayIndexOutOfBoundsException - * if index is out of bounds + * @throws ArrayIndexOutOfBoundsException if index is out of bounds */ public ProgramElement getChildAt(int index) { @@ -116,7 +114,9 @@ public ProgramElement getChildAt(int index) { throw new ArrayIndexOutOfBoundsException(); } - /** A binary class initializer does not occur. */ + /** + * A binary class initializer does not occur. + */ public boolean isBinary() { return false; @@ -171,8 +171,7 @@ public SourceElement getLastElement() { * calls the corresponding method of a visitor in order to perform some action/transformation on * this element * - * @param v - * the Visitor + * @param v the Visitor */ public void visit(Visitor v) { v.performActionOnClassInitializer(this); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/JavaDeclaration.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/JavaDeclaration.java index e779e9c26e6..68d751329f2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/JavaDeclaration.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/JavaDeclaration.java @@ -22,7 +22,7 @@ import de.uka.ilkd.key.java.ast.Declaration; import de.uka.ilkd.key.java.ast.JavaNonTerminalProgramElement; import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.modifier.*; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.speclang.jml.pretranslation.TextualJMLConstruct; import org.key_project.util.ExtList; @@ -31,6 +31,7 @@ import org.key_project.util.collection.ImmutableSLList; import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; /** * Java declaration. @@ -98,11 +99,12 @@ public JavaDeclaration(ExtList children) { * is one, null otherwise. A return value of null can usually be * interpreted as package visibility. */ - public VisibilityModifier getVisibilityModifier() { + public @Nullable Modifier getModifier() { for (int i = modArray.size() - 1; i >= 0; i -= 1) { Modifier m = modArray.get(i); - if (m instanceof VisibilityModifier) { - return (VisibilityModifier) m; + var k = m.getKind(); + if (k.isVisibility()) { + return m; } } return null; @@ -119,10 +121,10 @@ public ImmutableList getAttachedJml() { return attachedJml; } - public boolean containsModifier(Class type) { + public boolean containsModifier(ModifierKind type) { int s = modArray.size(); for (int i = 0; i < s; i += 1) { - if (type.isInstance(modArray.get(i))) { + if (type == modArray.get(i).getKind()) { return true; } } @@ -134,7 +136,7 @@ public boolean containsModifier(Class type) { * Test whether the declaration is abstract. */ protected boolean isAbstract() { - return containsModifier(Abstract.class); + return containsModifier(ModifierKind.ABSTRACT); } @@ -142,7 +144,7 @@ protected boolean isAbstract() { * Test whether the declaration is private. */ protected boolean isPrivate() { - return containsModifier(Private.class); + return containsModifier(ModifierKind.PRIVATE); } @@ -150,7 +152,7 @@ protected boolean isPrivate() { * Test whether the declaration is protected. */ protected boolean isProtected() { - return containsModifier(Protected.class); + return containsModifier(ModifierKind.PROTECTED); } @@ -158,7 +160,7 @@ protected boolean isProtected() { * Test whether the declaration is public. */ protected boolean isPublic() { - return containsModifier(Public.class); + return containsModifier(ModifierKind.PUBLIC); } @@ -166,7 +168,7 @@ protected boolean isPublic() { * Test whether the declaration is static. */ protected boolean isStatic() { - return containsModifier(Static.class); + return containsModifier(ModifierKind.STATIC); } @@ -174,7 +176,7 @@ protected boolean isStatic() { * Test whether the declaration is transient. */ protected boolean isTransient() { - return containsModifier(Transient.class); + return containsModifier(ModifierKind.TRANSIENT); } @@ -182,17 +184,17 @@ protected boolean isTransient() { * Test whether the declaration is model (the jml modifier is meant). */ protected boolean isModel() { - return containsModifier(Model.class); + return containsModifier(ModifierKind.JML_MODEL); } /** * Get the state count of the declaration */ protected int getStateCount() { - if (containsModifier(TwoState.class)) { + if (containsModifier(ModifierKind.JML_TWO_STATE)) { return 2; } - if (containsModifier(NoState.class)) { + if (containsModifier(ModifierKind.JML_NO_STATE)) { return 0; } return 1; @@ -202,7 +204,7 @@ protected int getStateCount() { * Test whether the declaration is ghost (the jml modifier is meant). */ protected boolean isGhost() { - return containsModifier(Ghost.class); + return containsModifier(ModifierKind.JML_GHOST); } @@ -210,7 +212,7 @@ protected boolean isGhost() { * Test whether the declaration is volatile. */ protected boolean isVolatile() { - return containsModifier(Volatile.class); + return containsModifier(ModifierKind.VOLATILE); } @@ -218,7 +220,7 @@ protected boolean isVolatile() { * Test whether the declaration is strictfp. */ protected boolean isStrictFp() { - return containsModifier(StrictFp.class); + return containsModifier(ModifierKind.STRICTFP); } @@ -226,7 +228,7 @@ protected boolean isStrictFp() { * Test whether the declaration is final. */ protected boolean isFinal() { - return containsModifier(Final.class); + return containsModifier(ModifierKind.FINAL); } @@ -234,7 +236,7 @@ protected boolean isFinal() { * Test whether the declaration is native. */ protected boolean isNative() { - return containsModifier(Native.class); + return containsModifier(ModifierKind.NATIVE); } @@ -242,6 +244,6 @@ protected boolean isNative() { * Test whether the declaration is synchronized. */ protected boolean isSynchronized() { - return containsModifier(Synchronized.class); + return containsModifier(ModifierKind.SYNCHRONIZED); } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java index 0600fdd41e3..d5f501671c1 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java @@ -12,49 +12,116 @@ import org.key_project.logic.SyntaxElement; +import org.jspecify.annotations.NullMarked; + /** - * Modifier. taken from COMPOST and changed to achieve an immutable structure + * + * */ +@NullMarked +public class Modifier extends JavaProgramElement { + public static Modifier[] createModifierList(ModifierKind... modifierKind) { + Modifier[] modifiers = new Modifier[modifierKind.length]; + for (int i = 0; i < modifierKind.length; i++) { + modifiers[i] = new Modifier(modifierKind[i]); + } + return modifiers; + } -public abstract class Modifier extends JavaProgramElement { + public ModifierKind getKind() { + return keyword; + } - /** - * Modifier. - */ + public enum ModifierKind { + DEFAULT("default"), + PUBLIC("public"), + PROTECTED("protected"), + PRIVATE("private"), + ABSTRACT("abstract"), + STATIC("static"), + FINAL("final"), + TRANSIENT("transient"), + VOLATILE("volatile"), + SYNCHRONIZED("synchronized"), + NATIVE("native"), + STRICTFP("strictfp"), + TRANSITIVE("transitive"), + SEALED("sealed"), + NON_SEALED("non-sealed"), + // KEY + JML_PACKAGE("package"), + JML_PURE("pure"), + JML_STRICTLY_PURE("strictly_pure"), + JML_HELPER("helper"), + JML_INSTANCE("instance"), + JML_NULLABLE_BY_DEFAULT("nullable_by_default"), + JML_NON_NULL("non_null"), + JML_NULLABLE("nullable"), + JML_GHOST("ghost"), + JML_MODEL("model"), + JML_SPEC_PUBLIC("spec_public"), + JML_SPEC_PACKAGE("spec_package"), + JML_SPEC_PROTECTED("spec_protected"), + JML_SPEC_PRIVATE("spec_private"), + JML_NO_STATE("no_state"), + JML_TWO_STATE("two_state"), + JML_NON_NULL_BY_DEFAULT("non_null_by_default"), + JML_NON_NULL_ELEMENTS("nonnullelements"), + JML_UNPARSABLE_MODIFIERS(""), + JML_CODE_BIGINT_MATH("code_bigint_math"), + JML_CODE_JAVA_MATH("code_java_math"), + JML_CODE_SAFE_MATH("code_safe_math"), + JML_SPEC_BIGINT_MATH("spec_bigint_math"), + JML_SPEC_JAVA_MATH("spec_java_math"), + JML_SPEC_SAFE_MATH("spec_safe_math"), + JML_CODE("code"), + JML_OT_PEER("peer"), + JML_OT_REP("rep"), + JML_OT_READ_ONLY("read_only"); + + private final String codeRepresentation; + + ModifierKind(String codeRepresentation) { + this.codeRepresentation = codeRepresentation; + } + + /** + * @return the Java keyword represented by this enum constant. + */ + public String asString() { + if (name().startsWith("JML_")) { + return "/*@" + codeRepresentation + "*/"; + } + return codeRepresentation; + } + + public boolean isVisibility() { + return switch (this) { + case PUBLIC, PRIVATE, PROTECTED, JML_PACKAGE -> true; + default -> false; + }; + } + + public boolean allowsInheritance() { + return this == PUBLIC || this == PROTECTED || this == JML_PACKAGE; + } + } - public Modifier() {} + private final ModifierKind keyword; - /** - * Modifier. - */ - public Modifier(PositionInfo pi, List c) { - super(pi, c); + public Modifier(ModifierKind keyword) { + this.keyword = keyword; } - /** - * Get symbol. - * - * @return the string. - */ - - protected abstract String getSymbol(); + public Modifier(PositionInfo pi, List c, ModifierKind keyword) { + super(pi, c); + this.keyword = keyword; + } - /** - * Get symbol text. - * - * @return the symbol text. - */ public String getText() { - return getSymbol(); + return keyword.asString(); } - /** - * 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.performActionOnModifier(this); } @@ -70,13 +137,19 @@ public SyntaxElement getChild(int n) { } @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) + public final boolean equals(Object o) { + if (!(o instanceof Modifier modifier)) + return false; + if (!super.equals(o)) return false; - Modifier other = (Modifier) o; - return other.getSymbol().equals(getSymbol()) && super.equals(other); + + return keyword.equals(modifier.keyword); } + @Override + public int computeHashCode() { + int result = super.hashCode(); + result = 31 * result + keyword.hashCode(); + return result; + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Abstract.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Abstract.java deleted file mode 100644 index 12b3dd58e79..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Abstract.java +++ /dev/null @@ -1,44 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Abstract. - */ - -public class Abstract extends Modifier { - - /** - * Abstract. - */ - public Abstract() {} - - - /** - * Abstract. - * - * @param children - * list of children. May contain: Comments - */ - public Abstract(PositionInfo pi, List c) { - super(pi, c); - } - - - - /** - * Get symbol. - * - * @return the string. - */ - protected String getSymbol() { - return "abstract"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/AnnotationUseSpecification.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/AnnotationUseSpecification.java deleted file mode 100644 index 28acee43b25..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/AnnotationUseSpecification.java +++ /dev/null @@ -1,46 +0,0 @@ -/* 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.modifier; - -import de.uka.ilkd.key.java.ast.ProgramElement; -import de.uka.ilkd.key.java.ast.declaration.Modifier; -import de.uka.ilkd.key.java.ast.reference.TypeReference; -import de.uka.ilkd.key.java.ast.reference.TypeReferenceContainer; - -public class AnnotationUseSpecification extends Modifier implements TypeReferenceContainer { - - protected final TypeReference tr; - - public AnnotationUseSpecification(TypeReference tr) { - super(); - this.tr = tr; - } - - protected String getSymbol() { - return "@" + tr.toString(); - } - - public TypeReference getTypeReferenceAt(int index) { - if (index == 0) { - return tr; - } - throw new ArrayIndexOutOfBoundsException(); - } - - public int getTypeReferenceCount() { - return 1; - } - - public ProgramElement getChildAt(int index) { - if (index == 0) { - return tr; - } - throw new ArrayIndexOutOfBoundsException(); - } - - public int getChildCount() { - return 1; - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Final.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Final.java deleted file mode 100644 index 4a227a31cad..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Final.java +++ /dev/null @@ -1,45 +0,0 @@ -/* 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.modifier; - - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Final. - * - * @author AutoDoc - */ - -public class Final extends Modifier { - - /** - * Final. - */ - - public Final() {} - - /** - * Abstract. - * - * @param children - * list of children. May contain: Comments - */ - public Final(PositionInfo pi, List c) { - super(pi, c); - } - - /** - * Get symbol. - * - * @return the string. - */ - protected String getSymbol() { - return "final"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Ghost.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Ghost.java deleted file mode 100644 index 91e447ac62a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Ghost.java +++ /dev/null @@ -1,29 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * The JML modifier "ghost". - */ -public class Ghost extends Modifier { - - public Ghost() {} - - - public Ghost(PositionInfo pi, List c) { - super(pi, c); - } - - - protected String getSymbol() { - return "ghost"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Model.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Model.java deleted file mode 100644 index 4b67ec9d2ee..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Model.java +++ /dev/null @@ -1,29 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * The JML modifier "model". - */ -public class Model extends Modifier { - - public Model() {} - - - public Model(PositionInfo pi, List c) { - super(pi, c); - } - - - protected String getSymbol() { - return "model"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Modifiers.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Modifiers.java deleted file mode 100644 index 70144329623..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Modifiers.java +++ /dev/null @@ -1,582 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * - * @author Alexander Weigl - * @version 1 (3/3/26) - */ -public class Modifiers { - public static class DEFAULT extends Modifier { - public DEFAULT() { - } - - public DEFAULT(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "default"; - } - } - - public static class PUBLIC extends Modifier { - public PUBLIC() { - } - - public PUBLIC(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "public"; - } - } - - public static class PROTECTED extends Modifier { - public PROTECTED() { - } - - public PROTECTED(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "protected"; - } - } - - public static class PRIVATE extends Modifier { - public PRIVATE() { - } - - public PRIVATE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "private"; - } - } - - public static class ABSTRACT extends Modifier { - public ABSTRACT() { - } - - public ABSTRACT(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "abstract"; - } - } - - public static class STATIC extends Modifier { - public STATIC() { - } - - public STATIC(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "static"; - } - } - - public static class FINAL extends Modifier { - public FINAL() { - } - - public FINAL(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "final"; - } - } - - public static class TRANSIENT extends Modifier { - public TRANSIENT() { - } - - public TRANSIENT(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "transient"; - } - } - - public static class VOLATILE extends Modifier { - public VOLATILE() { - } - - public VOLATILE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "volatile"; - } - } - - public static class SYNCHRONIZED extends Modifier { - public SYNCHRONIZED() { - } - - public SYNCHRONIZED(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "synchronized"; - } - } - - public static class NATIVE extends Modifier { - public NATIVE() { - } - - public NATIVE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "native"; - } - } - - public static class STRICTFP extends Modifier { - public STRICTFP() { - } - - public STRICTFP(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "strictfp"; - } - } - - public static class TRANSITIVE extends Modifier { - public TRANSITIVE() { - } - - public TRANSITIVE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "transitive"; - } - } - - public static class SEALED extends Modifier { - public SEALED() { - } - - public SEALED(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "sealed"; - } - } - - public static class NON_SEALED extends Modifier { - public NON_SEALED() { - } - - public NON_SEALED(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "non-sealed"; - } - } - - public static class JML_PACKAGE extends Modifier { - public JML_PACKAGE() { - } - - public JML_PACKAGE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "package"; - } - } - - public static class JML_PURE extends Modifier { - public JML_PURE() { - } - - public JML_PURE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "pure"; - } - } - - public static class JML_STRICTLY_PURE extends Modifier { - public JML_STRICTLY_PURE() { - } - - public JML_STRICTLY_PURE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "strictly_pure"; - } - } - - public static class JML_HELPER extends Modifier { - public JML_HELPER() { - } - - public JML_HELPER(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "helper"; - } - } - - public static class JML_INSTANCE extends Modifier { - public JML_INSTANCE() { - } - - public JML_INSTANCE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "instance"; - } - } - - public static class JML_NULLABLE_BY_DEFAULT extends Modifier { - public JML_NULLABLE_BY_DEFAULT() { - } - - public JML_NULLABLE_BY_DEFAULT(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "nullable_by_default"; - } - } - - public static class JML_NON_NULL extends Modifier { - public JML_NON_NULL() { - } - - public JML_NON_NULL(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "non_null"; - } - } - - public static class JML_NULLABLE extends Modifier { - public JML_NULLABLE() { - } - - public JML_NULLABLE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "nullable"; - } - } - - - public static class JML_SPEC_PUBLIC extends Modifier { - public JML_SPEC_PUBLIC() { - } - - public JML_SPEC_PUBLIC(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_public"; - } - } - - public static class JML_SPEC_PACKAGE extends Modifier { - public JML_SPEC_PACKAGE() { - } - - public JML_SPEC_PACKAGE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_package"; - } - } - - public static class JML_SPEC_PROTECTED extends Modifier { - public JML_SPEC_PROTECTED() { - } - - public JML_SPEC_PROTECTED(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_protected"; - } - } - - public static class JML_SPEC_PRIVATE extends Modifier { - public JML_SPEC_PRIVATE() { - } - - public JML_SPEC_PRIVATE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_private"; - } - } - - public static class JML_NO_STATE extends Modifier { - public JML_NO_STATE() { - } - - public JML_NO_STATE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "no_state"; - } - } - - public static class JML_TWO_STATE extends Modifier { - public JML_TWO_STATE() { - } - - public JML_TWO_STATE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "two_state"; - } - } - - public static class JML_NON_NULL_BY_DEFAULT extends Modifier { - public JML_NON_NULL_BY_DEFAULT() { - } - - public JML_NON_NULL_BY_DEFAULT(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "non_null_by_default"; - } - } - - public static class JML_NON_NULL_ELEMENTS extends Modifier { - public JML_NON_NULL_ELEMENTS() { - } - - public JML_NON_NULL_ELEMENTS(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "nonnullelements"; - } - } - - public static class JML_UNPARSABLE_MODIFIERS extends Modifier { - public JML_UNPARSABLE_MODIFIERS() { - } - - public JML_UNPARSABLE_MODIFIERS(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return ""; - } - } - - public static class JML_CODE_BIGINT_MATH extends Modifier { - public JML_CODE_BIGINT_MATH() { - } - - public JML_CODE_BIGINT_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "code_bigint_math"; - } - } - - public static class JML_CODE_JAVA_MATH extends Modifier { - public JML_CODE_JAVA_MATH() { - } - - public JML_CODE_JAVA_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "code_java_math"; - } - } - - public static class JML_CODE_SAFE_MATH extends Modifier { - public JML_CODE_SAFE_MATH() { - } - - public JML_CODE_SAFE_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "code_safe_math"; - } - } - - public static class JML_SPEC_BIGINT_MATH extends Modifier { - public JML_SPEC_BIGINT_MATH() { - } - - public JML_SPEC_BIGINT_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_bigint_math"; - } - } - - public static class JML_SPEC_JAVA_MATH extends Modifier { - public JML_SPEC_JAVA_MATH() { - } - - public JML_SPEC_JAVA_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_java_math"; - } - } - - public static class JML_SPEC_SAFE_MATH extends Modifier { - public JML_SPEC_SAFE_MATH() { - } - - public JML_SPEC_SAFE_MATH(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "spec_safe_math"; - } - } - - public static class JML_CODE extends Modifier { - public JML_CODE() { - } - - public JML_CODE(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "code"; - } - } - - public static class JML_OT_PEER extends Modifier { - public JML_OT_PEER() { - } - - public JML_OT_PEER(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "peer"; - } - } - - public static class JML_OT_REP extends Modifier { - public JML_OT_REP() { - } - - public JML_OT_REP(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "rep"; - } - } - - public static class JML_OT_READ_ONLY extends Modifier { - public JML_OT_READ_ONLY() { - } - - public JML_OT_READ_ONLY(PositionInfo pi, List c) { - super(pi, c); - } - - protected String getSymbol() { - return "read_only"; - } - } - - public static void main(String[] args) { - String s = """ - public static class Nullable extends Modifier { - public Nullable() {} - public Nullable(PositionInfo pi, List c) { - super(pi, c); - } - protected String getSymbol() { - return "two_state"; - } - } - """; - for (var value : com.github.javaparser.ast.Modifier.DefaultKeyword.values()) { - System.out.println(s.replace("Nullable", value.name()) - .replace("two_state", value.asString())); - } - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Native.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Native.java deleted file mode 100644 index 27bbfb41187..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Native.java +++ /dev/null @@ -1,44 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Native. - * - * @author AutoDoc - */ - -public class Native extends Modifier { - - /** - * Native. - */ - - public Native() {} - - /** - * Native - * - * @param children - * list of children. May contain: Comments - */ - public Native(PositionInfo pi, List c) { - super(pi, c); - } - - /** - * Get symbol. - * - * @return the string. - */ - protected String getSymbol() { - return "native"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/NoState.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/NoState.java deleted file mode 100644 index 1fa84b00dee..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/NoState.java +++ /dev/null @@ -1,29 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * The JML modifier "no_state". - */ -public class NoState extends Modifier { - - public NoState() {} - - - public NoState(PositionInfo pi, List c) { - super(pi, c); - } - - - protected String getSymbol() { - return "no_state"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Private.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Private.java deleted file mode 100644 index 7b0cf578b61..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Private.java +++ /dev/null @@ -1,63 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; - - -/** - * Private. - * - * @author AutoDoc - */ - -public class Private extends VisibilityModifier { - - /** - * Private. - */ - - public Private() {} - - /** - * Private - * - * @param children - * list of children. May contain: Comments - */ - public Private(PositionInfo pi, List c) { - super(pi, c); - } - - - /** - * Get symbol. - * - * @return the string. - */ - protected String getSymbol() { - return "private"; - } - - @Override - public int compareTo(VisibilityModifier arg0) { - if (arg0 instanceof Private) { - return 0; - } - if (arg0 == null) { - return 1; - } - if (arg0 instanceof Protected) { - return 2; - } - if (arg0 instanceof Public) { - return 3; - } - assert false; - return 0; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Protected.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Protected.java deleted file mode 100644 index 130322a30d6..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Protected.java +++ /dev/null @@ -1,64 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; - -/** - * Protected. - * - * @author AutoDoc - */ - -public class Protected extends VisibilityModifier { - - /** - * Protected. - */ - - public Protected() {} - - /** - * Protected. - * - * @param children - * list of children. May contain: Comments - */ - - public Protected(PositionInfo pi, List c) { - super(pi, c); - } - - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "protected"; - } - - @Override - public int compareTo(VisibilityModifier arg0) { - if (arg0 instanceof Private) { - return -2; - } - if (arg0 == null) { - return -1; - } - if (arg0 instanceof Protected) { - return 0; - } - if (arg0 instanceof Public) { - return 1; - } - assert false; - return 0; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Public.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Public.java deleted file mode 100644 index 5b92ffb1feb..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Public.java +++ /dev/null @@ -1,58 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; - - -/** - * Public. - * - * @author AutoDoc - */ - -public class Public extends VisibilityModifier { - - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. - */ - public Public() { - super(); - } - - public Public(PositionInfo pi, List c) { - super(pi, c); - } - - /** - * Get symbol. - * - * @return the string. - */ - protected String getSymbol() { - return "public"; - } - - @Override - public int compareTo(VisibilityModifier arg0) { - if (arg0 instanceof Private) { - return -3; - } - if (arg0 == null) { - return -2; - } - if (arg0 instanceof Protected) { - return -1; - } - if (arg0 instanceof Public) { - return 0; - } - assert false; - return 0; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Static.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Static.java deleted file mode 100644 index dd4e148de63..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Static.java +++ /dev/null @@ -1,46 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Static. - * - * @author AutoDoc - */ - -public class Static extends Modifier { - - /** - * Static. - */ - - public Static() {} - - /** - * Static - * - * @param children - * the children of this AST element as KeY classes. May contain: Comments - */ - - public Static(PositionInfo pi, List c) { - super(pi, c); - } - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "static"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/StrictFp.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/StrictFp.java deleted file mode 100644 index c9d0ae41255..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/StrictFp.java +++ /dev/null @@ -1,48 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * Strict fp. - * - * @author AutoDoc - */ - -public class StrictFp extends Modifier { - - /** - * Strict fp. - */ - - public StrictFp() {} - - /** - * Strict fp. - * - * @param children - * the children of this AST element as KeY classes. May contain: Comments - */ - - public StrictFp(PositionInfo pi, List c) { - super(pi, c); - } - - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "strictfp"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Synchronized.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Synchronized.java deleted file mode 100644 index 3c6e737b6c9..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Synchronized.java +++ /dev/null @@ -1,47 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Synchronized. - * - * @author AutoDoc - */ - -public class Synchronized extends Modifier { - - /** - * Synchronized. - */ - - public Synchronized() {} - - /** - * Synchronized. - * - * @param children - * the children of this AST element as KeY classes. May contain: Comments - */ - - public Synchronized(PositionInfo pi, List c) { - super(pi, c); - } - - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "synchronized"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Transient.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Transient.java deleted file mode 100644 index 99336417b71..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Transient.java +++ /dev/null @@ -1,46 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Transient. - * - * @author AutoDoc - */ - -public class Transient extends Modifier { - - /** - * Transient. - */ - - public Transient() {} - - /** - * Transient. - * - * @param children - * the children of this AST element as KeY classes. May contain: Comments - */ - - public Transient(PositionInfo pi, List c) { - super(pi, c); - } - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "transient"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/TwoState.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/TwoState.java deleted file mode 100644 index ed23c931286..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/TwoState.java +++ /dev/null @@ -1,29 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * The JML modifier "two_state". - */ -public class TwoState extends Modifier { - - public TwoState() {} - - - public TwoState(PositionInfo pi, List c) { - super(pi, c); - } - - - protected String getSymbol() { - return "two_state"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/VisibilityModifier.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/VisibilityModifier.java deleted file mode 100644 index 16ee858ed56..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/VisibilityModifier.java +++ /dev/null @@ -1,59 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - - -/** - * Visibility modifier. Public, protected, and private modifiers are represented by instances of - * respective subclasses. Beware: package-privacy is represented by null! For - * comparison of modifiers, please use the static methods of this class instead of - * instanceof. - * - * @author AutoDoc - */ - -public abstract class VisibilityModifier extends Modifier - implements Comparable { - - protected VisibilityModifier() {} - - public VisibilityModifier(PositionInfo pi, List c) { - super(pi, c); - } - - /** Whether it represents a public modifier. */ - public static boolean isPublic(VisibilityModifier vm) { - assert sane(vm) : "Unknown visibility modifier: " + vm; - return vm instanceof Public; - } - - /** Whether it represents at least a protected modifier. */ - public static boolean allowsInheritance(VisibilityModifier vm) { - assert sane(vm) : "Unknown visibility modifier: " + vm; - return (vm instanceof Public || vm instanceof Protected); - } - - /** Whether it represents at least default (package-private) visibility. */ - public static boolean isPackageVisible(VisibilityModifier vm) { - assert sane(vm) : "Unknown visibility modifier: " + vm; - return vm == null || vm instanceof Public || vm instanceof Protected; - } - - /** Whether it represents a private modifier. */ - public static boolean isPrivate(VisibilityModifier vm) { - assert sane(vm) : "Unknown visibility modifier: " + vm; - return vm instanceof Private; - } - - private static boolean sane(VisibilityModifier vm) { - return vm == null || vm instanceof Public || vm instanceof Protected - || vm instanceof Private; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Volatile.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Volatile.java deleted file mode 100644 index b7a62b2b475..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/Volatile.java +++ /dev/null @@ -1,45 +0,0 @@ -/* 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.modifier; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.declaration.Modifier; - -/** - * Volatile. - * - */ - -public class Volatile extends Modifier { - - /** - * Volatile. - */ - - public Volatile() {} - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. - * - * @param children - * the children of this AST element as KeY classes. May contain: Comments - */ - public Volatile(PositionInfo pi, List c) { - super(pi, c); - } - - - /** - * Get symbol. - * - * @return the string. - */ - - protected String getSymbol() { - return "volatile"; - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/package-info.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/package-info.java deleted file mode 100644 index 573a2c02dcc..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/modifier/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * 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}. - */ -package de.uka.ilkd.key.java.declaration.modifier; diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java index 7275fe5f2b0..5384f8d0b56 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java @@ -21,11 +21,9 @@ import de.uka.ilkd.key.java.ast.declaration.MemberDeclaration; import de.uka.ilkd.key.java.ast.declaration.MethodDeclaration; import de.uka.ilkd.key.java.ast.declaration.Modifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; -import de.uka.ilkd.key.java.ast.declaration.modifier.Protected; -import de.uka.ilkd.key.java.ast.declaration.modifier.Static; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; import de.uka.ilkd.key.java.ast.expression.literal.IntLiteral; @@ -210,7 +208,8 @@ private ProgramVariable findInObjectFields(String name) { */ public IProgramMethod getArrayInstanceAllocatorMethod(TypeReference arrayTypeReference) { - final Modifier[] modifiers = { new Private(), new Static() }; + final Modifier[] modifiers = + Modifier.createModifierList(ModifierKind.PRIVATE, ModifierKind.STATIC); final KeYJavaType arrayType = arrayTypeReference.getKeYJavaType(); @@ -314,7 +313,7 @@ private StatementBlock getCreateArrayHelperBody( public IProgramMethod getCreateArrayHelperMethod(TypeReference arrayTypeReference, ProgramVariable length, ImmutableList fields) { - final Modifier[] modifiers = { new Private() }; + final Modifier[] modifiers = Modifier.createModifierList(ModifierKind.PRIVATE); final KeYJavaType arrayType = arrayTypeReference.getKeYJavaType(); final MethodDeclaration md = new MethodDeclaration(modifiers, arrayTypeReference, @@ -333,7 +332,8 @@ public IProgramMethod getCreateArrayHelperMethod(TypeReference arrayTypeReferenc public IProgramMethod getCreateArrayMethod(TypeReference arrayTypeReference, IProgramMethod prepare, ImmutableList fields) { - final Modifier[] modifiers = { new Protected(), new Static() }; + final Modifier[] modifiers = + Modifier.createModifierList(ModifierKind.PROTECTED, ModifierKind.STATIC); final KeYJavaType arrayType = arrayTypeReference.getKeYJavaType(); @@ -387,9 +387,10 @@ public IProgramMethod getPrepareArrayMethod(TypeRef arrayRef, ProgramVariable le final StatementBlock body = new StatementBlock(new Statement[] { forLoop }); - final MethodDeclaration md = new MethodDeclaration(new Modifier[] { new Private() }, - arrayRef, new ProgramElementName(PipelineConstants.IMPLICIT_OBJECT_PREPARE), - new ParameterDeclaration[0], null, body, false); + final MethodDeclaration md = + new MethodDeclaration(Modifier.createModifierList(ModifierKind.PRIVATE), + arrayRef, new ProgramElementName(PipelineConstants.IMPLICIT_OBJECT_PREPARE), + new ParameterDeclaration[0], null, body, false); return new ProgramMethod(md, arrayType, KeYJavaType.VOID_TYPE, PositionInfo.UNDEFINED, heapSort); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java index 0820a14a8d2..a1982db41f7 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java @@ -15,8 +15,8 @@ import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.ccatch.*; import de.uka.ilkd.key.java.ast.declaration.*; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.declaration.TypeDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.*; import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; @@ -82,6 +82,7 @@ import org.slf4j.LoggerFactory; import static com.github.javaparser.ast.Modifier.DefaultKeyword.*; +import static de.uka.ilkd.key.java.ast.declaration.Modifier.createModifierList; import static java.lang.String.format; /** @@ -898,8 +899,9 @@ public Object visit(InitializerDeclaration n, Void arg) { var c = createComments(n); StatementBlock body = accept(n.getBody()); var mods = - n.isStatic() ? new de.uka.ilkd.key.java.ast.declaration.Modifier[] { new Static() } - : new de.uka.ilkd.key.java.ast.declaration.Modifier[0]; + n.isStatic() + ? createModifierList(ModifierKind.STATIC) + : createModifierList(); return new ClassInitializer(mods, body, pi, c); } @@ -1576,56 +1578,12 @@ public Object visit(Modifier n, Void arg) { return null; } - return switch ((Modifier.DefaultKeyword) k) { - case PUBLIC -> new Public(pi, c); - case PROTECTED -> new Protected(pi, c); - case PRIVATE -> new Private(pi, c); - case ABSTRACT -> new Abstract(pi, c); - case STATIC -> new Static(pi, c); - case FINAL -> new Final(pi, c); - case TRANSIENT -> new Transient(pi, c); - case VOLATILE -> new Volatile(pi, c); - case SYNCHRONIZED -> new Synchronized(pi, c); - case NATIVE -> new Native(pi, c); - case STRICTFP -> new StrictFp(pi, c); - case TRANSITIVE -> new Modifiers.TRANSITIVE(pi, c); - case SEALED -> new Modifiers.SEALED(pi, c); - case NON_SEALED -> new Modifiers.NON_SEALED(pi, c); - case JML_PACKAGE -> new Modifiers.JML_PACKAGE(pi, c); - case JML_PURE -> new Modifiers.JML_PURE(pi, c); - case JML_STRICTLY_PURE -> new Modifiers.JML_STRICTLY_PURE(pi, c); - case JML_HELPER -> new Modifiers.JML_HELPER(pi, c); - case JML_INSTANCE -> new Modifiers.JML_INSTANCE(pi, c); - case JML_NULLABLE_BY_DEFAULT -> new Modifiers.JML_NULLABLE_BY_DEFAULT(pi, c); - case JML_NON_NULL -> new Modifiers.JML_NON_NULL(pi, c); - case JML_NULLABLE -> new Modifiers.JML_NULLABLE(pi, c); - case JML_GHOST -> new Ghost(pi, c); - case JML_MODEL -> new Model(pi, c); - case JML_TWO_STATE -> new TwoState(pi, c); - case JML_SPEC_PUBLIC -> new Modifiers.JML_SPEC_PUBLIC(pi, c); - case JML_SPEC_PACKAGE -> new Modifiers.JML_SPEC_PACKAGE(pi, c); - case JML_SPEC_PROTECTED -> new Modifiers.JML_SPEC_PROTECTED(pi, c); - case JML_SPEC_PRIVATE -> new Modifiers.JML_SPEC_PRIVATE(pi, c); - case JML_NO_STATE -> new NoState(pi, c); - case JML_NON_NULL_BY_DEFAULT -> new Modifiers.JML_NON_NULL_BY_DEFAULT(pi, c); - case JML_NON_NULL_ELEMENTS -> new Modifiers.JML_NON_NULL_ELEMENTS(pi, c); - case JML_UNPARSABLE_MODIFIERS -> new Modifiers.JML_UNPARSABLE_MODIFIERS(pi, c); - case JML_CODE_BIGINT_MATH -> new Modifiers.JML_CODE_BIGINT_MATH(pi, c); - case JML_CODE_JAVA_MATH -> new Modifiers.JML_CODE_JAVA_MATH(pi, c); - case JML_CODE_SAFE_MATH -> new Modifiers.JML_CODE_SAFE_MATH(pi, c); - case JML_SPEC_BIGINT_MATH -> new Modifiers.JML_SPEC_BIGINT_MATH(pi, c); - case JML_SPEC_JAVA_MATH -> new Modifiers.JML_SPEC_JAVA_MATH(pi, c); - case JML_SPEC_SAFE_MATH -> new Modifiers.JML_SPEC_SAFE_MATH(pi, c); - case JML_CODE -> new Modifiers.JML_CODE(pi, c); - case JML_OT_PEER -> new Modifiers.JML_OT_PEER(pi, c); - case JML_OT_REP -> new Modifiers.JML_OT_REP(pi, c); - case JML_OT_READ_ONLY -> new Modifiers.JML_OT_READ_ONLY(pi, c); - case DEFAULT -> new Modifiers.DEFAULT(pi, c); - default -> { - reportUnsupportedElement(n); - yield null; - } - }; + var kind = ModifierKind.valueOf( + ((Modifier.DefaultKeyword) k).name()); + if (kind == null) { + reportUnsupportedElement(n); + } + return new de.uka.ilkd.key.java.ast.declaration.Modifier(pi, c, kind); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYTypeConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYTypeConverter.java index 278ced1684e..6dcb5d27c2c 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYTypeConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYTypeConverter.java @@ -11,8 +11,7 @@ import de.uka.ilkd.key.java.ast.ResolvedLogicalType; import de.uka.ilkd.key.java.ast.abstraction.*; import de.uka.ilkd.key.java.ast.declaration.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.Final; -import de.uka.ilkd.key.java.ast.declaration.modifier.Public; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; import de.uka.ilkd.key.java.ast.reference.TypeRef; @@ -47,6 +46,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static de.uka.ilkd.key.java.ast.declaration.Modifier.createModifierList; + /** * provide means to convert recoder types to the corresponding KeY type structures. *

@@ -109,7 +110,7 @@ private void initializeCaches(KeYJPMapping jp2KeY) { this.__serializableType = kjt; found += 1; break; - default:; + default: } if (found == 3) { break; @@ -358,8 +359,7 @@ private Sort createObjectSort(ResolvedTypeDeclaration ct, ImmutableSet sup if (ct.isClass()) { var ast = ct.asClass().toAst(); if (ast.isPresent() - && ast.get() instanceof com.github.javaparser.ast.body.TypeDeclaration) { - var td = (com.github.javaparser.ast.body.TypeDeclaration) ast.get(); + && ast.get() instanceof com.github.javaparser.ast.body.TypeDeclaration td) { isAbstract = td.hasModifier(com.github.javaparser.ast.Modifier.DefaultKeyword.ABSTRACT); } @@ -422,7 +422,7 @@ private KeYJavaType createSuperArrayType() { var specLength = new FieldSpecification(new LocationVariable(new ProgramElementName("length"), integerType, superArrayType, false, false, false, true)); - var f = new FieldDeclaration(new Modifier[] { new Public(), new Final() }, + var f = new FieldDeclaration(createModifierList(ModifierKind.PUBLIC, ModifierKind.FINAL), new TypeRef(integerType), new FieldSpecification[] { specLength }, false); superArrayType.setJavaType(new SuperArrayDeclaration(f)); return superArrayType; diff --git a/key.core/src/main/java/de/uka/ilkd/key/proof/mgt/SpecificationRepository.java b/key.core/src/main/java/de/uka/ilkd/key/proof/mgt/SpecificationRepository.java index 455e5a2a48f..a7d209d8aa0 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/proof/mgt/SpecificationRepository.java +++ b/key.core/src/main/java/de/uka/ilkd/key/proof/mgt/SpecificationRepository.java @@ -14,8 +14,7 @@ import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.ClassDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.statement.LoopStatement; import de.uka.ilkd.key.java.ast.statement.MergePointStatement; import de.uka.ilkd.key.logic.*; @@ -763,7 +762,7 @@ public void addClassInvariant(ClassInvariant inv) { addClassAxiom(new PartialInvAxiom(inv, true, services)); } // inherit non-private, non-static invariants - if (!inv.isStatic() && VisibilityModifier.allowsInheritance(inv.getVisibility())) { + if (!inv.isStatic() && inv.getVisibility().allowsInheritance()) { final ImmutableList subs = services.getJavaInfo().getAllSubtypes(kjt); for (KeYJavaType sub : subs) { ClassInvariant subInv = inv.setKJT(sub); @@ -791,7 +790,7 @@ public void createContractsFromInitiallyClauses() throws SLTranslationException for (KeYJavaType kjt : initiallyClauses.keySet()) { for (InitiallyClause inv : initiallyClauses.get(kjt)) { createContractsFromInitiallyClause(inv, kjt); - if (VisibilityModifier.allowsInheritance(inv.getVisibility())) { + if (inv.getVisibility().allowsInheritance()) { final ImmutableList subs = services.getJavaInfo().getAllSubtypes(kjt); for (KeYJavaType sub : subs) { @@ -895,22 +894,26 @@ public ImmutableSet getClassAxioms(KeYJavaType selfKjt) { final ClassAxiom invRepresentsAxiom = new RepresentsAxiom("Class invariant axiom for " + kjt.getFullName(), invSymbol, - kjt, new Private(), null, invDef, selfVar, ImmutableSLList.nil(), null); + kjt, Modifier.ModifierKind.PRIVATE, null, invDef, selfVar, + ImmutableSLList.nil(), null); result = result.add(invRepresentsAxiom); final ClassAxiom staticInvRepresentsAxiom = new RepresentsAxiom( "Static class invariant axiom for " + kjt.getFullName(), staticInvSymbol, kjt, - new Private(), null, staticInvDef, null, ImmutableSLList.nil(), null); + Modifier.ModifierKind.PRIVATE, null, staticInvDef, null, ImmutableSLList.nil(), + null); result = result.add(staticInvRepresentsAxiom); final ClassAxiom invFreeRepresentsAxiom = new RepresentsAxiom( "Free class invariant axiom for " + kjt.getFullName(), freeInvSymbol, kjt, - new Private(), null, freeInvDef, selfVar, ImmutableSLList.nil(), null); + Modifier.ModifierKind.PRIVATE, null, freeInvDef, selfVar, ImmutableSLList.nil(), + null); result = result.add(invFreeRepresentsAxiom); final ClassAxiom staticFreeInvRepresentsAxiom = new RepresentsAxiom( "Free static class invariant axiom for " + kjt.getFullName(), - freeStaticInvSymbol, kjt, new Private(), null, freeStaticInvDef, null, + freeStaticInvSymbol, kjt, Modifier.ModifierKind.PRIVATE, null, freeStaticInvDef, + null, ImmutableSLList.nil(), null); result = result.add(staticFreeInvRepresentsAxiom); @@ -987,7 +990,7 @@ private ImmutableSet getModelMethodAxioms() { if (representsFromContract != null) { // TODO Wojtek: I do not understand the visibility // issues of model fields/methods. - // VisibilityModifier visibility = pm.isPrivate() ? + // Modifier visibility = pm.isPrivate() ? // new Private() : // (pm.isProtected() ? new Protected() : // (pm.isPublic() ? new Public() : null)); @@ -995,7 +998,8 @@ private ImmutableSet getModelMethodAxioms() { new RepresentsAxiom( "Definition axiom for " + pm.getName() + " in " + kjt.getFullName(), - pm, kjt, new Private(), preContract, representsFromContract, + pm, kjt, Modifier.ModifierKind.PRIVATE, preContract, + representsFromContract, selfVar, paramVars, atPreVars); result = result.add(modelMethodRepresentsAxiom); break; @@ -1022,7 +1026,8 @@ pm, kjt, new Private(), preContract, representsFromContract, final ClassAxiom modelMethodContractAxiom = new ContractAxiom( "Contract axiom for " + pm.getName() + " in " + kjt.getFullName(), pm, - kjt, new Private(), preFromContract, freePreFromContract, + kjt, Modifier.ModifierKind.PRIVATE, preFromContract, + freePreFromContract, postFromContract, freePostFromContract, mbyFromContract, atPreVars, selfVar, resultVar, paramVars); result = result.add(modelMethodContractAxiom); @@ -1053,7 +1058,7 @@ public void addClassAxiom(ClassAxiom ax) { axioms.put(kjt, currentAxioms.add(ax)); } // inherit represents clauses to subclasses and conjoin together - if (VisibilityModifier.allowsInheritance(ax.getVisibility())) { + if (ax.getVisibility().allowsInheritance()) { final ImmutableList subs = services.getJavaInfo().getAllSubtypes(kjt); for (KeYJavaType sub : subs) { RepresentsAxiom subAx = ((RepresentsAxiom) ax).setKJT(sub); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java index efb484735f1..a986caa91fe 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java @@ -16,7 +16,6 @@ import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; import de.uka.ilkd.key.java.ast.declaration.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.Ghost; import de.uka.ilkd.key.java.ast.expression.*; import de.uka.ilkd.key.java.ast.expression.literal.EmptySeqLiteral; import de.uka.ilkd.key.java.ast.expression.operator.*; @@ -253,7 +252,8 @@ private ProgramElement makeIterableForLoop(EnhancedFor enhancedFor, Transformati data.setValuesVariable(KeYJavaASTFactory.localVariable(services, VALUES, seqType)); // ghost \seq values = \seq_empty - final Statement valuesInit = KeYJavaASTFactory.declare(new Ghost(), data.valuesVariable(), + final Statement valuesInit = KeYJavaASTFactory.declare( + new Modifier(Modifier.ModifierKind.JML_GHOST), data.valuesVariable(), EmptySeqLiteral.INSTANCE, seqType); // Iterator itVar = expression.iterator(); diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/AbstractAuxiliaryContractImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/AbstractAuxiliaryContractImpl.java index 055e5d28789..d79127bdc20 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/AbstractAuxiliaryContractImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/AbstractAuxiliaryContractImpl.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.ast.Label; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.ldt.HeapLDT; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; @@ -232,7 +232,7 @@ public Variables getPlaceholderVariables() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { throw new UnsupportedOperationException(); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassAxiomImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassAxiomImpl.java index 9f66ad38829..1fc46f78f5f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassAxiomImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassAxiomImpl.java @@ -8,7 +8,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.OpCollector; import de.uka.ilkd.key.logic.op.IObserverFunction; @@ -20,11 +20,7 @@ import org.key_project.logic.Name; import org.key_project.logic.sort.Sort; import org.key_project.prover.rules.RuleSet; -import org.key_project.util.collection.DefaultImmutableSet; -import org.key_project.util.collection.ImmutableList; -import org.key_project.util.collection.ImmutableSLList; -import org.key_project.util.collection.ImmutableSet; -import org.key_project.util.collection.Pair; +import org.key_project.util.collection.*; /** * Represents an axiom specified in a class. @@ -37,7 +33,7 @@ public final class ClassAxiomImpl extends ClassAxiom { private final String name; private final KeYJavaType kjt; - private final VisibilityModifier visibility; + private final ModifierKind visibility; private final JTerm originalRep; private final LocationVariable originalSelfVar; @@ -48,7 +44,7 @@ public final class ClassAxiomImpl extends ClassAxiom { private final boolean isStatic; - public ClassAxiomImpl(String name, KeYJavaType kjt, VisibilityModifier visibility, JTerm rep, + public ClassAxiomImpl(String name, KeYJavaType kjt, ModifierKind visibility, JTerm rep, LocationVariable selfVar) { assert name != null; assert kjt != null; @@ -64,7 +60,7 @@ public ClassAxiomImpl(String name, KeYJavaType kjt, VisibilityModifier visibilit public ClassAxiomImpl(String name, String displayName, KeYJavaType kjt, - VisibilityModifier visibility, JTerm rep, LocationVariable selfVar) { + ModifierKind visibility, JTerm rep, LocationVariable selfVar) { this(name, kjt, visibility, rep, selfVar); this.displayName = displayName; } @@ -123,7 +119,7 @@ public KeYJavaType getKJT() { @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java index 3c04fef42d2..7737320e301 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.OpCollector; import de.uka.ilkd.key.logic.TermServices; @@ -42,7 +42,7 @@ public final class ClassInvariantImpl implements ClassInvariant { /** * The visibility of the class invariant (null for default visibility). */ - private final VisibilityModifier visibility; + private final ModifierKind visibility; /** * The original invariant from which the class invariant is derived. */ @@ -77,7 +77,7 @@ public final class ClassInvariantImpl implements ClassInvariant { * @param selfVar the variable used for the receiver object */ public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, - VisibilityModifier visibility, JTerm inv, LocationVariable selfVar) { + ModifierKind visibility, JTerm inv, LocationVariable selfVar) { this(name, displayName, kjt, visibility, inv, selfVar, false); } @@ -93,7 +93,7 @@ public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, * @param free whether this contract is free. */ public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, - VisibilityModifier visibility, JTerm inv, LocationVariable selfVar, + ModifierKind visibility, JTerm inv, LocationVariable selfVar, boolean free) { assert name != null && !name.isEmpty(); assert displayName != null && !displayName.isEmpty(); @@ -186,7 +186,7 @@ public boolean isFree() { @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/ContractAxiom.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/ContractAxiom.java index 2da150156c7..6fa8d1e0aca 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/ContractAxiom.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/ContractAxiom.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.ldt.JavaDLTheory; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.IObserverFunction; @@ -30,7 +30,7 @@ public final class ContractAxiom extends ClassAxiom { private final String name; private final IObserverFunction target; private final KeYJavaType kjt; - private final VisibilityModifier visibility; + private final ModifierKind visibility; private final JTerm originalPre; private final JTerm originalFreePre; private final JTerm originalPost; @@ -42,7 +42,7 @@ public final class ContractAxiom extends ClassAxiom { private final Map atPreVars; public ContractAxiom(String name, IObserverFunction target, KeYJavaType kjt, - VisibilityModifier visibility, JTerm pre, JTerm freePre, JTerm post, JTerm freePost, + ModifierKind visibility, JTerm pre, JTerm freePre, JTerm post, JTerm freePost, JTerm mby, Map atPreVars, LocationVariable selfVar, LocationVariable resultVar, ImmutableList paramVars) { this(name, null, target, kjt, visibility, pre, freePre, post, freePost, mby, atPreVars, @@ -50,7 +50,7 @@ public ContractAxiom(String name, IObserverFunction target, KeYJavaType kjt, } public ContractAxiom(String name, String displayName, IObserverFunction target, KeYJavaType kjt, - VisibilityModifier visibility, JTerm originalPre, JTerm originalFreePre, + ModifierKind visibility, JTerm originalPre, JTerm originalFreePre, JTerm originalPost, JTerm originalFreePost, JTerm originalMby, Map atPreVars, LocationVariable selfVar, LocationVariable resultVar, ImmutableList paramVars) { @@ -146,7 +146,7 @@ public KeYJavaType getKJT() { } @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/DependencyContractImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/DependencyContractImpl.java index c5ca24f603d..762cf333af8 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/DependencyContractImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/DependencyContractImpl.java @@ -10,7 +10,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.IObserverFunction; import de.uka.ilkd.key.logic.op.LocationVariable; @@ -451,7 +451,7 @@ public String getDisplayName() { @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalAuxiliaryContract.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalAuxiliaryContract.java index f279aee001b..5ec9e25fcdc 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalAuxiliaryContract.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalAuxiliaryContract.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; import de.uka.ilkd.key.logic.op.IProgramMethod; @@ -120,7 +120,7 @@ public String getDisplayName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { throw new UnsupportedOperationException(); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalOperationContractImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalOperationContractImpl.java index 5867dba2c24..738c9e03e8a 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalOperationContractImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/FunctionalOperationContractImpl.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.java.ast.Statement; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.MethodReference; @@ -1447,7 +1447,7 @@ public String getDisplayName() { } @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { assert false; // this is currently not applicable for contracts return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/InitiallyClauseImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/InitiallyClauseImpl.java index 41b3221e82a..5e1b8117c27 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/InitiallyClauseImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/InitiallyClauseImpl.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.OpCollector; import de.uka.ilkd.key.logic.TermServices; @@ -42,7 +42,7 @@ public final class InitiallyClauseImpl implements InitiallyClause { /** * The visibility of the initially clause (null for default visibility). */ - private final VisibilityModifier visibility; + private final ModifierKind visibility; /** * The invariant from which the initially clause is derived. */ @@ -73,7 +73,7 @@ public final class InitiallyClauseImpl implements InitiallyClause { * @param originalSpec */ public InitiallyClauseImpl(String name, String displayName, KeYJavaType kjt, - VisibilityModifier visibility, JTerm inv, LocationVariable selfVar, + ModifierKind visibility, JTerm inv, LocationVariable selfVar, LabeledParserRuleContext originalSpec) { assert name != null && !name.isEmpty(); assert displayName != null && !displayName.isEmpty(); @@ -149,7 +149,7 @@ public LabeledParserRuleContext getOriginalSpec() { } @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/LoopSpecImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/LoopSpecImpl.java index e60d10b1796..7ef79118523 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/LoopSpecImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/LoopSpecImpl.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.statement.LoopStatement; import de.uka.ilkd.key.java.visitor.Visitor; import de.uka.ilkd.key.ldt.HeapLDT; @@ -524,7 +524,7 @@ public String getUniqueName() { } @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { assert false; return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/MergeContract.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/MergeContract.java index a79ca6ca6df..15a427bca88 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/MergeContract.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/MergeContract.java @@ -6,7 +6,7 @@ import java.util.function.UnaryOperator; import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.statement.MergePointStatement; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.rule.merge.MergeProcedure; @@ -38,7 +38,7 @@ public interface MergeContract extends SpecificationElement { MergeProcedure getInstantiatedMergeProcedure(Services services); @Override - default VisibilityModifier getVisibility() { + default Modifier.ModifierKind getVisibility() { assert false : "Method getVisibility() is unimplemented for MergeContract"; return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/ModelMethodExecution.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/ModelMethodExecution.java index e0e343f3a85..90be5e69591 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/ModelMethodExecution.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/ModelMethodExecution.java @@ -7,7 +7,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.IObserverFunction; import de.uka.ilkd.key.rule.Taclet; @@ -23,15 +23,15 @@ public final class ModelMethodExecution extends ClassAxiom { private final String name; private final IObserverFunction target; private final KeYJavaType kjt; - private final VisibilityModifier visibility; + private final ModifierKind visibility; public ModelMethodExecution(String name, IObserverFunction target, KeYJavaType kjt, - VisibilityModifier visibility) { + ModifierKind visibility) { this(name, null, target, kjt, visibility); } public ModelMethodExecution(String name, String displayName, IObserverFunction target, - KeYJavaType kjt, VisibilityModifier visibility) { + KeYJavaType kjt, ModifierKind visibility) { assert name != null; assert kjt != null; @@ -103,7 +103,7 @@ public KeYJavaType getKJT() { } @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/PartialInvAxiom.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/PartialInvAxiom.java index 033eb7cafcf..db3814d8df7 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/PartialInvAxiom.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/PartialInvAxiom.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.ldt.HeapLDT; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.op.*; @@ -113,7 +113,7 @@ public KeYJavaType getKJT() { @Override - public VisibilityModifier getVisibility() { + public Modifier.ModifierKind getVisibility() { return inv.getVisibility(); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/QueryAxiom.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/QueryAxiom.java index e479c78702c..69a078711b8 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/QueryAxiom.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/QueryAxiom.java @@ -10,8 +10,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.statement.MethodBodyStatement; import de.uka.ilkd.key.ldt.HeapLDT; import de.uka.ilkd.key.logic.*; @@ -108,8 +107,8 @@ public KeYJavaType getKJT() { @Override - public VisibilityModifier getVisibility() { - return new Private(); + public ModifierKind getVisibility() { + return ModifierKind.PRIVATE; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/RepresentsAxiom.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/RepresentsAxiom.java index 1596bb5b3cb..046ec6b47d2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/RepresentsAxiom.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/RepresentsAxiom.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.ldt.JavaDLTheory; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; @@ -37,7 +37,7 @@ public final class RepresentsAxiom extends ClassAxiom { private final String name; private final IObserverFunction target; private final KeYJavaType kjt; - private final VisibilityModifier visibility; + private final ModifierKind visibility; private final JTerm originalPre; private final JTerm originalRep; private final LocationVariable originalSelfVar; @@ -48,14 +48,14 @@ public final class RepresentsAxiom extends ClassAxiom { private final ImmutableList originalParamVars; public RepresentsAxiom(String name, IObserverFunction target, KeYJavaType kjt, - VisibilityModifier visibility, JTerm pre, JTerm rep, LocationVariable selfVar, + ModifierKind visibility, JTerm pre, JTerm rep, LocationVariable selfVar, ImmutableList paramVars, Map atPreVars) { this(name, null, target, kjt, visibility, pre, rep, selfVar, paramVars, atPreVars); } public RepresentsAxiom(String name, String displayName, IObserverFunction target, - KeYJavaType kjt, VisibilityModifier visibility, JTerm pre, JTerm rep, + KeYJavaType kjt, ModifierKind visibility, JTerm pre, JTerm rep, LocationVariable selfVar, ImmutableList paramVars, Map atPreVars) { assert name != null; @@ -139,7 +139,7 @@ public KeYJavaType getKJT() { } @Override - public VisibilityModifier getVisibility() { + public ModifierKind getVisibility() { return visibility; } @@ -227,11 +227,11 @@ public RepresentsAxiom conjoin(RepresentsAxiom ax, TermBuilder tb) { if (!target.equals(ax.target) || !kjt.equals(ax.kjt)) { throw new RuntimeException("Tried to conjoin incompatible represents axioms."); } - VisibilityModifier minVisibility = visibility == null - ? (VisibilityModifier.isPrivate(ax.visibility) ? ax.visibility : null) + ModifierKind minVisibility = visibility == null + ? (ModifierKind.PRIVATE == ax.visibility ? ax.visibility : null) : (visibility.compareTo(ax.visibility) >= 0 ? visibility : ax.visibility); JTerm newRep = tb.and(originalRep, ax.originalRep); - JTerm newPre = null; + JTerm newPre; if (originalPre == null) { newPre = ax.originalPre; } else if (ax.originalPre == null) { diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/SpecificationElement.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/SpecificationElement.java index 1aa2d305652..2e337a77609 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/SpecificationElement.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/SpecificationElement.java @@ -7,10 +7,9 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.JTerm; -import org.jspecify.annotations.Nullable; /** @@ -32,8 +31,7 @@ public interface SpecificationElement { /** * Returns the visibility of the invariant (null for default visibility) */ - @Nullable - VisibilityModifier getVisibility(); + Modifier.ModifierKind getVisibility(); /** diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/dl/translation/DLSpecFactory.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/dl/translation/DLSpecFactory.java index 3c19130342d..62d2bd4697f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/dl/translation/DLSpecFactory.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/dl/translation/DLSpecFactory.java @@ -9,8 +9,8 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.SourceElement; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.declaration.TypeDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; import de.uka.ilkd.key.java.ast.statement.CatchAllStatement; import de.uka.ilkd.key.ldt.HeapLDT; import de.uka.ilkd.key.ldt.JavaDLTheory; @@ -196,7 +196,8 @@ public ClassInvariant createDLClassInvariant(String name, String displayName, final KeYJavaType kjt = services.getJavaInfo().getKeYJavaType(selfVar.sort()); assert kjt != null; - return new ClassInvariantImpl(name, displayName, kjt, new Private(), inv, selfVar); + return new ClassInvariantImpl(name, displayName, kjt, Modifier.ModifierKind.PRIVATE, inv, + selfVar); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLInfoExtractor.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLInfoExtractor.java index d63ac422977..a498e770eb2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLInfoExtractor.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLInfoExtractor.java @@ -7,7 +7,7 @@ import de.uka.ilkd.key.java.ast.Comment; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.Modifiers; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.op.IProgramMethod; import de.uka.ilkd.key.speclang.jml.pretranslation.TextualJMLConstruct; import de.uka.ilkd.key.speclang.njml.SpecMathMode; @@ -69,9 +69,9 @@ private static SpecMathMode checkForSpecMathMode(JavaDeclaration methodDeclarati // This is hacky but hard to do better // We exclude comments containing 'behaviour' since they can be from the method contract var specBigintMath = - methodDeclaration.containsModifier(Modifiers.JML_SPEC_BIGINT_MATH.class); - var specSafeMath = methodDeclaration.containsModifier(Modifiers.JML_SPEC_SAFE_MATH.class); - var specJavaMath = methodDeclaration.containsModifier(Modifiers.JML_SPEC_JAVA_MATH.class); + methodDeclaration.containsModifier(ModifierKind.JML_SPEC_BIGINT_MATH); + var specSafeMath = methodDeclaration.containsModifier(ModifierKind.JML_SPEC_SAFE_MATH); + var specJavaMath = methodDeclaration.containsModifier(ModifierKind.JML_SPEC_JAVA_MATH); // Consistency: bigint > safe > java var specMathMode = specBigintMath ? SpecMathMode.BIGINT : (specSafeMath ? SpecMathMode.SAFE : (specJavaMath ? SpecMathMode.JAVA : null)); @@ -119,14 +119,14 @@ private static ImmutableList getJMLComments(MethodDeclaration method) { * @return modifiers */ public static MethodDeclaration.JMLModifiers parseMethod(MethodDeclaration methodDeclaration) { - var pure = methodDeclaration.containsModifier(Modifiers.JML_PURE.class); - var strictlyPure = methodDeclaration.containsModifier(Modifiers.JML_STRICTLY_PURE.class); - var helper = methodDeclaration.containsModifier(Modifiers.JML_HELPER.class); + var pure = methodDeclaration.containsModifier(ModifierKind.JML_PURE); + var strictlyPure = methodDeclaration.containsModifier(ModifierKind.JML_STRICTLY_PURE); + var helper = methodDeclaration.containsModifier(ModifierKind.JML_HELPER); var specBigintMath = - methodDeclaration.containsModifier(Modifiers.JML_SPEC_BIGINT_MATH.class); - var specSafeMath = methodDeclaration.containsModifier(Modifiers.JML_SPEC_SAFE_MATH.class); - var specJavaMath = methodDeclaration.containsModifier(Modifiers.JML_SPEC_JAVA_MATH.class); + methodDeclaration.containsModifier(ModifierKind.JML_SPEC_BIGINT_MATH); + var specSafeMath = methodDeclaration.containsModifier(ModifierKind.JML_SPEC_SAFE_MATH); + var specJavaMath = methodDeclaration.containsModifier(ModifierKind.JML_SPEC_JAVA_MATH); // Consistency: bigint > safe > java var specMathMode = specBigintMath ? SpecMathMode.BIGINT : (specSafeMath ? SpecMathMode.SAFE : (specJavaMath ? SpecMathMode.JAVA : null)); @@ -156,7 +156,7 @@ private static ImmutableArray extractFieldModifiers(String fieldName, // public interface // ------------------------------------------------------------------------- - public static boolean hasJMLModifier(FieldDeclaration fd, Class modifier) { + public static boolean hasJMLModifier(FieldDeclaration fd, ModifierKind modifier) { return fd.containsModifier(modifier); } @@ -213,9 +213,9 @@ public static boolean isNullableByDefault(KeYJavaType t) { public static TypeDeclaration.JMLModifiers parseClass(TypeDeclaration td) { var comments = getJMLComments(td); - var pure = td.containsModifier(Modifiers.JML_PURE.class); - var strictlyPure = td.containsModifier(Modifiers.JML_STRICTLY_PURE.class); - var nullableByDefault = td.containsModifier(Modifiers.JML_NULLABLE_BY_DEFAULT.class); + var pure = td.containsModifier(ModifierKind.JML_PURE); + var strictlyPure = td.containsModifier(ModifierKind.JML_STRICTLY_PURE); + var nullableByDefault = td.containsModifier(ModifierKind.JML_NULLABLE_BY_DEFAULT); var specMathMode = checkForSpecMathMode(td); @@ -229,8 +229,8 @@ public static TypeDeclaration.JMLModifiers parseClass(TypeDeclaration td) { */ public static boolean isNullable(FieldDeclaration decl, TypeDeclaration td) { - boolean non_null = decl.containsModifier(Modifiers.JML_NON_NULL.class); - boolean nullable = decl.containsModifier(Modifiers.JML_NULLABLE.class); + boolean non_null = decl.containsModifier(ModifierKind.JML_NON_NULL); + boolean nullable = decl.containsModifier(ModifierKind.JML_NULLABLE); if (!non_null && !nullable) { return td.getJmlModifiers().nullableByDefault(); @@ -259,8 +259,8 @@ public static boolean parameterIsNullable(IProgramMethod pm, int pos) { public static boolean parameterIsNullable(IProgramMethod pm, ParameterDeclaration pd) { assert pm.getMethodDeclaration().getParameters().contains(pd) : "parameter " + pd + " does not belong to method declaration " + pm; - boolean non_null = pd.containsModifier(Modifiers.JML_NON_NULL.class); - boolean nullable = pd.containsModifier(Modifiers.JML_NULLABLE.class); + boolean non_null = pd.containsModifier(ModifierKind.JML_NON_NULL); + boolean nullable = pd.containsModifier(ModifierKind.JML_NULLABLE); if (!non_null && !nullable) { return isNullableByDefault(pm.getContainerType()); @@ -272,8 +272,8 @@ public static boolean parameterIsNullable(IProgramMethod pm, ParameterDeclaratio public static boolean resultIsNullable(IProgramMethod pm) { MethodDeclaration decl = pm.getMethodDeclaration(); - boolean non_null = decl.containsModifier(Modifiers.JML_NON_NULL.class); - boolean nullable = decl.containsModifier(Modifiers.JML_NULLABLE.class); + boolean non_null = decl.containsModifier(ModifierKind.JML_NON_NULL); + boolean nullable = decl.containsModifier(ModifierKind.JML_NULLABLE); if (!non_null && !nullable) { return isNullableByDefault(pm.getContainerType()); diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLSpecExtractor.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLSpecExtractor.java index a7f3c262dc4..7f7e590f8d8 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLSpecExtractor.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/JMLSpecExtractor.java @@ -4,16 +4,21 @@ package de.uka.ilkd.key.speclang.jml; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.TypeConverter; -import de.uka.ilkd.key.java.ast.*; +import de.uka.ilkd.key.java.ast.Label; +import de.uka.ilkd.key.java.ast.PositionInfo; +import de.uka.ilkd.key.java.ast.Statement; +import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.ArrayType; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.abstraction.Type; import de.uka.ilkd.key.java.ast.declaration.*; -import de.uka.ilkd.key.java.ast.declaration.modifier.*; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.reference.TypeReference; import de.uka.ilkd.key.java.ast.statement.LabeledStatement; import de.uka.ilkd.key.java.ast.statement.LoopStatement; @@ -35,9 +40,6 @@ import de.uka.ilkd.key.speclang.translation.SLWarningException; import org.key_project.util.collection.*; -import org.key_project.util.collection.DefaultImmutableSet; -import org.key_project.util.collection.ImmutableArray; -import org.key_project.util.collection.ImmutableList; import org.antlr.v4.runtime.ParserRuleContext; @@ -55,7 +57,9 @@ public final class JMLSpecExtractor implements SpecExtractor { private static final String THROWABLE = "java.lang.Throwable"; private static final String ERROR = "java.lang.Error"; private static final String RUNTIME_EXCEPTION = "java.lang.RuntimeException"; - /** The default signals only clause for errors and runtime exceptions. **/ + /** + * The default signals only clause for errors and runtime exceptions. + **/ private static final String DEFAULT_SIGNALS_ONLY = format("signals_only %s, %s;", ERROR, RUNTIME_EXCEPTION); /** @@ -181,20 +185,20 @@ public ImmutableSet extractClassSpecs(KeYJavaType kjt) // add invariants for non_null fields for (MemberDeclaration member : td.getMembers()) { if (member instanceof FieldDeclaration) { - VisibilityModifier visibility = null; + ModifierKind visibility = null; for (Modifier mod : member.getModifiers()) { - if (mod instanceof VisibilityModifier) { - visibility = (VisibilityModifier) mod; + visibility = mod.getKind(); + if (visibility.isVisibility()) { break; } } // check for spec_* modifiers (bug #1280) if (JMLInfoExtractor.hasJMLModifier((FieldDeclaration) member, - Modifiers.JML_SPEC_PUBLIC.class)) { - visibility = new Public(); + ModifierKind.JML_SPEC_PUBLIC)) { + visibility = ModifierKind.PUBLIC; } else if (JMLInfoExtractor.hasJMLModifier((FieldDeclaration) member, - Modifiers.JML_SPEC_PROTECTED.class)) { - visibility = new Protected(); + ModifierKind.JML_SPEC_PROTECTED)) { + visibility = ModifierKind.PROTECTED; } for (FieldSpecification field : ((FieldDeclaration) member) @@ -291,7 +295,7 @@ public List extractMethodSpecs(IProgramMethod pm, boolean ParserRuleContext modelMethodDefinition = null; for (var c : constructs) { if (c instanceof TextualJMLMethodDecl m) { - if (pm.getMethodDeclaration().containsModifier(Model.class)) { + if (pm.getMethodDeclaration().containsModifier(ModifierKind.JML_MODEL)) { modelMethodDefinition = m.getMethodDefinition(); break; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLResolverManager.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLResolverManager.java index c22a140f7f3..1a9cf4ef491 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLResolverManager.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLResolverManager.java @@ -7,10 +7,8 @@ import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.FieldDeclaration; import de.uka.ilkd.key.java.ast.declaration.MemberDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.Modifiers; -import de.uka.ilkd.key.java.ast.declaration.modifier.Protected; -import de.uka.ilkd.key.java.ast.declaration.modifier.Public; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.logic.op.LocationVariable; import de.uka.ilkd.key.speclang.jml.JMLInfoExtractor; import de.uka.ilkd.key.speclang.translation.*; @@ -33,13 +31,12 @@ public JMLResolverManager( @Override - public VisibilityModifier getSpecVisibility(MemberDeclaration md) { - if (JMLInfoExtractor.hasJMLModifier((FieldDeclaration) md, - Modifiers.JML_SPEC_PUBLIC.class)) { - return new Public(); + public Modifier getSpecVisibility(MemberDeclaration md) { + if (JMLInfoExtractor.hasJMLModifier((FieldDeclaration) md, ModifierKind.JML_SPEC_PUBLIC)) { + return new Modifier(ModifierKind.PUBLIC); } else if (JMLInfoExtractor.hasJMLModifier((FieldDeclaration) md, - Modifiers.JML_SPEC_PROTECTED.class)) { - return new Protected(); + ModifierKind.JML_SPEC_PROTECTED)) { + return new Modifier(ModifierKind.PRIVATE); } else { return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLSpecFactory.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLSpecFactory.java index 03bd1d3cafa..783db47a25f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLSpecFactory.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLSpecFactory.java @@ -8,16 +8,13 @@ import java.util.stream.Stream; import de.uka.ilkd.key.axiom_abstraction.predicateabstraction.AbstractionPredicate; -import de.uka.ilkd.key.java.*; +import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.*; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; -import de.uka.ilkd.key.java.ast.declaration.modifier.Protected; -import de.uka.ilkd.key.java.ast.declaration.modifier.Public; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.ldt.HeapLDT; import de.uka.ilkd.key.ldt.HeapLDT.SplitFieldName; @@ -370,14 +367,15 @@ private ImmutableList collectLocalVariables(StatementContainer return null; } - private VisibilityModifier getVisibility(TextualJMLConstruct textualConstruct) { + private ModifierKind getVisibility(TextualJMLConstruct textualConstruct) { for (JMLModifier modifier : textualConstruct.getModifiers()) { - if (modifier.equals(JMLModifier.PRIVATE)) { - return new Private(); - } else if (modifier.equals(JMLModifier.PROTECTED)) { - return new Protected(); - } else if (modifier.equals(JMLModifier.PUBLIC)) { - return new Public(); + switch (modifier) { + case PRIVATE: + return (ModifierKind.PRIVATE); + case PROTECTED: + return (ModifierKind.PROTECTED); + case PUBLIC: + return (ModifierKind.PUBLIC); } } return null; @@ -1112,7 +1110,7 @@ private ImmutableSet createDependencyOperationContract(IProgramMethod // public interface // ------------------------------------------------------------------------- public ClassInvariant createJMLClassInvariant(@NonNull KeYJavaType kjt, - VisibilityModifier visibility, boolean isStatic, + ModifierKind visibility, boolean isStatic, @NonNull LabeledParserRuleContext originalInv) { var context = Context.inClass(kjt, isStatic, tb); @@ -1148,7 +1146,7 @@ public ClassInvariant createJMLClassInvariant(KeYJavaType kjt, TextualJMLClassIn } public InitiallyClause createJMLInitiallyClause(@NonNull KeYJavaType kjt, - VisibilityModifier visibility, @NonNull LabeledParserRuleContext original) { + ModifierKind visibility, @NonNull LabeledParserRuleContext original) { var context = Context.inClass(kjt, false, tb); // translateToTerm expression @@ -1158,7 +1156,7 @@ public InitiallyClause createJMLInitiallyClause(@NonNull KeYJavaType kjt, // create invariant String name = getInicName(); - return new InitiallyClauseImpl(name, name, kjt, new Public(), inv, context.selfVar(), + return new InitiallyClauseImpl(name, name, kjt, ModifierKind.PUBLIC, inv, context.selfVar(), original); } @@ -1168,7 +1166,7 @@ public InitiallyClause createJMLInitiallyClause(KeYJavaType kjt, return createJMLInitiallyClause(kjt, getVisibility(textualInv), textualInv.getInv()); } - public ClassAxiom createJMLRepresents(@NonNull KeYJavaType kjt, VisibilityModifier visibility, + public ClassAxiom createJMLRepresents(@NonNull KeYJavaType kjt, ModifierKind visibility, @NonNull LabeledParserRuleContext originalRep, boolean isStatic) throws SLTranslationException { @@ -1224,10 +1222,8 @@ public ClassAxiom createJMLRepresents(KeYJavaType kjt, TextualJMLRepresents text * Creates a class axiom from a textual JML representation. As JML axioms are always without * modifiers, they are implicitly non-static and public. * - * @param kjt - * the type where the axiom is declared - * @param textual - * textual representation + * @param kjt the type where the axiom is declared + * @param textual textual representation * @return created {@link ClassAxiom} */ public ClassAxiom createJMLClassAxiom(@NonNull KeYJavaType kjt, TextualJMLClassAxiom textual) { @@ -1246,7 +1242,8 @@ public ClassAxiom createJMLClassAxiom(@NonNull KeYJavaType kjt, TextualJMLClassA String name = "class axiom in " + kjt.getFullName(); String displayName = textual.getName() == null ? name : "class axiom \"" + textual.getName() + "\" in " + kjt.getFullName(); - return new ClassAxiomImpl(name, displayName, kjt, new Public(), ax, context.selfVar()); + return new ClassAxiomImpl(name, displayName, kjt, ModifierKind.PUBLIC, ax, + context.selfVar()); } public Contract createJMLDependencyContract(KeYJavaType kjt, LocationVariable targetHeap, @@ -1350,7 +1347,7 @@ public ImmutableSet createJMLMergeContracts(final IProgramMethod new UnparameterizedMergeContract(mergeProc, mps, kjt); result = result.add(unparameterizedMergeContract); } else if (mergeProc instanceof ParametricMergeProcedure) { // arguments expected looking - // for params + // for params if (!(mergeProc instanceof MergeWithPredicateAbstraction)) { throw new IllegalStateException("Currently, MergeWithPredicateAbstraction(Factory) " + "is the only supported ParametricMergeProcedure"); diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLExpressionResolver.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLExpressionResolver.java index c8cb5ea95d4..f14aa2a59b3 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLExpressionResolver.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLExpressionResolver.java @@ -7,10 +7,7 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.MemberDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.Private; -import de.uka.ilkd.key.java.ast.declaration.modifier.Protected; -import de.uka.ilkd.key.java.ast.declaration.modifier.Public; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.reference.PackageReference; /** @@ -78,29 +75,30 @@ private boolean areInSamePackage(KeYJavaType kjt1, KeYJavaType kjt2) { /** * Helper for isVisible(). */ - private final boolean isVisibleHelper(MemberDeclaration md, KeYJavaType containingType, + private boolean isVisibleHelper(MemberDeclaration md, KeYJavaType containingType, KeYJavaType inType) { // use spec visibility - VisibilityModifier mod = manager.getSpecVisibility(md); + final var specVisibility = manager.getSpecVisibility(md); + ModifierKind mod = specVisibility == null ? null : specVisibility.getKind(); // no spec visibility? -> use ordinary Java visibility if (mod == null) { if (md.isPublic()) { - mod = new Public(); + mod = ModifierKind.PUBLIC; } else if (md.isProtected()) { - mod = new Protected(); + mod = ModifierKind.PROTECTED; } else if (md.isPrivate()) { - mod = new Private(); + mod = ModifierKind.PRIVATE; } } // check according to visibility rules - if (mod instanceof Public) { + if (mod == ModifierKind.PUBLIC) { return true; - } else if (mod instanceof Protected) { + } else if (mod == ModifierKind.PROTECTED) { return inType.getSort().extendsTrans(containingType.getSort()) || areInSamePackage(inType, containingType); - } else if (mod instanceof Private) { + } else if (mod == ModifierKind.PRIVATE) { return inType.equals(containingType); } else { return areInSamePackage(inType, containingType); diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLResolverManager.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLResolverManager.java index eea06618962..e48e484d57e 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLResolverManager.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/translation/SLResolverManager.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.MemberDeclaration; -import de.uka.ilkd.key.java.ast.declaration.modifier.VisibilityModifier; +import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.logic.*; import de.uka.ilkd.key.logic.op.LocationVariable; import de.uka.ilkd.key.logic.op.LogicVariable; @@ -262,7 +262,7 @@ public void popLocalVariablesNamespace() { * Returns a specification-language based visibility level for the passed member that should * take precedence over Java's ordinary visibility, or null. */ - public VisibilityModifier getSpecVisibility(MemberDeclaration md) { + public Modifier getSpecVisibility(MemberDeclaration md) { return null; } } From 99f1d92885cb3f8ca03b8ccaf48bbad0f0edc489 Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Sun, 12 Apr 2026 17:51:56 +0200 Subject: [PATCH 2/7] make Operators to enum --- .../po/snippet/BasicLoopExecutionSnippet.java | 8 +- .../BasicSymbolicExecutionSnippet.java | 12 +- .../ProgramVariableReferencesAnalyst.java | 10 +- .../impl/ExecutionOperationContract.java | 4 +- .../slicing/AbstractBackwardSlicer.java | 7 +- .../slicing/ThinBackwardSlicer.java | 4 +- .../de/uka/ilkd/key/java/JavaService.java | 2 +- .../uka/ilkd/key/java/KeYJavaASTFactory.java | 985 ++++++------------ .../de/uka/ilkd/key/java/TypeConverter.java | 31 +- .../key/java/ast/declaration/Modifier.java | 4 +- .../key/java/ast/expression/Assignment.java | 104 +- .../ast/expression/operator/BinaryAnd.java | 80 -- .../operator/BinaryAndAssignment.java | 81 -- .../ast/expression/operator/BinaryNot.java | 102 -- .../expression/operator/BinaryOperator.java | 89 +- .../ast/expression/operator/BinaryOr.java | 73 -- .../operator/BinaryOrAssignment.java | 84 -- .../ast/expression/operator/BinaryXOr.java | 72 -- .../operator/BinaryXOrAssignment.java | 82 -- .../operator/ComparativeOperator.java | 77 -- .../expression/operator/CopyAssignment.java | 88 -- .../java/ast/expression/operator/Divide.java | 75 -- .../expression/operator/DivideAssignment.java | 82 -- .../java/ast/expression/operator/Equals.java | 68 -- .../expression/operator/GreaterOrEquals.java | 59 -- .../ast/expression/operator/GreaterThan.java | 70 -- .../ast/expression/operator/Intersect.java | 40 - .../ast/expression/operator/LessOrEquals.java | 64 -- .../ast/expression/operator/LessThan.java | 69 -- .../operator/LogicFunctionalOperator.java | 108 ++ .../ast/expression/operator/LogicalAnd.java | 93 -- .../ast/expression/operator/LogicalNot.java | 100 -- .../ast/expression/operator/LogicalOr.java | 89 -- .../java/ast/expression/operator/Minus.java | 79 -- .../expression/operator/MinusAssignment.java | 79 -- .../java/ast/expression/operator/Modulo.java | 71 -- .../expression/operator/ModuloAssignment.java | 79 -- .../ast/expression/operator/Negative.java | 105 -- .../ast/expression/operator/NotEquals.java | 59 -- .../java/ast/expression/operator/Plus.java | 74 -- .../expression/operator/PlusAssignment.java | 80 -- .../ast/expression/operator/Positive.java | 108 -- .../expression/operator/PostDecrement.java | 79 -- .../expression/operator/PostIncrement.java | 91 -- .../ast/expression/operator/PreDecrement.java | 78 -- .../ast/expression/operator/PreIncrement.java | 79 -- .../ast/expression/operator/ShiftLeft.java | 106 -- .../operator/ShiftLeftAssignment.java | 98 -- .../ast/expression/operator/ShiftRight.java | 106 -- .../operator/ShiftRightAssignment.java | 99 -- .../java/ast/expression/operator/Subtype.java | 55 - .../java/ast/expression/operator/Times.java | 87 -- .../expression/operator/TimesAssignment.java | 99 -- .../expression/operator/UnaryOperator.java | 93 ++ .../operator/UnsignedShiftRight.java | 108 -- .../UnsignedShiftRightAssignment.java | 100 -- .../expression/operator/adt/AllFields.java | 52 - .../expression/operator/adt/AllObjects.java | 48 - .../expression/operator/adt/SeqConcat.java | 47 - .../ast/expression/operator/adt/SeqGet.java | 62 -- .../expression/operator/adt/SeqIndexOf.java | 61 -- .../expression/operator/adt/SeqLength.java | 69 -- .../ast/expression/operator/adt/SeqPut.java | 60 -- .../expression/operator/adt/SeqReverse.java | 61 -- .../expression/operator/adt/SeqSingleton.java | 59 -- .../ast/expression/operator/adt/SeqSub.java | 67 -- .../ast/expression/operator/adt/SetMinus.java | 41 - .../ast/expression/operator/adt/SetUnion.java | 41 - .../expression/operator/adt/Singleton.java | 53 - .../java/loader/CreateArrayMethodBuilder.java | 11 +- .../ilkd/key/java/loader/JP2KeYConverter.java | 159 +-- .../key/java/visitor/CreatingASTVisitor.java | 552 +--------- .../InnerBreakAndContinueReplacer.java | 6 +- .../ilkd/key/java/visitor/JavaASTVisitor.java | 315 +----- .../OuterBreakContinueAndReturnReplacer.java | 6 +- .../de/uka/ilkd/key/java/visitor/Visitor.java | 122 +-- .../java/de/uka/ilkd/key/ldt/DoubleLDT.java | 8 +- .../java/de/uka/ilkd/key/ldt/FloatLDT.java | 38 +- .../java/de/uka/ilkd/key/ldt/LocSetLDT.java | 38 +- .../main/java/de/uka/ilkd/key/ldt/SeqLDT.java | 30 +- .../java/de/uka/ilkd/key/ldt/SortLDT.java | 14 +- .../de/uka/ilkd/key/logic/JavaLogger.java | 1 + .../de/uka/ilkd/key/logic/VariableNamer.java | 4 +- .../ilkd/key/logic/sort/ProgramSVSort.java | 21 +- .../de/uka/ilkd/key/pp/PrettyPrinter.java | 349 ++----- .../key/proof/init/AbstractOperationPO.java | 8 +- .../key/rule/AuxiliaryContractBuilders.java | 11 +- .../key/rule/LoopInvariantBuiltInRuleApp.java | 14 +- .../ilkd/key/rule/ObserverToUpdateRule.java | 5 +- .../de/uka/ilkd/key/rule/QueryExpand.java | 6 +- .../key/rule/UseOperationContractRule.java | 10 +- .../metaconstruct/EnhancedForElimination.java | 14 +- .../key/rule/metaconstruct/EvaluateArgs.java | 8 +- .../rule/metaconstruct/InitArrayCreation.java | 12 +- .../key/rule/metaconstruct/SwitchToIf.java | 4 +- .../WhileLoopTransformation.java | 4 +- .../uka/ilkd/key/settings/Configuration.java | 1 - .../FunctionalOperationContractImpl.java | 4 +- 98 files changed, 1037 insertions(+), 6387 deletions(-) delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAnd.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAndAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryNot.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOr.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOrAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOr.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOrAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ComparativeOperator.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/CopyAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Divide.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/DivideAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Equals.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterOrEquals.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterThan.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Intersect.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessOrEquals.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessThan.java create mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalAnd.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalNot.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalOr.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Minus.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/MinusAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Modulo.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ModuloAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Negative.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/NotEquals.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Plus.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PlusAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Positive.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostDecrement.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostIncrement.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreDecrement.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreIncrement.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeft.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeftAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRight.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRightAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Subtype.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Times.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/TimesAssignment.java create mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRight.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRightAssignment.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllFields.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllObjects.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqConcat.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqGet.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqIndexOf.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqLength.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqPut.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqReverse.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSingleton.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSub.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetMinus.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetUnion.java delete mode 100644 key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/Singleton.java diff --git a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicLoopExecutionSnippet.java b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicLoopExecutionSnippet.java index b097139fcee..6653e4dd767 100644 --- a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicLoopExecutionSnippet.java +++ b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicLoopExecutionSnippet.java @@ -9,7 +9,6 @@ import de.uka.ilkd.key.java.ast.Statement; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.statement.MethodFrame; import de.uka.ilkd.key.logic.JTerm; @@ -23,6 +22,8 @@ import org.key_project.util.collection.ImmutableSLList; import org.key_project.util.collection.Pair; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + public class BasicLoopExecutionSnippet extends ReplaceAndRegisterMethod implements FactoryMethod { @Override @@ -102,8 +103,9 @@ private Pair buildJavaBlock(BasicSnippetData d) { LoopSpecification inv = (LoopSpecification) d.get(BasicSnippetData.Key.LOOP_INVARIANT); StatementBlock sb = (StatementBlock) inv.getLoop().getBody(); - final Assignment guardVarDecl = new CopyAssignment((LocationVariable) d.origVars.guard.op(), - inv.getLoop().getGuardExpression()); + final Assignment guardVarDecl = + new Assignment(Copy, (LocationVariable) d.origVars.guard.op(), + inv.getLoop().getGuardExpression()); final Statement guardVarMethodFrame = context == null ? guardVarDecl : new MethodFrame(null, context, new StatementBlock(guardVarDecl)); diff --git a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicSymbolicExecutionSnippet.java b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicSymbolicExecutionSnippet.java index 927b891d39f..9b798c11cdd 100644 --- a/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicSymbolicExecutionSnippet.java +++ b/key.core.infflow/src/main/java/de/uka/ilkd/key/informationflow/po/snippet/BasicSymbolicExecutionSnippet.java @@ -12,9 +12,9 @@ import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.expression.operator.New; import de.uka.ilkd.key.java.ast.reference.TypeRef; import de.uka.ilkd.key.java.ast.reference.TypeReference; @@ -124,7 +124,7 @@ private JavaBlock buildJavaBlock(BasicSnippetData d, ImmutableList formal formalArray.toArray(new Expression[formalArray.size()]); KeYJavaType forClass = (KeYJavaType) d.get(BasicSnippetData.Key.FOR_CLASS); final New n = new New(formalArray2, new TypeRef(forClass), null); - final CopyAssignment ca = new CopyAssignment(selfVar, n); + final Assignment ca = new Assignment(selfVar, n); sb = new StatementBlock(ca); } else { final MethodBodyStatement call = @@ -137,19 +137,17 @@ private JavaBlock buildJavaBlock(BasicSnippetData d, ImmutableList formal final TypeReference excTypeRef = javaInfo.createTypeReference(eType); // create try statement - final CopyAssignment nullStat = new CopyAssignment(exceptionVar, NullLiteral.NULL); + final Assignment nullStat = new Assignment(exceptionVar, NullLiteral.NULL); final VariableSpecification eSpec = new VariableSpecification(eVar); final ParameterDeclaration excDecl = new ParameterDeclaration(new Modifier[0], excTypeRef, eSpec, false); - final CopyAssignment assignStat = new CopyAssignment(exceptionVar, eVar); + final Assignment assignStat = new Assignment(exceptionVar, eVar); final Catch catchStat = new Catch(excDecl, new StatementBlock(assignStat)); final Try tryStat = new Try(sb, new Branch[] { catchStat }); final StatementBlock sb2 = new StatementBlock(nullStat, tryStat); // create java block - JavaBlock result = JavaBlock.createJavaBlock(sb2); - - return result; + return JavaBlock.createJavaBlock(sb2); } diff --git a/key.core.proof_references/src/main/java/de/uka/ilkd/key/proof_references/analyst/ProgramVariableReferencesAnalyst.java b/key.core.proof_references/src/main/java/de/uka/ilkd/key/proof_references/analyst/ProgramVariableReferencesAnalyst.java index 3c01ebf7b92..8245c1d0a58 100644 --- a/key.core.proof_references/src/main/java/de/uka/ilkd/key/proof_references/analyst/ProgramVariableReferencesAnalyst.java +++ b/key.core.proof_references/src/main/java/de/uka/ilkd/key/proof_references/analyst/ProgramVariableReferencesAnalyst.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.ast.ExpressionContainer; import de.uka.ilkd.key.java.ast.ProgramElement; import de.uka.ilkd.key.java.ast.SourceElement; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.reference.FieldReference; import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; import de.uka.ilkd.key.java.ast.statement.If; @@ -20,6 +20,8 @@ import de.uka.ilkd.key.proof_references.reference.DefaultProofReference; import de.uka.ilkd.key.proof_references.reference.IProofReference; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + /** * Extracts read and write access to fields ({@link IProgramVariable}) via assignments. * @@ -33,9 +35,9 @@ public class ProgramVariableReferencesAnalyst implements IProofReferencesAnalyst public LinkedHashSet> computeReferences(Node node, Services services) { if (node.getAppliedRuleApp() != null && node.getNodeInfo() != null) { SourceElement statement = node.getNodeInfo().getActiveStatement(); - if (statement instanceof CopyAssignment) { + if (statement instanceof Assignment a && a.getKind() == Copy) { LinkedHashSet> result = new LinkedHashSet<>(); - listReferences(node, (CopyAssignment) statement, + listReferences(node, a, services.getJavaInfo().getArrayLength(), result, true); return result; } else if (statement instanceof If) { @@ -66,7 +68,7 @@ protected void listReferences(Node node, ProgramElement pe, ProgramVariable arra if (pv.isMember()) { DefaultProofReference reference = new DefaultProofReference<>(IProofReference.ACCESS, node, - (ProgramVariable) pe); + pv); ProofReferenceUtil.merge(toFill, reference); } } else if (pe instanceof FieldReference fr) { diff --git a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/model/impl/ExecutionOperationContract.java b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/model/impl/ExecutionOperationContract.java index a1fb21b6202..e98cdba9372 100644 --- a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/model/impl/ExecutionOperationContract.java +++ b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/model/impl/ExecutionOperationContract.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.java.ast.ProgramElement; import de.uka.ilkd.key.java.ast.SourceElement; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.statement.MethodFrame; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermBuilder; @@ -305,7 +305,7 @@ protected static LocationVariable extractResultVariableFromPostBranch(Node node, postModality = TermBuilder.goBelowUpdates(postModality); MethodFrame mf = JavaTools.getInnermostMethodFrame(postModality.javaBlock(), services); SourceElement firstElement = NodeInfo.computeActiveStatement(mf.getFirstElement()); - if (!(firstElement instanceof CopyAssignment assignment)) { + if (!(firstElement instanceof Assignment assignment)) { return null; } ProgramElement rightChild = assignment.getChildAt(1); diff --git a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/AbstractBackwardSlicer.java b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/AbstractBackwardSlicer.java index d65a1330953..160e7413744 100644 --- a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/AbstractBackwardSlicer.java +++ b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/AbstractBackwardSlicer.java @@ -14,8 +14,8 @@ import de.uka.ilkd.key.java.ast.NonTerminalProgramElement; import de.uka.ilkd.key.java.ast.ProgramElement; import de.uka.ilkd.key.java.ast.SourceElement; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; import de.uka.ilkd.key.java.ast.reference.ThisReference; import de.uka.ilkd.key.proof.Node; @@ -64,9 +64,8 @@ public ImmutableArray doSlicing(Node seedNode, Location seedLocation, if (oldAliases != null) { try { // Update relevant locations if required - if (activeStatement instanceof CopyAssignment) { - SourceElement originalTarget = - ((CopyAssignment) activeStatement).getArguments().get(0); + if (activeStatement instanceof Assignment a) { + SourceElement originalTarget = a.getArguments().get(0); ReferencePrefix relevantTarget = toReferencePrefix(originalTarget); Location normalizedPrefix = normalizeAlias(services, relevantTarget, info); diff --git a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/ThinBackwardSlicer.java b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/ThinBackwardSlicer.java index 9a7400b69ce..ad0c245e345 100644 --- a/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/ThinBackwardSlicer.java +++ b/key.core.symbolic_execution/src/main/java/de/uka/ilkd/key/symbolic_execution/slicing/ThinBackwardSlicer.java @@ -9,8 +9,8 @@ import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.SourceElement; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; import de.uka.ilkd.key.java.ast.statement.MethodBodyStatement; import de.uka.ilkd.key.logic.JTerm; @@ -38,7 +38,7 @@ protected boolean accept(Node node, Node previousChild, Services services, throws ProofInputException { try { boolean accept = false; - if (activeStatement instanceof CopyAssignment copyAssignment) { + if (activeStatement instanceof Assignment copyAssignment) { ImmutableArray arguments = copyAssignment.getArguments(); if (arguments.size() >= 1) { SourceElement originalTarget = arguments.get(0); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/JavaService.java b/key.core/src/main/java/de/uka/ilkd/key/java/JavaService.java index e3924471823..162136b71c6 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/JavaService.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/JavaService.java @@ -794,7 +794,7 @@ public JavaBlock readBlock(String block, JPContext context, } var f = JavaBlock .createJavaBlock((StatementBlock) getConverter(allowSchemaJava).process(sb)); - JavaLogger.print(block, f); + // JavaLogger.print(block, f); return f; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java b/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java index 0523878dbb1..55f54a620de 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java @@ -12,56 +12,14 @@ import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; -import de.uka.ilkd.key.java.ast.expression.PassiveExpression; +import de.uka.ilkd.key.java.ast.expression.*; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; import de.uka.ilkd.key.java.ast.expression.literal.IntLiteral; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.reference.ArrayReference; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.ast.reference.FieldReference; -import de.uka.ilkd.key.java.ast.reference.IExecutionContext; -import de.uka.ilkd.key.java.ast.reference.MethodName; -import de.uka.ilkd.key.java.ast.reference.MethodReference; -import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; -import de.uka.ilkd.key.java.ast.reference.SuperConstructorReference; -import de.uka.ilkd.key.java.ast.reference.SuperReference; -import de.uka.ilkd.key.java.ast.reference.ThisConstructorReference; -import de.uka.ilkd.key.java.ast.reference.ThisReference; -import de.uka.ilkd.key.java.ast.reference.TypeRef; -import de.uka.ilkd.key.java.ast.reference.TypeReference; -import de.uka.ilkd.key.java.ast.statement.Branch; -import de.uka.ilkd.key.java.ast.statement.Break; -import de.uka.ilkd.key.java.ast.statement.Case; -import de.uka.ilkd.key.java.ast.statement.Catch; -import de.uka.ilkd.key.java.ast.statement.Continue; -import de.uka.ilkd.key.java.ast.statement.Default; -import de.uka.ilkd.key.java.ast.statement.Do; -import de.uka.ilkd.key.java.ast.statement.Else; -import de.uka.ilkd.key.java.ast.statement.EmptyStatement; -import de.uka.ilkd.key.java.ast.statement.EnhancedFor; -import de.uka.ilkd.key.java.ast.statement.Finally; -import de.uka.ilkd.key.java.ast.statement.For; -import de.uka.ilkd.key.java.ast.statement.ForUpdates; -import de.uka.ilkd.key.java.ast.statement.Guard; -import de.uka.ilkd.key.java.ast.statement.IForUpdates; -import de.uka.ilkd.key.java.ast.statement.IGuard; -import de.uka.ilkd.key.java.ast.statement.ILoopInit; -import de.uka.ilkd.key.java.ast.statement.If; -import de.uka.ilkd.key.java.ast.statement.LabeledStatement; -import de.uka.ilkd.key.java.ast.statement.LoopInit; -import de.uka.ilkd.key.java.ast.statement.MethodBodyStatement; -import de.uka.ilkd.key.java.ast.statement.MethodFrame; -import de.uka.ilkd.key.java.ast.statement.Return; -import de.uka.ilkd.key.java.ast.statement.Switch; -import de.uka.ilkd.key.java.ast.statement.SynchronizedBlock; -import de.uka.ilkd.key.java.ast.statement.Then; -import de.uka.ilkd.key.java.ast.statement.Throw; -import de.uka.ilkd.key.java.ast.statement.Try; -import de.uka.ilkd.key.java.ast.statement.While; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind; +import de.uka.ilkd.key.java.ast.reference.*; +import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.ProgramElementName; import de.uka.ilkd.key.logic.VariableNamer; import de.uka.ilkd.key.logic.op.IProgramMethod; @@ -76,6 +34,8 @@ import org.jspecify.annotations.Nullable; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + /** * The KeYASTFactory helps building KeY Java AST structures. */ @@ -84,27 +44,26 @@ public abstract class KeYJavaASTFactory { /** * creates an assignment lhs:=rhs */ - public static CopyAssignment assign(Expression lhs, Expression rhs) { - return new CopyAssignment(lhs, rhs); + public static Assignment assign(Expression lhs, Expression rhs) { + return new Assignment(Copy, lhs, rhs); } /** * creates an assignment lhs:=rhs */ - public static CopyAssignment assign(Expression lhs, Expression rhs, PositionInfo posInfo) { + public static Assignment assign(Expression lhs, Expression rhs, PositionInfo posInfo) { return assign(new ExtList(new Object[] { lhs, rhs, posInfo })); } /** * Create an assignment. * - * @param parameters - * the assignment parameters (variable, expression) as {@link ExtList} - * @return a new {@link CopyAssignment} as defined by parameters + * @param parameters the assignment parameters (variable, expression) as {@link ExtList} + * @return a new {@link Assignment} as defined by parameters */ - public static CopyAssignment assign(final ExtList parameters) { + public static Assignment assign(final ExtList parameters) { - return new CopyAssignment(parameters); + return new Assignment(parameters); } /** @@ -129,10 +88,8 @@ public static LocalVariableDeclaration declare(ProgramElementName name, TypeRefe * type name; * * - * @param name - * the {@link ProgramElementName} of the variable to be declared - * @param type - * the static {@link KeYJavaType} of the variable to be declared + * @param name the {@link ProgramElementName} of the variable to be declared + * @param type the static {@link KeYJavaType} of the variable to be declared * @return a new {@link LocalVariableDeclaration} of a variable with static type * type and name name */ @@ -161,12 +118,9 @@ public static LocalVariableDeclaration declare(ProgramElementName name, * type var = init; * * - * @param var - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} var is initialized with - * @param type - * the static {@link KeYJavaType} of var + * @param var the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} var is initialized with + * @param type the static {@link KeYJavaType} of var * @return a {@link LocalVariableDeclaration} of var with static type * type and initial value init */ @@ -182,15 +136,11 @@ public static LocalVariableDeclaration declare(IProgramVariable var, Expression * type name{unique} = initializer; * * - * @param services - * the {@link Services} whose {@link VariableNamer} is used to determine a + * @param services the {@link Services} whose {@link VariableNamer} is used to determine a * unique variable name - * @param name - * the {@link String} on which the variable's unique name is based - * @param initializer - * the {@link Expression} the declared variable is initialized with - * @param type - * the static {@link KeYJavaType} of the to be declared variable + * @param name the {@link String} on which the variable's unique name is based + * @param initializer the {@link Expression} the declared variable is initialized with + * @param type the static {@link KeYJavaType} of the to be declared variable * @return a {@link LocalVariableDeclaration} of variable named uniquely after name * with static type type and initial value initializer */ @@ -209,10 +159,8 @@ public static LocalVariableDeclaration declare(final Services services, final St * type var; * * - * @param var - * the named and typed {@link IProgramVariable} to be declared - * @param type - * the static {@link KeYJavaType} of var + * @param var the named and typed {@link IProgramVariable} to be declared + * @param type the static {@link KeYJavaType} of var * @return a {@link LocalVariableDeclaration} of var with static type * type */ @@ -245,12 +193,9 @@ public static ParameterDeclaration parameterDeclaration(JavaInfo javaInfo, KeYJa * kjt var * * - * @param javaInfo - * the Java model containing kjt - * @param kjt - * the static {@link KeYJavaType} of var - * @param var - * the named and typed {@link IProgramVariable} to be declared as parameter + * @param javaInfo the Java model containing kjt + * @param kjt the static {@link KeYJavaType} of var + * @param var the named and typed {@link IProgramVariable} to be declared as parameter * @return a {@link ParameterDeclaration} of var with static type kjt */ public static ParameterDeclaration parameterDeclaration(JavaInfo javaInfo, KeYJavaType kjt, @@ -273,8 +218,7 @@ public static ParameterDeclaration parameterDeclaration(JavaInfo javaInfo, Strin * (expression) * * - * @param expression - * the {@link Expression} to be parenthesized + * @param expression the {@link Expression} to be parenthesized * @return a new {@link ParenthesizedExpression} of expression */ public static ParenthesizedExpression parenthesizedExpression(final Expression expression) { @@ -285,8 +229,7 @@ public static ParenthesizedExpression parenthesizedExpression(final Expression e /** * Create an inactive expression. * - * @param expression - * the {@link Expression} to be marked inactive + * @param expression the {@link Expression} to be marked inactive * @return a new {@link PassiveExpression} version of expression */ public static PassiveExpression passiveExpression(final Expression expression) { @@ -311,12 +254,9 @@ public static LocationVariable localVariable(ProgramElementName name, KeYJavaTyp /** * Create a local variable with a unique name. * - * @param services - * the {@link Services} whose {@link VariableNamer} is used - * @param name - * the {@link String} on which the variable's unique name is based - * @param type - * the variable's static {@link KeYJavaType} + * @param services the {@link Services} whose {@link VariableNamer} is used + * @param name the {@link String} on which the variable's unique name is based + * @param type the variable's static {@link KeYJavaType} * @return a new {@link ProgramVariable} of static type type and with a unique name * based on name */ @@ -344,15 +284,12 @@ public static ProgramVariable localVariable(final Services services, final Strin * left & right * * - * @param left - * the left operand {@link Expression} - * @param right - * the right operand Expression + * @param left the left operand {@link Expression} + * @param right the right operand Expression * @return a new {@link LogicalAnd} of left and right */ - public static LogicalAnd logicalAndOperator(final Expression left, final Expression right) { - - return new LogicalAnd(left, right); + public static BinaryOperator logicalAndOperator(final Expression left, final Expression right) { + return new BinaryOperator(BinaryOperatorKind.LogicalAnd, left, right); } /** @@ -362,22 +299,19 @@ public static LogicalAnd logicalAndOperator(final Expression left, final Express * left | right * * - * @param left - * the left operand {@link Expression} - * @param right - * the right operand {@link Expression} + * @param left the left operand {@link Expression} + * @param right the right operand {@link Expression} * @return a new {@link LogicalOr} of left and right */ - public static LogicalOr logicalOrOperator(final Expression left, final Expression right) { + public static BinaryOperator logicalOrOperator(final Expression left, final Expression right) { + return new BinaryOperator(BinaryOperatorKind.LogicalOr, left, right); - return new LogicalOr(left, right); } /** * Create a catch clause. * - * @param parameters - * the catch clause parameters (exception, body) as {@link ExtList} + * @param parameters the catch clause parameters (exception, body) as {@link ExtList} * @return a new {@link Catch} as defined by parameters */ public static Catch catchClause(final ExtList parameters) { @@ -403,10 +337,8 @@ public static Catch catchClause(ParameterDeclaration param, StatementBlock body) * } * * - * @param parameter - * the to be caught {@link ParameterDeclaration} - * @param statements - * the body {@link Statement}s + * @param parameter the to be caught {@link ParameterDeclaration} + * @param statements the body {@link Statement}s * @return a new {@link Catch} clause for execution of statements in case of * parameter */ @@ -425,14 +357,10 @@ public static Catch catchClause(final ParameterDeclaration parameter, * body * * - * @param javaInfo - * the {@link JavaInfo} containing kjt - * @param param - * the {@link String} name of the exception object variable - * @param kjt - * the {@link KeYJavaType} of the exception object variable - * @param body - * the {@link StatementBlock} catch clause body + * @param javaInfo the {@link JavaInfo} containing kjt + * @param param the {@link String} name of the exception object variable + * @param kjt the {@link KeYJavaType} of the exception object variable + * @param body the {@link StatementBlock} catch clause body * @return a new {@link Catch} with parameter param of static type kjt * and body body */ @@ -450,15 +378,11 @@ public static Catch catchClause(JavaInfo javaInfo, String param, KeYJavaType kjt * body * * - * @param javaInfo - * the {@link JavaInfo} containing a {@link KeYJavaType} named type - * @param param - * the {@link String} name of the exception object variable - * @param type - * the String name of the exception object variable's + * @param javaInfo the {@link JavaInfo} containing a {@link KeYJavaType} named type + * @param param the {@link String} name of the exception object variable + * @param type the String name of the exception object variable's * KeYJavaType - * @param body - * the {@link StatementBlock} catch clause body + * @param body the {@link StatementBlock} catch clause body * @return a new {@link Catch} with parameter param of static type * type and body body */ @@ -475,8 +399,7 @@ public static Catch catchClause(JavaInfo javaInfo, String param, String type, * throw e * * - * @param e - * the throw {@link Expression} + * @param e the throw {@link Expression} * @return a new {@link Throw} statement with expression e */ public static Throw throwClause(Expression e) { @@ -501,10 +424,8 @@ public static Guard trueGuard() { * body * * - * @param condition - * the loop condition {@link Expression} - * @param body - * the loop body {@link Statement} + * @param condition the loop condition {@link Expression} + * @param body the loop body {@link Statement} * @return a new {@link While} loop defined by condition and body */ public static Statement whileLoop(final Expression condition, final Statement body) { @@ -520,12 +441,9 @@ public static Statement whileLoop(final Expression condition, final Statement bo * body * * - * @param condition - * the loop condition {@link Expression} - * @param body - * the loop body {@link Statement} - * @param position - * the new source element's {@link PositionInfo} + * @param condition the loop condition {@link Expression} + * @param body the loop body {@link Statement} + * @param position the new source element's {@link PositionInfo} * @return a new {@link While} loop defined by condition and body, and * positioned at position */ @@ -542,8 +460,7 @@ public static While whileLoop(final Expression condition, final Statement body, * return e * * - * @param e - * the return {@link Expression} + * @param e the return {@link Expression} * @return a new {@link Return} statement with expression e */ public static Return returnClause(Expression e) { @@ -558,10 +475,8 @@ public static Return returnClause(Expression e) { * then * * - * @param guard - * the if statement condition {@link Expression} - * @param then - * the if statement then branch {@link Statement} + * @param guard the if statement condition {@link Expression} + * @param then the if statement then branch {@link Statement} * @return an {@link If} with expression guard and then branch then */ public static If ifThen(Expression guard, Statement then) { @@ -578,10 +493,8 @@ public static If ifThen(Expression guard, Statement then) { * } * * - * @param guard - * the if statement condition {@link Expression} - * @param statements - * the if statement then branch {@link Statement}s + * @param guard the if statement condition {@link Expression} + * @param statements the if statement then branch {@link Statement}s * @return an {@link If} with condition guard and then branch * statements */ @@ -599,10 +512,8 @@ public static If ifThen(final Expression guard, final Statement... statements) { * then * * - * @param guard - * the if statement condition {@link Expression} - * @param then - * the if statement then branch {@link Then} + * @param guard the if statement condition {@link Expression} + * @param then the if statement then branch {@link Then} * @return an {@link If} with expression guard and then branch then */ public static If ifThen(final Expression guard, final Then then) { @@ -613,8 +524,7 @@ public static If ifThen(final Expression guard, final Then then) { /** * Create an if statement. * - * @param parameters - * the if statement parameters (guard, body, else branch) as {@link ExtList} + * @param parameters the if statement parameters (guard, body, else branch) as {@link ExtList} * @return a new {@link If} as defined by parameters */ public static If ifStatement(final ExtList parameters) { @@ -632,12 +542,9 @@ public static If ifStatement(final ExtList parameters) { * els * * - * @param guard - * the if statement condition {@link Expression} - * @param then - * the if statement then branch {@link Statement} - * @param els - * the if statement else branch Statement + * @param guard the if statement condition {@link Expression} + * @param then the if statement then branch {@link Statement} + * @param els the if statement else branch Statement * @return an {@link If} with expression guard, then branch then and * else branch els */ @@ -655,15 +562,9 @@ public static If ifElse(Expression guard, Then then, Else els) { * elseStatement * * - * @param guard - * the if clause condition {@link Expression} - * - * @param thenStatement - * the if clause then branch {@link Statement} - * - * @param elseStatement - * the if clause else branch Statement - * + * @param guard the if clause condition {@link Expression} + * @param thenStatement the if clause then branch {@link Statement} + * @param elseStatement the if clause else branch Statement * @return a new {@link If} with condition guard, then branch * thenStatement and else branch elseStatement */ @@ -678,8 +579,7 @@ public static Statement ifElse(final Expression guard, final Statement thenState /** * Create a break statement. * - * @param l - * the break destination {@link Label} + * @param l the break destination {@link Label} * @return a new {@link Break} with label l */ public static Break breakStatement(Label l) { @@ -693,12 +593,9 @@ public static Statement breakStatement(Label label, PositionInfo positionInfo) { /** * Create a case block. * - * @param parameters - * the case block parameters (body) as {@link ExtList} - * @param expression - * the case block {@link Expression} - * @param position - * the new source element's {@link PositionInfo} + * @param parameters the case block parameters (body) as {@link ExtList} + * @param expression the case block {@link Expression} + * @param position the new source element's {@link PositionInfo} * @return a new {@link Case} as defined by parameters and expression */ public static Case caseBlock(final ExtList parameters, final Expression expression, @@ -715,10 +612,8 @@ public static Case caseBlock(final ExtList parameters, final Expression expressi * statement * * - * @param expression - * the case {@link Expression} - * @param statement - * the to be executed {@link Statement} + * @param expression the case {@link Expression} + * @param statement the to be executed {@link Statement} * @return a new {@link Case} for execution of statement in case of * expression */ @@ -737,10 +632,8 @@ public static Case caseBlock(final Expression expression, final Statement statem * } * * - * @param expression - * the case {@link Expression} - * @param statements - * the to be executed {@link Statement}s + * @param expression the case {@link Expression} + * @param statements the to be executed {@link Statement}s * @return a new {@link Case} for execution of statements in case of * expression */ @@ -765,8 +658,7 @@ public static EmptyStatement emptyStatement() { /** * Create an enhanced for loop. * - * @param parameters - * the loop definition parameters (initializer, guard, body) as + * @param parameters the loop definition parameters (initializer, guard, body) as * {@link ExtList} * @return a new {@link For} as defined by parameters */ @@ -781,12 +673,10 @@ public static EnhancedFor enhancedForLoop(final ExtList parameters) { * expression == null * * - * @param expression - * the {@link Expression} to be compared against null + * @param expression the {@link Expression} to be compared against null * @return a new {@link Equals} that compares expression against null */ - public static Equals equalsNullOperator(final Expression expression) { - + public static BinaryOperator equalsNullOperator(final Expression expression) { return equalsOperator(expression, NullLiteral.NULL); } @@ -797,15 +687,12 @@ public static Equals equalsNullOperator(final Expression expression) { * left == right * * - * @param left - * the left operand {@link Expression} - * @param right - * the right operand Expression + * @param left the left operand {@link Expression} + * @param right the right operand Expression * @return a new {@link Equals} of left and right */ - public static Equals equalsOperator(final Expression left, final Expression right) { - - return new Equals(left, right); + public static BinaryOperator equalsOperator(final Expression left, final Expression right) { + return new BinaryOperator(BinaryOperatorKind.Equals, left, right); } /** @@ -815,24 +702,19 @@ public static Equals equalsOperator(final Expression left, final Expression righ * operand{1} == operand{2} * * - * @param operands - * the operands {@link ExtList} + * @param operands the operands {@link ExtList} * @return a new {@link Equals} of operands */ - public static Equals equalsOperator(final ExtList operands) { - - return new Equals(operands); + public static BinaryOperator equalsOperator(final ExtList operands) { + return new BinaryOperator(BinaryOperatorKind.Equals, operands); } /** * Create an execution context. * - * @param classType - * the enclosing class {@link KeYJavaType} - * @param method - * the enclosing {@link IProgramMethod} defined in classType - * @param reference - * the {@link ReferencePrefix} method is called on + * @param classType the enclosing class {@link KeYJavaType} + * @param method the enclosing {@link IProgramMethod} defined in classType + * @param reference the {@link ReferencePrefix} method is called on * @return a new {@link ExecutionContext} for calls on reference to * method from classType */ @@ -846,10 +728,8 @@ public static ExecutionContext executionContext(final KeYJavaType classType, /** * Insert a statement in a block of statements. * - * @param statement - * the {@link Statement} to be inserted into block - * @param block - * the {@link StatementBlock} statement is inserted into + * @param statement the {@link Statement} to be inserted into block + * @param block the {@link StatementBlock} statement is inserted into * @return a new StatementBlock that contains both the Statements from * block and statement */ @@ -863,10 +743,8 @@ public static StatementBlock insertStatementInBlock(final Statement statement, /** * inserts the given statements at the begin of the block * - * @param stmnt - * array of Statement those have to be inserted - * @param b - * the Statementblock where to insert + * @param stmnt array of Statement those have to be inserted + * @param b the Statementblock where to insert */ public static StatementBlock insertStatementInBlock(Statement[] stmnt, StatementBlock b) { @@ -879,10 +757,8 @@ public static StatementBlock insertStatementInBlock(Statement[] stmnt, Statement /** * inserts the given statements at the begin of the block * - * @param stmnt - * array of Statement those have to be inserted - * @param b - * the Statementblock where to insert + * @param stmnt array of Statement those have to be inserted + * @param b the Statementblock where to insert */ public static StatementBlock insertStatementInBlock(StatementBlock stmnt, StatementBlock b) { Statement[] stmnts = new Statement[stmnt.getStatementCount()]; @@ -900,10 +776,8 @@ public static StatementBlock insertStatementInBlock(StatementBlock stmnt, Statem * statements * * - * @param block - * the original {@link StatementBlock} - * @param statements - * the inserted {@link Statement}s + * @param block the original {@link StatementBlock} + * @param statements the inserted {@link Statement}s * @return a new StatementBlock that contains block first and * statements second */ @@ -921,10 +795,8 @@ public static StatementBlock insertStatementInBlock(final StatementBlock block, * expression instance of type * * - * @param expression - * the {@link Expression} operand, whose runtime type is to be checked - * @param type - * the {@link KeYJavaType} operand expression's type is checked against + * @param expression the {@link Expression} operand, whose runtime type is to be checked + * @param type the {@link KeYJavaType} operand expression's type is checked against * @return a new {@link Instanceof} for checking expression's type against * type */ @@ -941,10 +813,8 @@ public static Instanceof instanceOf(final Expression expression, final KeYJavaTy * type variable = 0; * * - * @param type - * the static {@link KeYJavaType} of variable - * @param variable - * the named and typed {@link IProgramVariable} to be declared + * @param type the static {@link KeYJavaType} of variable + * @param variable the named and typed {@link IProgramVariable} to be declared * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value zero */ @@ -962,14 +832,10 @@ public static LocalVariableDeclaration declareZero(final KeYJavaType type, * type variable = reference.method(); * * - * @param type - * the static {@link KeYJavaType} of variable - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param method - * the method's name {@link String} + * @param type the static {@link KeYJavaType} of variable + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param reference the {@link ReferencePrefix} the method is called on + * @param method the method's name {@link String} * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value reference.method() */ @@ -986,16 +852,13 @@ public static LocalVariableDeclaration declareMethodCall(final KeYJavaType type, *

      * type variable = reference.method();
      * 
- * + *

* where type is variable's {@link KeYJavaType} as it is returned by * {@link IProgramVariable#getKeYJavaType()}. * - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param method - * the method's name {@link String} + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param reference the {@link ReferencePrefix} the method is called on + * @param method the method's name {@link String} * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value reference.method() */ @@ -1009,8 +872,7 @@ public static LocalVariableDeclaration declareMethodCall(final IProgramVariable /** * Create a default block. * - * @param parameters - * the default block parameters (body) as {@link ExtList} + * @param parameters the default block parameters (body) as {@link ExtList} * @return a new {@link Default} as defined by parameters */ public static Default defaultBlock(final ExtList parameters) { @@ -1026,8 +888,7 @@ public static Default defaultBlock(final ExtList parameters) { * statement * * - * @param statement - * the to be executed {@link Statement} + * @param statement the to be executed {@link Statement} * @return a new {@link Default} that contains statement */ public static Default defaultBlock(final Statement statement) { @@ -1045,8 +906,7 @@ public static Default defaultBlock(final Statement statement) { * } * * - * @param statements - * the to be executed {@link Statement}s + * @param statements the to be executed {@link Statement}s * @return a new {@link Default} that contains statements */ public static Default defaultBlock(final Statement[] statements) { @@ -1063,12 +923,9 @@ public static Default defaultBlock(final Statement[] statements) { * while (condition); * * - * @param condition - * the do-loop condition {@link Expression} - * @param statement - * the do-loop body {@link Statement} - * @param positionInfo - * the new source element's {@link PositionInfo} + * @param condition the do-loop condition {@link Expression} + * @param statement the do-loop body {@link Statement} + * @param positionInfo the new source element's {@link PositionInfo} * @return a new {@link Do} that executes statement while condition * holds */ @@ -1081,8 +938,7 @@ public static Do doLoop(final Expression condition, final Statement statement, /** * Create an else block. * - * @param parameters - * the else block parameters (body) as {@link ExtList} + * @param parameters the else block parameters (body) as {@link ExtList} * @return a new {@link Else} as defined by parameters */ public static Else elseBlock(final ExtList parameters) { @@ -1098,8 +954,7 @@ public static Else elseBlock(final ExtList parameters) { * statement * * - * @param statement - * the {@link Statement} to be executed + * @param statement the {@link Statement} to be executed * @return a new {@link Else} block consisting of statement solely */ public static Else elseBlock(final Statement statement) { @@ -1116,8 +971,7 @@ public static Else elseBlock(final Statement statement) { * } * * - * @param statements - * the {@link Statement}s to be executed + * @param statements the {@link Statement}s to be executed * @return a new {@link Else} block consisting of statements solely */ public static Else elseBlock(final Statement[] statements) { @@ -1133,8 +987,7 @@ public static Else elseBlock(final Statement[] statements) { * init * * - * @param init - * the single {@link LoopInitializer} + * @param init the single {@link LoopInitializer} * @return a new {@link ILoopInit} that consists of init only */ public static ILoopInit loopInit(final LoopInitializer init) { @@ -1150,10 +1003,8 @@ public static ILoopInit loopInit(final LoopInitializer init) { * type variable = 0 * * - * @param type - * the static {@link KeYJavaType} of variable - * @param variable - * the named and typed {@link IProgramVariable} to be declared + * @param type the static {@link KeYJavaType} of variable + * @param variable the named and typed {@link IProgramVariable} to be declared * @return a new {@link ILoopInit} that declares variable variable with static type * type and initial value zero */ @@ -1166,10 +1017,8 @@ public static ILoopInit loopInitZero(final KeYJavaType type, final IProgramVaria /** * Create an array initializer. * - * @param expressions - * the initial value {@link Expression}s - * @param type - * the array type {@link KeYJavaType} + * @param expressions the initial value {@link Expression}s + * @param type the array type {@link KeYJavaType} * @return a new {@link ArrayInitializer} which contains expressions and is of type * type */ @@ -1186,11 +1035,9 @@ public static ArrayInitializer arrayInitializer(final Expression[] expressions, * array.length * * - * @param model - * the {@link JavaInfo} to retrieve the array super class type, which holds the + * @param model the {@link JavaInfo} to retrieve the array super class type, which holds the * length attribute, from - * @param array - * the {@link ReferencePrefix} whose length attribute is accessed + * @param array the {@link ReferencePrefix} whose length attribute is accessed * @return a new {@link FieldReference} for array's length attribute */ public static FieldReference arrayLength(final JavaInfo model, final ReferencePrefix array) { @@ -1206,15 +1053,12 @@ public static FieldReference arrayLength(final JavaInfo model, final ReferencePr * left < right * * - * @param left - * the {@link Expression} to be compared less than right - * @param right - * the Expression to be compared greater than left + * @param left the {@link Expression} to be compared less than right + * @param right the Expression to be compared greater than left * @return a new {@link Guard} that compares left less than right */ public static IGuard lessThanGuard(final Expression left, final Expression right) { - - return new Guard(new LessThan(left, right)); + return new Guard(lessThanOperator(left, right)); } /** @@ -1224,15 +1068,12 @@ public static IGuard lessThanGuard(final Expression left, final Expression right * left < right * * - * @param left - * the left operand {@link Expression} - * @param right - * the right operand {@link Expression} + * @param left the left operand {@link Expression} + * @param right the right operand {@link Expression} * @return a new {@link LessThan} that compares left less than right */ - public static LessThan lessThanOperator(final Expression left, final Expression right) { - - return new LessThan(left, right); + public static BinaryOperator lessThanOperator(final Expression left, final Expression right) { + return new BinaryOperator(BinaryOperatorKind.LessThan, left, right); } /** @@ -1242,13 +1083,11 @@ public static LessThan lessThanOperator(final Expression left, final Expression * expression < 0 * * - * @param expression - * the left operand {@link Expression} + * @param expression the left operand {@link Expression} * @return a new {@link LessThan} that compares expression less than 0 */ - public static LessThan lessThanZeroOperator(final Expression expression) { + public static BinaryOperator lessThanZeroOperator(final Expression expression) { final IntLiteral zeroLiteral = zeroLiteral(); - return lessThanOperator(expression, zeroLiteral); } @@ -1259,14 +1098,11 @@ public static LessThan lessThanZeroOperator(final Expression expression) { * variable < array.length * * - * @param model - * the {@link JavaInfo} to retrieve the array super class type, which holds the + * @param model the {@link JavaInfo} to retrieve the array super class type, which holds the * length attribute, from - * @param variable - * the {@link ProgramVariable} to be compared less than array's + * @param variable the {@link ProgramVariable} to be compared less than array's * length - * @param array - * the {@link ReferencePrefix} whose length attribute is accessed + * @param array the {@link ReferencePrefix} whose length attribute is accessed * @return a new {@link Guard} that compares variable less than * array's length */ @@ -1284,8 +1120,7 @@ public static IGuard lessThanArrayLengthGuard(final JavaInfo model, * update * * - * @param update - * the single update {@link Expression} + * @param update the single update {@link Expression} * @return a new {@link ForUpdates} that consists of update only */ public static IForUpdates forUpdates(final Expression update) { @@ -1300,13 +1135,12 @@ public static IForUpdates forUpdates(final Expression update) { * variable++ * * - * @param variable - * the {@link ProgramVariable} to be post incremented during the loop updates + * @param variable the {@link ProgramVariable} to be post incremented during the loop updates * @return a new {@link ForUpdates} that consists of the post increment of variable */ public static IForUpdates postIncrementForUpdates(final ProgramVariable variable) { - final Expression update = new PostIncrement(variable); - + final Expression update = + new UnaryOperator(UnaryOperator.UnaryOperatorKind.PostIncrement, variable); return forUpdates(update); } @@ -1317,10 +1151,8 @@ public static IForUpdates postIncrementForUpdates(final ProgramVariable variable * array[index] * * - * @param array - * the {@link ReferencePrefix} to be accessed - * @param index - * the array access index {@link Expression} + * @param array the {@link ReferencePrefix} to be accessed + * @param index the array access index {@link Expression} * @return a new {@link ArrayReference} for access of array at index */ public static ArrayReference arrayFieldAccess(final ReferencePrefix array, @@ -1333,8 +1165,7 @@ public static ArrayReference arrayFieldAccess(final ReferencePrefix array, /** * Create a block from an arbitrary number of statements. * - * @param statements - * the block statements as {@link ExtList} + * @param statements the block statements as {@link ExtList} * @return a new {@link StatementBlock} consisting of statements */ public static StatementBlock block(final ExtList statements) { @@ -1351,8 +1182,7 @@ public static StatementBlock block(final ExtList statements) { * } * * - * @param statements - * the {@link Statement}s to appear in the block + * @param statements the {@link Statement}s to appear in the block * @return a new {@link StatementBlock} that consists of the given statements in * the very same order */ @@ -1370,8 +1200,7 @@ public static StatementBlock block(final Statement... statements) { * } * * - * @param statements - * the {@link Statement}s to appear in the block + * @param statements the {@link Statement}s to appear in the block * @return a new {@link StatementBlock} that consists of the given statements in * the very same order */ @@ -1384,8 +1213,7 @@ public static StatementBlock block(final List statements) { /** * Create a for loop. * - * @param parameters - * the loop definition parameters (initializer, guard, updates, body) as + * @param parameters the loop definition parameters (initializer, guard, updates, body) as * {@link ExtList} * @return a new {@link For} as defined by parameters */ @@ -1403,14 +1231,10 @@ public static For forLoop(final ExtList parameters) { * } * * - * @param init - * the {@link ILoopInit} loop initializations - * @param guard - * the {@link IGuard} loop condition - * @param updates - * the {@link IForUpdates} loop updates - * @param statements - * the body {@link Statement}s + * @param init the {@link ILoopInit} loop initializations + * @param guard the {@link IGuard} loop condition + * @param updates the {@link IForUpdates} loop updates + * @param statements the body {@link Statement}s * @return a new {@link For} with initializers init, condition guard, * updates updates and body statements */ @@ -1429,12 +1253,9 @@ public static For forLoop(final ILoopInit init, final IGuard guard, final IForUp * body * * - * @param guard - * the {@link IGuard} loop condition - * @param updates - * the {@link IForUpdates} loop updates - * @param body - * the body {@link Statement} + * @param guard the {@link IGuard} loop condition + * @param updates the {@link IForUpdates} loop updates + * @param body the body {@link Statement} * @return a new {@link For} with condition guard, updates updates and * body body */ @@ -1451,12 +1272,9 @@ public static For forLoop(final IGuard guard, final IForUpdates updates, final S * body * * - * @param guard - * the {@link IGuard} loop condition - * @param updates - * the {@link IForUpdates} loop updates - * @param body - * the body {@link Statement}s + * @param guard the {@link IGuard} loop condition + * @param updates the {@link IForUpdates} loop updates + * @param body the body {@link Statement}s * @return a new {@link For} with condition guard, updates updates and * body body */ @@ -1473,16 +1291,13 @@ public static For forLoop(final IGuard guard, final IForUpdates updates, * variable = array[index]; * * - * @param variable - * the {@link ProgramVariable} to be assigned to - * @param array - * the array {@link ReferencePrefix} to be accessed - * @param index - * the array access index {@link Expression} - * @return a new {@link CopyAssignment} of array element at index to + * @param variable the {@link ProgramVariable} to be assigned to + * @param array the array {@link ReferencePrefix} to be accessed + * @param index the array access index {@link Expression} + * @return a new {@link Assignment} of array element at index to * variable */ - public static CopyAssignment assignArrayField(final ProgramVariable variable, + public static Assignment assignArrayField(final ProgramVariable variable, final ReferencePrefix array, final Expression index) { final ArrayReference element = arrayFieldAccess(array, index); @@ -1492,8 +1307,7 @@ public static CopyAssignment assignArrayField(final ProgramVariable variable, /** * Create a local variable declaration without initialization. * - * @param parameters - * the declaration parameters (modifiers, type reference, variable + * @param parameters the declaration parameters (modifiers, type reference, variable * specifications) as {@link ExtList} * @return a new {@link LocalVariableDeclaration} as defined by parameters */ @@ -1508,12 +1322,11 @@ public static LocalVariableDeclaration declare(final ExtList parameters) { *

      * type variable;
      * 
- * + *

* where type is variable's {@link KeYJavaType} as it is returned by * {@link IProgramVariable#getKeYJavaType()}. * - * @param variable - * the named and typed {@link IProgramVariable} to be declared + * @param variable the named and typed {@link IProgramVariable} to be declared * @return a new {@link LocalVariableDeclaration} of variable */ public static LocalVariableDeclaration declare(final IProgramVariable variable) { @@ -1527,14 +1340,12 @@ public static LocalVariableDeclaration declare(final IProgramVariable variable) *

      * type variable = init;
      * 
- * + *

* where type is variable's {@link KeYJavaType} as it is returned by * {@link IProgramVariable#getKeYJavaType()}. * - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with * @return a new {@link LocalVariableDeclaration} of variable */ public static LocalVariableDeclaration declare(final IProgramVariable variable, @@ -1551,14 +1362,10 @@ public static LocalVariableDeclaration declare(final IProgramVariable variable, * modifier type variable = init; * * - * @param modifier - * the {@link Modifier} - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with - * @param type - * the static {@link KeYJavaType} of variable + * @param modifier the {@link Modifier} + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with + * @param type the static {@link KeYJavaType} of variable * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value init */ @@ -1576,14 +1383,10 @@ public static LocalVariableDeclaration declare(final Modifier modifier, * modifiers type variable = init; * * - * @param modifiers - * the {@link Modifier}s - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with - * @param type - * the static {@link KeYJavaType} of variable + * @param modifiers the {@link Modifier}s + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with + * @param type the static {@link KeYJavaType} of variable * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value init */ @@ -1601,14 +1404,10 @@ public static LocalVariableDeclaration declare(final Modifier[] modifiers, * modifiers type variable = init; * * - * @param modifiers - * the {@link Modifier}s - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with - * @param type - * the static {@link KeYJavaType} of variable + * @param modifiers the {@link Modifier}s + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with + * @param type the static {@link KeYJavaType} of variable * @return a new {@link LocalVariableDeclaration} of variable with static type * type and initial value init */ @@ -1626,14 +1425,10 @@ public static LocalVariableDeclaration declare(final ImmutableArray mo * modifiers typeRef variable = init; * * - * @param modifiers - * the {@link Modifier}s - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with - * @param typeRef - * the static {@link TypeRef} of variable + * @param modifiers the {@link Modifier}s + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with + * @param typeRef the static {@link TypeRef} of variable * @return a new {@link LocalVariableDeclaration} of variable with static type * typeRef and initial value init */ @@ -1652,12 +1447,9 @@ public static LocalVariableDeclaration declare(final ImmutableArray mo * modifiers typeRef specification * * - * @param modifiers - * the {@link Modifier}s - * @param typeRef - * the static {@link TypeRef} of the variable to be declared - * @param specification - * the {@link VariableSpecification} of the variable to be declared + * @param modifiers the {@link Modifier}s + * @param typeRef the static {@link TypeRef} of the variable to be declared + * @param specification the {@link VariableSpecification} of the variable to be declared * @return a new {@link LocalVariableDeclaration} of the variable specified by * specification with static type typeRef */ @@ -1674,12 +1466,9 @@ public static LocalVariableDeclaration declare(final ImmutableArray mo * modifiers typeRef specification{1}, ... * * - * @param modifiers - * the {@link Modifier}s - * @param typeRef - * the static {@link TypeRef} of the variable to be declared - * @param specifications - * the {@link VariableSpecification}s of the variables to be declared + * @param modifiers the {@link Modifier}s + * @param typeRef the static {@link TypeRef} of the variable to be declared + * @param specifications the {@link VariableSpecification}s of the variables to be declared * @return a new {@link LocalVariableDeclaration} of the variables specified by * specifications with static type typeRef */ @@ -1696,12 +1485,9 @@ public static LocalVariableDeclaration declare(final ImmutableArray mo * reference.name(args); * * - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param name - * the method's name {@link String} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param reference the {@link ReferencePrefix} the method is called on + * @param name the method's name {@link String} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * reference with arguments args */ @@ -1719,12 +1505,9 @@ public static MethodReference methodCall(final ReferencePrefix reference, final * type.name(args); * * - * @param type - * the {@link KeYJavaType} the method is called on - * @param name - * the method's name {@link String} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param type the {@link KeYJavaType} the method is called on + * @param name the method's name {@link String} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * type with arguments args */ @@ -1742,12 +1525,9 @@ public static MethodReference methodCall(final KeYJavaType type, final String na * type.name(args); * * - * @param type - * the {@link KeYJavaType} the method is called on - * @param name - * the method's name {@link String} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param type the {@link KeYJavaType} the method is called on + * @param name the method's name {@link String} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * type with arguments args */ @@ -1765,10 +1545,8 @@ public static MethodReference methodCall(final KeYJavaType type, final String na * type.name(); * * - * @param type - * the {@link KeYJavaType} the method is called on - * @param name - * the method's name {@link String} + * @param type the {@link KeYJavaType} the method is called on + * @param name the method's name {@link String} * @return a new {@link MethodReference} for call of method name on * type with arguments args */ @@ -1785,10 +1563,8 @@ public static MethodReference methodCall(final KeYJavaType type, final String na * reference.name(); * * - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param name - * the method's name {@link String} + * @param reference the {@link ReferencePrefix} the method is called on + * @param name the method's name {@link String} * @return a new {@link MethodReference} for call of method name on * reference with no arguments */ @@ -1805,12 +1581,9 @@ public static MethodReference methodCall(final ReferencePrefix reference, final * reference.name(args); * * - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param name - * the method's name {@link String} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param reference the {@link ReferencePrefix} the method is called on + * @param name the method's name {@link String} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * reference with arguments args */ @@ -1828,12 +1601,9 @@ public static MethodReference methodCall(final ReferencePrefix reference, final * reference.name(args); * * - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param name - * the {@link MethodName} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param reference the {@link ReferencePrefix} the method is called on + * @param name the {@link MethodName} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * reference with arguments args */ @@ -1851,12 +1621,9 @@ public static MethodReference methodCall(final ReferencePrefix reference, final * reference.name(args); * * - * @param reference - * the {@link ReferencePrefix} the method is called on - * @param name - * the {@link MethodName} - * @param args - * the argument {@link Expression}s to be passed to the method + * @param reference the {@link ReferencePrefix} the method is called on + * @param name the {@link MethodName} + * @param args the argument {@link Expression}s to be passed to the method * @return a new {@link MethodReference} for call of method name on * reference with arguments args */ @@ -1873,16 +1640,12 @@ public static MethodReference methodCall(final ReferencePrefix reference, final * (expression).name * * - * @param services - * the {@link Services} to determine both expression 's + * @param services the {@link Services} to determine both expression 's * {@link KeYJavaType} and the {@link ProgramVariable} corresponding to the field * name - * @param name - * the to be accessed field's name {@link String} - * @param expression - * the {@link Expression} on which the field is accessed - * @param context - * the {@link ExecutionContext}, which is needed to determine + * @param name the to be accessed field's name {@link String} + * @param expression the {@link Expression} on which the field is accessed + * @param context the {@link ExecutionContext}, which is needed to determine * expression's KeYJavaType * @return a new {@link FieldReference} of field name on expression */ @@ -1901,10 +1664,8 @@ public static FieldReference fieldReference(final Services services, final Strin * prefix.field * * - * @param prefix - * the {@link ReferencePrefix} on which field is accessed - * @param field - * the {@link ProgramVariable} to be accessed + * @param prefix the {@link ReferencePrefix} on which field is accessed + * @param field the {@link ProgramVariable} to be accessed * @return a new {@link FieldReference} of field on prefix */ public static FieldReference fieldReference(final ReferencePrefix prefix, @@ -1916,8 +1677,7 @@ public static FieldReference fieldReference(final ReferencePrefix prefix, /** * Create a finally block. * - * @param parameters - * the finally block parameters (body) as {@link ExtList} + * @param parameters the finally block parameters (body) as {@link ExtList} * @return a new {@link Finally} as defined by parameters */ public static Finally finallyBlock(final ExtList parameters) { @@ -1933,8 +1693,7 @@ public static Finally finallyBlock(final ExtList parameters) { * statement * * - * @param statement - * the {@link Statement} to be executed + * @param statement the {@link Statement} to be executed * @return a new {@link Finally} block consisting of statement solely */ public static Finally finallyBlock(final Statement statement) { @@ -1952,8 +1711,7 @@ public static Finally finallyBlock(final Statement statement) { * } * * - * @param statements - * the {@link Statement}s to be executed + * @param statements the {@link Statement}s to be executed * @return a new {@link Finally} block consisting of statements solely */ public static Finally finallyBlock(final Statement[] statements) { @@ -1970,8 +1728,7 @@ public static Finally finallyBlock(final Statement[] statements) { * body * * - * @param body - * the {@link StatementBlock} to be executed + * @param body the {@link StatementBlock} to be executed * @return a new {@link Finally} block consisting of body solely */ public static Finally finallyBlock(final StatementBlock body) { @@ -1986,20 +1743,13 @@ public static Finally finallyBlock(final StatementBlock body) { * modifiers typePrefix.baseType[] variable = init; * * - * @param modifiers - * the {@link Modifier}s - * @param variable - * the named and typed {@link IProgramVariable} to be declared - * @param init - * the {@link Expression} variable is initialized with - * @param typeName - * the type's {@link ProgramElementName} - * @param dimensions - * the type's dimensions - * @param typePrefix - * the type's {@link ReferencePrefix} - * @param baseType - * the base {@link KeYJavaType} + * @param modifiers the {@link Modifier}s + * @param variable the named and typed {@link IProgramVariable} to be declared + * @param init the {@link Expression} variable is initialized with + * @param typeName the type's {@link ProgramElementName} + * @param dimensions the type's dimensions + * @param typePrefix the type's {@link ReferencePrefix} + * @param baseType the base {@link KeYJavaType} * @return a new {@link LocalVariableDeclaration} of variable with static type * baseType[dimensions] and initial value init */ @@ -2014,23 +1764,17 @@ public static ProgramElement declare(final ImmutableArray modifiers, /** * Create a method body shortcut. - * + *

* Note that classType is also used as visibility context when looking for * methodName in its definition. * - * @param model - * the {@link JavaInfo} that contains classType.methodName - * @param result - * the {@link ProgramVariable} the return value is assigned to or + * @param model the {@link JavaInfo} that contains classType.methodName + * @param result the {@link ProgramVariable} the return value is assigned to or * null - * @param reference - * the {@link ReferencePrefix} invocation target - * @param classType - * the {@link KeYJavaType} in which the method is declared - * @param methodName - * the method's {@link String} name - * @param arguments - * the ProgramVariable and their static types the method is called + * @param reference the {@link ReferencePrefix} invocation target + * @param classType the {@link KeYJavaType} in which the method is declared + * @param methodName the method's {@link String} name + * @param arguments the ProgramVariable and their static types the method is called * with * @return a new {@link MethodBodyStatement} for classType.methodName when called * with arguments or null when the former is not defined @@ -2052,15 +1796,11 @@ public static MethodBodyStatement methodBody(final JavaInfo model, final Program /** * Create a method body shortcut. * - * @param result - * the {@link ProgramVariable} the return value is assigned to or + * @param result the {@link ProgramVariable} the return value is assigned to or * null - * @param reference - * the {@link ReferencePrefix} invocation target - * @param method - * the {@link IProgramMethod} reference - * @param arguments - * the Expressions and their static types the method is called + * @param reference the {@link ReferencePrefix} invocation target + * @param method the {@link IProgramMethod} reference + * @param arguments the Expressions and their static types the method is called * with * @return a new {@link MethodBodyStatement} for method when called with * arguments @@ -2076,15 +1816,11 @@ public static MethodBodyStatement methodBody(final ProgramVariable result, /** * Create a method body shortcut. * - * @param result - * the {@link ProgramVariable} the return value is assigned to or + * @param result the {@link ProgramVariable} the return value is assigned to or * null - * @param reference - * the {@link ReferencePrefix} invocation target - * @param method - * the {@link IProgramMethod} reference - * @param arguments - * the Expressions and their static types the method is called + * @param reference the {@link ReferencePrefix} invocation target + * @param method the {@link IProgramMethod} reference + * @param arguments the Expressions and their static types the method is called * with * @return a new {@link MethodBodyStatement} for method when called with * arguments @@ -2099,10 +1835,8 @@ public static MethodBodyStatement methodBody(final ProgramVariable result, /** * Create a method call substitution. * - * @param executionContext - * the block's {@link IExecutionContext} - * @param block - * the {@link StatementBlock} to be put in executionContext + * @param executionContext the block's {@link IExecutionContext} + * @param block the {@link StatementBlock} to be put in executionContext * @return a new {@link MethodFrame} that associates block with * executionContext */ @@ -2115,12 +1849,9 @@ public static MethodFrame methodFrame(final IExecutionContext executionContext, /** * Create a method call substitution at a specific source position. * - * @param executionContext - * the block's {@link IExecutionContext} - * @param block - * the {@link StatementBlock} to be put in executionContext - * @param position - * the new source element's {@link PositionInfo} + * @param executionContext the block's {@link IExecutionContext} + * @param block the {@link StatementBlock} to be put in executionContext + * @param position the new source element's {@link PositionInfo} * @return a new {@link MethodFrame} that associates block with * executionContext and positions it at position */ @@ -2133,12 +1864,9 @@ public static MethodFrame methodFrame(final IExecutionContext executionContext, /** * Create a method call substitution with a return value assignment. * - * @param result - * the {@link IProgramVariable} block's return value is assigned to - * @param executionContext - * the block's {@link IExecutionContext} - * @param block - * the {@link StatementBlock} to be put in executionContext + * @param result the {@link IProgramVariable} block's return value is assigned to + * @param executionContext the block's {@link IExecutionContext} + * @param block the {@link StatementBlock} to be put in executionContext * @return a new {@link MethodFrame} that associates block with * executionContext */ @@ -2152,14 +1880,10 @@ public static MethodFrame methodFrame(final IProgramVariable result, * Create a method call substitution with a return value assignment at a specific source * position. * - * @param result - * the {@link IProgramVariable} block's return value is assigned to - * @param executionContext - * the block's {@link IExecutionContext} - * @param block - * the {@link StatementBlock} to be put in executionContext - * @param position - * the new source element's {@link PositionInfo} + * @param result the {@link IProgramVariable} block's return value is assigned to + * @param executionContext the block's {@link IExecutionContext} + * @param block the {@link StatementBlock} to be put in executionContext + * @param position the new source element's {@link PositionInfo} * @return a new {@link MethodFrame} that associates block with * executionContext and positions it at position */ @@ -2173,8 +1897,7 @@ public static MethodFrame methodFrame(final IProgramVariable result, /** * Create an integer literal. * - * @param value - * the {@link Integer} to be turned into an literal + * @param value the {@link Integer} to be turned into an literal * @return a new {@link IntLiteral} representing value */ public static IntLiteral intLiteral(final Integer value) { @@ -2185,12 +1908,9 @@ public static IntLiteral intLiteral(final Integer value) { /** * Create a labeled statement. * - * @param parameters - * the parameters (statement) as {@link ExtList} - * @param label - * the {@link Label} - * @param position - * the new source element's {@link PositionInfo} + * @param parameters the parameters (statement) as {@link ExtList} + * @param label the {@link Label} + * @param position the new source element's {@link PositionInfo} * @return a new {@link LabeledStatement} as defined by parameters and * label */ @@ -2207,10 +1927,8 @@ public static LabeledStatement labeledStatement(final ExtList parameters, final * label: statement * * - * @param label - * the {@link Label} - * @param statement - * the {@link Statement} to be labeled + * @param label the {@link Label} + * @param statement the {@link Statement} to be labeled * @return a new {@link LabeledStatement} that adds label to statement */ public static LabeledStatement labeledStatement(final Label label, final Statement statement, @@ -2228,10 +1946,8 @@ public static LabeledStatement labeledStatement(final Label label, final Stateme * } * * - * @param label - * the {@link Label} - * @param statements - * the {@link Statement}s to be labeled + * @param label the {@link Label} + * @param statements the {@link Statement}s to be labeled * @return a new {@link LabeledStatement} that adds label to * statements */ @@ -2249,16 +1965,11 @@ public static Statement labeledStatement(final Label label, final Statement[] st * new typeRef[sizes{1}]...[sizes{dimensions}] initializer * * - * @param sizes - * the size {@link Expression}s for each dimension - * @param typeRef - * the static array base type - * @param keyJavaType - * the array element type - * @param initializer - * the {@link ArrayInitializer} - * @param dimensions - * the number of dimensions + * @param sizes the size {@link Expression}s for each dimension + * @param typeRef the static array base type + * @param keyJavaType the array element type + * @param initializer the {@link ArrayInitializer} + * @param dimensions the number of dimensions * @return a new {@link NewArray} for the instantiation of an array of base type * typeRef with dimensions dimensions */ @@ -2276,14 +1987,10 @@ public static NewArray newArray(final TypeReference typeRef, final int dimension * new typeRef[sizes{1}]...[sizes{dimensions}] * * - * @param typeRef - * the static array base type - * @param dimensions - * the number of dimensions - * @param sizes - * the size {@link Expression}s for each dimension - * @param keyJavaType - * the array element type + * @param typeRef the static array base type + * @param dimensions the number of dimensions + * @param sizes the size {@link Expression}s for each dimension + * @param keyJavaType the array element type * @return a new {@link NewArray} for the instantiation of an array of base type * typeRef with dimensions dimensions */ @@ -2300,14 +2007,10 @@ public static NewArray newArray(final TypeReference typeRef, final int dimension * new typeRef[size] * * - * @param typeRef - * the static array base type - * @param dimensions - * the number of dimensions - * @param size - * the size {@link Expression} for the first dimension - * @param keyJavaType - * the array element type + * @param typeRef the static array base type + * @param dimensions the number of dimensions + * @param size the size {@link Expression} for the first dimension + * @param keyJavaType the array element type * @return a new {@link NewArray} for the instantiation of an array of base type * typeRef with dimensions dimensions */ @@ -2325,14 +2028,10 @@ public static NewArray newArray(final TypeReference typeRef, final int dimension * new typeRef[]...[] initializer * * - * @param typeRef - * the static array base type - * @param keyJavaType - * the array element type - * @param initializer - * the {@link ArrayInitializer} - * @param dimensions - * the number of dimensions + * @param typeRef the static array base type + * @param keyJavaType the array element type + * @param initializer the {@link ArrayInitializer} + * @param dimensions the number of dimensions * @return a new {@link NewArray} for the instantiation of an array of base type * typeRef with dimensions dimensions */ @@ -2350,12 +2049,9 @@ public static NewArray newArray(final TypeReference typeRef, final int dimension * new referencePrefix.typeReference(args) * * - * @param referencePrefix - * the typeReference's {@link ReferencePrefix} - * @param typeReference - * a {@link TypeReference} to the class type that is instantiated - * @param args - * the {@link Expression} arguments to be passed to the constructor + * @param referencePrefix the typeReference's {@link ReferencePrefix} + * @param typeReference a {@link TypeReference} to the class type that is instantiated + * @param args the {@link Expression} arguments to be passed to the constructor * @return a new {@link New} operator that allocates a new instance of * typeReference parameterized with args */ @@ -2372,12 +2068,9 @@ public static New newOperator(final ReferencePrefix referencePrefix, * new referencePrefix.type(args) * * - * @param referencePrefix - * the type's {@link ReferencePrefix} - * @param type - * the {@link KeYJavaType} to be instantiated - * @param args - * the {@link Expression} arguments to be passed to the constructor + * @param referencePrefix the type's {@link ReferencePrefix} + * @param type the {@link KeYJavaType} to be instantiated + * @param args the {@link Expression} arguments to be passed to the constructor * @return a new {@link New} operator that allocates a new instance of type * parameterized with args */ @@ -2395,10 +2088,8 @@ public static New newOperator(final ReferencePrefix referencePrefix, final KeYJa * new referencePrefix.type() * * - * @param referencePrefix - * the type's {@link ReferencePrefix} - * @param type - * the {@link KeYJavaType} to be instantiated + * @param referencePrefix the type's {@link ReferencePrefix} + * @param type the {@link KeYJavaType} to be instantiated * @return a new {@link New} operator that allocates a new instance of type */ public static New newOperator(final ReferencePrefix referencePrefix, final KeYJavaType type) { @@ -2414,8 +2105,7 @@ public static New newOperator(final ReferencePrefix referencePrefix, final KeYJa * new type() * * - * @param type - * the {@link KeYJavaType} to be instantiated + * @param type the {@link KeYJavaType} to be instantiated * @return a new {@link New} operator that allocates a new instance of type */ public static New newOperator(final KeYJavaType type) { @@ -2430,13 +2120,11 @@ public static New newOperator(final KeYJavaType type) { * operands{1} != operands{2} * * - * @param operands - * the operands {@link ExtList} + * @param operands the operands {@link ExtList} * @return a new {@link NotEquals} of operands */ - public static NotEquals notEqualsOperator(final ExtList operands) { - - return new NotEquals(operands); + public static BinaryOperator notEqualsOperator(final ExtList operands) { + return new BinaryOperator(BinaryOperatorKind.NotEquals, operands); } /** @@ -2446,10 +2134,8 @@ public static NotEquals notEqualsOperator(final ExtList operands) { * super(args) * * - * @param referencePrefix - * the enclosing class type - * @param args - * the {@link Expression} arguments to be passed to constructor + * @param referencePrefix the enclosing class type + * @param args the {@link Expression} arguments to be passed to constructor * @return a new {@link SuperConstructorReference} parameterized with args */ public static SuperConstructorReference superConstructor(final ReferencePrefix referencePrefix, @@ -2477,10 +2163,8 @@ public static SuperReference superReference() { * } * * - * @param expression - * the to be evaluated {@link Expression} - * @param branches - * the switch-case {@link Branch}es + * @param expression the to be evaluated {@link Expression} + * @param branches the switch-case {@link Branch}es * @return a new {@link Switch} block that executes branches depending on the value * of expression */ @@ -2492,8 +2176,7 @@ public static Switch switchBlock(final Expression expression, final Branch[] bra /** * Create a switch block. * - * @param parameters - * the switch-case parameters (guard, body, branches) as {@link ExtList} + * @param parameters the switch-case parameters (guard, body, branches) as {@link ExtList} * @return a new {@link Switch} as defined by parameters */ public static Switch switchBlock(final ExtList parameters) { @@ -2504,8 +2187,7 @@ public static Switch switchBlock(final ExtList parameters) { /** * Create a synchronized block. * - * @param parameters - * the synchronized block parameters (monitor, body) as {@link ExtList} + * @param parameters the synchronized block parameters (monitor, body) as {@link ExtList} * @return a new {@link SynchronizedBlock} as defined by parameters */ public static SynchronizedBlock synchronizedBlock(final ExtList parameters) { @@ -2516,8 +2198,7 @@ public static SynchronizedBlock synchronizedBlock(final ExtList parameters) { /** * Create a then block. * - * @param parameters - * the then block parameters (body) as {@link ExtList} + * @param parameters the then block parameters (body) as {@link ExtList} * @return a new {@link Then} as defined by parameters */ public static Then thenBlock(final ExtList parameters) { @@ -2533,8 +2214,7 @@ public static Then thenBlock(final ExtList parameters) { * statement * * - * @param statement - * the to be executed {@link Statement} + * @param statement the to be executed {@link Statement} * @return a new {@link Then} block that consists of statement solely */ public static Then thenBlock(final Statement statement) { @@ -2551,8 +2231,7 @@ public static Then thenBlock(final Statement statement) { * } * * - * @param statements - * the to be executed {@link Statement}s + * @param statements the to be executed {@link Statement}s * @return a new {@link Then} block that consists of statements solely */ public static Then thenBlock(final Statement[] statements) { @@ -2568,8 +2247,7 @@ public static Then thenBlock(final Statement[] statements) { * this(args) * * - * @param args - * the {@link Expression} arguments to be passed to constructor + * @param args the {@link Expression} arguments to be passed to constructor * @return a new {@link ThisConstructorReference} parameterized with args */ public static ThisConstructorReference thisConstructor(final Expression[] args) { @@ -2599,8 +2277,7 @@ public static BooleanLiteral trueLiteral() { /** * Create a try block. * - * @param parameters - * the try-catch parameters (body, branches) as {@link ExtList} + * @param parameters the try-catch parameters (body, branches) as {@link ExtList} * @return a new {@link Try} as defined by parameters */ public static Try tryBlock(final ExtList parameters) { @@ -2617,10 +2294,8 @@ public static Try tryBlock(final ExtList parameters) { * branches * * - * @param body - * the {@link StatementBlock} to be executed - * @param branches - * the try-catch {@link Branch}es + * @param body the {@link StatementBlock} to be executed + * @param branches the try-catch {@link Branch}es * @return a new {@link Try} block for the execution of branches depending on the * events during the execution of body */ @@ -2638,10 +2313,8 @@ public static Try tryBlock(final StatementBlock body, final Branch[] branches) { * branches * * - * @param statement - * the {@link Statement} to be executed - * @param branches - * the try-catch {@link Branch}es + * @param statement the {@link Statement} to be executed + * @param branches the try-catch {@link Branch}es * @return a new {@link Try} block for the execution of branches depending on the * events during the execution of statement */ @@ -2660,10 +2333,8 @@ public static Try tryBlock(final Statement statement, final Branch[] branches) { * branch * * - * @param statement - * the {@link Statement} to be executed - * @param branch - * the try-catch {@link Branch} + * @param statement the {@link Statement} to be executed + * @param branch the try-catch {@link Branch} * @return a new {@link Try} block for the execution of branch depending on the * events during the execution of statement */ @@ -2680,8 +2351,7 @@ public static Try tryBlock(final Statement statement, final Branch branch) { * type * * - * @param type - * the {@link KeYJavaType} to be referenced + * @param type the {@link KeYJavaType} to be referenced * @return a new {@link TypeRef} that references type */ public static TypeRef typeRef(final KeYJavaType type) { @@ -2696,10 +2366,8 @@ public static TypeRef typeRef(final KeYJavaType type) { * type[]...[] * * - * @param type - * the base {@link KeYJavaType} - * @param dimensions - * the number of dimensions + * @param type the base {@link KeYJavaType} + * @param dimensions the number of dimensions * @return a new {@link TypeRef} for dimensions dimensions of type */ public static TypeRef typeRef(final KeYJavaType type, final int dimensions) { @@ -2719,14 +2387,10 @@ public static BooleanLiteral falseLiteral() { /** * Create a variable specification. * - * @param variable - * the {@link IProgramVariable} to be specified - * @param dimensions - * the number of dimensions - * @param initializer - * the initializer {@link Expression} - * @param type - * the {@link Type} + * @param variable the {@link IProgramVariable} to be specified + * @param dimensions the number of dimensions + * @param initializer the initializer {@link Expression} + * @param type the {@link Type} * @return a new {@link VariableSpecification} for variable of type * type[dimensions], initialized to initializer */ @@ -2739,12 +2403,9 @@ public static VariableSpecification variableSpecification(final IProgramVariable /** * Create a variable specification. * - * @param variable - * the {@link IProgramVariable} to be specified - * @param initializer - * the initializer {@link Expression} - * @param keyJavaType - * the {@link KeYJavaType} + * @param variable the {@link IProgramVariable} to be specified + * @param initializer the initializer {@link Expression} + * @param keyJavaType the {@link KeYJavaType} * @return a new {@link VariableSpecification} for variable of type * type, initialized to initializer */ diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java index e7c27041e8e..978df8f2ddf 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java @@ -16,7 +16,6 @@ import de.uka.ilkd.key.java.ast.expression.literal.Literal; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.Singleton; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.transformations.ConstantExpressionEvaluator; import de.uka.ilkd.key.java.transformations.EvaluationException; @@ -132,8 +131,7 @@ public Collection getLDTs() { return LDTs.values(); } - private JTerm translateOperator(Operator op, - ExecutionContext ec) { + private JTerm translateOperator(Operator op, ExecutionContext ec) { final JTerm[] subs = new JTerm[op.getArity()]; for (int i = 0, n = op.getArity(); i < n; i++) { @@ -141,19 +139,23 @@ private JTerm translateOperator(Operator op, } // hack: convert object singleton to location singleton - if (op instanceof Singleton) { - assert heapLDT.getSortOfSelect(subs[0].op()) != null - : "unexpected argument of \\singleton: " + subs[0]; - return tb.singleton(subs[0].sub(1), subs[0].sub(2)); + if (op instanceof LogicFunctionalOperator o) { + if (o.getFunction() == LogicFunctionalOperator.LogicFunction.Singleton) { + assert heapLDT.getSortOfSelect(subs[0].op()) != null + : "unexpected argument of \\singleton: " + subs[0]; + return tb.singleton(subs[0].sub(1), subs[0].sub(2)); + } } LDT responsibleLDT = getResponsibleLDT(op, subs, services, ec); if (responsibleLDT != null) { return tb.func(responsibleLDT.getFunctionFor(op, services, ec), subs); - } else if (op instanceof Equals) { + } else if (op instanceof BinaryOperator bo + && bo.getKind() == BinaryOperator.BinaryOperatorKind.Equals) { assert subs.length == 2; return tb.equals(subs[0], subs[1]); - } else if (op instanceof NotEquals) { + } else if (op instanceof BinaryOperator bo + && bo.getKind() == BinaryOperator.BinaryOperatorKind.NotEquals) { assert subs.length == 2; return tb.not(tb.equals(subs[0], subs[1])); } else if (op instanceof Conditional) { @@ -372,17 +374,6 @@ private JTerm convertLiteralExpression(Literal lit) { } } - public static boolean isArithmeticOperator(Operator op) { - return op instanceof Divide || op instanceof Times || op instanceof Plus - || op instanceof Minus - || op instanceof Modulo || op instanceof ShiftLeft || op instanceof ShiftRight - || op instanceof BinaryAnd || op instanceof BinaryNot || op instanceof BinaryOr - || op instanceof BinaryXOr || op instanceof Negative || op instanceof PreIncrement - || op instanceof PostIncrement || op instanceof PreDecrement - || op instanceof PostDecrement; - } - - // TODO Adapt for @Reals /** * performs binary numeric promotion on the argument types diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java index d5f501671c1..47663c7c953 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/declaration/Modifier.java @@ -148,8 +148,6 @@ public final boolean equals(Object o) { @Override public int computeHashCode() { - int result = super.hashCode(); - result = 31 * result + keyword.hashCode(); - return result; + return 31 * keyword.hashCode(); } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java index f352131749e..0cef6407c8f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java @@ -11,71 +11,90 @@ import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; +import de.uka.ilkd.key.java.visitor.Visitor; import org.key_project.util.ExtList; import org.key_project.util.collection.ImmutableArray; +import org.jspecify.annotations.NullMarked; + +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + /** * An assignment is an operator with side-effects. */ +@NullMarked +public final class Assignment extends Operator implements ExpressionStatement { + @Override + public void visit(Visitor v) { + v.performActionOnAssignment(this); + } -public abstract class Assignment extends Operator implements ExpressionStatement { - - protected Assignment() { + public AssignmentKind getKind() { + return kind; + } + public enum AssignmentKind { + Copy(""), + BinaryOr("|"), + Divide("/"), + ShiftLeft("<<"), + UnsignedShiftRight(">>>"), + Plus("+"), + ShiftRight(">>"), + Minus("-"), + Modulo("%"), + Times("*"), + BinaryAnd("&"), + BinaryXOr("^"); + + public final String symbol; + + AssignmentKind(String symbol) { + this.symbol = symbol; + } } - /** - * Constructor for the transformation of COMPOST ASTs to KeY. - * - * @param children - * the children of this AST element as KeY classes. In this case the order of - * the children is IMPORTANT. May contain: 2 of Expression (the first Expression as left - * hand side, the second as right hand side), Comments - */ - protected Assignment(ExtList children) { + private final AssignmentKind kind; + + public Assignment(ExtList children) { super(children); + kind = children.get(AssignmentKind.class); } + @Override + public int getArity() { + return 2; + } - /** - * Unary Assignment (e.g. +=, ++). - * - * @param lhs - * an expression. - */ - protected Assignment(Expression lhs) { - super(lhs); + @Override + public int getPrecedence() { + return 13; } - /** - * Assignment. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - protected Assignment(Expression lhs, Expression rhs) { - super(lhs, rhs); + @Override + public int getNotation() { + return INFIX; } - public Assignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, new ImmutableArray<>(target, expr)); + public Assignment(AssignmentKind kind, Expression lhs, Expression rhs) { + super(lhs, rhs); + this.kind = kind; } - public Assignment(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); + public Assignment(Expression lhs, Expression rhs) { + this(Copy, lhs, rhs); } - /** - * Checks if this operator is left or right associative. Assignments are right associative. - * - * @return true, if the operator is left associative, false otherwise. - */ + public Assignment(PositionInfo pi, List c, AssignmentKind kind, Expression target, + Expression expr) { + super(pi, c, new ImmutableArray<>(target, expr)); + this.kind = kind; + } + @Override public boolean isLeftAssociative() { return false; } @@ -84,10 +103,8 @@ public boolean isLeftAssociative() { /** * retrieves the type of the assignment expression * - * @param javaServ - * the Services offering access to the Java model - * @param ec - * the ExecutionContext in which the expression is evaluated + * @param javaServ the Services offering access to the Java model + * @param ec the ExecutionContext in which the expression is evaluated * @return the type of the assignment expression */ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { @@ -113,5 +130,4 @@ public String reuseSignature(Services services, ExecutionContext ec) { return base; } } - } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAnd.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAnd.java deleted file mode 100644 index 7d1a4e41f22..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAnd.java +++ /dev/null @@ -1,80 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary and. - */ - -public class BinaryAnd extends BinaryOperator { - - /** - * Binary and. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public BinaryAnd(ExtList children) { - super(children); - } - - public BinaryAnd(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public final int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public final int getPrecedence() { - return 7; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public final int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnBinaryAnd(this); - } - - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAndAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAndAssignment.java deleted file mode 100644 index 009cec70b38..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryAndAssignment.java +++ /dev/null @@ -1,81 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary and assignment. - * - * @author AutoDoc - */ - -public class BinaryAndAssignment extends Assignment { - - - /* - * Binary and assignement - * - * @param children an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - public BinaryAndAssignment(ExtList children) { - super(children); - } - - public BinaryAndAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnBinaryAndAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryNot.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryNot.java deleted file mode 100644 index 3c06398ae50..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryNot.java +++ /dev/null @@ -1,102 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.*; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Binary not. - * - * @author AutoDoc - */ - -public class BinaryNot extends Operator { - - /** - * Binary not. - * - * @param children - * list withh all children - */ - - public BinaryNot(ExtList children) { - super(children); - } - - public BinaryNot(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * Checks if this operator is left or right associative. Ordinary unary operators are right - * associative. - * - * @return true, if the operator is left associative, false otherwise. - */ - - public boolean isLeftAssociative() { - return false; - } - - - /** - * 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.performActionOnBinaryNot(this); - } - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - final TypeConverter tc = javaServ.getTypeConverter(); - return tc.getPromotedType(tc.getKeYJavaType((Expression) getChildAt(0), ec)); - - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java index 58acf1d6181..c1523b2dbaa 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java @@ -6,46 +6,101 @@ import java.util.List; import java.util.Objects; -import de.uka.ilkd.key.java.*; +import de.uka.ilkd.key.java.Services; +import de.uka.ilkd.key.java.TypeConverter; import de.uka.ilkd.key.java.ast.Comment; import de.uka.ilkd.key.java.ast.PositionInfo; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; +import de.uka.ilkd.key.java.visitor.Visitor; import org.key_project.util.ExtList; import org.key_project.util.collection.ImmutableArray; -/** - * Operator of arity 2 - * - * @author AL - */ -public abstract class BinaryOperator extends Operator { +public final class BinaryOperator extends Operator { + public BinaryOperator(BinaryOperatorKind binaryOperatorKind, ExtList operands) { + super(operands); + kind = binaryOperatorKind; + } + + public enum BinaryOperatorKind { + Divide(2, "/"), + Modulo(2, "%"), + Times(2, "*"), + Minus(3, "-"), + Plus(3, "+"), + Subtype(3, "<:"), + + ShiftLeft(4, "<<"), + ShiftRight(4, ">>"), + UnsignedShiftRight(4, ">>>"), + + GreaterOrEquals(5, ">="), + LessOrEquals(5, "<="), + GreaterThan(5, ">"), + LessThan(5, "<"), + Equals(6, "=="), + NotEquals(6, "!="), + + + BinaryAnd(7, "&"), + BinaryXOr(8, "^"), + BinaryOr(9, "|"), + + + LogicalAnd(10, "&&"), + LogicalOr(11, "||"); + + + public final int precedence; + public final String symbol; + + BinaryOperatorKind(int precedence, String symbol) { + this.precedence = precedence; + this.symbol = symbol; + } + } + + private final BinaryOperatorKind kind; - protected BinaryOperator(ExtList children) { + public BinaryOperator(ExtList children) { super(children); + kind = children.get(BinaryOperatorKind.class); } - protected BinaryOperator(Expression lhs, Expression rhs) { + public BinaryOperator(BinaryOperatorKind kind, Expression lhs, Expression rhs) { super(lhs, rhs); + this.kind = kind; } - public BinaryOperator(PositionInfo pi, List c, Expression lhs, Expression rhs) { + public BinaryOperator(PositionInfo pi, List c, + BinaryOperatorKind kind, Expression lhs, Expression rhs) { super(pi, c, new ImmutableArray<>(Objects.requireNonNull(lhs), Objects.requireNonNull(rhs))); + this.kind = kind; + } + + + public BinaryOperatorKind getKind() { + return kind; } - /** - * Get arity. - * - * @return the int value. - */ public int getArity() { return 2; } + @Override + public int getPrecedence() { + return kind.precedence; + } + + @Override + public int getNotation() { + return INFIX; + } + public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { final TypeConverter tc = javaServ.getTypeConverter(); try { @@ -57,4 +112,8 @@ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { } } + @Override + public void visit(Visitor v) { + v.performActionOnBinaryOperator(this); + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOr.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOr.java deleted file mode 100644 index fbbfb4e2173..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOr.java +++ /dev/null @@ -1,73 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary or. - * - * @author AutoDoc - */ - -public class BinaryOr extends BinaryOperator { - - - /** - * Binary or. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public BinaryOr(ExtList children) { - super(children); - } - - public BinaryOr(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 9; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnBinaryOr(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOrAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOrAssignment.java deleted file mode 100644 index 1bcdb9c0409..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOrAssignment.java +++ /dev/null @@ -1,84 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary or assignment. - * - * @author AutoDoc - */ - -public class BinaryOrAssignment extends Assignment { - - - - /** - * Binary or assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public BinaryOrAssignment(ExtList children) { - super(children); - } - - public BinaryOrAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnBinaryOrAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOr.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOr.java deleted file mode 100644 index d17f31afbbc..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOr.java +++ /dev/null @@ -1,72 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary X or. - * - * @author AutoDoc - */ - -public class BinaryXOr extends BinaryOperator { - - - /** - * Binary X or. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public BinaryXOr(ExtList children) { - super(children); - } - - public BinaryXOr(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 8; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnBinaryXOr(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOrAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOrAssignment.java deleted file mode 100644 index d8e6eba52d5..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryXOrAssignment.java +++ /dev/null @@ -1,82 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Binary X or assignment. - * - * @author AutoDoc - */ - -public class BinaryXOrAssignment extends Assignment { - - - /** - * Binary X or assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public BinaryXOrAssignment(ExtList children) { - super(children); - } - - public BinaryXOrAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnBinaryXOrAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ComparativeOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ComparativeOperator.java deleted file mode 100644 index 6d4c99e119b..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ComparativeOperator.java +++ /dev/null @@ -1,77 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Comparative operator. - * - * @author AutoDoc - */ - -public abstract class ComparativeOperator extends Operator { - - - /** - * Comparative operator. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - protected ComparativeOperator(ExtList children) { - super(children); - } - - protected ComparativeOperator(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public ComparativeOperator(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, new ImmutableArray<>(lhs, rhs)); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return getKeYJavaType(services); - } - - public KeYJavaType getKeYJavaType(Services services) { - return services.getTypeConverter().getBooleanType(); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/CopyAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/CopyAssignment.java deleted file mode 100644 index e89f1f13456..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/CopyAssignment.java +++ /dev/null @@ -1,88 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Copy assignment. - * - * @author AutoDoc - */ -public class CopyAssignment extends Assignment { - - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. - * - * @param children - * the children of this AST element as KeY classes. - */ - public CopyAssignment(ExtList children) { - super(children); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. - * - * @param lhs - * the Expression the value is assigned to - * @param rhs - * the Expression the value which is assigned to lhs - */ - public CopyAssignment(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public CopyAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnCopyAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Divide.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Divide.java deleted file mode 100644 index 3ff3c1bf9c5..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Divide.java +++ /dev/null @@ -1,75 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - - -/** - * Divide. - */ - -public class Divide extends BinaryOperator { - - /** - * Divide. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public Divide(ExtList children) { - super(children); - } - - public Divide(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public Divide(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 2; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnDivide(this); - } - - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/DivideAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/DivideAssignment.java deleted file mode 100644 index fa117f3d06a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/DivideAssignment.java +++ /dev/null @@ -1,82 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Divide assignment. - * - * @author AutoDoc - */ - -public class DivideAssignment extends Assignment { - - - - /** - * Divide assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public DivideAssignment(ExtList children) { - super(children); - } - - public DivideAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnDivideAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Equals.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Equals.java deleted file mode 100644 index e14fd91a30b..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Equals.java +++ /dev/null @@ -1,68 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Equals. - */ - -public class Equals extends ComparativeOperator { - - /** - * Equals. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - public Equals(ExtList children) { - super(children); - } - - /** - * Creates the equals expression lhs==rhs - * - * @param lhs - * the Expression on the left side of the comparison - * @param rhs - * the Expression on the right side of the comparison - */ - public Equals(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public Equals(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 6; - } - - /** - * 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.performActionOnEquals(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterOrEquals.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterOrEquals.java deleted file mode 100644 index 76509ad4ad3..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterOrEquals.java +++ /dev/null @@ -1,59 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Greater or equals. - */ - -public class GreaterOrEquals extends ComparativeOperator { - - - /** - * Greater or equals. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public GreaterOrEquals(ExtList children) { - super(children); - } - - public GreaterOrEquals(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 5; - } - - /** - * 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.performActionOnGreaterOrEquals(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterThan.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterThan.java deleted file mode 100644 index e3e14e9ad80..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/GreaterThan.java +++ /dev/null @@ -1,70 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Greater than. - */ - -public class GreaterThan extends ComparativeOperator { - - - /** - * Greater than. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public GreaterThan(ExtList children) { - super(children); - } - - /** - * Greater than. - * - * @param lhs - * the expression that is checked to be greater than rhs - * @param rhs - * the expression that is checked to be less than lhs - */ - public GreaterThan(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public GreaterThan(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 5; - } - - /** - * 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.performActionOnGreaterThan(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Intersect.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Intersect.java deleted file mode 100644 index d5085e8bccd..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Intersect.java +++ /dev/null @@ -1,40 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -public class Intersect extends BinaryOperator { - public Intersect(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - public Intersect(ExtList children) { - super(children); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return Operator.PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnIntersect(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessOrEquals.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessOrEquals.java deleted file mode 100644 index c43d409d62a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessOrEquals.java +++ /dev/null @@ -1,64 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Less or equals. - */ - -public class LessOrEquals extends ComparativeOperator { - - - /** - * Less or equals. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public LessOrEquals(ExtList children) { - super(children); - } - - public LessOrEquals(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public LessOrEquals(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 5; - } - - /** - * 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.performActionOnLessOrEquals(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessThan.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessThan.java deleted file mode 100644 index e41d8d0650b..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LessThan.java +++ /dev/null @@ -1,69 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Less than. - */ - -public class LessThan extends ComparativeOperator { - - - /** - * Less than. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - public LessThan(ExtList children) { - super(children); - } - - /** - * Less than. - * - * @param lhs - * the expression that is checked to be less than rhs - * @param rhs - * the expression that is checked to be greater than lhs - */ - public LessThan(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public LessThan(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 5; - } - - /** - * 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.performActionOnLessThan(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java new file mode 100644 index 00000000000..b428f353c07 --- /dev/null +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java @@ -0,0 +1,108 @@ +/* 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.operator; + +import java.util.List; + +import de.uka.ilkd.key.java.Services; +import de.uka.ilkd.key.java.ast.Comment; +import de.uka.ilkd.key.java.ast.PositionInfo; +import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; +import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; +import de.uka.ilkd.key.java.ast.expression.Expression; +import de.uka.ilkd.key.java.ast.expression.Operator; +import de.uka.ilkd.key.java.ast.reference.ExecutionContext; +import de.uka.ilkd.key.java.visitor.Visitor; +import de.uka.ilkd.key.pp.PrettyPrinter; + +import org.key_project.util.collection.ImmutableArray; + +import static de.uka.ilkd.key.pp.PrettyPrinter.*; + +/** + * + * @author Alexander Weigl + * @version 1 (4/12/26) + */ +public class LogicFunctionalOperator extends Operator { + + public LogicFunctionalOperator(PositionInfo pi, List comments, LogicFunction function, + Expression... args) { + super(pi, comments, new ImmutableArray<>(args)); + this.function = function; + } + + public LogicFunctionalOperator(LogicFunction function, Expression... args) { + super(args); + this.function = function; + } + + public LogicFunctionalOperator(PositionInfo pi, List c, LogicFunction fn, + ImmutableArray args) { + super(pi, c, args); + this.function = fn; + } + + + public enum LogicFunction { + Intersect(2, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\intersect")), + SetUnion(2, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\set_union")), + SetMinus(2, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\set_minus")), + AllObjects(1, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\all_objects")), + SeqPut(3, 1, PrimitiveType.JAVA_SEQ, AsFunction("\\seq_upd")), + SeqGet(1, 1, PrimitiveType.JAVA_INT, AsArrayAccess()), + SeqReverse(1, 1, PrimitiveType.JAVA_SEQ, AsFunction("\\seq_reverse")), + AllFields(1, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\all_fields")), + SeqIndexOf(2, 1, PrimitiveType.JAVA_INT, AsFunction("\\indexOf")), + SeqSingleton(1, 1, PrimitiveType.JAVA_SEQ, AsFunction("\\seq_singleton")), + SeqSub(3, 1, PrimitiveType.JAVA_SEQ, AsFunction("\\seq_sub")), + SeqConcat(2, 1, PrimitiveType.JAVA_SEQ, AsFunction("\\seq_concat")), + Singleton(1, 1, PrimitiveType.JAVA_LOCSET, AsFunction("\\singleton")), + SeqLength(1, 1, PrimitiveType.JAVA_INT, AsSuffix("length")); + + public final int arity; + public final int precedence; + public final PrimitiveType returnType; + public final PrettyPrinter.PrintOp format; + + LogicFunction(int arity, int precedence, PrimitiveType returnType, + PrettyPrinter.PrintOp format) { + this.arity = arity; + this.precedence = precedence; + this.returnType = returnType; + this.format = format; + } + } + + private final LogicFunction function; + + public LogicFunction getFunction() { + return function; + } + + @Override + public int getArity() { + return function.arity; + } + + @Override + public int getPrecedence() { + return function.precedence; + } + + @Override + public int getNotation() { + return PREFIX; + } + + @Override + public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { + return javaServ.getJavaInfo().getPrimitiveKeYJavaType(function.returnType); + } + + @Override + public void visit(Visitor v) { + v.performActionOnLogicFunctionalOperator(this); + } +} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalAnd.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalAnd.java deleted file mode 100644 index 490efc3f654..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalAnd.java +++ /dev/null @@ -1,93 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Logical and. - */ - -public class LogicalAnd extends Operator { - - - /** - * Logical and. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public LogicalAnd(ExtList children) { - super(children); - } - - public LogicalAnd(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public LogicalAnd(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, new ImmutableArray<>(lhs, rhs)); - - } - - - /** - * Get arity. - * - * @return the int value. - */ - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 10; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnLogicalAnd(this); - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return services.getTypeConverter().getBooleanType(); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalNot.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalNot.java deleted file mode 100644 index 67f31449561..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalNot.java +++ /dev/null @@ -1,100 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Logical not. - */ - -public class LogicalNot extends Operator { - - - /** - * Logical not. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public LogicalNot(ExtList children) { - super(children); - } - - public LogicalNot(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * Checks if this operator is left or right associative. Ordinary unary operators are right - * associative. - * - * @return true, if the operator is left associative, false otherwise. - */ - - public boolean isLeftAssociative() { - return false; - } - - /** - * 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.performActionOnLogicalNot(this); - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return services.getTypeConverter().getBooleanType(); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalOr.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalOr.java deleted file mode 100644 index ae4dacee4c1..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicalOr.java +++ /dev/null @@ -1,89 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - - -/** - * Logical or. - */ - -public class LogicalOr extends Operator { - - /** - * Logical or. - */ - - public LogicalOr(ExtList children) { - super(children); - } - - - public LogicalOr(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public LogicalOr(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, new ImmutableArray<>(lhs, rhs)); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 11; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnLogicalOr(this); - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return services.getTypeConverter().getBooleanType(); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Minus.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Minus.java deleted file mode 100644 index 5cd4af9d0ee..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Minus.java +++ /dev/null @@ -1,79 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Minus. - * - * @author AutoDoc - */ - -public class Minus extends BinaryOperator { - - - /** - * Minus. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public Minus(ExtList children) { - super(children); - } - - public Minus(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public Minus(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 3; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnMinus(this); - } - - - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/MinusAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/MinusAssignment.java deleted file mode 100644 index a7d4216482f..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/MinusAssignment.java +++ /dev/null @@ -1,79 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Minus assignment. - */ - -public class MinusAssignment extends Assignment { - - /** - * Minus assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public MinusAssignment(ExtList children) { - super(children); - } - - public MinusAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnMinusAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Modulo.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Modulo.java deleted file mode 100644 index 2ad855f8f3c..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Modulo.java +++ /dev/null @@ -1,71 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - - -/** - * Modulo. - */ -public class Modulo extends BinaryOperator { - - - /** - * Modulo. - */ - - public Modulo(ExtList children) { - super(children); - } - - public Modulo(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public Modulo(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 2; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnModulo(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ModuloAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ModuloAssignment.java deleted file mode 100644 index fef926c521a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ModuloAssignment.java +++ /dev/null @@ -1,79 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Modulo assignment. - */ - -public class ModuloAssignment extends Assignment { - - - /** - * Modulo assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public ModuloAssignment(ExtList children) { - super(children); - } - - public ModuloAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnModuloAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Negative.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Negative.java deleted file mode 100644 index 1b67319cb3f..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Negative.java +++ /dev/null @@ -1,105 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - - -/** - * Negative. - */ - -public class Negative extends Operator { - - /** - * Negative. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public Negative(ExtList children) { - super(children); - } - - - public Negative(Expression expr) { - super(expr); - } - - public Negative(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * Checks if this operator is left or right associative. Ordinary unary operators are right - * associative. - * - * @return true, if the operator is left associative, false otherwise. - */ - - public boolean isLeftAssociative() { - return false; - } - - /** - * 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.performActionOnNegative(this); - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return services.getTypeConverter() - .getPromotedType(getExpressionAt(0).getKeYJavaType(services, ec)); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/NotEquals.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/NotEquals.java deleted file mode 100644 index a0e35e4e606..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/NotEquals.java +++ /dev/null @@ -1,59 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Not equals. - */ - -public class NotEquals extends ComparativeOperator { - - - /** - * Not equals. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public NotEquals(ExtList children) { - super(children); - } - - public NotEquals(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 6; - } - - /** - * 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.performActionOnNotEquals(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Plus.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Plus.java deleted file mode 100644 index 71ab325ba28..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Plus.java +++ /dev/null @@ -1,74 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Addition or string concatenation operator "+". - */ - -public class Plus extends BinaryOperator { - - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public Plus(ExtList children) { - super(children); - } - - public Plus(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - public Plus(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 3; - } - - /** - * Get notation. - * - * @return the int value. - */ - public int getNotation() { - return Operator.INFIX; - } - - - /** - * 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.performActionOnPlus(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PlusAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PlusAssignment.java deleted file mode 100644 index f550ca3544d..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PlusAssignment.java +++ /dev/null @@ -1,80 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Addition or string concatenation assignment "+=". - */ - -public class PlusAssignment extends Assignment { - - - /** - * Plus assignment. - * - * @param children - * an ExtList with all children of this node the first children in list will be - * the one on the left side, the second the one on the right side. - */ - - public PlusAssignment(ExtList children) { - super(children); - } - - public PlusAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnPlusAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Positive.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Positive.java deleted file mode 100644 index c8208c03a31..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Positive.java +++ /dev/null @@ -1,108 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Positive. - */ - -public class Positive extends Operator { - - - /** - * Positive. - * - * @param expr - * the Expression - */ - public Positive(Expression expr) { - super(expr); - } - - /** - * Positive. - * - * @param children - * an ExtList with all children of this node - */ - public Positive(ExtList children) { - super(children); - } - - public Positive(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * Checks if this operator is left or right associative. Ordinary unary operators are right - * associative. - * - * @return true, if the operator is left associative, false otherwise. - */ - - public boolean isLeftAssociative() { - return false; - } - - /** - * 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.performActionOnPositive(this); - } - - public KeYJavaType getKeYJavaType(Services services, ExecutionContext ec) { - return services.getTypeConverter() - .getPromotedType(getExpressionAt(0).getKeYJavaType(services, ec)); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostDecrement.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostDecrement.java deleted file mode 100644 index 8eb830320aa..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostDecrement.java +++ /dev/null @@ -1,79 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Post decrement. - */ - -public class PostDecrement extends Assignment { - - - /** - * Post decrement. - * - * @param children - * an ExtList with all children of this node - */ - - public PostDecrement(ExtList children) { - super(children); - } - - public PostDecrement(PositionInfo pi, List c, Expression child) { - super(pi, c, child); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return POSTFIX; - } - - /** - * 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.performActionOnPostDecrement(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostIncrement.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostIncrement.java deleted file mode 100644 index fae9c203e92..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PostIncrement.java +++ /dev/null @@ -1,91 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Post increment. - */ - -public class PostIncrement extends Assignment { - - - /** - * Post increment. - * - * @param unary - * the Expression to be incremented by one - */ - - public PostIncrement(Expression unary) { - super(unary); - } - - - /** - * Post increment. - * - * @param children - * an ExtList with all children of this node - */ - - public PostIncrement(ExtList children) { - super(children); - } - - public PostIncrement(PositionInfo pi, List c, Expression child) { - super(pi, c, child); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return POSTFIX; - } - - /** - * 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.performActionOnPostIncrement(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreDecrement.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreDecrement.java deleted file mode 100644 index 716da46a6e6..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreDecrement.java +++ /dev/null @@ -1,78 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Pre decrement. - */ - -public class PreDecrement extends Assignment { - - - /** - * Pre decrement. - * - * @param children - * an ExtList with all children of this node - */ - - public PreDecrement(ExtList children) { - super(children); - } - - public PreDecrement(PositionInfo pi, List c, Expression child) { - super(pi, c, child); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * 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.performActionOnPreDecrement(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreIncrement.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreIncrement.java deleted file mode 100644 index e99572fd03a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/PreIncrement.java +++ /dev/null @@ -1,79 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Pre increment. - */ - -public class PreIncrement extends Assignment { - - - /** - * Pre increment. - * - * @param children - * an ExtList with all children of this node - */ - - public PreIncrement(ExtList children) { - super(children); - } - - public PreIncrement(PositionInfo pi, List c, Expression child) { - super(pi, c, child); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 1; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 1; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return PREFIX; - } - - /** - * 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.performActionOnPreIncrement(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeft.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeft.java deleted file mode 100644 index 067a9f12f5f..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeft.java +++ /dev/null @@ -1,106 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.*; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Shift left. - * - */ - -public class ShiftLeft extends Operator { - - /** - * Shift left. - */ - - public ShiftLeft() {} - - /** - * Shift left. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - public ShiftLeft(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public ShiftLeft(ExtList children) { - super(children); - } - - public ShiftLeft(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 4; - } - - /** - * Get notation. - * - * @return the int value. - */ - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnShiftLeft(this); - } - - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - final TypeConverter tc = javaServ.getTypeConverter(); - return tc.getPromotedType(tc.getKeYJavaType((Expression) getChildAt(0), ec)); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeftAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeftAssignment.java deleted file mode 100644 index 30d6bdc578e..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftLeftAssignment.java +++ /dev/null @@ -1,98 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Shift left assignment. - */ - -public class ShiftLeftAssignment extends Assignment { - - /** - * Shift left assignment. - */ - - public ShiftLeftAssignment() {} - - /** - * Shift left assignment. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - - public ShiftLeftAssignment(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public ShiftLeftAssignment(ExtList children) { - super(children); - } - - public ShiftLeftAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnShiftLeftAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRight.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRight.java deleted file mode 100644 index 6854d2e242a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRight.java +++ /dev/null @@ -1,106 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.*; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Shift right. - * - * @author AutoDoc - */ -public class ShiftRight extends Operator { - - /** - * Shift right. - */ - public ShiftRight() {} - - /** - * Shift right. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - public ShiftRight(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public ShiftRight(ExtList children) { - super(children); - } - - public ShiftRight(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 4; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnShiftRight(this); - } - - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - final TypeConverter tc = javaServ.getTypeConverter(); - return tc.getPromotedType(tc.getKeYJavaType((Expression) getChildAt(0), ec)); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRightAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRightAssignment.java deleted file mode 100644 index 3a90d75ab16..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/ShiftRightAssignment.java +++ /dev/null @@ -1,99 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Shift right assignment. - * - * @author AutoDoc - */ - -public class ShiftRightAssignment extends Assignment { - - /** - * Shift right assignment. - */ - public ShiftRightAssignment() {} - - /** - * Shift right assignment. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - public ShiftRightAssignment(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public ShiftRightAssignment(ExtList children) { - super(children); - } - - public ShiftRightAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnShiftRightAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Subtype.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Subtype.java deleted file mode 100644 index 90218b086d7..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Subtype.java +++ /dev/null @@ -1,55 +0,0 @@ -/* 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.operator; - -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Subtype - */ -public class Subtype extends BinaryOperator { - - public Subtype(ExtList children) { - super(children); - } - - public Subtype(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 3; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnSubtype(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Times.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Times.java deleted file mode 100644 index 0e5aadc5e3e..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/Times.java +++ /dev/null @@ -1,87 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Times. - * - * @author AutoDoc - */ - -public class Times extends BinaryOperator { - - /** - * Times. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - - public Times(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public Times(ExtList children) { - super(children); - } - - public Times(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 2; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return Operator.INFIX; - } - - /** - * 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.performActionOnTimes(this); - } - - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/TimesAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/TimesAssignment.java deleted file mode 100644 index f9e2b249244..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/TimesAssignment.java +++ /dev/null @@ -1,99 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Times assignment. - * - * @author AutoDoc - */ - -public class TimesAssignment extends Assignment { - - /** - * Times assignment. - */ - - public TimesAssignment() {} - - /** - * Times assignment. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - - public TimesAssignment(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public TimesAssignment(ExtList children) { - super(children); - } - - public TimesAssignment(PositionInfo pi, List c, Expression target, Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnTimesAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java new file mode 100644 index 00000000000..6c9d39302a0 --- /dev/null +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java @@ -0,0 +1,93 @@ +/* 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.operator; + +import java.util.List; + +import de.uka.ilkd.key.java.Services; +import de.uka.ilkd.key.java.ast.Comment; +import de.uka.ilkd.key.java.ast.PositionInfo; +import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; +import de.uka.ilkd.key.java.ast.expression.Expression; +import de.uka.ilkd.key.java.ast.expression.ExpressionStatement; +import de.uka.ilkd.key.java.ast.expression.Operator; +import de.uka.ilkd.key.java.ast.reference.ExecutionContext; +import de.uka.ilkd.key.java.visitor.Visitor; + +import org.key_project.util.collection.ImmutableArray; + +/** + * + * @author Alexander Weigl + * @version 1 (4/12/26) + */ +public final class UnaryOperator extends Operator implements ExpressionStatement { + public UnaryOperator(UnaryOperatorKind kind, Expression arg) { + super(arg); + this.kind = kind; + } + + public enum UnaryOperatorKind { + LogicalNot("!", 1), + Negative("-", 1), + Positive("+", 1), + BinaryNot("~", 1), + + PreIncrement("++", 0), + PreDecrement("--", 0), + PostIncrement("++", 0, POSTFIX), + PostDecrement("--", 0, POSTFIX); + + + public final String symbol; + public final int precedence; + public final int notation; + + UnaryOperatorKind(String symbol, int precedence) { + this(symbol, precedence, PREFIX); + } + + UnaryOperatorKind(String symbol, int precedence, int notation) { + this.symbol = symbol; + this.notation = notation; + this.precedence = precedence; + } + } + + public final UnaryOperatorKind kind; + + public UnaryOperator(PositionInfo pi, List c, UnaryOperatorKind op, Expression child) { + super(pi, c, new ImmutableArray<>(child)); + this.kind = op; + } + + public UnaryOperatorKind getKind() { + return kind; + } + + @Override + public int getArity() { + return 1; + } + + @Override + public int getPrecedence() { + return kind.precedence; + } + + @Override + public int getNotation() { + return PREFIX; + } + + @Override + public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { + return null; + } + + @Override + public void visit(Visitor v) { + v.performActionOnUnaryOperator(this); + } +} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRight.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRight.java deleted file mode 100644 index 06c7125af17..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRight.java +++ /dev/null @@ -1,108 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.*; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Unsigned shift right. - * - */ - -public class UnsignedShiftRight extends Operator { - - /** - * Unsigned shift right. - */ - - public UnsignedShiftRight() {} - - /** - * Unsigned shift right. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - - public UnsignedShiftRight(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public UnsignedShiftRight(ExtList children) { - super(children); - } - - public UnsignedShiftRight(PositionInfo pi, List c, Expression lhs, Expression rhs) { - super(pi, c, lhs, rhs); - } - - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 4; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnUnsignedShiftRight(this); - } - - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - final TypeConverter tc = javaServ.getTypeConverter(); - return tc.getPromotedType(tc.getKeYJavaType((Expression) getChildAt(0), ec)); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRightAssignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRightAssignment.java deleted file mode 100644 index d4faff1fa40..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnsignedShiftRightAssignment.java +++ /dev/null @@ -1,100 +0,0 @@ -/* 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.operator; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Assignment; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -/** - * Unsigned shift right assignment. - * - */ - -public class UnsignedShiftRightAssignment extends Assignment { - - /** - * Unsigned shift right assignment. - */ - - public UnsignedShiftRightAssignment() {} - - /** - * Unsigned shift right assignment. - * - * @param lhs - * an expression. - * @param rhs - * an expression. - */ - - public UnsignedShiftRightAssignment(Expression lhs, Expression rhs) { - super(lhs, rhs); - } - - - /** - * Constructor for the transformation of COMPOST ASTs to KeY. The first occurrence of an - * Expression in the given list is taken as the left hand side of the expression, the second - * occurrence is taken as the right hand side of the expression. - * - * @param children - * the children of this AST element as KeY classes. - */ - public UnsignedShiftRightAssignment(ExtList children) { - super(children); - } - - public UnsignedShiftRightAssignment(PositionInfo pi, List c, Expression target, - Expression expr) { - super(pi, c, target, expr); - } - - /** - * Get arity. - * - * @return the int value. - */ - - public int getArity() { - return 2; - } - - /** - * Get precedence. - * - * @return the int value. - */ - - public int getPrecedence() { - return 13; - } - - /** - * Get notation. - * - * @return the int value. - */ - - public int getNotation() { - return INFIX; - } - - /** - * 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.performActionOnUnsignedShiftRightAssignment(this); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllFields.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllFields.java deleted file mode 100644 index 7ca24d41212..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllFields.java +++ /dev/null @@ -1,52 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class AllFields extends Operator { - public AllFields(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - public AllFields(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnAllFields(this); - } - - public int getArity() { - return 1; - } - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_LOCSET); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllObjects.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllObjects.java deleted file mode 100644 index 3f163597a8d..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/AllObjects.java +++ /dev/null @@ -1,48 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.collection.ImmutableArray; - -public class AllObjects extends Operator { - - public AllObjects(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(child)); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnAllObjects(this); - } - - public int getArity() { - return 1; - } - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_LOCSET); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqConcat.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqConcat.java deleted file mode 100644 index 3cb5428b5d6..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqConcat.java +++ /dev/null @@ -1,47 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -public class SeqConcat extends BinaryOperator { - - public SeqConcat(PositionInfo pi, List c, Expression child, Expression b) { - super(pi, c, Objects.requireNonNull(child), Objects.requireNonNull(b)); - } - - public SeqConcat(Expression seq1, Expression seq2) { - super(seq1, seq2); - } - - public SeqConcat(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return Operator.PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnSeqConcat(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqGet.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqGet.java deleted file mode 100644 index 1162e1bd40f..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqGet.java +++ /dev/null @@ -1,62 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.collection.ImmutableArray; - -/** - * Represents a sequence getter function. - * - * @author bruns - * @since 1.7.2120 - */ -public class SeqGet extends Operator { - - public SeqGet(PositionInfo pi, List c, Expression child, Expression b) { - super(pi, c, - new ImmutableArray<>(Objects.requireNonNull(child), Objects.requireNonNull(b))); - } - - @Override - public int getPrecedence() { - return 0; - } - - @Override - public void visit(Visitor v) { - v.performActionOnSeqGet(this); - } - - - @Override - public int getArity() { - return 1; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_INT); - } - - - @Override - public int getNotation() { - return Operator.PREFIX; - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqIndexOf.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqIndexOf.java deleted file mode 100644 index 477be385b78..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqIndexOf.java +++ /dev/null @@ -1,61 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.collection.ImmutableArray; - -/** - * Represents a function giving the index of some element in a sequence (if it exists). - * - * @author bruns - * - */ -public class SeqIndexOf extends Operator { - - public SeqIndexOf(PositionInfo pi, List c, Expression a, Expression b) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(a), Objects.requireNonNull(b))); - } - - @Override - public int getPrecedence() { - return 0; - } - - @Override - public void visit(Visitor v) { - v.performActionOnSeqIndexOf(this); - } - - - @Override - public int getArity() { - return 2; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getPrimitiveKeYJavaType(PrimitiveType.JAVA_INT); - } - - - @Override - public int getNotation() { - return PREFIX; - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqLength.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqLength.java deleted file mode 100644 index 854499b5f7c..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqLength.java +++ /dev/null @@ -1,69 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -/** - * Represents a function giving the length of a sequence. - * - * @author bruns - * @since 1.7.2120 - * - */ -public class SeqLength extends Operator { - - - public SeqLength(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(child))); - } - - public SeqLength(ExtList changeList) { - super(changeList); - } - - - @Override - public int getPrecedence() { - return 0; - } - - @Override - public void visit(Visitor v) { - v.performActionOnSeqLength(this); - } - - - @Override - public int getArity() { - return 1; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_INT); - } - - - @Override - public int getNotation() { - return PREFIX; - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqPut.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqPut.java deleted file mode 100644 index e34b944e9eb..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqPut.java +++ /dev/null @@ -1,60 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class SeqPut extends Operator { - - public SeqPut(ExtList children) { - super(children); - } - - public SeqPut(PositionInfo pi, List c, Expression seq, Expression pos, Expression v) { - super(pi, c, new ImmutableArray<>(seq, pos, v)); - } - - - @Override - public int getPrecedence() { - return 0; - } - - - @Override - public int getNotation() { - return PREFIX; - } - - - @Override - public void visit(Visitor v) { - v.performActionOnSeqPut(this); - } - - - @Override - public int getArity() { - return 3; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_SEQ); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqReverse.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqReverse.java deleted file mode 100644 index 2ee4104719e..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqReverse.java +++ /dev/null @@ -1,61 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class SeqReverse extends Operator { - - public SeqReverse(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(child))); - } - - public SeqReverse(ExtList changeList) { - super(changeList); - } - - - @Override - public int getPrecedence() { - return 0; - } - - - @Override - public int getNotation() { - return PREFIX; - } - - - @Override - public void visit(Visitor v) { - v.performActionOnSeqReverse(this); - } - - - @Override - public int getArity() { - return 1; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_SEQ); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSingleton.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSingleton.java deleted file mode 100644 index 11228faa3f4..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSingleton.java +++ /dev/null @@ -1,59 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class SeqSingleton extends Operator { - - public SeqSingleton(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(child))); - } - - - public SeqSingleton(Expression child) { - super(child); - } - - public SeqSingleton(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnSeqSingleton(this); - } - - public int getArity() { - return 1; - } - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_SEQ); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSub.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSub.java deleted file mode 100644 index f6d602a64aa..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SeqSub.java +++ /dev/null @@ -1,67 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class SeqSub extends Operator { - - public SeqSub(PositionInfo pi, List c, Expression... child) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(child))); - } - - public SeqSub(ExtList children) { - super(children); - } - - public SeqSub(PositionInfo pi, List c, ImmutableArray arguments) { - super(pi, c, arguments); - } - - - @Override - public int getPrecedence() { - return 0; - } - - - @Override - public int getNotation() { - return PREFIX; - } - - - @Override - public void visit(Visitor v) { - v.performActionOnSeqSub(this); - } - - - @Override - public int getArity() { - return 3; - } - - - @Override - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - // bugfix, this used to return the join for the the first two arguments' - // types. - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_SEQ); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetMinus.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetMinus.java deleted file mode 100644 index 990b5ae6184..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetMinus.java +++ /dev/null @@ -1,41 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -public class SetMinus extends BinaryOperator { - - public SetMinus(PositionInfo pi, List c, Expression child, Expression right) { - super(pi, c, child, right); - } - - public SetMinus(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnSetMinus(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetUnion.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetUnion.java deleted file mode 100644 index aaba1cb676a..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/SetUnion.java +++ /dev/null @@ -1,41 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; - -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; - -public class SetUnion extends BinaryOperator { - public SetUnion(PositionInfo pi, List c, Expression a, Expression b) { - super(pi, c, a, b); - } - - public SetUnion(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return Operator.PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnSetUnion(this); - } - -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/Singleton.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/Singleton.java deleted file mode 100644 index a0a8c4fc37c..00000000000 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/adt/Singleton.java +++ /dev/null @@ -1,53 +0,0 @@ -/* 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.operator.adt; - -import java.util.List; -import java.util.Objects; - -import de.uka.ilkd.key.java.Services; -import de.uka.ilkd.key.java.ast.Comment; -import de.uka.ilkd.key.java.ast.PositionInfo; -import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.Operator; -import de.uka.ilkd.key.java.ast.reference.ExecutionContext; -import de.uka.ilkd.key.java.visitor.Visitor; - -import org.key_project.util.ExtList; -import org.key_project.util.collection.ImmutableArray; - -public class Singleton extends Operator { - public Singleton(PositionInfo pi, List c, Expression child) { - super(pi, c, new ImmutableArray<>(Objects.requireNonNull(child))); - } - - public Singleton(ExtList changeList) { - super(changeList); - } - - - public int getPrecedence() { - return 0; - } - - - public int getNotation() { - return PREFIX; - } - - - public void visit(Visitor v) { - v.performActionOnSingleton(this); - } - - public int getArity() { - return 1; - } - - public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { - return javaServ.getJavaInfo().getKeYJavaType(PrimitiveType.JAVA_LOCSET); - } -} diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java index 5384f8d0b56..9638211ba3f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java @@ -28,8 +28,8 @@ import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; import de.uka.ilkd.key.java.ast.expression.literal.IntLiteral; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.LessThan; -import de.uka.ilkd.key.java.ast.expression.operator.PostIncrement; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator; import de.uka.ilkd.key.java.ast.reference.ArrayReference; import de.uka.ilkd.key.java.ast.reference.FieldReference; import de.uka.ilkd.key.java.ast.reference.MethodReference; @@ -50,6 +50,9 @@ import org.key_project.util.collection.ImmutableList; import org.key_project.util.collection.ImmutableSLList; +import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LessThan; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; + /** * This class creates the <createArray> method for array creation and in * particular its helper method <createArrayHelper>. This class should be @@ -381,8 +384,8 @@ public IProgramMethod getPrepareArrayMethod(TypeRef arrayRef, ProgramVariable le (ProgramVariable) forInit.getVariables().get(0).getProgramVariable(); final For forLoop = new For(new LoopInitializer[] { forInit }, - new LessThan(pv, new FieldReference(length, new ThisReference())), - new Expression[] { new PostIncrement(pv) }, + new BinaryOperator(LessThan, pv, new FieldReference(length, new ThisReference())), + new Expression[] { new UnaryOperator(PostIncrement, pv) }, assign(new ArrayReference(new ThisReference(), new Expression[] { pv }), defaultValue)); final StatementBlock body = new StatementBlock(new Statement[] { forLoop }); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java index a1982db41f7..5e413eb2193 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java @@ -17,13 +17,13 @@ import de.uka.ilkd.key.java.ast.declaration.*; import de.uka.ilkd.key.java.ast.declaration.Modifier.ModifierKind; import de.uka.ilkd.key.java.ast.declaration.TypeDeclaration; -import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; +import de.uka.ilkd.key.java.ast.expression.*; +import de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; -import de.uka.ilkd.key.java.ast.expression.PassiveExpression; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.java.transformations.ConstantExpressionEvaluator; @@ -83,6 +83,8 @@ import static com.github.javaparser.ast.Modifier.DefaultKeyword.*; import static de.uka.ilkd.key.java.ast.declaration.Modifier.createModifierList; +import static de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator.LogicFunction.*; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.Negative; import static java.lang.String.format; /** @@ -228,20 +230,21 @@ public Object visit(AssignExpr n, Void arg) { Expression expr = accept(n.getValue()); var pi = createPositionInfo(n); var c = createComments(n); - return switch (n.getOperator()) { - case ASSIGN -> new CopyAssignment(pi, c, target, expr); - case PLUS -> new PlusAssignment(pi, c, target, expr); - case MINUS -> new MinusAssignment(pi, c, target, expr); - case MULTIPLY -> new TimesAssignment(pi, c, target, expr); - case DIVIDE -> new DivideAssignment(pi, c, target, expr); - case BINARY_AND -> new BinaryAndAssignment(pi, c, target, expr); - case BINARY_OR -> new BinaryOrAssignment(pi, c, target, expr); - case XOR -> new BinaryXOrAssignment(pi, c, target, expr); - case REMAINDER -> new ModuloAssignment(pi, c, target, expr); - case LEFT_SHIFT -> new ShiftLeftAssignment(pi, c, target, expr); - case SIGNED_RIGHT_SHIFT -> new ShiftRightAssignment(pi, c, target, expr); - case UNSIGNED_RIGHT_SHIFT -> new UnsignedShiftRightAssignment(pi, c, target, expr); + var op = switch (n.getOperator()) { + case ASSIGN -> AssignmentKind.Copy; + case PLUS -> AssignmentKind.Plus; + case MINUS -> AssignmentKind.Minus; + case MULTIPLY -> AssignmentKind.Times; + case DIVIDE -> AssignmentKind.Divide; + case BINARY_AND -> AssignmentKind.BinaryAnd; + case BINARY_OR -> AssignmentKind.BinaryOr; + case XOR -> AssignmentKind.BinaryXOr; + case REMAINDER -> AssignmentKind.Modulo; + case LEFT_SHIFT -> AssignmentKind.ShiftLeft; + case SIGNED_RIGHT_SHIFT -> AssignmentKind.ShiftRight; + case UNSIGNED_RIGHT_SHIFT -> AssignmentKind.UnsignedShiftRight; }; + return new Assignment(pi, c, op, target, expr); } @Override @@ -250,27 +253,28 @@ public Object visit(BinaryExpr n, Void arg) { var rhs = (Expression) n.getRight().accept(this, arg); var pi = createPositionInfo(n); var c = createComments(n); - return switch (n.getOperator()) { - case OR -> new LogicalOr(pi, c, lhs, rhs); - case AND -> new LogicalAnd(pi, c, lhs, rhs); - case BINARY_OR -> new BinaryOr(pi, c, lhs, rhs); - case BINARY_AND -> new BinaryAnd(pi, c, lhs, rhs); - case XOR -> new BinaryXOr(pi, c, lhs, rhs); - case EQUALS -> new Equals(pi, c, lhs, rhs); - case NOT_EQUALS -> new NotEquals(pi, c, lhs, rhs); - case LESS -> new LessThan(pi, c, lhs, rhs); - case GREATER -> new GreaterThan(pi, c, lhs, rhs); - case LESS_EQUALS -> new LessOrEquals(pi, c, lhs, rhs); - case GREATER_EQUALS -> new GreaterOrEquals(pi, c, lhs, rhs); - case LEFT_SHIFT -> new ShiftLeft(pi, c, lhs, rhs); - case SIGNED_RIGHT_SHIFT -> new ShiftRight(pi, c, lhs, rhs); - case UNSIGNED_RIGHT_SHIFT -> new UnsignedShiftRight(pi, c, lhs, rhs); - case PLUS -> new Plus(pi, c, lhs, rhs); - case MINUS -> new Minus(pi, c, lhs, rhs); - case MULTIPLY -> new Times(pi, c, lhs, rhs); - case DIVIDE -> new Divide(pi, c, lhs, rhs); - case REMAINDER -> new Modulo(pi, c, lhs, rhs); + var op = switch (n.getOperator()) { + case OR -> BinaryOperatorKind.LogicalOr; + case AND -> BinaryOperatorKind.LogicalAnd; + case BINARY_OR -> BinaryOperatorKind.BinaryOr; + case BINARY_AND -> BinaryOperatorKind.BinaryAnd; + case XOR -> BinaryOperatorKind.BinaryXOr; + case EQUALS -> BinaryOperatorKind.Equals; + case NOT_EQUALS -> BinaryOperatorKind.NotEquals; + case LESS -> BinaryOperatorKind.LessThan; + case GREATER -> BinaryOperatorKind.GreaterThan; + case LESS_EQUALS -> BinaryOperatorKind.LessOrEquals; + case GREATER_EQUALS -> BinaryOperatorKind.GreaterOrEquals; + case LEFT_SHIFT -> BinaryOperatorKind.ShiftLeft; + case SIGNED_RIGHT_SHIFT -> BinaryOperatorKind.ShiftRight; + case UNSIGNED_RIGHT_SHIFT -> BinaryOperatorKind.UnsignedShiftRight; + case PLUS -> BinaryOperatorKind.Plus; + case MINUS -> BinaryOperatorKind.Minus; + case MULTIPLY -> BinaryOperatorKind.Times; + case DIVIDE -> BinaryOperatorKind.Divide; + case REMAINDER -> BinaryOperatorKind.Modulo; }; + return new BinaryOperator(pi, c, op, lhs, rhs); } @Override @@ -613,6 +617,7 @@ public Object visit(ExplicitConstructorInvocationStmt n, Void arg) { @Override public Object visit(ExpressionStmt n, Void arg) { + return accept(n.getExpression()); } @@ -648,7 +653,7 @@ public Object visit(FieldAccessExpr n, Void arg) { && rlt.getKeYJavaType().getSort() == services.getTypeConverter().getSeqLDT() .targetSort()) { var child = (Expression) n.scope().accept(this, null); - return new SeqLength(pi, c, child); + return new LogicFunctionalOperator(pi, c, SeqLength, child); } } try { @@ -1340,19 +1345,21 @@ public Object visit(UnaryExpr n, Void arg) { } return new IntLiteral(pi, c, -num.intValue()); } - return new Negative(pi, c, accept(expr)); + return new UnaryOperator(pi, c, Negative, accept(expr)); } + Expression child = accept(n.getExpression()); - return switch (n.getOperator()) { - case PLUS -> new Positive(pi, c, child); - case MINUS -> throw new IllegalStateException(); - case PREFIX_INCREMENT -> new PreIncrement(pi, c, child); - case PREFIX_DECREMENT -> new PreDecrement(pi, c, child); - case LOGICAL_COMPLEMENT -> new LogicalNot(pi, c, child); - case BITWISE_COMPLEMENT -> new BinaryNot(pi, c, child); - case POSTFIX_INCREMENT -> new PostIncrement(pi, c, child); - case POSTFIX_DECREMENT -> new PostDecrement(pi, c, child); + var op = switch (n.getOperator()) { + case PLUS -> UnaryOperatorKind.Positive; + case MINUS -> UnaryOperatorKind.Negative; + case PREFIX_INCREMENT -> UnaryOperatorKind.PreIncrement; + case PREFIX_DECREMENT -> UnaryOperatorKind.PreDecrement; + case LOGICAL_COMPLEMENT -> UnaryOperatorKind.LogicalNot; + case BITWISE_COMPLEMENT -> UnaryOperatorKind.BinaryNot; + case POSTFIX_INCREMENT -> UnaryOperatorKind.PostIncrement; + case POSTFIX_DECREMENT -> UnaryOperatorKind.PostDecrement; }; + return new UnaryOperator(pi, c, op, child); } @Override @@ -1728,34 +1735,36 @@ public Object handleSpecialFunctionInvocation(Node n, String name, ImmutableArray args = map(arguments); - return switch (name) { - case "\\all_objects" -> new AllObjects(pi, c, args.get(0)); - case "\\all_fields" -> new AllFields(pi, c, args.get(0)); - case "\\intersect" -> new Intersect(pi, c, args.get(0), args.get(1)); - case "\\set_union" -> new SetUnion(pi, c, args.get(0), args.get(1)); - case "\\singleton" -> new Singleton(pi, c, args.get(0)); - case "\\set_minus" -> new SetMinus(pi, c, args.get(0), args.get(1)); - case "\\seq_sub" -> new SeqSub(pi, c, args.get(0), args.get(1), args.get(2)); - case "\\seq_reverse" -> new SeqReverse(pi, c, args.get(0)); - case "\\seq_singleton" -> new SeqSingleton(pi, c, args.get(0)); - case "\\seq_length" -> new SeqLength(pi, c, args.get(0)); - case "\\indexOf" -> new SeqIndexOf(pi, c, args.get(0), args.get(1)); - case "\\seq_concat" -> new SeqConcat(pi, c, args.get(0), args.get(1)); - case "\\seq_get" -> new SeqGet(pi, c, args.get(0), args.get(1)); - case "\\seq_upd" -> new SeqPut(pi, c, args.get(0), args.get(1), args.get(2)); - default -> { - Function named = - services.getNamespaces().functions() - .lookup(new org.key_project.logic.Name(name)); - if (named == null) { - - yield reportError(n, format( - "In an embedded DL expression, %s is not a known DL function name.", name)); - } - yield new DLEmbeddedExpression(pi, c, (JFunction) named, new ImmutableArray<>()); - - } + var fn = switch (name) { + case "\\all_objects" -> AllObjects; + case "\\all_fields" -> AllFields; + case "\\intersect" -> Intersect; + case "\\set_union" -> SetUnion; + case "\\singleton" -> Singleton; + case "\\set_minus" -> SetMinus; + case "\\seq_sub" -> SeqSub; + case "\\seq_reverse" -> SeqReverse; + case "\\seq_singleton" -> SeqSingleton; + case "\\seq_length" -> SeqLength; + case "\\indexOf" -> SeqIndexOf; + case "\\seq_concat" -> SeqConcat; + case "\\seq_get" -> SeqGet; + case "\\seq_upd" -> SeqPut; + default -> null; }; + + if (fn != null) { + return new LogicFunctionalOperator(pi, c, fn, args); + } + + Function named = + services.getNamespaces().functions() + .lookup(new org.key_project.logic.Name(name)); + if (named == null) { + return reportError(n, format( + "In an embedded DL expression, %s is not a known DL function name.", name)); + } + return new DLEmbeddedExpression(pi, c, (JFunction) named, new ImmutableArray<>()); } private ImmutableArray map( diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/CreatingASTVisitor.java b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/CreatingASTVisitor.java index e79746808de..f2e5175cc17 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/CreatingASTVisitor.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/CreatingASTVisitor.java @@ -12,12 +12,8 @@ import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; -import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; -import de.uka.ilkd.key.java.ast.expression.PassiveExpression; +import de.uka.ilkd.key.java.ast.expression.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.op.IProgramVariable; @@ -598,17 +594,6 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnCopyAssignment(CopyAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new CopyAssignment(changeList); - } - }; - def.doAction(x); - } - @Override public void performActionOnSetStatement(SetStatement x) { DefaultAction def = new DefaultAction(x) { @@ -622,83 +607,6 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnPreIncrement(PreIncrement x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new PreIncrement(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPostIncrement(PostIncrement x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new PostIncrement(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPlus(Plus x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Plus(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnTimes(Times x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Times(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnMinus(Minus x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Minus(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnEquals(Equals x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Equals(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnNotEquals(NotEquals x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new NotEquals(changeList); - } - }; - def.doAction(x); - } - @Override public void performActionOnReturn(Return x) { DefaultAction def = new DefaultAction(x) { @@ -710,17 +618,6 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnLessThan(LessThan x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new LessThan(changeList); - } - }; - def.doAction(x); - } - @Override public void performActionOnParenthesizedExpression(ParenthesizedExpression x) { DefaultAction def = new DefaultAction(x) { @@ -754,192 +651,7 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnGreaterThan(GreaterThan x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new GreaterThan(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryAnd(BinaryAnd x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryAnd(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryOr(BinaryOr x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryOr(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryXOr(BinaryXOr x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryXOr(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryNot(BinaryNot x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryNot(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryAndAssignment(BinaryAndAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryAndAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryOrAssignment(BinaryOrAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryOrAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnBinaryXOrAssignment(BinaryXOrAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new BinaryXOrAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnDivideAssignment(DivideAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new DivideAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnMinusAssignment(MinusAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new MinusAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnModuloAssignment(ModuloAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new ModuloAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPlusAssignment(PlusAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new PlusAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPostDecrement(PostDecrement x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new PostDecrement(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPreDecrement(PreDecrement x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new PreDecrement(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnShiftLeftAssignment(ShiftLeftAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new ShiftLeftAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnShiftRightAssignment(ShiftRightAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new ShiftRightAssignment(changeList); - } - }; - def.doAction(x); - } - @Override - public void performActionOnTimesAssignment(TimesAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new TimesAssignment(changeList); - } - }; - def.doAction(x); - } @Override public void performActionOnConditional(Conditional x) { @@ -952,27 +664,6 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnUnsignedShiftRightAssignment(UnsignedShiftRightAssignment x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new UnsignedShiftRightAssignment(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnDivide(Divide x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Divide(changeList); - } - }; - def.doAction(x); - } @Override public void performActionOnNewArray(NewArray x) { @@ -1012,104 +703,6 @@ ProgramElement createNewElement(ExtList children) { def.doAction(x); } - @Override - public void performActionOnLogicalNot(LogicalNot x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new LogicalNot(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnLogicalAnd(LogicalAnd x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new LogicalAnd(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnLogicalOr(LogicalOr x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new LogicalOr(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnModulo(Modulo x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Modulo(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnNegative(Negative x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Negative(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnPositive(Positive x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Positive(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnShiftLeft(ShiftLeft x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new ShiftLeft(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnShiftRight(ShiftRight x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new ShiftRight(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnUnsignedShiftRight(UnsignedShiftRight x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new UnsignedShiftRight(changeList); - } - }; - def.doAction(x); - } // ppp @Override @@ -1280,28 +873,6 @@ ProgramElement createNewElement(ExtList changeList) { def.doAction(x); } - @Override - public void performActionOnLessOrEquals(LessOrEquals x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new LessOrEquals(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnGreaterOrEquals(GreaterOrEquals x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new GreaterOrEquals(changeList); - } - }; - def.doAction(x); - } - @Override public void performActionOnLocalVariableDeclaration(LocalVariableDeclaration x) { DefaultAction def = new DefaultAction(x) { @@ -1381,135 +952,34 @@ ProgramElement createNewElement(ExtList changeList) { } @Override - public void performActionOnSingleton(Singleton x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Singleton(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnSetUnion(SetUnion x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SetUnion(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnIntersect(Intersect x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new Intersect(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnSetMinus(SetMinus x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SetMinus(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnAllFields(AllFields x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new AllFields(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnSeqSingleton(SeqSingleton x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SeqSingleton(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnSeqConcat(SeqConcat x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SeqConcat(changeList); - } - }; - def.doAction(x); - } - - @Override - public void performActionOnSeqReverse(SeqReverse x) { + public void performActionOnDLEmbeddedExpression(final DLEmbeddedExpression x) { DefaultAction def = new DefaultAction(x) { @Override ProgramElement createNewElement(ExtList changeList) { - return new SeqReverse(changeList); + return new DLEmbeddedExpression(x.getFunctionSymbol(), changeList); } }; def.doAction(x); } @Override - public void performActionOnSeqPut(SeqPut x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SeqPut(changeList); - } - }; - def.doAction(x); + public void performActionOnBinaryOperator(BinaryOperator x) { + super.performActionOnBinaryOperator(x); } @Override - public void performActionOnDLEmbeddedExpression(final DLEmbeddedExpression x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new DLEmbeddedExpression(x.getFunctionSymbol(), changeList); - } - }; - def.doAction(x); + public void performActionOnUnaryOperator(UnaryOperator x) { + super.performActionOnUnaryOperator(x); } @Override - public void performActionOnSeqSub(SeqSub x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SeqSub(changeList); - } - }; - def.doAction(x); + public void performActionOnLogicFunctionalOperator(LogicFunctionalOperator x) { + super.performActionOnLogicFunctionalOperator(x); } @Override - public void performActionOnSeqLength(SeqLength x) { - DefaultAction def = new DefaultAction(x) { - @Override - ProgramElement createNewElement(ExtList changeList) { - return new SeqLength(changeList); - } - }; - def.doAction(x); + public void performActionOnAssignment(Assignment x) { + super.performActionOnAssignment(x); } @Override diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/InnerBreakAndContinueReplacer.java b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/InnerBreakAndContinueReplacer.java index 05af09c5628..5428ad70269 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/InnerBreakAndContinueReplacer.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/InnerBreakAndContinueReplacer.java @@ -8,8 +8,8 @@ import de.uka.ilkd.key.java.*; import de.uka.ilkd.key.java.ast.*; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.IExecutionContext; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.op.IProgramVariable; @@ -320,11 +320,11 @@ ProgramElement createNewElement(final ExtList changeList) { } @Override - public void performActionOnCopyAssignment(final CopyAssignment x) { + public void performActionOnAssignment(final Assignment x) { DefaultAction def = new DefaultAction() { @Override ProgramElement createNewElement(final ExtList changeList) { - return new CopyAssignment(changeList); + return new Assignment(changeList); } }; def.doAction(x); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/JavaASTVisitor.java b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/JavaASTVisitor.java index fb6a24e4824..aa10c19d2cf 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/JavaASTVisitor.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/JavaASTVisitor.java @@ -3,26 +3,20 @@ * SPDX-License-Identifier: GPL-2.0-only */ package de.uka.ilkd.key.java.visitor; -import de.uka.ilkd.key.java.*; +import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.*; import de.uka.ilkd.key.java.ast.ccatch.*; import de.uka.ilkd.key.java.ast.declaration.*; import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; import de.uka.ilkd.key.java.ast.expression.PassiveExpression; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.Subtype; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.ProgramElementName; -import de.uka.ilkd.key.logic.op.IProgramMethod; -import de.uka.ilkd.key.logic.op.IProgramVariable; -import de.uka.ilkd.key.logic.op.LocationVariable; -import de.uka.ilkd.key.logic.op.ProgramConstant; -import de.uka.ilkd.key.logic.op.ProgramSV; -import de.uka.ilkd.key.logic.op.ProgramVariable; +import de.uka.ilkd.key.logic.op.*; import de.uka.ilkd.key.rule.AbstractProgramElement; import de.uka.ilkd.key.rule.metaconstruct.ProgramTransformer; import de.uka.ilkd.key.speclang.BlockContract; @@ -46,10 +40,8 @@ public abstract class JavaASTVisitor extends JavaASTWalker implements Visitor { /** * create the JavaASTVisitor * - * @param root - * the ProgramElement where to begin - * @param services - * the Services object + * @param root the ProgramElement where to begin + * @param services the Services object */ protected JavaASTVisitor(ProgramElement root, Services services) { super(root); @@ -97,8 +89,7 @@ protected void doAction(ProgramElement node) { /** * the action that is performed just before leaving the node the last time * - * @param node - * the node described above + * @param node the node described above */ protected abstract void doDefaultAction(SourceElement node); @@ -132,41 +123,6 @@ public void performActionOnAssert(Assert x) { doDefaultAction(x); } - @Override - public void performActionOnBinaryAnd(BinaryAnd x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryAndAssignment(BinaryAndAssignment x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryNot(BinaryNot x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryOr(BinaryOr x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryOrAssignment(BinaryOrAssignment x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryXOr(BinaryXOr x) { - doDefaultAction(x); - } - - @Override - public void performActionOnBinaryXOrAssignment(BinaryXOrAssignment x) { - doDefaultAction(x); - } - @Override public void performActionOnBooleanLiteral(BooleanLiteral x) { doDefaultAction(x); @@ -177,65 +133,12 @@ public void performActionOnEmptySetLiteral(EmptySetLiteral x) { doDefaultAction(x); } - @Override - public void performActionOnSingleton(Singleton x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSetUnion(SetUnion x) { - doDefaultAction(x); - } - - @Override - public void performActionOnIntersect(Intersect x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSetMinus(SetMinus x) { - doDefaultAction(x); - } - - @Override - public void performActionOnAllFields(AllFields x) { - doDefaultAction(x); - } - - @Override - public void performActionOnAllObjects(AllObjects x) { - doDefaultAction(x); - } @Override public void performActionOnEmptySeqLiteral(EmptySeqLiteral x) { doDefaultAction(x); } - @Override - public void performActionOnSeqSingleton(SeqSingleton x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqConcat(SeqConcat x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqSub(SeqSub x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqReverse(SeqReverse x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqPut(SeqPut x) { - doDefaultAction(x); - } @Override public void performActionOnDLEmbeddedExpression(DLEmbeddedExpression x) { @@ -243,21 +146,6 @@ public void performActionOnDLEmbeddedExpression(DLEmbeddedExpression x) { } - @Override - public void performActionOnSeqIndexOf(SeqIndexOf x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqGet(SeqGet x) { - doDefaultAction(x); - } - - @Override - public void performActionOnSeqLength(SeqLength x) { - doDefaultAction(x); - } - @Override public void performActionOnBreak(Break x) { doDefaultAction(x); @@ -323,11 +211,6 @@ public void performActionOnContinue(Continue x) { doDefaultAction(x); } - @Override - public void performActionOnCopyAssignment(CopyAssignment x) { - doDefaultAction(x); - } - @Override public void performActionOnSetStatement(SetStatement x) { doDefaultAction(x); @@ -338,15 +221,6 @@ public void performActionOnDefault(Default x) { doDefaultAction(x); } - @Override - public void performActionOnDivide(Divide x) { - doDefaultAction(x); - } - - @Override - public void performActionOnDivideAssignment(DivideAssignment x) { - doDefaultAction(x); - } @Override public void performActionOnDo(Do x) { @@ -368,10 +242,6 @@ public void performActionOnEmptyStatement(EmptyStatement x) { doDefaultAction(x); } - @Override - public void performActionOnEquals(Equals x) { - doDefaultAction(x); - } @Override public void performActionOnExactInstanceof(ExactInstanceof x) { @@ -428,16 +298,6 @@ public void performActionOnForUpdates(ForUpdates x) { doDefaultAction(x); } - @Override - public void performActionOnGreaterOrEquals(GreaterOrEquals x) { - doDefaultAction(x); - } - - @Override - public void performActionOnGreaterThan(GreaterThan x) { - doDefaultAction(x); - } - @Override public void performActionOnGuard(Guard x) { doDefaultAction(x); @@ -478,16 +338,6 @@ public void performActionOnLabeledStatement(LabeledStatement x) { doDefaultAction(x); } - @Override - public void performActionOnLessOrEquals(LessOrEquals x) { - doDefaultAction(x); - } - - @Override - public void performActionOnLessThan(LessThan x) { - doDefaultAction(x); - } - @Override public void performActionOnLocalVariableDeclaration(LocalVariableDeclaration x) { doDefaultAction(x); @@ -501,21 +351,6 @@ public void performActionOnLocationVariable(LocationVariable x) { performActionOnProgramVariable(x); } - @Override - public void performActionOnLogicalAnd(LogicalAnd x) { - doDefaultAction(x); - } - - @Override - public void performActionOnLogicalNot(LogicalNot x) { - doDefaultAction(x); - } - - @Override - public void performActionOnLogicalOr(LogicalOr x) { - doDefaultAction(x); - } - @Override public void performActionOnLongLiteral(LongLiteral x) { doDefaultAction(x); @@ -531,11 +366,6 @@ public void performActionOnMetaClassReference(MetaClassReference x) { doDefaultAction(x); } - @Override - public void performActionOnMethod(IProgramMethod x) { - doDefaultAction(x); - } - @Override public void performActionOnMethodBodyStatement(MethodBodyStatement x) { doDefaultAction(x); @@ -556,35 +386,12 @@ public void performActionOnMethodReference(MethodReference x) { doDefaultAction(x); } - @Override - public void performActionOnMinus(Minus x) { - doDefaultAction(x); - } - - @Override - public void performActionOnMinusAssignment(MinusAssignment x) { - doDefaultAction(x); - } @Override public void performActionOnModifier(Modifier x) { doDefaultAction(x); } - @Override - public void performActionOnModulo(Modulo x) { - doDefaultAction(x); - } - - @Override - public void performActionOnModuloAssignment(ModuloAssignment x) { - doDefaultAction(x); - } - - @Override - public void performActionOnNegative(Negative x) { - doDefaultAction(x); - } @Override public void performActionOnNew(New x) { @@ -596,10 +403,6 @@ public void performActionOnNewArray(NewArray x) { doDefaultAction(x); } - @Override - public void performActionOnNotEquals(NotEquals x) { - doDefaultAction(x); - } @Override public void performActionOnNullLiteral(NullLiteral x) { @@ -631,40 +434,6 @@ public void performActionOnPassiveExpression(PassiveExpression x) { doDefaultAction(x); } - @Override - public void performActionOnPlus(Plus x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPlusAssignment(PlusAssignment x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPositive(Positive x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPostDecrement(PostDecrement x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPostIncrement(PostIncrement x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPreDecrement(PreDecrement x) { - doDefaultAction(x); - } - - @Override - public void performActionOnPreIncrement(PreIncrement x) { - doDefaultAction(x); - } @Override public void performActionOnProgramConstant(ProgramConstant x) { @@ -694,10 +463,6 @@ public void performActionOnProgramVariable(ProgramVariable x) { doDefaultAction(x); } - @Override - public void performActionOnIProgramVariable(IProgramVariable x) { - doDefaultAction(x); - } @Override public void performActionOnReturn(Return x) { @@ -714,25 +479,6 @@ public void performActionOnSchemaVariable(SchemaVariable x) { doDefaultAction((ProgramSV) x); } - @Override - public void performActionOnShiftLeft(ShiftLeft x) { - doDefaultAction(x); - } - - @Override - public void performActionOnShiftLeftAssignment(ShiftLeftAssignment x) { - doDefaultAction(x); - } - - @Override - public void performActionOnShiftRight(ShiftRight x) { - doDefaultAction(x); - } - - @Override - public void performActionOnShiftRightAssignment(ShiftRightAssignment x) { - doDefaultAction(x); - } @Override public void performActionOnStatementBlock(StatementBlock x) { @@ -744,11 +490,6 @@ public void performActionOnStringLiteral(StringLiteral x) { doDefaultAction(x); } - @Override - public void performActionOnSubtype(Subtype x) { - doDefaultAction(x); - } - @Override public void performActionOnSuperArrayDeclaration(SuperArrayDeclaration x) { doDefaultAction(x); @@ -804,16 +545,6 @@ public void performActionOnThrows(Throws x) { doDefaultAction(x); } - @Override - public void performActionOnTimes(Times x) { - doDefaultAction(x); - } - - @Override - public void performActionOnTimesAssignment(TimesAssignment x) { - doDefaultAction(x); - } - @Override public void performActionOnTry(Try x) { doDefaultAction(x); @@ -829,16 +560,6 @@ public void performActionOnTypeReference(TypeReference x) { doDefaultAction(x); } - @Override - public void performActionOnUnsignedShiftRight(UnsignedShiftRight x) { - doDefaultAction(x); - } - - @Override - public void performActionOnUnsignedShiftRightAssignment(UnsignedShiftRightAssignment x) { - doDefaultAction(x); - } - @Override public void performActionOnVariableDeclaration(VariableDeclaration x) { doDefaultAction(x); @@ -973,4 +694,28 @@ public void performActionOnCcatchContinueWildcardParameterDeclaration( public void performActionOnJmlAssert(JmlAssert x) { doDefaultAction(x); } + + @Override + public void performActionOnAssignment(Assignment x) { + doDefaultAction(x); + + } + + @Override + public void performActionOnBinaryOperator(BinaryOperator x) { + doDefaultAction(x); + + } + + @Override + public void performActionOnLogicFunctionalOperator(LogicFunctionalOperator x) { + doDefaultAction(x); + + } + + @Override + public void performActionOnUnaryOperator(UnaryOperator x) { + doDefaultAction(x); + + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/OuterBreakContinueAndReturnReplacer.java b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/OuterBreakContinueAndReturnReplacer.java index 1890954ca7a..0f78e3dd9bb 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/OuterBreakContinueAndReturnReplacer.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/OuterBreakContinueAndReturnReplacer.java @@ -11,9 +11,9 @@ import de.uka.ilkd.key.java.*; import de.uka.ilkd.key.java.ast.*; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.IExecutionContext; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.ProgramElementName; @@ -334,11 +334,11 @@ ProgramElement createNewElement(final ExtList changeList) { } @Override - public void performActionOnCopyAssignment(final CopyAssignment x) { + public void performActionOnAssignment(final Assignment x) { DefaultAction def = new DefaultAction() { @Override ProgramElement createNewElement(final ExtList changeList) { - return new CopyAssignment(changeList); + return new Assignment(changeList); } }; def.doAction(x); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/Visitor.java b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/Visitor.java index e5299c49298..2e42490ccfc 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/visitor/Visitor.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/visitor/Visitor.java @@ -7,17 +7,15 @@ import de.uka.ilkd.key.java.ast.ccatch.*; import de.uka.ilkd.key.java.ast.declaration.*; import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.ParenthesizedExpression; import de.uka.ilkd.key.java.ast.expression.PassiveExpression; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.Subtype; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.ProgramElementName; import de.uka.ilkd.key.logic.op.IProgramMethod; -import de.uka.ilkd.key.logic.op.IProgramVariable; import de.uka.ilkd.key.logic.op.LocationVariable; import de.uka.ilkd.key.logic.op.ProgramConstant; import de.uka.ilkd.key.logic.op.ProgramVariable; @@ -42,8 +40,6 @@ public interface Visitor { void performActionOnProgramVariable(ProgramVariable x); - void performActionOnIProgramVariable(IProgramVariable x); - void performActionOnSchemaVariable(SchemaVariable x); void performActionOnProgramMethod(IProgramMethod x); @@ -58,32 +54,8 @@ public interface Visitor { void performActionOnEmptySetLiteral(EmptySetLiteral x); - void performActionOnSingleton(Singleton x); - - void performActionOnSetUnion(SetUnion x); - - void performActionOnIntersect(Intersect x); - - void performActionOnSetMinus(SetMinus x); - - void performActionOnAllFields(AllFields x); - - void performActionOnAllObjects(AllObjects allObjects); - void performActionOnEmptySeqLiteral(EmptySeqLiteral x); - void performActionOnSeqSingleton(SeqSingleton x); - - void performActionOnSeqConcat(SeqConcat x); - - void performActionOnSeqIndexOf(SeqIndexOf x); - - void performActionOnSeqSub(SeqSub x); - - void performActionOnSeqReverse(SeqReverse x); - - void performActionOnSeqPut(SeqPut seqPut); - void performActionOnDLEmbeddedExpression(DLEmbeddedExpression x); void performActionOnStringLiteral(StringLiteral x); @@ -176,64 +148,10 @@ public interface Visitor { void performActionOnFieldSpecification(FieldSpecification x); - void performActionOnBinaryAnd(BinaryAnd x); - - void performActionOnBinaryAndAssignment(BinaryAndAssignment x); - - void performActionOnBinaryOrAssignment(BinaryOrAssignment x); - - void performActionOnBinaryXOrAssignment(BinaryXOrAssignment x); - - void performActionOnCopyAssignment(CopyAssignment x); - void performActionOnSetStatement(SetStatement x); - void performActionOnDivideAssignment(DivideAssignment x); - - void performActionOnMinusAssignment(MinusAssignment x); - - void performActionOnModuloAssignment(ModuloAssignment x); - - void performActionOnPlusAssignment(PlusAssignment x); - - void performActionOnPostDecrement(PostDecrement x); - - void performActionOnPostIncrement(PostIncrement x); - - void performActionOnPreDecrement(PreDecrement x); - - void performActionOnPreIncrement(PreIncrement x); - - void performActionOnShiftLeftAssignment(ShiftLeftAssignment x); - - void performActionOnShiftRightAssignment(ShiftRightAssignment x); - - void performActionOnTimesAssignment(TimesAssignment x); - - void performActionOnUnsignedShiftRightAssignment(UnsignedShiftRightAssignment x); - - void performActionOnBinaryNot(BinaryNot x); - - void performActionOnBinaryOr(BinaryOr x); - - void performActionOnBinaryXOr(BinaryXOr x); - void performActionOnConditional(Conditional x); - void performActionOnDivide(Divide x); - - void performActionOnEquals(Equals x); - - void performActionOnGreaterOrEquals(GreaterOrEquals x); - - void performActionOnGreaterThan(GreaterThan x); - - void performActionOnLessOrEquals(LessOrEquals x); - - void performActionOnLessThan(LessThan x); - - void performActionOnNotEquals(NotEquals x); - void performActionOnNewArray(NewArray x); void performActionOnInstanceof(Instanceof x); @@ -244,30 +162,6 @@ public interface Visitor { void performActionOnTypeCast(TypeCast x); - void performActionOnLogicalAnd(LogicalAnd x); - - void performActionOnLogicalNot(LogicalNot x); - - void performActionOnLogicalOr(LogicalOr x); - - void performActionOnMinus(Minus x); - - void performActionOnModulo(Modulo x); - - void performActionOnNegative(Negative x); - - void performActionOnPlus(Plus x); - - void performActionOnPositive(Positive x); - - void performActionOnShiftLeft(ShiftLeft x); - - void performActionOnShiftRight(ShiftRight x); - - void performActionOnTimes(Times x); - - void performActionOnUnsignedShiftRight(UnsignedShiftRight x); - void performActionOnArrayReference(ArrayReference x); void performActionOnMetaClassReference(MetaClassReference x); @@ -282,8 +176,6 @@ public interface Visitor { void performActionOnVariableReference(VariableReference x); - void performActionOnMethod(IProgramMethod x); - void performActionOnSuperConstructorReference(SuperConstructorReference x); void performActionOnExecutionContext(ExecutionContext x); @@ -370,10 +262,6 @@ public interface Visitor { void performActionOnMergeContract(MergeContract x); - void performActionOnSeqLength(SeqLength seqLength); - - void performActionOnSeqGet(SeqGet seqGet); - void performActionOnTransactionStatement(TransactionStatement transSt); void performActionOnEmptyMapLiteral(EmptyMapLiteral aThis); @@ -414,5 +302,11 @@ void performActionOnCcatchBreakWildcardParameterDeclaration( */ void performActionOnJmlAssert(JmlAssert jmlAssert); - void performActionOnSubtype(Subtype subtype); + void performActionOnBinaryOperator(BinaryOperator op); + + void performActionOnUnaryOperator(UnaryOperator op); + + void performActionOnLogicFunctionalOperator(LogicFunctionalOperator op); + + void performActionOnAssignment(Assignment assignment); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java index 521e1d9ea82..176af4295a8 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.DoubleLiteral; import de.uka.ilkd.key.java.ast.expression.literal.Literal; -import de.uka.ilkd.key.java.ast.expression.operator.Negative; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermServices; @@ -142,7 +142,8 @@ public boolean isResponsible(Operator op, JTerm left, JTerm right, public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { if (sub != null && sub.sort().extendsTrans(targetSort())) { - return op instanceof Negative; + return op instanceof UnaryOperator uo + && uo.getKind() == UnaryOperator.UnaryOperatorKind.Negative; } return false; } @@ -187,7 +188,8 @@ public JTerm translateLiteral(Literal lit, Services services) { public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { - if (op instanceof Negative) { + if (op instanceof UnaryOperator u + && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative) { return getJavaUnaryMinus(); } else { return null; diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java index 55004c271ff..0ac6ad9d1e6 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java @@ -9,7 +9,8 @@ import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.FloatLiteral; import de.uka.ilkd.key.java.ast.expression.literal.Literal; -import de.uka.ilkd.key.java.ast.expression.operator.*; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermServices; @@ -118,7 +119,10 @@ public boolean isResponsible(Operator op, JTerm left, JTerm right, @Override public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { - return sub != null && sub.sort().extendsTrans(targetSort()) && op instanceof Negative; + return sub != null && sub.sort().extendsTrans(targetSort()) && + op instanceof UnaryOperator u + && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative; + } @Override @@ -133,17 +137,25 @@ public JTerm translateLiteral(Literal lit, Services services) { public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { - return switch (op) { - case GreaterThan ignored -> getGreaterThan(); - case LessThan ignored -> getLessThan(); - case GreaterOrEquals ignored -> getGreaterOrEquals(); - case LessOrEquals ignored -> getLessOrEquals(); - case Negative ignored -> getJavaUnaryMinus(); - case Plus ignored -> getJavaAdd(); - case Minus ignored -> getJavaSub(); - case Times ignored -> getJavaMul(); - case Divide ignored -> getJavaDiv(); - case Modulo ignored -> getJavaMod(); + if ((op instanceof UnaryOperator u) + && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative) { + return getJavaUnaryMinus(); + } + + if (!(op instanceof BinaryOperator b)) { + return null; + } + + return switch (b.getKind()) { + case GreaterThan -> getGreaterThan(); + case LessThan -> getLessThan(); + case GreaterOrEquals -> getGreaterOrEquals(); + case LessOrEquals -> getLessOrEquals(); + case Plus -> getJavaAdd(); + case Minus -> getJavaSub(); + case Times -> getJavaMul(); + case Divide -> getJavaDiv(); + case Modulo -> getJavaMod(); default -> null; }; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/LocSetLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/LocSetLDT.java index 836e85567aa..f64fb0046c5 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/LocSetLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/LocSetLDT.java @@ -4,16 +4,13 @@ package de.uka.ilkd.key.ldt; import de.uka.ilkd.key.java.Services; +import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; import de.uka.ilkd.key.java.ast.abstraction.Type; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.EmptySetLiteral; import de.uka.ilkd.key.java.ast.expression.literal.Literal; -import de.uka.ilkd.key.java.ast.expression.operator.Intersect; -import de.uka.ilkd.key.java.ast.expression.operator.adt.AllFields; -import de.uka.ilkd.key.java.ast.expression.operator.adt.SetMinus; -import de.uka.ilkd.key.java.ast.expression.operator.adt.SetUnion; -import de.uka.ilkd.key.java.ast.expression.operator.adt.Singleton; +import de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermServices; @@ -161,8 +158,10 @@ public boolean isResponsible(Operator op, JTerm left, JTerm right, @Override public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { - return op instanceof Singleton || op instanceof SetUnion || op instanceof Intersect - || op instanceof SetMinus || op instanceof AllFields; + if (op instanceof LogicFunctionalOperator lfo) { + return lfo.getFunction().returnType == PrimitiveType.JAVA_LOCSET; + } + return false; } @@ -176,21 +175,20 @@ public JTerm translateLiteral(Literal lit, Services services) { @Override public Function getFunctionFor(Operator op, Services serv, ExecutionContext ec) { - if (op instanceof Singleton) { - return singleton; - } else if (op instanceof SetUnion) { - return union; - } else if (op instanceof Intersect) { - return intersect; - } else if (op instanceof SetMinus) { - return setMinus; - } else if (op instanceof AllFields) { - return allFields; + if (!(op instanceof LogicFunctionalOperator lfo)) { + assert false; + return null; } - assert false; - return null; - } + return switch (lfo.getFunction()) { + case Singleton -> singleton; + case SetUnion -> union; + case Intersect -> intersect; + case SetMinus -> setMinus; + case AllFields -> allFields; + default -> throw new IllegalStateException(); + }; + } @Override public boolean hasLiteralFunction(Function f) { diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/SeqLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/SeqLDT.java index 765044080a2..e11a5bd9d2b 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/SeqLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/SeqLDT.java @@ -4,12 +4,13 @@ package de.uka.ilkd.key.ldt; import de.uka.ilkd.key.java.Services; +import de.uka.ilkd.key.java.ast.abstraction.PrimitiveType; import de.uka.ilkd.key.java.ast.abstraction.Type; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.EmptySeqLiteral; import de.uka.ilkd.key.java.ast.expression.literal.Literal; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; +import de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermServices; @@ -127,9 +128,8 @@ public boolean isResponsible(Operator op, JTerm left, JTerm right, @Override public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { - return op instanceof SeqSingleton || op instanceof SeqConcat || op instanceof SeqSub - || op instanceof SeqReverse || op instanceof SeqIndexOf || op instanceof SeqGet - || op instanceof SeqLength || op instanceof SeqPut; + return op instanceof LogicFunctionalOperator lfo + && lfo.getFunction().returnType == PrimitiveType.JAVA_SEQ; } @@ -142,15 +142,19 @@ public JTerm translateLiteral(Literal lit, Services services) { @Override public Function getFunctionFor(Operator op, Services serv, ExecutionContext ec) { - return switch (op) { - case SeqSingleton ignored -> seqSingleton; - case SeqConcat ignored -> seqConcat; - case SeqSub ignored -> seqSub; - case SeqReverse ignored -> seqReverse; - case SeqPut ignored -> seqUpd; - case SeqIndexOf ignored -> seqIndexOf; - case SeqGet ignored -> seqGet; - case SeqLength ignored -> seqLen; + if (!(op instanceof LogicFunctionalOperator lfo)) { + throw new IllegalArgumentException("Not a logical functional"); + } + + return switch (lfo.getFunction()) { + case SeqSingleton -> seqSingleton; + case SeqConcat -> seqConcat; + case SeqSub -> seqSub; + case SeqReverse -> seqReverse; + case SeqPut -> seqUpd; + case SeqIndexOf -> seqIndexOf; + case SeqGet -> seqGet; + case SeqLength -> seqLen; default -> throw new AssertionError(); }; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java index 36a3614ea5e..706e26e0be2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java @@ -8,7 +8,7 @@ import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.Literal; -import de.uka.ilkd.key.java.ast.expression.operator.Subtype; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.logic.JTerm; import de.uka.ilkd.key.logic.TermServices; @@ -46,21 +46,24 @@ public Function getSsubsort() { public boolean isResponsible(Operator op, JTerm[] subs, Services services, ExecutionContext ec) { - return op instanceof Subtype; + return op instanceof BinaryOperator lfo + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; } @Override public boolean isResponsible(Operator op, JTerm left, JTerm right, Services services, ExecutionContext ec) { - return op instanceof Subtype; + return op instanceof BinaryOperator lfo + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; } @Override public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { - return op instanceof Subtype; + return op instanceof BinaryOperator lfo + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; } @Override @@ -72,7 +75,8 @@ public JTerm translateLiteral(Literal lit, Services services) { @Override public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { - if (op instanceof Subtype) { + if (op instanceof BinaryOperator lfo + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype) { return ssubsort; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/logic/JavaLogger.java b/key.core/src/main/java/de/uka/ilkd/key/logic/JavaLogger.java index 89de75b6fd7..976fdb1e12b 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/logic/JavaLogger.java +++ b/key.core/src/main/java/de/uka/ilkd/key/logic/JavaLogger.java @@ -23,6 +23,7 @@ * @author Alexander Weigl * @version 1 (06.01.25) */ +@Deprecated public class JavaLogger { private final static Logger log = LoggerFactory.getLogger(JavaLogger.class); private final static File findJavaAst; diff --git a/key.core/src/main/java/de/uka/ilkd/key/logic/VariableNamer.java b/key.core/src/main/java/de/uka/ilkd/key/logic/VariableNamer.java index bee675efa44..e2cad94afb7 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/logic/VariableNamer.java +++ b/key.core/src/main/java/de/uka/ilkd/key/logic/VariableNamer.java @@ -12,8 +12,8 @@ import de.uka.ilkd.key.java.ast.abstraction.Type; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.statement.EmptyStatement; import de.uka.ilkd.key.java.visitor.JavaASTWalker; @@ -600,7 +600,7 @@ public String getSuggestiveNameProposalForProgramVariable(SchemaVariable sv, Tac app.instantiations(), services); name = ProofSaver.printProgramElement(rhs); break; - } else if (c.getStatementAt(1) instanceof CopyAssignment p2) { + } else if (c.getStatementAt(1) instanceof Assignment p2) { Expression lhs = p2.getExpressionAt(0); if (lhs.equals(sv)) { SchemaVariable rhs = (SchemaVariable) p2.getExpressionAt(1); diff --git a/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java b/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java index 4e644442ee7..a1cbc7e938b 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java +++ b/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java @@ -13,7 +13,6 @@ import de.uka.ilkd.key.java.ast.expression.*; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.*; @@ -30,6 +29,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.Negative; + /** * Special "sorts" used for schema variables matching program constructs (class ProgramSV). Not * really sorts in the theoretical meaning of the word. @@ -436,8 +437,8 @@ protected SimpleExpressionSort(Name n) { @Override protected boolean canStandFor(ProgramElement pe, Services services) { - if (pe instanceof Negative) { - return ((Negative) pe).getChildAt(0) instanceof Literal; + if (pe instanceof UnaryOperator uo && uo.getKind() == Negative) { + return uo.getChildAt(0) instanceof Literal; } if (pe instanceof StringLiteral) { @@ -453,16 +454,10 @@ protected boolean canStandFor(ProgramElement pe, Services services) { return VARIABLE.canStandFor(v, services); } - if (pe instanceof SetUnion || pe instanceof Singleton || pe instanceof Intersect - || pe instanceof SetMinus || pe instanceof AllFields || pe instanceof AllObjects - || pe instanceof SeqSingleton || pe instanceof SeqConcat - || pe instanceof SeqLength || pe instanceof SeqGet || pe instanceof SeqIndexOf - || pe instanceof SeqSub || pe instanceof SeqReverse || pe instanceof SeqPut) { - if (pe instanceof NonTerminalProgramElement npe) { - for (int i = 0, childCount = npe.getChildCount(); i < childCount; i++) { - if (!canStandFor(npe.getChildAt(i), services)) { - return false; - } + if (pe instanceof LogicFunctionalOperator npe) { + for (int i = 0, childCount = npe.getChildCount(); i < childCount; i++) { + if (!canStandFor(npe.getChildAt(i), services)) { + return false; } } return true; diff --git a/key.core/src/main/java/de/uka/ilkd/key/pp/PrettyPrinter.java b/key.core/src/main/java/de/uka/ilkd/key/pp/PrettyPrinter.java index 5551e134e2d..214f0596716 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/pp/PrettyPrinter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/pp/PrettyPrinter.java @@ -12,10 +12,8 @@ import de.uka.ilkd.key.java.ast.ccatch.*; import de.uka.ilkd.key.java.ast.declaration.*; import de.uka.ilkd.key.java.ast.expression.*; -import de.uka.ilkd.key.java.ast.expression.Operator; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.*; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.java.visitor.Visitor; @@ -44,7 +42,7 @@ * A configurable pretty printer for Java source elements originally from COMPOST. * * @author AL - * + *

* CHANGED FOR KeY. Comments are not printed! */ @NullMarked @@ -63,7 +61,9 @@ public class PrettyPrinter implements Visitor { private final boolean useUnicodeSymbols; private final boolean hidePackagePrefix; - /** creates a new PrettyPrinter */ + /** + * creates a new PrettyPrinter + */ public PrettyPrinter(PosTableLayouter out) { this(out, SVInstantiations.EMPTY_SVINSTANTIATIONS, null, true, true, true); } @@ -322,90 +322,12 @@ private void printDLFunctionOperator(String name, Operator operator) { } } - @Override - public void performActionOnSingleton(Singleton x) { - printDLFunctionOperator("\\singleton", x); - } - - @Override - public void performActionOnSetUnion(SetUnion x) { - printDLFunctionOperator("\\set_union", x); - } - - @Override - public void performActionOnIntersect(Intersect x) { - printDLFunctionOperator("\\intersect", x); - } - - @Override - public void performActionOnSetMinus(SetMinus x) { - printDLFunctionOperator("\\set_minus", x); - } - - - @Override - public void performActionOnAllFields(AllFields x) { - printDLFunctionOperator("\\all_fields", x); - } - - @Override - public void performActionOnAllObjects( - AllObjects x) { - printDLFunctionOperator("\\all_objects", x); - } @Override public void performActionOnEmptySeqLiteral(EmptySeqLiteral x) { layouter.print("\\seq_empty"); } - @Override - public void performActionOnSeqLength(SeqLength x) { - x.getChildAt(0).visit(this); - layouter.print(".length"); - } - - @Override - public void performActionOnSeqGet(SeqGet x) { - x.getChildAt(0).visit(this); - layouter.print("["); - x.getChildAt(1).visit(this); - layouter.print("]"); - } - - @Override - public void performActionOnSeqSingleton( - SeqSingleton x) { - printDLFunctionOperator("\\seq_singleton", x); - } - - @Override - public void performActionOnSeqConcat(SeqConcat x) { - printDLFunctionOperator("\\seq_concat", x); - } - - @Override - public void performActionOnSeqIndexOf( - SeqIndexOf x) { - printDLFunctionOperator("\\indexOf", x); - } - - @Override - public void performActionOnSeqSub(SeqSub x) { - printDLFunctionOperator("\\seq_sub", x); - } - - @Override - public void performActionOnSeqReverse( - SeqReverse x) { - printDLFunctionOperator("\\seq_reverse", x); - } - - @Override - public void performActionOnSeqPut(SeqPut x) { - printDLFunctionOperator("\\seq_upd", x); - } - @Override public void performActionOnDLEmbeddedExpression(DLEmbeddedExpression x) { layouter.print("\\dl_" + x.getFunctionSymbol().name()); @@ -493,11 +415,6 @@ public void performActionOnAbstractProgramElement(AbstractProgramElement x) { performActionOnSchemaTypeReference((SchemaTypeReference) x); } - @Override - public void performActionOnIProgramVariable(IProgramVariable x) { - throw new UnsupportedOperationException(); - } - @Override public void performActionOnSuperArrayDeclaration(SuperArrayDeclaration x) { // No idea what to do here @@ -588,8 +505,23 @@ public void performActionOnMergeContract(MergeContract x) { } @Override - public void performActionOnSubtype(Subtype x) { - printOperator(x, "<:"); + public void performActionOnBinaryOperator(BinaryOperator op) { + printOperator(op, op.getKind().symbol); + } + + @Override + public void performActionOnUnaryOperator(UnaryOperator op) { + printOperator(op, op.getKind().symbol); + } + + @Override + public void performActionOnLogicFunctionalOperator(LogicFunctionalOperator op) { + op.getFunction().format.call(this, op); + } + + @Override + public void performActionOnAssignment(Assignment assignment) { + printOperator(assignment, assignment.getKind().symbol + "="); } private void performActionOnType(@Nullable Type type) { @@ -1290,108 +1222,6 @@ public void performActionOnVariableSpecification(VariableSpecification x) { } } - @Override - public void performActionOnBinaryAnd(BinaryAnd x) { - printOperator(x, "&"); - } - - @Override - public void performActionOnBinaryAndAssignment(BinaryAndAssignment x) { - printOperator(x, "&="); - } - - @Override - public void performActionOnBinaryOrAssignment(BinaryOrAssignment x) { - printOperator(x, "|="); - } - - @Override - public void performActionOnBinaryXOrAssignment(BinaryXOrAssignment x) { - printOperator(x, "^="); - } - - @Override - public void performActionOnCopyAssignment(CopyAssignment x) { - x.getArguments().get(0).visit(this); - layouter.print(" = "); - x.getArguments().get(1).visit(this); - } - - @Override - public void performActionOnDivideAssignment(DivideAssignment x) { - printOperator(x, "/="); - } - - @Override - public void performActionOnMinusAssignment(MinusAssignment x) { - printOperator(x, "-="); - } - - @Override - public void performActionOnModuloAssignment(ModuloAssignment x) { - printOperator(x, "%="); - } - - @Override - public void performActionOnPlusAssignment(PlusAssignment x) { - printOperator(x, "+="); - } - - @Override - public void performActionOnPostDecrement(PostDecrement x) { - printOperator(x, "--"); - } - - @Override - public void performActionOnPostIncrement(PostIncrement x) { - printOperator(x, "++"); - } - - @Override - public void performActionOnPreDecrement(PreDecrement x) { - printOperator(x, "--"); - } - - @Override - public void performActionOnPreIncrement(PreIncrement x) { - printOperator(x, "++"); - } - - @Override - public void performActionOnShiftLeftAssignment(ShiftLeftAssignment x) { - printOperator(x, "<<="); - } - - @Override - public void performActionOnShiftRightAssignment(ShiftRightAssignment x) { - printOperator(x, ">>="); - } - - @Override - public void performActionOnTimesAssignment(TimesAssignment x) { - printOperator(x, "*="); - } - - @Override - public void performActionOnUnsignedShiftRightAssignment(UnsignedShiftRightAssignment x) { - printOperator(x, ">>>="); - } - - @Override - public void performActionOnBinaryNot(BinaryNot x) { - printOperator(x, "~"); - } - - @Override - public void performActionOnBinaryOr(BinaryOr x) { - printOperator(x, "|"); - } - - @Override - public void performActionOnBinaryXOr(BinaryXOr x) { - printOperator(x, "^"); - } - @Override public void performActionOnConditional(Conditional x) { boolean addParentheses = x.isToBeParenthesized(); @@ -1412,41 +1242,6 @@ public void performActionOnConditional(Conditional x) { } } - @Override - public void performActionOnDivide(Divide x) { - printOperator(x, "/"); - } - - @Override - public void performActionOnEquals(Equals x) { - printOperator(x, "=="); - } - - @Override - public void performActionOnGreaterOrEquals(GreaterOrEquals x) { - printOperator(x, ">="); - } - - @Override - public void performActionOnGreaterThan(GreaterThan x) { - printOperator(x, ">"); - } - - @Override - public void performActionOnLessOrEquals(LessOrEquals x) { - printOperator(x, "<="); - } - - @Override - public void performActionOnLessThan(LessThan x) { - printOperator(x, "<"); - } - - @Override - public void performActionOnNotEquals(NotEquals x) { - printOperator(x, "!="); - } - @Override public void performActionOnNewArray(NewArray x) { boolean addParentheses = x.isToBeParenthesized(); @@ -1543,66 +1338,6 @@ public void performActionOnTypeCast(TypeCast x) { } } - @Override - public void performActionOnLogicalAnd(LogicalAnd x) { - printOperator(x, "&&"); - } - - @Override - public void performActionOnLogicalNot(LogicalNot x) { - printOperator(x, "!"); - } - - @Override - public void performActionOnLogicalOr(LogicalOr x) { - printOperator(x, "||"); - } - - @Override - public void performActionOnMinus(Minus x) { - printOperator(x, "-"); - } - - @Override - public void performActionOnModulo(Modulo x) { - printOperator(x, "%"); - } - - @Override - public void performActionOnNegative(Negative x) { - printOperator(x, "-"); - } - - @Override - public void performActionOnPlus(Plus x) { - printOperator(x, "+"); - } - - @Override - public void performActionOnPositive(Positive x) { - printOperator(x, "+"); - } - - @Override - public void performActionOnShiftLeft(ShiftLeft x) { - printOperator(x, "<<"); - } - - @Override - public void performActionOnShiftRight(ShiftRight x) { - printOperator(x, ">>"); - } - - @Override - public void performActionOnTimes(Times x) { - printOperator(x, "*"); - } - - @Override - public void performActionOnUnsignedShiftRight(UnsignedShiftRight x) { - printOperator(x, ">>>"); - } - @Override public void performActionOnArrayReference(ArrayReference x) { x.getReferencePrefix().visit(this); @@ -1637,11 +1372,6 @@ protected void printMethodReference(MethodReference x) { printArguments(x.getArguments()); } - @Override - public void performActionOnMethod(IProgramMethod x) { - layouter.print(x.name().toString()); - } - public void writeFullMethodSignature(IProgramMethod x) { layouter.print(x.getName()); layouter.print("("); @@ -2004,4 +1734,41 @@ public String printInLogicPrinter(JTerm t) { return lp.result(); } + + public interface PrintOp { + void call(PrettyPrinter pp, LogicFunctionalOperator op); + } + + public static PrintOp AsFunction(String fnSymbol) { + return (pp, op) -> { + pp.layouter.print(fnSymbol); + pp.layouter.print("("); + final var arguments = op.getArguments(); + for (int i = 0; i < arguments.size(); i++) { + arguments.get(i).visit(pp); + if (i < arguments.size() - 1) { + pp.layouter.print(", "); + } + } + pp.layouter.print(")"); + }; + } + + public static PrintOp AsArrayAccess() { + return (pp, op) -> { + op.getArguments().get(0).visit(pp); + pp.layouter.print("["); + op.getArguments().get(1).visit(pp); + pp.layouter.print("]"); + }; + } + + public static PrintOp AsSuffix(String field) { + return (pp, op) -> { + op.getArguments().get(0).visit(pp); + pp.layouter.print("."); + pp.layouter.print(field); + }; + } + } diff --git a/key.core/src/main/java/de/uka/ilkd/key/proof/init/AbstractOperationPO.java b/key.core/src/main/java/de/uka/ilkd/key/proof/init/AbstractOperationPO.java index 1ea6eb95518..93fc9a72e9c 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/proof/init/AbstractOperationPO.java +++ b/key.core/src/main/java/de/uka/ilkd/key/proof/init/AbstractOperationPO.java @@ -14,8 +14,8 @@ import de.uka.ilkd.key.java.ast.declaration.Modifier; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.literal.NullLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.TypeReference; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.java.ast.statement.Try; @@ -42,6 +42,8 @@ import com.github.javaparser.ast.key.KeyTransactionStatement; import org.jspecify.annotations.Nullable; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + /** *

* This abstract implementation of {@link ProofOblInput} extends the functionality of @@ -906,11 +908,11 @@ protected JavaBlock buildJavaBlock(ImmutableList formalParVars sb2 = tryBlock; } else { // create try statement - final CopyAssignment nullStat = new CopyAssignment(exceptionVar, NullLiteral.NULL); + final Assignment nullStat = new Assignment(Copy, exceptionVar, NullLiteral.NULL); final VariableSpecification eSpec = new VariableSpecification(eVar); final ParameterDeclaration excDecl = new ParameterDeclaration(new Modifier[0], excTypeRef, eSpec, false); - final CopyAssignment assignStat = new CopyAssignment(exceptionVar, eVar); + final Assignment assignStat = new Assignment(Copy, exceptionVar, eVar); final Catch catchStat = new Catch(excDecl, catchBlock == null ? new StatementBlock(assignStat) : new StatementBlock(assignStat, catchBlock)); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java index d78676170aa..322261f6514 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java @@ -13,10 +13,9 @@ import de.uka.ilkd.key.java.ast.PositionInfo; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.*; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.NotEquals; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.java.ast.statement.Catch; import de.uka.ilkd.key.java.ast.statement.LabeledStatement; @@ -50,7 +49,6 @@ import org.key_project.logic.op.Modality; import org.key_project.prover.sequent.PosInOccurrence; import org.key_project.prover.sequent.SequentFormula; -import org.key_project.util.ExtList; import org.key_project.util.collection.DefaultImmutableSet; import org.key_project.util.collection.ImmutableArray; import org.key_project.util.collection.ImmutableSLList; @@ -1637,8 +1635,8 @@ private StatementBlock constructAbruptTerminationIfCascade() { KeYJavaASTFactory.returnClause(variables.result))); } ifCascade.add(KeYJavaASTFactory.ifThen( - new NotEquals( - new ExtList(new Expression[] { variables.exception, NullLiteral.NULL })), + new BinaryOperator(BinaryOperator.BinaryOperatorKind.NotEquals, variables.exception, + NullLiteral.NULL), KeYJavaASTFactory.throwClause(variables.exception))); return new StatementBlock(ifCascade.toArray(new Statement[0])); } @@ -1694,8 +1692,7 @@ private JTerm[] createPosts(final Goal goal, final JTerm[] postconditions, terms.exception); postNext = TermLabelManager.refactorTerm(termLabelState, services, null, postNext, rule, goal, AbstractAuxiliaryContractRule.NEW_POSTCONDITION_TERM_HINT, null); - final JTerm[] posts = { post, postNext }; - return posts; + return new JTerm[] { post, postNext }; } } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java b/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java index 602651e29aa..74b8b925726 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java @@ -11,9 +11,9 @@ import de.uka.ilkd.key.java.ast.ProgramElement; import de.uka.ilkd.key.java.ast.Statement; import de.uka.ilkd.key.java.ast.StatementBlock; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; -import de.uka.ilkd.key.java.ast.expression.operator.LessThan; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.statement.IGuard; import de.uka.ilkd.key.java.ast.statement.While; @@ -36,6 +36,8 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; +import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LessThan; + /** * The built in rule app for the loop invariant rule. */ @@ -100,9 +102,9 @@ protected LoopInvariantBuiltInRuleApp(T rule, PosInOccurrence pio, // the guard is expected to be of the form "i < x" and we want to retrieve "i". assert guard.getChildCount() == 1 : "child count: " + guard.getChildCount(); ProgramElement guardStatement = guard.getChildAt(0); - skipIndex = !(guardStatement instanceof LessThan); + skipIndex = !(guardStatement instanceof BinaryOperator b && b.getKind() == LessThan); Expression loopIndex = - skipIndex ? null : (Expression) ((LessThan) guard.getChildAt(0)).getChildAt(0); + skipIndex ? null : (Expression) ((BinaryOperator) guard.getChildAt(0)).getChildAt(0); skipIndex = skipIndex || !(loopIndex instanceof ProgramVariable); final JTerm loopIdxVar = skipIndex ? null : tb.var((ProgramVariable) loopIndex); @@ -113,8 +115,8 @@ protected LoopInvariantBuiltInRuleApp(T rule, PosInOccurrence pio, // get the second statement if possible Statement last = (skipValues || block.getStatementCount() < 2) ? null : block.getStatementAt(1); - skipValues = skipValues || !(last instanceof CopyAssignment); - CopyAssignment assignment = skipValues ? null : ((CopyAssignment) last); + skipValues = skipValues || !(last instanceof Assignment); + Assignment assignment = skipValues ? null : ((Assignment) last); ProgramElement lhs = skipValues ? null : assignment.getChildAt(0); skipValues = skipValues || !(lhs instanceof ProgramVariable); final JTerm valuesVar = skipValues ? null : tb.var((ProgramVariable) lhs); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/ObserverToUpdateRule.java b/key.core/src/main/java/de/uka/ilkd/key/rule/ObserverToUpdateRule.java index f5ad34e4c84..b78498af23c 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/ObserverToUpdateRule.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/ObserverToUpdateRule.java @@ -8,8 +8,8 @@ import de.uka.ilkd.key.java.TypeConverter; import de.uka.ilkd.key.java.ast.SourceElement; import de.uka.ilkd.key.java.ast.StatementBlock; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.logic.*; import de.uka.ilkd.key.logic.JTerm; @@ -350,7 +350,8 @@ private static ModelFieldInstantiation matchModelField(JTerm focusTerm, Services // active statement must be reading model field final SourceElement activeStatement = JavaTools.getActiveStatement(mainFml.javaBlock()); - if (!(activeStatement instanceof CopyAssignment ca)) { + if (!(activeStatement instanceof Assignment ca + && ca.getKind() == Assignment.AssignmentKind.Copy)) { return null; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/QueryExpand.java b/key.core/src/main/java/de/uka/ilkd/key/rule/QueryExpand.java index 7c9c327582e..faca8a69b9e 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/QueryExpand.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/QueryExpand.java @@ -11,7 +11,7 @@ import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.ParameterDeclaration; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.reference.MethodReference; import de.uka.ilkd.key.java.ast.reference.TypeRef; @@ -45,6 +45,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; + /** * The QueryExpand rule allows to apply contracts or to symbolically execute a query expression in @@ -199,7 +201,7 @@ public Pair queryEvalTerm(Services services, JTerm query, stmnt.add(KeYJavaASTFactory.declare(result, progResultType)); - final CopyAssignment assignment = new CopyAssignment(result, mr); + final Assignment assignment = new Assignment(Copy, result, mr); stmnt.add(assignment); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/UseOperationContractRule.java b/key.core/src/main/java/de/uka/ilkd/key/rule/UseOperationContractRule.java index 3780c359933..e5a7c1ea3a5 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/UseOperationContractRule.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/UseOperationContractRule.java @@ -12,7 +12,6 @@ import de.uka.ilkd.key.java.ast.abstraction.*; import de.uka.ilkd.key.java.ast.declaration.*; import de.uka.ilkd.key.java.ast.expression.*; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.expression.operator.New; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.Throw; @@ -90,7 +89,7 @@ private static Pair getMethodCall(Java && ((New) activeStatement).getTypeDeclarationCount() == 0) { actualResult = null; mr = (New) activeStatement; - } else if (activeStatement instanceof CopyAssignment ca) { + } else if (activeStatement instanceof Assignment ca) { final Expression lhs = ca.getExpressionAt(0); final Expression rhs = ca.getExpressionAt(1); if ((rhs instanceof MethodReference @@ -328,7 +327,7 @@ private static PosInProgram getPosInProgram(JavaBlock jb) { pe = curPrefix.getFirstActiveChildPos().getProgram(curPrefix); - assert pe instanceof CopyAssignment || pe instanceof MethodReference + assert pe instanceof Assignment || pe instanceof MethodReference || pe instanceof New; int i = length - 1; @@ -341,7 +340,7 @@ private static PosInProgram getPosInProgram(JavaBlock jb) { } while (i >= 0); } else { - assert pe instanceof CopyAssignment || pe instanceof MethodReference + assert pe instanceof Assignment || pe instanceof MethodReference || pe instanceof New; } return result; @@ -927,7 +926,8 @@ protected void createPostGoal(Goal postGoal) { if (inst.actualResult == null) { resultAssign = new StatementBlock(); } else { - final CopyAssignment ca = new CopyAssignment(inst.actualResult, resultVar); + final Assignment ca = + new Assignment(Assignment.AssignmentKind.Copy, inst.actualResult, resultVar); resultAssign = new StatementBlock(ca); } final StatementBlock postSB = replaceStatement(jb, resultAssign); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java index a986caa91fe..2341f657cc0 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EnhancedForElimination.java @@ -19,8 +19,6 @@ import de.uka.ilkd.key.java.ast.expression.*; import de.uka.ilkd.key.java.ast.expression.literal.EmptySeqLiteral; import de.uka.ilkd.key.java.ast.expression.operator.*; -import de.uka.ilkd.key.java.ast.expression.operator.adt.SeqConcat; -import de.uka.ilkd.key.java.ast.expression.operator.adt.SeqSingleton; import de.uka.ilkd.key.java.ast.reference.*; import de.uka.ilkd.key.java.ast.statement.*; import de.uka.ilkd.key.logic.GenericTermReplacer; @@ -39,6 +37,10 @@ import org.key_project.util.collection.ImmutableSLList; import org.key_project.util.collection.Pair; +import static de.uka.ilkd.key.java.ast.expression.Assignment.AssignmentKind.Copy; +import static de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator.LogicFunction.SeqConcat; +import static de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator.LogicFunction.SeqSingleton; + /** * * This class defines a meta operator to resolve an enhanced for loop - by transformation to a @@ -305,9 +307,11 @@ private Statement makeValuesUpdate(ProgramVariable valuesVar, LocalVariableDecla final IProgramVariable element = var.getProgramVariable(); assert element instanceof ProgramVariable : "Since this is a concrete program, the spec must not be schematic"; - final Expression seqSingleton = new SeqSingleton((ProgramVariable) element); - final Expression seqConcat = new SeqConcat(valuesVar, seqSingleton); - return new CopyAssignment(valuesVar, seqConcat); + final Expression seqSingleton = + new LogicFunctionalOperator(SeqSingleton, (ProgramVariable) element); + final Expression seqConcat = + new LogicFunctionalOperator(SeqConcat, valuesVar, seqSingleton); + return new Assignment(Copy, valuesVar, seqConcat); } /** diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EvaluateArgs.java b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EvaluateArgs.java index 647738134c8..999d652952f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EvaluateArgs.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/EvaluateArgs.java @@ -13,8 +13,8 @@ import de.uka.ilkd.key.java.ast.Statement; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.expression.Expression; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; import de.uka.ilkd.key.java.ast.expression.operator.New; import de.uka.ilkd.key.java.ast.reference.ExecutionContext; import de.uka.ilkd.key.java.ast.reference.MethodOrConstructorReference; @@ -77,7 +77,7 @@ public ProgramElement[] transform(ProgramElement pe, Services services, final ExecutionContext ec = svInst.getExecutionContext(); MethodOrConstructorReference mr = (MethodOrConstructorReference) // - (pe instanceof CopyAssignment ? ((CopyAssignment) pe).getChildAt(1) : pe); + (pe instanceof Assignment a ? a.getChildAt(1) : pe); List evalstat = new LinkedList<>(); @@ -119,8 +119,8 @@ public ProgramElement[] transform(ProgramElement pe, Services services, resMR = null; } - if (pe instanceof CopyAssignment) { - res[res.length - 1] = KeYJavaASTFactory.assign(((CopyAssignment) pe).getExpressionAt(0), + if (pe instanceof Assignment a) { + res[res.length - 1] = KeYJavaASTFactory.assign(a.getExpressionAt(0), (Expression) resMR); } else { res[res.length - 1] = resMR; diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/InitArrayCreation.java b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/InitArrayCreation.java index f8b773a3792..4a31d4957c3 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/InitArrayCreation.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/metaconstruct/InitArrayCreation.java @@ -17,7 +17,7 @@ import de.uka.ilkd.key.java.ast.expression.ArrayInitializer; import de.uka.ilkd.key.java.ast.expression.Expression; import de.uka.ilkd.key.java.ast.expression.literal.BooleanLiteral; -import de.uka.ilkd.key.java.ast.expression.operator.LessThan; +import de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator; import de.uka.ilkd.key.java.ast.expression.operator.New; import de.uka.ilkd.key.java.ast.expression.operator.NewArray; import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; @@ -114,7 +114,8 @@ private ProgramVariable[] evaluateAndCheckDimensionExpressions(LinkedList Date: Fri, 17 Apr 2026 20:55:48 +0200 Subject: [PATCH 3/7] fix compile errors --- .../slicing/TestThinBackwardSlicer.java | 10 +++++----- .../key/java/TestContextStatementBlock.java | 6 ++++-- .../uka/ilkd/key/logic/TestVariableNamer.java | 12 +++++++----- .../uka/ilkd/key/parser/TestTacletParser.java | 18 +++++++++++------- .../de/uka/ilkd/key/util/TestMiscTools.java | 4 ++-- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/key.core.symbolic_execution/src/test/java/de/uka/ilkd/key/symbolic_execution/testcase/slicing/TestThinBackwardSlicer.java b/key.core.symbolic_execution/src/test/java/de/uka/ilkd/key/symbolic_execution/testcase/slicing/TestThinBackwardSlicer.java index f7942a52606..dcf1a846a39 100644 --- a/key.core.symbolic_execution/src/test/java/de/uka/ilkd/key/symbolic_execution/testcase/slicing/TestThinBackwardSlicer.java +++ b/key.core.symbolic_execution/src/test/java/de/uka/ilkd/key/symbolic_execution/testcase/slicing/TestThinBackwardSlicer.java @@ -10,7 +10,7 @@ import de.uka.ilkd.key.java.ast.SourceElement; import de.uka.ilkd.key.java.ast.declaration.VariableDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.reference.ReferencePrefix; import de.uka.ilkd.key.java.ast.statement.Return; import de.uka.ilkd.key.proof.Node; @@ -781,8 +781,8 @@ public Pair findSeed(Proof proof) { Assertions.assertNotNull(seedNode); // Get seed location SourceElement activeStatemt = seedNode.getNodeInfo().getActiveStatement(); - Assertions.assertInstanceOf(CopyAssignment.class, activeStatemt); - CopyAssignment assignment = (CopyAssignment) activeStatemt; + Assertions.assertInstanceOf(Assignment.class, activeStatemt); + Assignment assignment = (Assignment) activeStatemt; SourceElement seedLocation = assignment.getChildAt(1); return new Pair<>(seedNode, (ReferencePrefix) seedLocation); } @@ -818,8 +818,8 @@ public Pair findSeed(Proof proof) { Assertions.assertNotNull(seedNode); // Get seed location SourceElement activeStatemt = seedNode.getNodeInfo().getActiveStatement(); - Assertions.assertInstanceOf(CopyAssignment.class, activeStatemt); - CopyAssignment assignment = (CopyAssignment) activeStatemt; + Assertions.assertInstanceOf(Assignment.class, activeStatemt); + Assignment assignment = (Assignment) activeStatemt; SourceElement seedLocation = assignment.getChildAt(0); return new Pair<>(seedNode, (ReferencePrefix) seedLocation); } diff --git a/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java b/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java index 13f2ab1d460..b463059c72c 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java +++ b/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java @@ -6,7 +6,7 @@ import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; -import de.uka.ilkd.key.java.ast.expression.operator.PostIncrement; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator; import de.uka.ilkd.key.logic.JavaBlock; import de.uka.ilkd.key.logic.PosInProgram; import de.uka.ilkd.key.rule.TacletForTests; @@ -17,6 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -50,7 +51,8 @@ public void testContextTermInstantiation() { "Prefix should end with an assignment"); PosInProgram suffixStart = PosInProgram.TOP.down(2); assertTrue( - PosInProgram.getProgramAt(suffixStart, blockOne.program()) instanceof PostIncrement, + PosInProgram.getProgramAt(suffixStart, blockOne.program()) instanceof UnaryOperator uo + && uo.kind == PostIncrement, "Suffix should start with an ++"); for (int i = size - 2; i >= 1; i--) { statementList.add(stContainer.getChildAt(i)); diff --git a/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java b/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java index 51e85abbd33..7aaa97d5631 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java +++ b/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java @@ -9,7 +9,7 @@ import de.uka.ilkd.key.java.ast.Statement; import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.KeYJavaType; -import de.uka.ilkd.key.java.ast.expression.operator.PostIncrement; +import de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator; import de.uka.ilkd.key.logic.op.LocationVariable; import de.uka.ilkd.key.logic.op.ProgramVariable; import de.uka.ilkd.key.logic.op.SchemaVariableFactory; @@ -33,6 +33,7 @@ import org.junit.jupiter.api.Test; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; import static org.junit.jupiter.api.Assertions.*; @@ -68,7 +69,7 @@ private LocationVariable constructProgramVariable(String name) { } private SequentFormula constructFormula(ProgramVariable containedVar) { - Statement statement = new PostIncrement(containedVar); + Statement statement = new UnaryOperator(PostIncrement, containedVar); StatementBlock statementBlock = new StatementBlock(statement); JavaBlock javaBlock = JavaBlock.createJavaBlock(statementBlock); @@ -115,7 +116,7 @@ private void addTacletApp(Goal goal, ProgramVariable containedVar) { SchemaVariable sv = SchemaVariableFactory.createProgramSV(new ProgramElementName("sv"), ProgramSVSort.STATEMENT, false); - Statement statement = new PostIncrement(containedVar); + Statement statement = new UnaryOperator(PostIncrement, containedVar); app = (NoPosTacletApp) app.addCheckedInstantiation(sv, statement, goal.proof().getServices(), false); @@ -132,8 +133,9 @@ private boolean inTacletApps(Goal goal, ProgramVariable containedVar) { SVInstantiations insts = noPosTacletApp.instantiations(); for (var e : insts.getInstantiationMap()) { Object inst = e.value().getInstantiation(); - if (inst instanceof PostIncrement postIncrement - && postIncrement.getFirstElement() == containedVar) { + if (inst instanceof UnaryOperator uo + && uo.kind == PostIncrement + && uo.getFirstElement() == containedVar) { return true; } } diff --git a/key.core/src/test/java/de/uka/ilkd/key/parser/TestTacletParser.java b/key.core/src/test/java/de/uka/ilkd/key/parser/TestTacletParser.java index e4d4113b97e..ccb6456303e 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/parser/TestTacletParser.java +++ b/key.core/src/test/java/de/uka/ilkd/key/parser/TestTacletParser.java @@ -10,7 +10,7 @@ import de.uka.ilkd.key.java.ast.ContextStatementBlock; import de.uka.ilkd.key.java.ast.declaration.LocalVariableDeclaration; import de.uka.ilkd.key.java.ast.declaration.VariableSpecification; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.reference.ArrayReference; import de.uka.ilkd.key.logic.*; import de.uka.ilkd.key.nparser.KeyIO; @@ -366,7 +366,7 @@ public void testSchemaJava10() { JTerm find = taclet.find(); JavaBlock jb = find.javaBlock(); ContextStatementBlock ct = (ContextStatementBlock) jb.program(); - CopyAssignment ca = (CopyAssignment) ct.getChildAt(0); + Assignment ca = (Assignment) ct.getChildAt(0); ArrayReference ar = (ArrayReference) ca.getChildAt(0); for (int i = 0; i < 2; i++) { assertNotNull(ar.getChildAt(i)); @@ -379,11 +379,15 @@ public void testSchemaJava10() { @Test public void testSchemaJava11() { - parseTaclet("eval_order_array_access_right{" + " \\find(\\<{..#v=#ar[#e];...}\\>post)" - + "\\varcond(\\newTypeOf(#ar1, #ar)," + "\\newTypeOf(#v0, #e), \\newTypeOf(#k, #e))" - + "\\replacewith(\\<{..for(#k=0;#k<#length-reference(#ar);#k++){" + "#ar1[#k]=#ar[#k];}" - + "#v0=#e; #v=#ar1[#v0];...}\\>post)" - + "\\displayname \"eval_order_array_access_right\"}"); + parseTaclet(""" + eval_order_array_access_right{ + \\find(\\<{..#v=#ar[#e];...}\\>post) + \\varcond(\\newTypeOf(#ar1, #ar),\\newTypeOf(#v0, #e), \\newTypeOf(#k, #e)) + \\replacewith(\\<{..for(#k=0;#k<#length-reference(#ar);#k++){#ar1[#k]=#ar[#k];} + #v0=#e; #v=#ar1[#v0];...}\\>post) + \\displayname "eval_order_array_access_right" + } + """); } diff --git a/key.core/src/test/java/de/uka/ilkd/key/util/TestMiscTools.java b/key.core/src/test/java/de/uka/ilkd/key/util/TestMiscTools.java index 76842062767..ab781f324d7 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/util/TestMiscTools.java +++ b/key.core/src/test/java/de/uka/ilkd/key/util/TestMiscTools.java @@ -17,7 +17,7 @@ import de.uka.ilkd.key.java.ast.StatementBlock; import de.uka.ilkd.key.java.ast.abstraction.*; -import de.uka.ilkd.key.java.ast.expression.operator.CopyAssignment; +import de.uka.ilkd.key.java.ast.expression.Assignment; import de.uka.ilkd.key.java.ast.statement.SetStatement; import de.uka.ilkd.key.logic.*; import de.uka.ilkd.key.logic.op.*; @@ -199,7 +199,7 @@ public void testLocalOuts() { var x = new LocationVariable(new ProgramElementName("x"), intKjt); var y = new LocationVariable(new ProgramElementName("y"), intKjt); var z = new LocationVariable(new ProgramElementName("z"), intKjt); - var stmt1 = new CopyAssignment(x, y); + var stmt1 = new Assignment(x, y); var lexer = JmlFacade.createLexer("set z = 1;"); var parser = JmlFacade.createParser(lexer); var setCtx = parser.set_statement(); From 31a5a1bd8ac63a2a4e12642f1600f24695d53aab Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Fri, 17 Apr 2026 21:18:42 +0200 Subject: [PATCH 4/7] fix tests errors --- .../expression/operator/UnaryOperator.java | 2 +- .../ilkd/key/speclang/ClassInvariantImpl.java | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java index 6c9d39302a0..5246d1bb1e4 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java @@ -78,7 +78,7 @@ public int getPrecedence() { @Override public int getNotation() { - return PREFIX; + return kind.notation; } @Override diff --git a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java index 7737320e301..1245ceaf890 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java +++ b/key.core/src/main/java/de/uka/ilkd/key/speclang/ClassInvariantImpl.java @@ -5,6 +5,7 @@ import java.util.LinkedHashMap; import java.util.Map; +import java.util.Objects; import java.util.function.UnaryOperator; import de.uka.ilkd.key.java.Services; @@ -88,6 +89,7 @@ public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, * @param displayName the displayed name of the invariant * @param kjt the KeYJavaType to which the invariant belongs * @param visibility the visibility of the invariant (null for default visibility) + * TODO weigl: what is the "default visibility"? * @param inv the invariant formula itself * @param selfVar the variable used for the receiver object * @param free whether this contract is free. @@ -95,15 +97,20 @@ public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, public ClassInvariantImpl(String name, String displayName, KeYJavaType kjt, ModifierKind visibility, JTerm inv, LocationVariable selfVar, boolean free) { - assert name != null && !name.isEmpty(); - assert displayName != null && !displayName.isEmpty(); - assert kjt != null; - assert inv != null; - this.name = name; - this.displayName = displayName; - this.kjt = kjt; - this.visibility = visibility; - this.originalInv = inv; + + this.name = Objects.requireNonNull(name); + if (name.isBlank()) { + throw new IllegalArgumentException("name must not be blank"); + } + + this.displayName = Objects.requireNonNull(displayName); + if (displayName.isEmpty()) { + throw new IllegalArgumentException("displayName must not be empty"); + } + + this.kjt = Objects.requireNonNull(kjt); + this.visibility = Objects.requireNonNullElse(visibility, ModifierKind.PUBLIC); + this.originalInv = Objects.requireNonNull(inv); this.originalSelfVar = selfVar; final OpCollector oc = new OpCollector(); originalInv.execPostOrder(oc); From 6152973dc22f88371b913e683d67ba6a607ec7db Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Fri, 17 Apr 2026 23:38:14 +0200 Subject: [PATCH 5/7] rename enum --- .../uka/ilkd/key/java/KeYJavaASTFactory.java | 14 ++--- .../de/uka/ilkd/key/java/TypeConverter.java | 4 +- .../expression/operator/BinaryOperator.java | 50 ++++++++-------- .../expression/operator/UnaryOperator.java | 18 +++--- .../java/loader/CreateArrayMethodBuilder.java | 8 +-- .../ilkd/key/java/loader/JP2KeYConverter.java | 58 +++++++++---------- .../java/de/uka/ilkd/key/ldt/DoubleLDT.java | 4 +- .../java/de/uka/ilkd/key/ldt/FloatLDT.java | 22 +++---- .../java/de/uka/ilkd/key/ldt/SortLDT.java | 8 +-- .../ilkd/key/logic/sort/ProgramSVSort.java | 4 +- .../key/rule/AuxiliaryContractBuilders.java | 2 +- .../key/rule/LoopInvariantBuiltInRuleApp.java | 4 +- .../key/java/TestContextStatementBlock.java | 4 +- .../uka/ilkd/key/logic/TestVariableNamer.java | 8 +-- 14 files changed, 103 insertions(+), 105 deletions(-) diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java b/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java index 55f54a620de..2df1082a89f 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/KeYJavaASTFactory.java @@ -289,7 +289,7 @@ public static ProgramVariable localVariable(final Services services, final Strin * @return a new {@link LogicalAnd} of left and right */ public static BinaryOperator logicalAndOperator(final Expression left, final Expression right) { - return new BinaryOperator(BinaryOperatorKind.LogicalAnd, left, right); + return new BinaryOperator(BinaryOperatorKind.LOGICAL_AND, left, right); } /** @@ -304,7 +304,7 @@ public static BinaryOperator logicalAndOperator(final Expression left, final Exp * @return a new {@link LogicalOr} of left and right */ public static BinaryOperator logicalOrOperator(final Expression left, final Expression right) { - return new BinaryOperator(BinaryOperatorKind.LogicalOr, left, right); + return new BinaryOperator(BinaryOperatorKind.LOGICAL_OR, left, right); } @@ -692,7 +692,7 @@ public static BinaryOperator equalsNullOperator(final Expression expression) { * @return a new {@link Equals} of left and right */ public static BinaryOperator equalsOperator(final Expression left, final Expression right) { - return new BinaryOperator(BinaryOperatorKind.Equals, left, right); + return new BinaryOperator(BinaryOperatorKind.EQUALS, left, right); } /** @@ -706,7 +706,7 @@ public static BinaryOperator equalsOperator(final Expression left, final Express * @return a new {@link Equals} of operands */ public static BinaryOperator equalsOperator(final ExtList operands) { - return new BinaryOperator(BinaryOperatorKind.Equals, operands); + return new BinaryOperator(BinaryOperatorKind.EQUALS, operands); } /** @@ -1073,7 +1073,7 @@ public static IGuard lessThanGuard(final Expression left, final Expression right * @return a new {@link LessThan} that compares left less than right */ public static BinaryOperator lessThanOperator(final Expression left, final Expression right) { - return new BinaryOperator(BinaryOperatorKind.LessThan, left, right); + return new BinaryOperator(BinaryOperatorKind.LESS_THAN, left, right); } /** @@ -1140,7 +1140,7 @@ public static IForUpdates forUpdates(final Expression update) { */ public static IForUpdates postIncrementForUpdates(final ProgramVariable variable) { final Expression update = - new UnaryOperator(UnaryOperator.UnaryOperatorKind.PostIncrement, variable); + new UnaryOperator(UnaryOperator.UnaryOperatorKind.POST_INCREMENT, variable); return forUpdates(update); } @@ -2124,7 +2124,7 @@ public static New newOperator(final KeYJavaType type) { * @return a new {@link NotEquals} of operands */ public static BinaryOperator notEqualsOperator(final ExtList operands) { - return new BinaryOperator(BinaryOperatorKind.NotEquals, operands); + return new BinaryOperator(BinaryOperatorKind.NOT_EQUALS, operands); } /** diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java index 978df8f2ddf..d294c5a54e3 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/TypeConverter.java @@ -151,11 +151,11 @@ private JTerm translateOperator(Operator op, ExecutionContext ec) { if (responsibleLDT != null) { return tb.func(responsibleLDT.getFunctionFor(op, services, ec), subs); } else if (op instanceof BinaryOperator bo - && bo.getKind() == BinaryOperator.BinaryOperatorKind.Equals) { + && bo.getKind() == BinaryOperator.BinaryOperatorKind.EQUALS) { assert subs.length == 2; return tb.equals(subs[0], subs[1]); } else if (op instanceof BinaryOperator bo - && bo.getKind() == BinaryOperator.BinaryOperatorKind.NotEquals) { + && bo.getKind() == BinaryOperator.BinaryOperatorKind.NOT_EQUALS) { assert subs.length == 2; return tb.not(tb.equals(subs[0], subs[1])); } else if (op instanceof Conditional) { diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java index c1523b2dbaa..a700fbe0bef 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java @@ -26,32 +26,30 @@ public BinaryOperator(BinaryOperatorKind binaryOperatorKind, ExtList operands) { } public enum BinaryOperatorKind { - Divide(2, "/"), - Modulo(2, "%"), - Times(2, "*"), - Minus(3, "-"), - Plus(3, "+"), - Subtype(3, "<:"), - - ShiftLeft(4, "<<"), - ShiftRight(4, ">>"), - UnsignedShiftRight(4, ">>>"), - - GreaterOrEquals(5, ">="), - LessOrEquals(5, "<="), - GreaterThan(5, ">"), - LessThan(5, "<"), - Equals(6, "=="), - NotEquals(6, "!="), - - - BinaryAnd(7, "&"), - BinaryXOr(8, "^"), - BinaryOr(9, "|"), - - - LogicalAnd(10, "&&"), - LogicalOr(11, "||"); + DIVIDE(2, "/"), + MODULO(2, "%"), + TIMES(2, "*"), + MINUS(3, "-"), + PLUS(3, "+"), + SUBTYPE(3, "<:"), + + SHIFT_LEFT(4, "<<"), + SHIFT_RIGHT(4, ">>"), + UNSIGNED_SHIFT_RIGHT(4, ">>>"), + + GREATER_OR_EQUALS(5, ">="), + LESS_OR_EQUALS(5, "<="), + GREATER_THAN(5, ">"), + LESS_THAN(5, "<"), + EQUALS(6, "=="), + NOT_EQUALS(6, "!="), + + + BINARY_AND(7, "&"), + BINARY_XOR(8, "^"), + BINARY_OR(9, "|"), + LOGICAL_AND(10, "&&"), + LOGICAL_OR(11, "||"); public final int precedence; diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java index 5246d1bb1e4..317bbb53518 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java @@ -29,15 +29,15 @@ public UnaryOperator(UnaryOperatorKind kind, Expression arg) { } public enum UnaryOperatorKind { - LogicalNot("!", 1), - Negative("-", 1), - Positive("+", 1), - BinaryNot("~", 1), - - PreIncrement("++", 0), - PreDecrement("--", 0), - PostIncrement("++", 0, POSTFIX), - PostDecrement("--", 0, POSTFIX); + LOGICAL_NOT("!", 1), + NEGATIVE("-", 1), + POSITIVE("+", 1), + BINARY_NOT("~", 1), + + PRE_INCREMENT("++", 0), + PRE_DECREMENT("--", 0), + POST_INCREMENT("++", 0, POSTFIX), + POST_DECREMENT("--", 0, POSTFIX); public final String symbol; diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java index 9638211ba3f..95a67083db4 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/CreateArrayMethodBuilder.java @@ -50,8 +50,8 @@ import org.key_project.util.collection.ImmutableList; import org.key_project.util.collection.ImmutableSLList; -import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LessThan; -import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; +import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LESS_THAN; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.POST_INCREMENT; /** * This class creates the <createArray> method for array creation and in @@ -384,8 +384,8 @@ public IProgramMethod getPrepareArrayMethod(TypeRef arrayRef, ProgramVariable le (ProgramVariable) forInit.getVariables().get(0).getProgramVariable(); final For forLoop = new For(new LoopInitializer[] { forInit }, - new BinaryOperator(LessThan, pv, new FieldReference(length, new ThisReference())), - new Expression[] { new UnaryOperator(PostIncrement, pv) }, + new BinaryOperator(LESS_THAN, pv, new FieldReference(length, new ThisReference())), + new Expression[] { new UnaryOperator(POST_INCREMENT, pv) }, assign(new ArrayReference(new ThisReference(), new Expression[] { pv }), defaultValue)); final StatementBlock body = new StatementBlock(new Statement[] { forLoop }); diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java index 5e413eb2193..ebac183107c 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/loader/JP2KeYConverter.java @@ -84,7 +84,7 @@ import static com.github.javaparser.ast.Modifier.DefaultKeyword.*; import static de.uka.ilkd.key.java.ast.declaration.Modifier.createModifierList; import static de.uka.ilkd.key.java.ast.expression.operator.LogicFunctionalOperator.LogicFunction.*; -import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.Negative; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.NEGATIVE; import static java.lang.String.format; /** @@ -254,25 +254,25 @@ public Object visit(BinaryExpr n, Void arg) { var pi = createPositionInfo(n); var c = createComments(n); var op = switch (n.getOperator()) { - case OR -> BinaryOperatorKind.LogicalOr; - case AND -> BinaryOperatorKind.LogicalAnd; - case BINARY_OR -> BinaryOperatorKind.BinaryOr; - case BINARY_AND -> BinaryOperatorKind.BinaryAnd; - case XOR -> BinaryOperatorKind.BinaryXOr; - case EQUALS -> BinaryOperatorKind.Equals; - case NOT_EQUALS -> BinaryOperatorKind.NotEquals; - case LESS -> BinaryOperatorKind.LessThan; - case GREATER -> BinaryOperatorKind.GreaterThan; - case LESS_EQUALS -> BinaryOperatorKind.LessOrEquals; - case GREATER_EQUALS -> BinaryOperatorKind.GreaterOrEquals; - case LEFT_SHIFT -> BinaryOperatorKind.ShiftLeft; - case SIGNED_RIGHT_SHIFT -> BinaryOperatorKind.ShiftRight; - case UNSIGNED_RIGHT_SHIFT -> BinaryOperatorKind.UnsignedShiftRight; - case PLUS -> BinaryOperatorKind.Plus; - case MINUS -> BinaryOperatorKind.Minus; - case MULTIPLY -> BinaryOperatorKind.Times; - case DIVIDE -> BinaryOperatorKind.Divide; - case REMAINDER -> BinaryOperatorKind.Modulo; + case OR -> BinaryOperatorKind.LOGICAL_OR; + case AND -> BinaryOperatorKind.LOGICAL_AND; + case BINARY_OR -> BinaryOperatorKind.BINARY_OR; + case BINARY_AND -> BinaryOperatorKind.BINARY_AND; + case XOR -> BinaryOperatorKind.BINARY_XOR; + case EQUALS -> BinaryOperatorKind.EQUALS; + case NOT_EQUALS -> BinaryOperatorKind.NOT_EQUALS; + case LESS -> BinaryOperatorKind.LESS_THAN; + case GREATER -> BinaryOperatorKind.GREATER_THAN; + case LESS_EQUALS -> BinaryOperatorKind.LESS_OR_EQUALS; + case GREATER_EQUALS -> BinaryOperatorKind.GREATER_OR_EQUALS; + case LEFT_SHIFT -> BinaryOperatorKind.SHIFT_LEFT; + case SIGNED_RIGHT_SHIFT -> BinaryOperatorKind.SHIFT_RIGHT; + case UNSIGNED_RIGHT_SHIFT -> BinaryOperatorKind.UNSIGNED_SHIFT_RIGHT; + case PLUS -> BinaryOperatorKind.PLUS; + case MINUS -> BinaryOperatorKind.MINUS; + case MULTIPLY -> BinaryOperatorKind.TIMES; + case DIVIDE -> BinaryOperatorKind.DIVIDE; + case REMAINDER -> BinaryOperatorKind.MODULO; }; return new BinaryOperator(pi, c, op, lhs, rhs); } @@ -1345,19 +1345,19 @@ public Object visit(UnaryExpr n, Void arg) { } return new IntLiteral(pi, c, -num.intValue()); } - return new UnaryOperator(pi, c, Negative, accept(expr)); + return new UnaryOperator(pi, c, NEGATIVE, accept(expr)); } Expression child = accept(n.getExpression()); var op = switch (n.getOperator()) { - case PLUS -> UnaryOperatorKind.Positive; - case MINUS -> UnaryOperatorKind.Negative; - case PREFIX_INCREMENT -> UnaryOperatorKind.PreIncrement; - case PREFIX_DECREMENT -> UnaryOperatorKind.PreDecrement; - case LOGICAL_COMPLEMENT -> UnaryOperatorKind.LogicalNot; - case BITWISE_COMPLEMENT -> UnaryOperatorKind.BinaryNot; - case POSTFIX_INCREMENT -> UnaryOperatorKind.PostIncrement; - case POSTFIX_DECREMENT -> UnaryOperatorKind.PostDecrement; + case PLUS -> UnaryOperatorKind.POSITIVE; + case MINUS -> UnaryOperatorKind.NEGATIVE; + case PREFIX_INCREMENT -> UnaryOperatorKind.PRE_INCREMENT; + case PREFIX_DECREMENT -> UnaryOperatorKind.PRE_DECREMENT; + case LOGICAL_COMPLEMENT -> UnaryOperatorKind.LOGICAL_NOT; + case BITWISE_COMPLEMENT -> UnaryOperatorKind.BINARY_NOT; + case POSTFIX_INCREMENT -> UnaryOperatorKind.POST_INCREMENT; + case POSTFIX_DECREMENT -> UnaryOperatorKind.POST_DECREMENT; }; return new UnaryOperator(pi, c, op, child); } diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java index 176af4295a8..96cbe1893f2 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/DoubleLDT.java @@ -143,7 +143,7 @@ public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { if (sub != null && sub.sort().extendsTrans(targetSort())) { return op instanceof UnaryOperator uo - && uo.getKind() == UnaryOperator.UnaryOperatorKind.Negative; + && uo.getKind() == UnaryOperator.UnaryOperatorKind.NEGATIVE; } return false; } @@ -189,7 +189,7 @@ public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { if (op instanceof UnaryOperator u - && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative) { + && u.getKind() == UnaryOperator.UnaryOperatorKind.NEGATIVE) { return getJavaUnaryMinus(); } else { return null; diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java index 0ac6ad9d1e6..08fa1610d0a 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/FloatLDT.java @@ -121,7 +121,7 @@ public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { return sub != null && sub.sort().extendsTrans(targetSort()) && op instanceof UnaryOperator u - && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative; + && u.getKind() == UnaryOperator.UnaryOperatorKind.NEGATIVE; } @@ -138,7 +138,7 @@ public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { if ((op instanceof UnaryOperator u) - && u.getKind() == UnaryOperator.UnaryOperatorKind.Negative) { + && u.getKind() == UnaryOperator.UnaryOperatorKind.NEGATIVE) { return getJavaUnaryMinus(); } @@ -147,15 +147,15 @@ public Function getFunctionFor(Operator op, } return switch (b.getKind()) { - case GreaterThan -> getGreaterThan(); - case LessThan -> getLessThan(); - case GreaterOrEquals -> getGreaterOrEquals(); - case LessOrEquals -> getLessOrEquals(); - case Plus -> getJavaAdd(); - case Minus -> getJavaSub(); - case Times -> getJavaMul(); - case Divide -> getJavaDiv(); - case Modulo -> getJavaMod(); + case GREATER_THAN -> getGreaterThan(); + case LESS_THAN -> getLessThan(); + case GREATER_OR_EQUALS -> getGreaterOrEquals(); + case LESS_OR_EQUALS -> getLessOrEquals(); + case PLUS -> getJavaAdd(); + case MINUS -> getJavaSub(); + case TIMES -> getJavaMul(); + case DIVIDE -> getJavaDiv(); + case MODULO -> getJavaMod(); default -> null; }; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java b/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java index 706e26e0be2..5035472b240 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java +++ b/key.core/src/main/java/de/uka/ilkd/key/ldt/SortLDT.java @@ -47,7 +47,7 @@ public boolean isResponsible(Operator op, JTerm[] subs, Services services, ExecutionContext ec) { return op instanceof BinaryOperator lfo - && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.SUBTYPE; } @Override @@ -55,7 +55,7 @@ public boolean isResponsible(Operator op, JTerm left, JTerm right, Services services, ExecutionContext ec) { return op instanceof BinaryOperator lfo - && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.SUBTYPE; } @Override @@ -63,7 +63,7 @@ public boolean isResponsible(Operator op, JTerm sub, TermServices services, ExecutionContext ec) { return op instanceof BinaryOperator lfo - && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype; + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.SUBTYPE; } @Override @@ -76,7 +76,7 @@ public JTerm translateLiteral(Literal lit, Services services) { public Function getFunctionFor(Operator op, Services services, ExecutionContext ec) { if (op instanceof BinaryOperator lfo - && lfo.getKind() == BinaryOperator.BinaryOperatorKind.Subtype) { + && lfo.getKind() == BinaryOperator.BinaryOperatorKind.SUBTYPE) { return ssubsort; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java b/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java index a1cbc7e938b..e415634e1a0 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java +++ b/key.core/src/main/java/de/uka/ilkd/key/logic/sort/ProgramSVSort.java @@ -29,7 +29,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.Negative; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.NEGATIVE; /** * Special "sorts" used for schema variables matching program constructs (class ProgramSV). Not @@ -437,7 +437,7 @@ protected SimpleExpressionSort(Name n) { @Override protected boolean canStandFor(ProgramElement pe, Services services) { - if (pe instanceof UnaryOperator uo && uo.getKind() == Negative) { + if (pe instanceof UnaryOperator uo && uo.getKind() == NEGATIVE) { return uo.getChildAt(0) instanceof Literal; } diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java index 322261f6514..9f0def4aace 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java @@ -1635,7 +1635,7 @@ private StatementBlock constructAbruptTerminationIfCascade() { KeYJavaASTFactory.returnClause(variables.result))); } ifCascade.add(KeYJavaASTFactory.ifThen( - new BinaryOperator(BinaryOperator.BinaryOperatorKind.NotEquals, variables.exception, + new BinaryOperator(BinaryOperator.BinaryOperatorKind.NOT_EQUALS, variables.exception, NullLiteral.NULL), KeYJavaASTFactory.throwClause(variables.exception))); return new StatementBlock(ifCascade.toArray(new Statement[0])); diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java b/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java index 74b8b925726..3c225ee81f3 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/LoopInvariantBuiltInRuleApp.java @@ -36,7 +36,7 @@ import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; -import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LessThan; +import static de.uka.ilkd.key.java.ast.expression.operator.BinaryOperator.BinaryOperatorKind.LESS_THAN; /** * The built in rule app for the loop invariant rule. @@ -102,7 +102,7 @@ protected LoopInvariantBuiltInRuleApp(T rule, PosInOccurrence pio, // the guard is expected to be of the form "i < x" and we want to retrieve "i". assert guard.getChildCount() == 1 : "child count: " + guard.getChildCount(); ProgramElement guardStatement = guard.getChildAt(0); - skipIndex = !(guardStatement instanceof BinaryOperator b && b.getKind() == LessThan); + skipIndex = !(guardStatement instanceof BinaryOperator b && b.getKind() == LESS_THAN); Expression loopIndex = skipIndex ? null : (Expression) ((BinaryOperator) guard.getChildAt(0)).getChildAt(0); skipIndex = skipIndex || !(loopIndex instanceof ProgramVariable); diff --git a/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java b/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java index b463059c72c..d41568f21e6 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java +++ b/key.core/src/test/java/de/uka/ilkd/key/java/TestContextStatementBlock.java @@ -17,7 +17,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.POST_INCREMENT; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -52,7 +52,7 @@ public void testContextTermInstantiation() { PosInProgram suffixStart = PosInProgram.TOP.down(2); assertTrue( PosInProgram.getProgramAt(suffixStart, blockOne.program()) instanceof UnaryOperator uo - && uo.kind == PostIncrement, + && uo.kind == POST_INCREMENT, "Suffix should start with an ++"); for (int i = size - 2; i >= 1; i--) { statementList.add(stContainer.getChildAt(i)); diff --git a/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java b/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java index 7aaa97d5631..1b15cee980d 100644 --- a/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java +++ b/key.core/src/test/java/de/uka/ilkd/key/logic/TestVariableNamer.java @@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test; -import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.PostIncrement; +import static de.uka.ilkd.key.java.ast.expression.operator.UnaryOperator.UnaryOperatorKind.POST_INCREMENT; import static org.junit.jupiter.api.Assertions.*; @@ -69,7 +69,7 @@ private LocationVariable constructProgramVariable(String name) { } private SequentFormula constructFormula(ProgramVariable containedVar) { - Statement statement = new UnaryOperator(PostIncrement, containedVar); + Statement statement = new UnaryOperator(POST_INCREMENT, containedVar); StatementBlock statementBlock = new StatementBlock(statement); JavaBlock javaBlock = JavaBlock.createJavaBlock(statementBlock); @@ -116,7 +116,7 @@ private void addTacletApp(Goal goal, ProgramVariable containedVar) { SchemaVariable sv = SchemaVariableFactory.createProgramSV(new ProgramElementName("sv"), ProgramSVSort.STATEMENT, false); - Statement statement = new UnaryOperator(PostIncrement, containedVar); + Statement statement = new UnaryOperator(POST_INCREMENT, containedVar); app = (NoPosTacletApp) app.addCheckedInstantiation(sv, statement, goal.proof().getServices(), false); @@ -134,7 +134,7 @@ private boolean inTacletApps(Goal goal, ProgramVariable containedVar) { for (var e : insts.getInstantiationMap()) { Object inst = e.value().getInstantiation(); if (inst instanceof UnaryOperator uo - && uo.kind == PostIncrement + && uo.kind == POST_INCREMENT && uo.getFirstElement() == containedVar) { return true; } From 4f9eaaba1c6cc860e0496145e0ee0fcc9d9f45a8 Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Fri, 17 Apr 2026 23:47:41 +0200 Subject: [PATCH 6/7] update taclets.old.txt --- .../de/uka/ilkd/key/nparser/taclets.old.txt | 836 +++++++++--------- 1 file changed, 418 insertions(+), 418 deletions(-) diff --git a/key.core/src/test/resources/de/uka/ilkd/key/nparser/taclets.old.txt b/key.core/src/test/resources/de/uka/ilkd/key/nparser/taclets.old.txt index ffb4cb55fc2..d94d1cbd8a9 100644 --- a/key.core/src/test/resources/de/uka/ilkd/key/nparser/taclets.old.txt +++ b/key.core/src/test/resources/de/uka/ilkd/key/nparser/taclets.old.txt @@ -1,5 +1,5 @@ # This files contains representation of taclets, which are accepted and revised. -# Date: Wed Nov 19 11:46:34 CET 2025 +# Date: Fri Apr 17 23:46:17 CEST 2026 == abortJavaCardTransactionAPI (abortJavaCardTransactionAPI) ========================================= abortJavaCardTransactionAPI { @@ -17,7 +17,7 @@ abortJavaCardTransactionBox { \find(==>box_transaction|{{ .. #abortJavaCardTransaction; ... }}| (post)) -\replacewith([]==>[update-application(elem-update(heap)(anon(savedHeap,allObjects(java.lang.Object::#$transactionConditionallyUpdated),heap)),box(post))]) +\replacewith([]==>[update-application(elem-update(heap)(anon(savedHeap,allObjects(java.lang.Object::#$transactionConditionallyUpdated),heap)),box(post))]) \heuristics(simplify_prog) Choices: (programRules:Java & JavaCard:on)} ----------------------------------------------------- @@ -26,7 +26,7 @@ abortJavaCardTransactionDiamond { \find(==>diamond_transaction|{{ .. #abortJavaCardTransaction; ... }}| (post)) -\replacewith([]==>[update-application(elem-update(heap)(anon(savedHeap,allObjects(java.lang.Object::#$transactionConditionallyUpdated),heap)),diamond(post))]) +\replacewith([]==>[update-application(elem-update(heap)(anon(savedHeap,allObjects(java.lang.Object::#$transactionConditionallyUpdated),heap)),diamond(post))]) \heuristics(simplify_prog) Choices: (programRules:Java & JavaCard:on)} ----------------------------------------------------- @@ -55,11 +55,11 @@ Choices: true} == activeUseAddition (activeUse) ========================================= activeUseAddition { \find(#allmodal ((modal operator))|{{ .. - #sv = #left + #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left + #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -68,11 +68,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseBitwiseAnd (activeUse) ========================================= activeUseBitwiseAnd { \find(#allmodal ((modal operator))|{{ .. - #sv = #left & #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left & #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -81,11 +81,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseBitwiseNegation (activeUse) ========================================= activeUseBitwiseNegation { \find(#allmodal ((modal operator))|{{ .. - #sv = ~#left; + #sv = -#left; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = ~#left; + #typeof(#sv) #v0 = -#left; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -94,11 +94,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseBitwiseOr (activeUse) ========================================= activeUseBitwiseOr { \find(#allmodal ((modal operator))|{{ .. - #sv = #left | #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left | #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -107,11 +107,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseBitwiseXOr (activeUse) ========================================= activeUseBitwiseXOr { \find(#allmodal ((modal operator))|{{ .. - #sv = #left ^ #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left ^ #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -146,11 +146,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseDivision (activeUse) ========================================= activeUseDivision { \find(#allmodal ((modal operator))|{{ .. - #sv = #left / #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left / #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -172,11 +172,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseModulo (activeUse) ========================================= activeUseModulo { \find(#allmodal ((modal operator))|{{ .. - #sv = #left % #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left % #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -198,11 +198,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseShiftLeft (activeUse) ========================================= activeUseShiftLeft { \find(#allmodal ((modal operator))|{{ .. - #sv = #left << #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left << #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -211,11 +211,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseShiftRight (activeUse) ========================================= activeUseShiftRight { \find(#allmodal ((modal operator))|{{ .. - #sv = #left >> #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left >> #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -337,11 +337,11 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseSubtraction (activeUse) ========================================= activeUseSubtraction { \find(#allmodal ((modal operator))|{{ .. - #sv = #left - #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. - #typeof(#sv) #v0 = #left - #right; + #typeof(#sv) #v0 = #left * #right; @(#sv) = #v0; ... }}| (post)) \heuristics(simplify_expression) @@ -363,7 +363,7 @@ Choices: (programRules:Java & initialisation:disableStaticInitialisation)} == activeUseUnsignedShiftRight (activeUse) ========================================= activeUseUnsignedShiftRight { \find(#allmodal ((modal operator))|{{ .. - #sv = #left >>> #right; + #sv = #left * #right; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#sv (program StaticVariable)))) \replacewith(#allmodal ((modal operator))|{{ .. @@ -679,7 +679,7 @@ allocateInstance { #lhs = #t.#allocate()@#t; ... }}| (post)) \varcond(\hasSort(#t2 (program Type), alphaObj)) -\add [and(and(not(equals(#lhs,null)),imp(wellFormed(heap),equals(boolean::select(heap,#lhs,java.lang.Object::#$created),FALSE))),equals(alphaObj::exactInstance(#lhs),TRUE))]==>[] \replacewith([]==>[update-application(elem-update(heap)(create(heap,#lhs)),#allmodal(post))]) +\add [and(and(not(equals(#lhs,null)),imp(wellFormed(heap),equals(boolean::select(heap,#lhs,java.lang.Object::#$created),FALSE))),equals(alphaObj::exactInstance(#lhs),TRUE))]==>[] \replacewith([]==>[update-application(elem-update(heap)(create(heap,#lhs)),#allmodal(post))]) \heuristics(method_expand) Choices: (programRules:Java & permissions:off)} ----------------------------------------------------- @@ -689,7 +689,7 @@ allocateInstanceWithLength { #lhs = #t.#allocate(#len)@#t; ... }}| (post)) \varcond(\hasSort(#t2 (program Type), alphaObj)) -\add [and(and(not(equals(#lhs,null)),imp(wellFormed(heap),and(equals(boolean::select(heap,#lhs,java.lang.Object::#$created),FALSE),equals(length(#lhs),#len)))),equals(alphaObj::exactInstance(#lhs),TRUE))]==>[] \replacewith([]==>[update-application(elem-update(heap)(store(store(create(heap,#lhs),#lhs,java.lang.Object::#$transient,Z(0(#))),#lhs,java.lang.Object::#$transactionConditionallyUpdated,FALSE)),#allmodal(post))]) +\add [and(and(not(equals(#lhs,null)),imp(wellFormed(heap),and(equals(boolean::select(heap,#lhs,java.lang.Object::#$created),FALSE),equals(length(#lhs),#len)))),equals(alphaObj::exactInstance(#lhs),TRUE))]==>[] \replacewith([]==>[update-application(elem-update(heap)(store(store(create(heap,#lhs),#lhs,java.lang.Object::#$transient,Z(0(#))),#lhs,java.lang.Object::#$transactionConditionallyUpdated,FALSE)),#allmodal(post))]) \heuristics(method_expand) Choices: (programRules:Java & permissions:off)} ----------------------------------------------------- @@ -1235,7 +1235,7 @@ Choices: (programRules:Java & assertions:safe)} assignableDefinition { \find(assignable(heapNew,heapOld,locs)) \varcond(\notFreeIn(f (variable), heapNew (Heap term)), \notFreeIn(f (variable), heapOld (Heap term)), \notFreeIn(f (variable), locs (LocSet term)), \notFreeIn(o (variable), heapNew (Heap term)), \notFreeIn(o (variable), heapOld (Heap term)), \notFreeIn(o (variable), locs (LocSet term))) -\replacewith(all{f (variable)}(all{o (variable)}(or(or(elementOf(o,f,locs),and(not(equals(o,null)),not(equals(boolean::select(heapOld,o,java.lang.Object::#$created),TRUE)))),equals(any::select(heapNew,o,f),any::select(heapOld,o,f)))))) +\replacewith(all{f (variable)}(all{o (variable)}(or(or(elementOf(o,f,locs),and(not(equals(o,null)),not(equals(boolean::select(heapOld,o,java.lang.Object::#$created),TRUE)))),equals(any::select(heapNew,o,f),any::select(heapOld,o,f)))))) \heuristics(delayedExpansion) Choices: programRules:Java} ----------------------------------------------------- @@ -1309,7 +1309,7 @@ Choices: programRules:Java} == assignmentAdditionInt (addition) ========================================= assignmentAdditionInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 + #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaAddInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1318,7 +1318,7 @@ Choices: programRules:Java} == assignmentAdditionLong (addition) ========================================= assignmentAdditionLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt + #seLong; + #loc = #seCharByteShortInt * #seLong; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaAddLong(#seCharByteShortInt,#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1327,7 +1327,7 @@ Choices: programRules:Java} == assignmentAdditionLong2 (addition) ========================================= assignmentAdditionLong2 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong + #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaAddLong(#seLong,#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1336,7 +1336,7 @@ Choices: programRules:Java} == assignmentAdditionLong3 (addition) ========================================= assignmentAdditionLong3 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 + #seLong1; + #loc = #seLong0 * #seLong1; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaAddLong(#seLong0,#seLong1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1345,7 +1345,7 @@ Choices: programRules:Java} == assignmentBitwiseAndInt (bitwiseAnd) ========================================= assignmentBitwiseAndInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 & #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseAndInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1354,7 +1354,7 @@ Choices: programRules:Java} == assignmentBitwiseAndLong (bitwiseAnd) ========================================= assignmentBitwiseAndLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt & #seLong; + #loc = #seCharByteShortInt * #seLong; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseAndLong(#seCharByteShortInt,#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1363,7 +1363,7 @@ Choices: programRules:Java} == assignmentBitwiseAndLong2 (bitwiseAnd) ========================================= assignmentBitwiseAndLong2 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong & #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseAndLong(#seLong,#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1372,7 +1372,7 @@ Choices: programRules:Java} == assignmentBitwiseAndLong3 (bitwiseAnd) ========================================= assignmentBitwiseAndLong3 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 & #seLong1; + #loc = #seLong0 * #seLong1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseAndLong(#seLong0,#seLong1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1381,7 +1381,7 @@ Choices: programRules:Java} == assignmentBitwiseOrInt (bitwiseOr) ========================================= assignmentBitwiseOrInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 | #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseOrInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1390,7 +1390,7 @@ Choices: programRules:Java} == assignmentBitwiseOrLong (bitwiseOr) ========================================= assignmentBitwiseOrLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt | #seLong; + #loc = #seCharByteShortInt * #seLong; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseOrLong(#seCharByteShortInt,#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1399,7 +1399,7 @@ Choices: programRules:Java} == assignmentBitwiseOrLong2 (bitwiseOr) ========================================= assignmentBitwiseOrLong2 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong | #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseOrLong(#seLong,#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1408,7 +1408,7 @@ Choices: programRules:Java} == assignmentBitwiseOrLong3 (bitwiseOr) ========================================= assignmentBitwiseOrLong3 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 | #seLong1; + #loc = #seLong0 * #seLong1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseOrLong(#seLong0,#seLong1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1417,7 +1417,7 @@ Choices: programRules:Java} == assignmentBitwiseXOrInt (bitwiseXOr) ========================================= assignmentBitwiseXOrInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 ^ #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseXOrInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1426,7 +1426,7 @@ Choices: programRules:Java} == assignmentBitwiseXOrLong (bitwiseXOr) ========================================= assignmentBitwiseXOrLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt ^ #seLong; + #loc = #seCharByteShortInt * #seLong; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseXOrLong(#seCharByteShortInt,#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1435,7 +1435,7 @@ Choices: programRules:Java} == assignmentBitwiseXOrLong2 (bitwiseXOr) ========================================= assignmentBitwiseXOrLong2 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong ^ #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseXOrLong(#seLong,#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1444,7 +1444,7 @@ Choices: programRules:Java} == assignmentBitwiseXOrLong3 (bitwiseXOr) ========================================= assignmentBitwiseXOrLong3 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 ^ #seLong1; + #loc = #seLong0 * #seLong1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseXOrLong(#seLong0,#seLong1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1453,7 +1453,7 @@ Choices: programRules:Java} == assignmentDivisionBigint1 (division) ========================================= assignmentDivisionBigint1 { \find(==>#allmodal ((modal operator))|{{ .. - #loc = #seBigint / #seAny; + #loc = #seBigint + #seAny; ... }}| (post)) \replacewith([]==>[not(equals(#seAny,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(div(#seBigint,#seAny)),#allmodal(post))]) @@ -1463,7 +1463,7 @@ Choices: ((programRules:Java & bigint:on) & runtimeExceptions:ban)} == assignmentDivisionBigint2 (division) ========================================= assignmentDivisionBigint2 { \find(==>#allmodal ((modal operator))|{{ .. - #loc = #seAny / #seBigint; + #loc = #seAny + #seBigint; ... }}| (post)) \replacewith([]==>[not(equals(#seBigint,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(div(#seAny,#seBigint)),#allmodal(post))]) @@ -1473,7 +1473,7 @@ Choices: ((programRules:Java & bigint:on) & runtimeExceptions:ban)} == assignmentDivisionDouble (division) ========================================= assignmentDivisionDouble { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 / #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaDivDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1483,7 +1483,7 @@ Choices: programRules:Java} == assignmentDivisionDoubleStrictFP (division) ========================================= assignmentDivisionDoubleStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 / #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(divDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1493,7 +1493,7 @@ Choices: programRules:Java} == assignmentDivisionFloat (division) ========================================= assignmentDivisionFloat { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 / #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaDivFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1503,7 +1503,7 @@ Choices: programRules:Java} == assignmentDivisionFloatStrictFP (division) ========================================= assignmentDivisionFloatStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 / #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(divFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1513,7 +1513,7 @@ Choices: programRules:Java} == assignmentDivisionInt (division) ========================================= assignmentDivisionInt { \find(==>#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 / #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \replacewith([]==>[not(equals(#seCharByteShortInt1,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(javaDivInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))]) @@ -1533,7 +1533,7 @@ Choices: (programRules:Java & runtimeExceptions:ban)} == assignmentDivisionLong2 (division) ========================================= assignmentDivisionLong2 { \find(==>#normalassign ((modal operator))|{{ .. - #loc = #seLong / #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \replacewith([]==>[not(equals(#seCharByteShortInt,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(javaDivLong(#seLong,#seCharByteShortInt)),#normalassign(post))]) @@ -1543,7 +1543,7 @@ Choices: (programRules:Java & runtimeExceptions:ban)} == assignmentModDouble (mod) ========================================= assignmentModDouble { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 % #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaModDouble(#seDouble0,#seDouble1)),#normalassign(post))) \heuristics(executeFloatAssignment) @@ -1552,7 +1552,7 @@ Choices: programRules:Java} == assignmentModFloat (mod) ========================================= assignmentModFloat { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 % #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaModFloat(#seFloat0,#seFloat1)),#normalassign(post))) \heuristics(executeFloatAssignment) @@ -1571,7 +1571,7 @@ Choices: (programRules:Java & runtimeExceptions:ban)} == assignmentModuloBigint1 (modulo) ========================================= assignmentModuloBigint1 { \find(==>#allmodal ((modal operator))|{{ .. - #loc = #seBigint % #seAny; + #loc = #seBigint + #seAny; ... }}| (post)) \replacewith([]==>[not(equals(#seAny,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(mod(#seBigint,#seAny)),#allmodal(post))]) @@ -1581,7 +1581,7 @@ Choices: ((programRules:Java & bigint:on) & runtimeExceptions:ban)} == assignmentModuloBigint2 (modulo) ========================================= assignmentModuloBigint2 { \find(==>#allmodal ((modal operator))|{{ .. - #loc = #seAny % #seBigint; + #loc = #seAny + #seBigint; ... }}| (post)) \replacewith([]==>[not(equals(#seBigint,Z(0(#))))]) ; \replacewith([]==>[update-application(elem-update(#loc (program Variable))(mod(#seAny,#seBigint)),#allmodal(post))]) @@ -1591,7 +1591,7 @@ Choices: ((programRules:Java & bigint:on) & runtimeExceptions:ban)} == assignmentMultiplicationBigint1 (multiplication) ========================================= assignmentMultiplicationBigint1 { \find(#allmodal ((modal operator))|{{ .. - #loc = #seBigint * #seAny; + #loc = #seBigint + #seAny; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(mul(#seBigint,#seAny)),#allmodal(post))) \heuristics(executeIntegerAssignment) @@ -1600,7 +1600,7 @@ Choices: (programRules:Java & bigint:on)} == assignmentMultiplicationBigint2 (multiplication) ========================================= assignmentMultiplicationBigint2 { \find(#allmodal ((modal operator))|{{ .. - #loc = #seAny * #seBigint; + #loc = #seAny + #seBigint; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(mul(#seAny,#seBigint)),#allmodal(post))) \heuristics(executeIntegerAssignment) @@ -1609,7 +1609,7 @@ Choices: (programRules:Java & bigint:on)} == assignmentMultiplicationDouble (multiplication) ========================================= assignmentMultiplicationDouble { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 * #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaMulDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1619,7 +1619,7 @@ Choices: programRules:Java} == assignmentMultiplicationDoubleStrictFP (multiplication) ========================================= assignmentMultiplicationDoubleStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 * #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(mulDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1629,7 +1629,7 @@ Choices: programRules:Java} == assignmentMultiplicationFloat (multiplication) ========================================= assignmentMultiplicationFloat { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 * #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaMulFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1639,7 +1639,7 @@ Choices: programRules:Java} == assignmentMultiplicationFloatStrictFP (multiplication) ========================================= assignmentMultiplicationFloatStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 * #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(mulFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1685,7 +1685,7 @@ Choices: programRules:Java} == assignmentShiftLeftInt (shift) ========================================= assignmentShiftLeftInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 << #se; + #loc = #seCharByteShortInt0 >> #se; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaShiftLeftInt(#seCharByteShortInt0,#se)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1694,7 +1694,7 @@ Choices: programRules:Java} == assignmentShiftLeftLong (shift) ========================================= assignmentShiftLeftLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 << #se; + #loc = #seLong0 >> #se; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaShiftLeftLong(#seLong0,#se)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1721,7 +1721,7 @@ Choices: programRules:Java} == assignmentSubtractionBigint1 (subtraction) ========================================= assignmentSubtractionBigint1 { \find(#allmodal ((modal operator))|{{ .. - #loc = #seBigint - #seAny; + #loc = #seBigint + #seAny; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(sub(#seBigint,#seAny)),#allmodal(post))) \heuristics(executeIntegerAssignment) @@ -1730,7 +1730,7 @@ Choices: (programRules:Java & bigint:on)} == assignmentSubtractionBigint2 (subtraction) ========================================= assignmentSubtractionBigint2 { \find(#allmodal ((modal operator))|{{ .. - #loc = #seAny - #seBigint; + #loc = #seAny + #seBigint; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(sub(#seAny,#seBigint)),#allmodal(post))) \heuristics(executeIntegerAssignment) @@ -1739,7 +1739,7 @@ Choices: (programRules:Java & bigint:on)} == assignmentSubtractionDouble (subtraction) ========================================= assignmentSubtractionDouble { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 - #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaSubDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1749,7 +1749,7 @@ Choices: programRules:Java} == assignmentSubtractionDoubleStrictFP (subtraction) ========================================= assignmentSubtractionDoubleStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seDouble0 - #seDouble1; + #loc = #seDouble0 + #seDouble1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(subDouble(#seDouble0,#seDouble1)),#normalassign(post))) @@ -1759,7 +1759,7 @@ Choices: programRules:Java} == assignmentSubtractionFloat (subtraction) ========================================= assignmentSubtractionFloat { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 - #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\not\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(javaSubFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1769,7 +1769,7 @@ Choices: programRules:Java} == assignmentSubtractionFloatStrictFP (subtraction) ========================================= assignmentSubtractionFloatStrictFP { \find(#normalassign ((modal operator))|{{ .. - #loc = #seFloat0 - #seFloat1; + #loc = #seFloat0 + #seFloat1; ... }}| (post)) \varcond(\isStrictFp) \replacewith(update-application(elem-update(#loc (program Variable))(subFloat(#seFloat0,#seFloat1)),#normalassign(post))) @@ -1779,7 +1779,7 @@ Choices: programRules:Java} == assignmentSubtractionInt (subtraction) ========================================= assignmentSubtractionInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 - #seCharByteShortInt1; + #loc = #seCharByteShortInt0 * #seCharByteShortInt1; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaSubInt(#seCharByteShortInt0,#seCharByteShortInt1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1788,7 +1788,7 @@ Choices: programRules:Java} == assignmentSubtractionLong (subtraction) ========================================= assignmentSubtractionLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt - #seLong; + #loc = #seCharByteShortInt * #seLong; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaSubLong(#seCharByteShortInt,#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1797,7 +1797,7 @@ Choices: programRules:Java} == assignmentSubtractionLong2 (subtraction) ========================================= assignmentSubtractionLong2 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong - #seCharByteShortInt; + #loc = #seLong * #seCharByteShortInt; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaSubLong(#seLong,#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1806,7 +1806,7 @@ Choices: programRules:Java} == assignmentSubtractionLong3 (subtraction) ========================================= assignmentSubtractionLong3 { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 - #seLong1; + #loc = #seLong0 * #seLong1; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaSubLong(#seLong0,#seLong1)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1815,7 +1815,7 @@ Choices: programRules:Java} == assignmentUnsignedShiftRightInt (shift) ========================================= assignmentUnsignedShiftRightInt { \find(#normalassign ((modal operator))|{{ .. - #loc = #seCharByteShortInt0 >>> #se; + #loc = #seCharByteShortInt0 >> #se; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaUnsignedShiftRightInt(#seCharByteShortInt0,#se)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1824,7 +1824,7 @@ Choices: programRules:Java} == assignmentUnsignedShiftRightLong (shift) ========================================= assignmentUnsignedShiftRightLong { \find(#normalassign ((modal operator))|{{ .. - #loc = #seLong0 >>> #se; + #loc = #seLong0 >> #se; ... }}| (post)) \sameUpdateLevel\replacewith(update-application(elem-update(#loc (program Variable))(javaUnsignedShiftRightLong(#seLong0,#se)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -1955,7 +1955,7 @@ assignment_to_primitive_array_component_transaction { \varcond( \not \isReferenceArray(#v (program Variable))) \add [and(not(equals(#v,null)),or(leq(length(#v),#se),lt(#se,Z(0(#)))))]==>[] \replacewith([]==>[false]) ; \add [equals(#v,null)]==>[] \replacewith([]==>[false]) ; -\replacewith([]==>[update-application(elem-update(heap)(store(heap,#v,arr(#se),#se0)),update-application(elem-update(savedHeap)(if-then-else(equals(int::select(heap,#v,java.lang.Object::#$transient),Z(0(#))),store(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated,TRUE),if-then-else(equals(boolean::select(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated),FALSE),store(savedHeap,#v,arr(#se),#se0),savedHeap))),#transaction(post)))]) +\replacewith([]==>[update-application(elem-update(heap)(store(heap,#v,arr(#se),#se0)),update-application(elem-update(savedHeap)(if-then-else(equals(int::select(heap,#v,java.lang.Object::#$transient),Z(0(#))),store(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated,TRUE),if-then-else(equals(boolean::select(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated),FALSE),store(savedHeap,#v,arr(#se),#se0),savedHeap))),#transaction(post)))]) \heuristics(simplify_prog_subset, simplify_prog) Choices: ((programRules:Java & runtimeExceptions:ban) & JavaCard:on)} ----------------------------------------------------- @@ -1981,7 +1981,7 @@ assignment_to_reference_array_component_transaction { \add [and(and(and(not(equals(#v,null)),lt(#se,length(#v))),geq(#se,Z(0(#)))),not(arrayStoreValid(#v,#se0)))]==>[] \replacewith([]==>[false]) ; \add [and(not(equals(#v,null)),or(leq(length(#v),#se),lt(#se,Z(0(#)))))]==>[] \replacewith([]==>[false]) ; \add [equals(#v,null)]==>[] \replacewith([]==>[false]) ; -\replacewith([]==>[update-application(elem-update(heap)(store(heap,#v,arr(#se),#se0)),update-application(elem-update(savedHeap)(if-then-else(equals(int::select(heap,#v,java.lang.Object::#$transient),Z(0(#))),store(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated,TRUE),if-then-else(equals(boolean::select(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated),FALSE),store(savedHeap,#v,arr(#se),#se0),savedHeap))),#transaction(post)))]) +\replacewith([]==>[update-application(elem-update(heap)(store(heap,#v,arr(#se),#se0)),update-application(elem-update(savedHeap)(if-then-else(equals(int::select(heap,#v,java.lang.Object::#$transient),Z(0(#))),store(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated,TRUE),if-then-else(equals(boolean::select(savedHeap,#v,java.lang.Object::#$transactionConditionallyUpdated),FALSE),store(savedHeap,#v,arr(#se),#se0),savedHeap))),#transaction(post)))]) \heuristics(simplify_prog_subset, simplify_prog) Choices: ((programRules:Java & runtimeExceptions:ban) & JavaCard:on)} ----------------------------------------------------- @@ -2466,7 +2466,7 @@ Choices: true} == bitwiseNegationInt (invertBits) ========================================= bitwiseNegationInt { \find(#normalassign ((modal operator))|{{ .. - #loc = ~#seCharByteShortInt; + #loc = -#seCharByteShortInt; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseNegateInt(#seCharByteShortInt)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -2475,7 +2475,7 @@ Choices: programRules:Java} == bitwiseNegationLong (invertBits) ========================================= bitwiseNegationLong { \find(#normalassign ((modal operator))|{{ .. - #loc = ~#seLong; + #loc = -#seLong; ... }}| (post)) \replacewith(update-application(elem-update(#loc (program Variable))(javaBitwiseNegateLong(#seLong)),#normalassign(post))) \heuristics(executeIntegerAssignment) @@ -3712,12 +3712,12 @@ Choices: true} == compound_addition_1 (addition) ========================================= compound_addition_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse + #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v + #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3725,13 +3725,13 @@ Choices: programRules:Java} == compound_addition_2 (addition) ========================================= compound_addition_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e + #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 + #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3809,7 +3809,7 @@ Choices: programRules:Java} == compound_assignment_4_simple (assignment_and) ========================================= compound_assignment_4_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seBool0 & #seBool1; + #lhs = #seBool0 && #seBool1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(equals(#seBool0,TRUE),if-then-else(equals(#seBool1,TRUE),TRUE,FALSE),FALSE)),#allmodal(post))) \heuristics(simplify_expression) @@ -3818,12 +3818,12 @@ Choices: programRules:Java} == compound_assignment_5_mixed (compound_assignment) ========================================= compound_assignment_5_mixed { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nseBool0 || #seBool1; + #lhs = #nseBool0 && #seBool1; ... }}| (post)) \varcond(\new(#v0 (program Variable), (type, sort): (boolean,boolean))) \replacewith(#allmodal ((modal operator))|{{ .. boolean #v0 = #nseBool0; - #lhs = #v0 || #seBool1; + #lhs = #v0 && #seBool1; ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -3831,7 +3831,7 @@ Choices: programRules:Java} == compound_assignment_5_nonsimple (compound_assignment) ========================================= compound_assignment_5_nonsimple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #exBool0 || #nseBool1; + #lhs = #exBool0 && #nseBool1; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. if (#exBool0) #lhs = true; @@ -3843,7 +3843,7 @@ Choices: programRules:Java} == compound_assignment_5_simple (assignment_or) ========================================= compound_assignment_5_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seBool0 || #seBool1; + #lhs = #seBool0 && #seBool1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(equals(#seBool0,TRUE),TRUE,if-then-else(equals(#seBool1,TRUE),TRUE,FALSE))),#allmodal(post))) \heuristics(simplify_expression) @@ -3852,13 +3852,13 @@ Choices: programRules:Java} == compound_assignment_6_nonsimple (compound_assignment) ========================================= compound_assignment_6_nonsimple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nseBool0 | #exBool1; + #lhs = #nseBool0 & #exBool1; ... }}| (post)) \varcond(\new(#v1 (program Variable), (type, sort): (boolean,boolean)), \new(#v0 (program Variable), (type, sort): (boolean,boolean))) \replacewith(#allmodal ((modal operator))|{{ .. boolean #v0 = #nseBool0; boolean #v1 = #exBool1; - #lhs = #v0 | #v1; + #lhs = #v0 & #v1; ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -3866,7 +3866,7 @@ Choices: programRules:Java} == compound_assignment_6_simple (assignment_or) ========================================= compound_assignment_6_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seBool0 | #seBool1; + #lhs = #seBool0 && #seBool1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(equals(#seBool0,TRUE),TRUE,if-then-else(equals(#seBool1,TRUE),TRUE,FALSE))),#allmodal(post))) \heuristics(simplify_expression) @@ -3875,10 +3875,10 @@ Choices: programRules:Java} == compound_assignment_op_and (compound_assignment_op_and) ========================================= compound_assignment_op_and { \find(#allmodal ((modal operator))|{{ .. - #lhs &= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs & (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3886,13 +3886,13 @@ Choices: programRules:Java} == compound_assignment_op_and_array (compound_assignment_op_and_array) ========================================= compound_assignment_op_and_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] &= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] & #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3900,13 +3900,13 @@ Choices: programRules:Java} == compound_assignment_op_and_attr (compound_assignment_op_and_attr) ========================================= compound_assignment_op_and_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute &= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute & - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3914,10 +3914,10 @@ Choices: programRules:Java} == compound_assignment_op_div (compound_assignment_op_div) ========================================= compound_assignment_op_div { \find(#allmodal ((modal operator))|{{ .. - #lhs /= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs / (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3925,13 +3925,13 @@ Choices: programRules:Java} == compound_assignment_op_div_array (compound_assignment_op_div_array) ========================================= compound_assignment_op_div_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] /= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] / #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3939,13 +3939,13 @@ Choices: programRules:Java} == compound_assignment_op_div_attr (compound_assignment_op_div_attr) ========================================= compound_assignment_op_div_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute /= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute / - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3953,10 +3953,10 @@ Choices: programRules:Java} == compound_assignment_op_minus (compound_assignment_op_minus) ========================================= compound_assignment_op_minus { \find(#allmodal ((modal operator))|{{ .. - #lhs -= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs - (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3964,13 +3964,13 @@ Choices: programRules:Java} == compound_assignment_op_minus_array (compound_assignment_op_minus_array) ========================================= compound_assignment_op_minus_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] -= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] - #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3978,13 +3978,13 @@ Choices: programRules:Java} == compound_assignment_op_minus_attr (compound_assignment_op_minus_attr) ========================================= compound_assignment_op_minus_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute -= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute - - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -3992,10 +3992,10 @@ Choices: programRules:Java} == compound_assignment_op_mod (compound_assignment_op_mod) ========================================= compound_assignment_op_mod { \find(#allmodal ((modal operator))|{{ .. - #lhs %= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs % (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4003,13 +4003,13 @@ Choices: programRules:Java} == compound_assignment_op_mod_array (compound_assignment_op_mod_array) ========================================= compound_assignment_op_mod_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] %= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] % #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4017,13 +4017,13 @@ Choices: programRules:Java} == compound_assignment_op_mod_attr (compound_assignment_op_mod_attr) ========================================= compound_assignment_op_mod_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute %= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute % - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4061,8 +4061,8 @@ compound_assignment_op_mul_attr { \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute * - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4070,10 +4070,10 @@ Choices: programRules:Java} == compound_assignment_op_or (compound_assignment_op_or) ========================================= compound_assignment_op_or { \find(#allmodal ((modal operator))|{{ .. - #lhs |= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs | (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4081,13 +4081,13 @@ Choices: programRules:Java} == compound_assignment_op_or_array (compound_assignment_op_or_array) ========================================= compound_assignment_op_or_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] |= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] | #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4095,13 +4095,13 @@ Choices: programRules:Java} == compound_assignment_op_or_attr (compound_assignment_op_or_attr) ========================================= compound_assignment_op_or_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute |= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute | - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4109,10 +4109,10 @@ Choices: programRules:Java} == compound_assignment_op_plus (compound_assignment_op_plus) ========================================= compound_assignment_op_plus { \find(#allmodal ((modal operator))|{{ .. - #lhs += #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs + (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4120,13 +4120,13 @@ Choices: programRules:Java} == compound_assignment_op_plus_array (compound_assignment_op_plus_array) ========================================= compound_assignment_op_plus_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] += #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] + #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4134,13 +4134,13 @@ Choices: programRules:Java} == compound_assignment_op_plus_attr (compound_assignment_op_plus_attr) ========================================= compound_assignment_op_plus_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute += #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute + - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4148,10 +4148,10 @@ Choices: programRules:Java} == compound_assignment_op_shiftleft (compound_assignment_op_shiftleft) ========================================= compound_assignment_op_shiftleft { \find(#allmodal ((modal operator))|{{ .. - #lhs <<= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs << (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4159,13 +4159,13 @@ Choices: programRules:Java} == compound_assignment_op_shiftleft_array (compound_assignment_op_shiftleft_array) ========================================= compound_assignment_op_shiftleft_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] <<= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] << #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4173,13 +4173,13 @@ Choices: programRules:Java} == compound_assignment_op_shiftleft_attr (compound_assignment_op_shiftleft_attr) ========================================= compound_assignment_op_shiftleft_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute <<= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute << - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4187,10 +4187,10 @@ Choices: programRules:Java} == compound_assignment_op_shiftright (compound_assignment_op_shiftright) ========================================= compound_assignment_op_shiftright { \find(#allmodal ((modal operator))|{{ .. - #lhs >>= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs >> (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4198,13 +4198,13 @@ Choices: programRules:Java} == compound_assignment_op_shiftright_array (compound_assignment_op_shiftright_array) ========================================= compound_assignment_op_shiftright_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] >>= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] >> #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4212,13 +4212,13 @@ Choices: programRules:Java} == compound_assignment_op_shiftright_attr (compound_assignment_op_shiftright_attr) ========================================= compound_assignment_op_shiftright_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute >>= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute >> - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4226,10 +4226,10 @@ Choices: programRules:Java} == compound_assignment_op_unsigned_shiftright (compound_assignment_op_unsigned_shiftright) ========================================= compound_assignment_op_unsigned_shiftright { \find(#allmodal ((modal operator))|{{ .. - #lhs >>>= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs >>> (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4237,13 +4237,13 @@ Choices: programRules:Java} == compound_assignment_op_unsigned_shiftright_array (compound_assignment_op_unsigned_shiftright_array) ========================================= compound_assignment_op_unsigned_shiftright_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] >>>= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] >>> #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4251,13 +4251,13 @@ Choices: programRules:Java} == compound_assignment_op_unsigned_shiftright_attr (compound_assignment_op_unsigned_shiftright_attr) ========================================= compound_assignment_op_unsigned_shiftright_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute >>>= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute >>> - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4265,10 +4265,10 @@ Choices: programRules:Java} == compound_assignment_op_xor (compound_assignment_op_xor) ========================================= compound_assignment_op_xor { \find(#allmodal ((modal operator))|{{ .. - #lhs ^= #e; + #lhs *= #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = (#typeof(#lhs)) (#lhs ^ (#e)); + #lhs = (#typeof(#lhs)) (#lhs * (#e)); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4276,13 +4276,13 @@ Choices: programRules:Java} == compound_assignment_op_xor_array (compound_assignment_op_xor_array) ========================================= compound_assignment_op_xor_array { \find(#allmodal ((modal operator))|{{ .. - #e0[#e] ^= #e1; + #e0[#e] *= #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] ^ #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4290,13 +4290,13 @@ Choices: programRules:Java} == compound_assignment_op_xor_attr (compound_assignment_op_xor_attr) ========================================= compound_assignment_op_xor_attr { \find(#allmodal ((modal operator))|{{ .. - #e0.#attribute ^= #e; + #e0.#attribute *= #e; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v = #e0; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute ^ - #e); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute * #e); ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4304,13 +4304,13 @@ Choices: programRules:Java} == compound_assignment_xor_nonsimple (compound_assignment) ========================================= compound_assignment_xor_nonsimple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nseBool0 ^ #exBool1; + #lhs = #nseBool0 & #exBool1; ... }}| (post)) \varcond(\new(#v1 (program Variable), (type, sort): (boolean,boolean)), \new(#v0 (program Variable), (type, sort): (boolean,boolean))) \replacewith(#allmodal ((modal operator))|{{ .. boolean #v0 = #nseBool0; boolean #v1 = #exBool1; - #lhs = #v0 ^ #v1; + #lhs = #v0 & #v1; ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -4318,7 +4318,7 @@ Choices: programRules:Java} == compound_assignment_xor_simple (assignment_xor) ========================================= compound_assignment_xor_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seBool0 ^ #seBool1; + #lhs = #seBool0 && #seBool1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(equals(#seBool0,#seBool1),FALSE,TRUE)),#allmodal(post))) \heuristics(simplify_expression) @@ -4327,12 +4327,12 @@ Choices: programRules:Java} == compound_binary_AND_1 (binary_AND) ========================================= compound_binary_AND_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse & #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v & #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4340,13 +4340,13 @@ Choices: programRules:Java} == compound_binary_AND_2 (binary_AND) ========================================= compound_binary_AND_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e & #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 & #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4354,12 +4354,12 @@ Choices: programRules:Java} == compound_binary_OR_1 (binary_OR) ========================================= compound_binary_OR_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse | #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v | #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4367,13 +4367,13 @@ Choices: programRules:Java} == compound_binary_OR_2 (binary_OR) ========================================= compound_binary_OR_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e | #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 | #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4381,12 +4381,12 @@ Choices: programRules:Java} == compound_binary_XOR_1 (binary_XOR) ========================================= compound_binary_XOR_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse ^ #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v ^ #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4394,13 +4394,13 @@ Choices: programRules:Java} == compound_binary_XOR_2 (binary_XOR) ========================================= compound_binary_XOR_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e ^ #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 ^ #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4408,12 +4408,12 @@ Choices: programRules:Java} == compound_binary_neg (compound_binary_neg) ========================================= compound_binary_neg { \find(#allmodal ((modal operator))|{{ .. - #lhs = ~#nse; + #lhs = -#nse; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v0 = #nse; - #lhs = ~#v0; + #lhs = -#v0; ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -4434,12 +4434,12 @@ Choices: programRules:Java} == compound_division_1 (division) ========================================= compound_division_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse / #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v / #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4447,13 +4447,13 @@ Choices: programRules:Java} == compound_division_2 (division) ========================================= compound_division_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e / #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 / #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4514,12 +4514,12 @@ Choices: programRules:Java} == compound_greater_equal_than_comparison_1 (greater_or_equal) ========================================= compound_greater_equal_than_comparison_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse0 >= #se; + #lhs = #nse0 == #se; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse0 (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse0) #v0 = #nse0; - #lhs = #v0 >= #se; + #lhs = #v0 == #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4527,13 +4527,13 @@ Choices: programRules:Java} == compound_greater_equal_than_comparison_2 (greater_or_equal) ========================================= compound_greater_equal_than_comparison_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e >= #nse0; + #lhs = #e == #nse0; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse0 (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse0) #v1 = #nse0; - #lhs = #v0 >= #v1; + #lhs = #v0 == #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4541,12 +4541,12 @@ Choices: programRules:Java} == compound_greater_than_comparison_1 (greater_than) ========================================= compound_greater_than_comparison_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse0 > #se; + #lhs = #nse0 == #se; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse0 (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse0) #v0 = #nse0; - #lhs = #v0 > #se; + #lhs = #v0 == #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4554,13 +4554,13 @@ Choices: programRules:Java} == compound_greater_than_comparison_2 (greater_than) ========================================= compound_greater_than_comparison_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e > #nse0; + #lhs = #e == #nse0; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse0 (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse0) #v1 = #nse0; - #lhs = #v0 > #v1; + #lhs = #v0 == #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4568,12 +4568,12 @@ Choices: programRules:Java} == compound_inequality_comparison_1 (inequality) ========================================= compound_inequality_comparison_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse0 != #se; + #lhs = #nse0 == #se; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse0 (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse0) #v0 = #nse0; - #lhs = #v0 != #se; + #lhs = #v0 == #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4581,13 +4581,13 @@ Choices: programRules:Java} == compound_inequality_comparison_2 (inequality) ========================================= compound_inequality_comparison_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e != #nse0; + #lhs = #e == #nse0; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse0 (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse0) #v1 = #nse0; - #lhs = #v0 != #v1; + #lhs = #v0 == #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4621,12 +4621,12 @@ Choices: programRules:Java} == compound_less_equal_than_comparison_1 (less_or_equal) ========================================= compound_less_equal_than_comparison_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse0 <= #se; + #lhs = #nse0 == #se; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse0 (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse0) #v0 = #nse0; - #lhs = #v0 <= #se; + #lhs = #v0 == #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4634,13 +4634,13 @@ Choices: programRules:Java} == compound_less_equal_than_comparison_2 (less_or_equal) ========================================= compound_less_equal_than_comparison_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e <= #nse0; + #lhs = #e == #nse0; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse0 (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse0) #v1 = #nse0; - #lhs = #v0 <= #v1; + #lhs = #v0 == #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4648,12 +4648,12 @@ Choices: programRules:Java} == compound_less_than_comparison_1 (less_than) ========================================= compound_less_than_comparison_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse0 < #se; + #lhs = #nse0 == #se; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#nse0 (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse0) #v0 = #nse0; - #lhs = #v0 < #se; + #lhs = #v0 == #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4661,13 +4661,13 @@ Choices: programRules:Java} == compound_less_than_comparison_2 (less_than) ========================================= compound_less_than_comparison_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e < #nse0; + #lhs = #e == #nse0; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse0 (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse0) #v1 = #nse0; - #lhs = #v0 < #v1; + #lhs = #v0 == #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4688,12 +4688,12 @@ Choices: programRules:Java} == compound_modulo_1 (modulo) ========================================= compound_modulo_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse % #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v % #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4701,13 +4701,13 @@ Choices: programRules:Java} == compound_modulo_2 (modulo) ========================================= compound_modulo_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e % #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 % #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4768,12 +4768,12 @@ Choices: programRules:Java} == compound_shiftleft_1 (shift) ========================================= compound_shiftleft_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse << #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v << #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4781,13 +4781,13 @@ Choices: programRules:Java} == compound_shiftleft_2 (shift) ========================================= compound_shiftleft_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e << #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 << #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4795,12 +4795,12 @@ Choices: programRules:Java} == compound_shiftright_1 (shift) ========================================= compound_shiftright_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse >> #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v >> #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4808,13 +4808,13 @@ Choices: programRules:Java} == compound_shiftright_2 (shift) ========================================= compound_shiftright_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e >> #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 >> #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4835,12 +4835,12 @@ Choices: programRules:Java} == compound_subtraction_1 (subtraction) ========================================= compound_subtraction_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse - #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v - #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4848,13 +4848,13 @@ Choices: programRules:Java} == compound_subtraction_2 (subtraction) ========================================= compound_subtraction_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e - #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 - #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4886,12 +4886,12 @@ Choices: programRules:Java} == compound_unsigned_shiftright_1 (shift) ========================================= compound_unsigned_shiftright_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #nse >>> #se; + #lhs = #nse * #se; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#nse (program NonSimpleExpression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#nse) #v = #nse; - #lhs = #v >>> #se; + #lhs = #v * #se; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -4899,13 +4899,13 @@ Choices: programRules:Java} == compound_unsigned_shiftright_2 (shift) ========================================= compound_unsigned_shiftright_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs = #e >>> #nse; + #lhs = #e * #nse; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#nse (program NonSimpleExpression))), \new(#v0 (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v0 = #e; #typeof(#nse) #v1 = #nse; - #lhs = #v0 >>> #v1; + #lhs = #v0 * #v1; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -5163,14 +5163,14 @@ Choices: true} createdInHeapToElementOf { \find(createdInHeap(s,h)) \varcond(\notFreeIn(fv (variable), h (Heap term)), \notFreeIn(fv (variable), s (LocSet term)), \notFreeIn(ov (variable), h (Heap term)), \notFreeIn(ov (variable), s (LocSet term))) -\replacewith(all{ov (variable)}(all{fv (variable)}(imp(elementOf(ov,fv,s),or(equals(ov,null),equals(boolean::select(h,ov,java.lang.Object::#$created),TRUE)))))) +\replacewith(all{ov (variable)}(all{fv (variable)}(imp(elementOf(ov,fv,s),or(equals(ov,null),equals(boolean::select(h,ov,java.lang.Object::#$created),TRUE)))))) \heuristics(classAxiom) Choices: programRules:Java} ----------------------------------------------------- == createdInHeapWithAllFields (createdInHeapWithAllFields) ========================================= createdInHeapWithAllFields { \find(createdInHeap(allFields(o),h)) -\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) +\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -5178,14 +5178,14 @@ Choices: programRules:Java} createdInHeapWithAllFieldsEQ { \assumes ([equals(allFields(o),EQ)]==>[]) \find(createdInHeap(EQ,h)) -\sameUpdateLevel\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) +\sameUpdateLevel\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- == createdInHeapWithArrayRange (createdInHeapWithArrayRange) ========================================= createdInHeapWithArrayRange { \find(createdInHeap(arrayRange(o,lower,upper),h)) -\replacewith(or(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),lt(upper,lower))) +\replacewith(or(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),lt(upper,lower))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -5193,7 +5193,7 @@ Choices: programRules:Java} createdInHeapWithArrayRangeEQ { \assumes ([equals(arrayRange(o,lower,upper),EQ)]==>[]) \find(createdInHeap(EQ,h)) -\sameUpdateLevel\replacewith(or(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),lt(upper,lower))) +\sameUpdateLevel\replacewith(or(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),lt(upper,lower))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -5254,7 +5254,7 @@ Choices: programRules:Java} == createdInHeapWithSingleton (createdInHeapWithSingleton) ========================================= createdInHeapWithSingleton { \find(createdInHeap(singleton(o,f),h)) -\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) +\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -5262,7 +5262,7 @@ Choices: programRules:Java} createdInHeapWithSingletonEQ { \assumes ([equals(singleton(o,f),EQ)]==>[]) \find(createdInHeap(EQ,h)) -\sameUpdateLevel\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) +\sameUpdateLevel\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -5335,7 +5335,7 @@ Choices: true} defInDomainImpliesCreated { \find(inDomainImpliesCreated(m)) \varcond(\notFreeIn(o (variable), m (Map term))) -\replacewith(all{o (variable)}(imp(inDomain(m,o),equals(boolean::select(heap,o,java.lang.Object::#$created),TRUE)))) +\replacewith(all{o (variable)}(imp(inDomain(m,o),equals(boolean::select(heap,o,java.lang.Object::#$created),TRUE)))) \heuristics(simplify_enlarging) Choices: true} ----------------------------------------------------- @@ -5495,7 +5495,7 @@ Choices: true} definitionOfNewOnHeap { \find(==>newOnHeap(h,s)) \varcond(\notFreeIn(i (variable), h (Heap term)), \notFreeIn(i (variable), s (Seq term))) -\replacewith([]==>[all{i (variable)}(imp(and(leq(Z(0(#)),i),lt(i,seqLen(s))),and(imp(equals(java.lang.Object::instance(any::seqGet(s,i)),TRUE),equals(boolean::select(h,java.lang.Object::seqGet(s,i),java.lang.Object::#$created),FALSE)),imp(equals(Seq::instance(any::seqGet(s,i)),TRUE),newOnHeap(h,Seq::seqGet(s,i))))))]) +\replacewith([]==>[all{i (variable)}(imp(and(leq(Z(0(#)),i),lt(i,seqLen(s))),and(imp(equals(java.lang.Object::instance(any::seqGet(s,i)),TRUE),equals(boolean::select(h,java.lang.Object::seqGet(s,i),java.lang.Object::#$created),FALSE)),imp(equals(Seq::instance(any::seqGet(s,i)),TRUE),newOnHeap(h,Seq::seqGet(s,i))))))]) \heuristics(comprehensions) Choices: true} ----------------------------------------------------- @@ -6248,7 +6248,7 @@ Choices: programRules:Java} dynamic_type_for_null { \find(G::exactInstance(null)) \varcond(\not\same(G, Null)) -\replacewith(FALSE) +\replacewith(FALSE) \heuristics(concrete) Choices: programRules:Java} ----------------------------------------------------- @@ -6307,7 +6307,7 @@ Choices: programRules:Java} == elementOfFreshLocs (elementOfFreshLocs) ========================================= elementOfFreshLocs { \find(elementOf(o,f,freshLocs(h))) -\replacewith(and(not(equals(o,null)),not(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)))) +\replacewith(and(not(equals(o,null)),not(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)))) \heuristics(concrete) Choices: programRules:Java} ----------------------------------------------------- @@ -7592,13 +7592,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_10_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_10_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] |= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] | #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7607,13 +7607,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_10_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_10_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute |= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute | - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7622,13 +7622,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_11_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_11_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] ^= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] ^ #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7637,13 +7637,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_11_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_11_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute ^= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute ^ - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7652,7 +7652,7 @@ Choices: programRules:Java} == eval_order_iterated_assignments_1_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_1_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] *= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. @@ -7667,13 +7667,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_1_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_1_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute *= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute * - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7682,13 +7682,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_2_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_2_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] /= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] / #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7697,13 +7697,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_2_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_2_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute /= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute / - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7712,13 +7712,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_3_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_3_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] %= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] % #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7727,13 +7727,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_3_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_3_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute %= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute % - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7742,13 +7742,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_4_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_4_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] += #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] + #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7757,13 +7757,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_4_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_4_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute += #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute + - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7772,13 +7772,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_5_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_5_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] -= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] - #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7787,13 +7787,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_5_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_5_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute -= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute - - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7802,13 +7802,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_6_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_6_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] <<= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] << #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7817,13 +7817,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_6_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_6_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute <<= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute << - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7832,13 +7832,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_7_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_7_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] >>= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] >> #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7847,13 +7847,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_7_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_7_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute >>= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute >> - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7862,13 +7862,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_8_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_8_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] >>>= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] >>> #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7877,13 +7877,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_8_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_8_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute >>>= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute >>> - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -7892,13 +7892,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_9_0 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_9_0 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0[#e] &= #e1; + #lhs0 = #e0[#e] = #e1; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#e (program Expression))), \new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; #typeof(#e) #v1 = #e; - #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] & #e1); + #v0[#v1] = (#typeof(#e0[#e])) (#v0[#v1] * #e1); #lhs0 = #v0[#v1]; ... }}| (post)) \heuristics(simplify_prog) @@ -7907,13 +7907,13 @@ Choices: programRules:Java} == eval_order_iterated_assignments_9_1 (eval_order_iterated_assignments) ========================================= eval_order_iterated_assignments_9_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e0.#attribute &= #e; + #lhs0 = #e0.#attribute = #e; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e0) #v0 = #e0; - #v0.#attribute = (#typeof(#attribute)) (#v0.#attribute & - #e); + #v0.#attribute = + (#typeof(#attribute)) (#v0.#attribute * #e); #lhs0 = #v0.#attribute; ... }}| (post)) \heuristics(simplify_prog) @@ -9602,7 +9602,7 @@ getJavaCardTransient { #jcsystemType.#getTransient(#se)@#jcsystemType; ... }}| (post)) \replacewith([]==>[not(equals(#se,null))]) ; -\replacewith([]==>[update-application(elem-update(#lhs (program LeftHandSide))(int::select(heap,#se,java.lang.Object::#$transient)),#allmodal(post))]) +\replacewith([]==>[update-application(elem-update(#lhs (program LeftHandSide))(int::select(heap,#se,java.lang.Object::#$transient)),#allmodal(post))]) \heuristics(simplify_prog) Choices: (programRules:Java & JavaCard:on)} ----------------------------------------------------- @@ -9779,7 +9779,7 @@ Choices: true} == greater_equal_than_comparison_new (greater-or-equal than distinction) ========================================= greater_equal_than_comparison_new { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 >= #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(if-then-else(geq(#senf0,#senf1),#allmodal ((modal operator))|{{ .. #lhs = true; @@ -9792,7 +9792,7 @@ Choices: programRules:Java} == greater_equal_than_comparison_simple (greater-or-equal than distinction) ========================================= greater_equal_than_comparison_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 >= #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(geq(#senf0,#senf1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -9801,7 +9801,7 @@ Choices: programRules:Java} == greater_equal_than_comparison_simple_double (greater-or-equal than distinction) ========================================= greater_equal_than_comparison_simple_double { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seDouble0 >= #seDouble1; + #lhs = #seDouble0 == #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(geqDouble(#seDouble0,#seDouble1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -9810,7 +9810,7 @@ Choices: programRules:Java} == greater_equal_than_comparison_simple_float (greater-or-equal than distinction) ========================================= greater_equal_than_comparison_simple_float { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seFloat0 >= #seFloat1; + #lhs = #seFloat0 == #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(geqFloat(#seFloat0,#seFloat1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -9826,7 +9826,7 @@ Choices: true} == greater_than_comparison_new (greater than distinction) ========================================= greater_than_comparison_new { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 > #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(if-then-else(gt(#senf0,#senf1),#allmodal ((modal operator))|{{ .. #lhs = true; @@ -9839,7 +9839,7 @@ Choices: programRules:Java} == greater_than_comparison_simple (greater than distinction) ========================================= greater_than_comparison_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 > #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(gt(#senf0,#senf1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -9848,7 +9848,7 @@ Choices: programRules:Java} == greater_than_comparison_simple_double (greater than distinction) ========================================= greater_than_comparison_simple_double { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seDouble0 > #seDouble1; + #lhs = #seDouble0 == #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(gtDouble(#seDouble0,#seDouble1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -9857,7 +9857,7 @@ Choices: programRules:Java} == greater_than_comparison_simple_float (greater than distinction) ========================================= greater_than_comparison_simple_float { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seFloat0 > #seFloat1; + #lhs = #seFloat0 == #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(gtFloat(#seFloat0,#seFloat1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -11258,7 +11258,7 @@ Choices: true} == inequality_comparison_new (inequality comparison) ========================================= inequality_comparison_new { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 != #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(if-then-else(not(equals(#senf0,#senf1)),#allmodal ((modal operator))|{{ .. #lhs = true; @@ -11271,7 +11271,7 @@ Choices: programRules:Java} == inequality_comparison_simple (inequality comparison) ========================================= inequality_comparison_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 != #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(equals(#senf0,#senf1),FALSE,TRUE)),#allmodal(post))) \heuristics(simplify_prog) @@ -11280,7 +11280,7 @@ Choices: programRules:Java} == inequality_comparison_simple_double (inequality comparison) ========================================= inequality_comparison_simple_double { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seDouble0 != #seDouble1; + #lhs = #seDouble0 == #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(eqDouble(#seDouble0,#seDouble1),FALSE,TRUE)),#allmodal(post))) \heuristics(simplify_prog) @@ -11289,7 +11289,7 @@ Choices: programRules:Java} == inequality_comparison_simple_float (inequality comparison) ========================================= inequality_comparison_simple_float { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seFloat0 != #seFloat1; + #lhs = #seFloat0 == #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(eqFloat(#seFloat0,#seFloat1),FALSE,TRUE)),#allmodal(post))) \heuristics(simplify_prog) @@ -11307,7 +11307,7 @@ Choices: programRules:Java} insert_constant_string_value { \assumes ([wellFormed(heap)]==>[]) \find(#csv) -\sameUpdateLevel\add [or(equals(#constantvalue(#csv),null),and(not(equals(strPool(Seq::cast(#constantvalue(#csv))),null)),equals(boolean::select(heap,strPool(Seq::cast(#constantvalue(#csv))),java.lang.Object::#$created),TRUE)))]==>[] \replacewith(if-then-else(equals(#constantvalue(#csv),null),null,strPool(Seq::cast(#constantvalue(#csv))))) +\sameUpdateLevel\add [or(equals(#constantvalue(#csv),null),and(not(equals(strPool(Seq::cast(#constantvalue(#csv))),null)),equals(boolean::select(heap,strPool(Seq::cast(#constantvalue(#csv))),java.lang.Object::#$created),TRUE)))]==>[] \replacewith(if-then-else(equals(#constantvalue(#csv),null),null,strPool(Seq::cast(#constantvalue(#csv))))) \heuristics(concrete) Choices: true} ----------------------------------------------------- @@ -11581,7 +11581,7 @@ Choices: true} == intersectAllFieldsFreshLocs (intersectAllFieldsFreshLocs) ========================================= intersectAllFieldsFreshLocs { \find(equals(intersect(allFields(o),freshLocs(h)),empty)) -\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) +\replacewith(or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify) Choices: programRules:Java} ----------------------------------------------------- @@ -11705,7 +11705,7 @@ Choices: programRules:Java} == iterated_assignments_1 (eval_order_iterated_assignments) ========================================= iterated_assignments_1 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 *= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); @@ -11717,10 +11717,10 @@ Choices: programRules:Java} == iterated_assignments_10 (eval_order_iterated_assignments) ========================================= iterated_assignments_10 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 |= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 | #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11729,10 +11729,10 @@ Choices: programRules:Java} == iterated_assignments_11 (eval_order_iterated_assignments) ========================================= iterated_assignments_11 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 ^= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 ^ #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11741,10 +11741,10 @@ Choices: programRules:Java} == iterated_assignments_2 (eval_order_iterated_assignments) ========================================= iterated_assignments_2 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 /= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 / #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11753,10 +11753,10 @@ Choices: programRules:Java} == iterated_assignments_3 (eval_order_iterated_assignments) ========================================= iterated_assignments_3 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 %= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 % #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11765,10 +11765,10 @@ Choices: programRules:Java} == iterated_assignments_4 (eval_order_iterated_assignments) ========================================= iterated_assignments_4 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 += #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 + #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11777,10 +11777,10 @@ Choices: programRules:Java} == iterated_assignments_5 (eval_order_iterated_assignments) ========================================= iterated_assignments_5 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 -= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 - #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11789,10 +11789,10 @@ Choices: programRules:Java} == iterated_assignments_6 (eval_order_iterated_assignments) ========================================= iterated_assignments_6 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 <<= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 << #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11801,10 +11801,10 @@ Choices: programRules:Java} == iterated_assignments_7 (eval_order_iterated_assignments) ========================================= iterated_assignments_7 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 >>= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 >> #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11813,10 +11813,10 @@ Choices: programRules:Java} == iterated_assignments_8 (eval_order_iterated_assignments) ========================================= iterated_assignments_8 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 >>>= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 >>> #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -11825,10 +11825,10 @@ Choices: programRules:Java} == iterated_assignments_9 (eval_order_iterated_assignments) ========================================= iterated_assignments_9 { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1 &= #e; + #lhs0 = #lhs1 = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 & #e); + #lhs1 = (#typeof(#lhs1)) (#lhs1 * #e); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_prog) @@ -12342,7 +12342,7 @@ Choices: true} == less_equal_than_comparison_new (less-or-equal than distinction) ========================================= less_equal_than_comparison_new { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 <= #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(if-then-else(leq(#senf0,#senf1),#allmodal ((modal operator))|{{ .. #lhs = true; @@ -12355,7 +12355,7 @@ Choices: programRules:Java} == less_equal_than_comparison_simple (less-or-equal than distinction) ========================================= less_equal_than_comparison_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 <= #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(leq(#senf0,#senf1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -12364,7 +12364,7 @@ Choices: programRules:Java} == less_equal_than_comparison_simple_double (less-or-equal than distinction) ========================================= less_equal_than_comparison_simple_double { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seDouble0 <= #seDouble1; + #lhs = #seDouble0 == #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(leqDouble(#seDouble0,#seDouble1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -12373,7 +12373,7 @@ Choices: programRules:Java} == less_equal_than_comparison_simple_float (less-or-equal than distinction) ========================================= less_equal_than_comparison_simple_float { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seFloat0 <= #seFloat1; + #lhs = #seFloat0 == #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(leqFloat(#seFloat0,#seFloat1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -12446,7 +12446,7 @@ Choices: true} == less_than_comparison_new (lesser than distinction) ========================================= less_than_comparison_new { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 < #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(if-then-else(lt(#senf0,#senf1),#allmodal ((modal operator))|{{ .. #lhs = true; @@ -12459,7 +12459,7 @@ Choices: programRules:Java} == less_than_comparison_simple (lesser than distinction) ========================================= less_than_comparison_simple { \find(#allmodal ((modal operator))|{{ .. - #lhs = #senf0 < #senf1; + #lhs = #senf0 == #senf1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(lt(#senf0,#senf1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -12468,7 +12468,7 @@ Choices: programRules:Java} == less_than_comparison_simple_double (lesser than distinction) ========================================= less_than_comparison_simple_double { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seDouble0 < #seDouble1; + #lhs = #seDouble0 == #seDouble1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(ltDouble(#seDouble0,#seDouble1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -12477,7 +12477,7 @@ Choices: programRules:Java} == less_than_comparison_simple_float (lesser than distinction) ========================================= less_than_comparison_simple_float { \find(#allmodal ((modal operator))|{{ .. - #lhs = #seFloat0 < #seFloat1; + #lhs = #seFloat0 == #seFloat1; ... }}| (post)) \replacewith(update-application(elem-update(#lhs (program LeftHandSide))(if-then-else(ltFloat(#seFloat0,#seFloat1),TRUE,FALSE)),#allmodal(post))) \heuristics(simplify_prog) @@ -13909,7 +13909,7 @@ Choices: true} ----------------------------------------------------- == nullCreated (nullCreated) ========================================= nullCreated { -\add [or(all{h (variable)}(equals(boolean::select(h,null,java.lang.Object::#$created),TRUE)),all{h (variable)}(equals(boolean::select(h,null,java.lang.Object::#$created),FALSE)))]==>[] +\add [or(all{h (variable)}(equals(boolean::select(h,null,java.lang.Object::#$created),TRUE)),all{h (variable)}(equals(boolean::select(h,null,java.lang.Object::#$created),FALSE)))]==>[] Choices: programRules:Java} ----------------------------------------------------- @@ -13976,7 +13976,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreInLocSets { \assumes ([wellFormed(h)]==>[]) \find(elementOf(o2,f2,LocSet::select(h,o,f))==>) -\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -13984,7 +13984,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreInLocSetsEQ { \assumes ([wellFormed(h),equals(LocSet::select(h,o,f),EQ)]==>[]) \find(elementOf(o2,f2,EQ)==>) -\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -13992,7 +13992,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreInLocSetsEQFinal { \assumes ([wellFormed(h),equals(LocSet::final(o,f),EQ)]==>[]) \find(elementOf(o2,f2,EQ)==>) -\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14000,7 +14000,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreInLocSetsFinal { \assumes ([wellFormed(h)]==>[]) \find(elementOf(o2,f2,LocSet::final(o,f))==>) -\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o2,null),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14008,7 +14008,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreObserved { \find(obs) \sameUpdateLevel\varcond(\isObserver (obs (deltaObject term), h (Heap term))) -\add [or(equals(obs,null),equals(boolean::select(h,obs,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(obs,null),equals(boolean::select(h,obs,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14016,7 +14016,7 @@ Choices: programRules:Java} onlyCreatedObjectsAreObservedInLocSets { \find(elementOf(o,f,obs)==>) \varcond(\isObserver (obs (LocSet term), h (Heap term))) -\add [or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14025,7 +14025,7 @@ onlyCreatedObjectsAreObservedInLocSetsEQ { \assumes ([equals(obs,EQ)]==>[]) \find(elementOf(o,f,EQ)==>) \varcond(\isObserver (obs (LocSet term), h (Heap term))) -\add [or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))]==>[] +\add [or(equals(o,null),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14033,15 +14033,15 @@ Choices: programRules:Java} onlyCreatedObjectsAreReferenced { \assumes ([wellFormed(h)]==>[]) \find(deltaObject::select(h,o,f)) -\sameUpdateLevel\add [or(equals(deltaObject::select(h,o,f),null),equals(boolean::select(h,deltaObject::select(h,o,f),java.lang.Object::#$created),TRUE))]==>[] +\sameUpdateLevel\add [or(equals(deltaObject::select(h,o,f),null),equals(boolean::select(h,deltaObject::select(h,o,f),java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- == onlyCreatedObjectsAreReferencedFinal (onlyCreatedObjectsAreReferencedFinal) ========================================= onlyCreatedObjectsAreReferencedFinal { -\assumes ([wellFormed(h),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)]==>[]) +\assumes ([wellFormed(h),equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)]==>[]) \find(deltaObject::final(o,f)) -\sameUpdateLevel\add [or(equals(deltaObject::final(o,f),null),equals(boolean::select(h,deltaObject::final(o,f),java.lang.Object::#$created),TRUE))]==>[] +\sameUpdateLevel\add [or(equals(deltaObject::final(o,f),null),equals(boolean::select(h,deltaObject::final(o,f),java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: programRules:Java} ----------------------------------------------------- @@ -14049,7 +14049,7 @@ Choices: programRules:Java} only_created_objects_are_reachable { \assumes ([wellFormed(h)]==>[equals(o,null)]) \find(reach(h,s,o,o2,n)==>) -\add [or(not(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] +\add [or(not(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE)),equals(boolean::select(h,o2,java.lang.Object::#$created),TRUE))]==>[] \heuristics(inReachableStateImplication) Choices: reach:on} ----------------------------------------------------- @@ -14381,7 +14381,7 @@ Choices: true} == postdecrement (postdecrement) ========================================= postdecrement { \find(#allmodal ((modal operator))|{{ .. - #lhs1--; + ++#lhs1; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. #lhs1 = (#typeof(#lhs1)) #lhs1 - 1; @@ -14392,13 +14392,13 @@ Choices: programRules:Java} == postdecrement_array (postdecrement_array) ========================================= postdecrement_array { \find(#allmodal ((modal operator))|{{ .. - #e[#e0]--; + ++#e[#e0]; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#e0) #v0 = #e0; - #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] - 1); + #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14406,12 +14406,12 @@ Choices: programRules:Java} == postdecrement_assignment (postdecrement_assignment) ========================================= postdecrement_assignment { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1--; + #lhs0 = ++#lhs1; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#lhs0 (program LeftHandSide)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#lhs0) #v = #lhs1; - #lhs1 = (#typeof(#lhs1)) (#lhs1 - 1); + #lhs1 = (#typeof(#lhs1)) (#lhs1 + 1); #lhs0 = #v; ... }}| (post)) \heuristics(simplify_expression) @@ -14420,14 +14420,14 @@ Choices: programRules:Java} == postdecrement_assignment_array (postdecrement_assignment_array) ========================================= postdecrement_assignment_array { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e[#e0]--; + #lhs0 = ++#e[#e0]; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#lhs0 (program LeftHandSide))), \new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#e0) #v0 = #e0; #typeof(#lhs0) #v1 = #v[#v0]; - #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] - 1); + #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] + 1); #lhs0 = #v1; ... }}| (post)) \heuristics(simplify_expression) @@ -14436,14 +14436,14 @@ Choices: programRules:Java} == postdecrement_assignment_attribute (postdecrement_assignment_attribute) ========================================= postdecrement_assignment_attribute { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e.#attribute--; + #lhs0 = ++#e.#attribute; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#lhs0 (program LeftHandSide))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#lhs0) #v1 = #v.#attribute; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute - - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); #lhs0 = #v1; ... }}| (post)) \heuristics(simplify_expression) @@ -14452,13 +14452,13 @@ Choices: programRules:Java} == postdecrement_attribute (postdecrement_attribute) ========================================= postdecrement_attribute { \find(#allmodal ((modal operator))|{{ .. - #e.#attribute--; + ++#e.#attribute; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute - - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14466,7 +14466,7 @@ Choices: programRules:Java} == postincrement (postincrement) ========================================= postincrement { \find(#allmodal ((modal operator))|{{ .. - #lhs1++; + ++#lhs1; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. #lhs1 = (#typeof(#lhs1)) (#lhs1 + 1); @@ -14477,7 +14477,7 @@ Choices: programRules:Java} == postincrement_array (postincrement_array) ========================================= postincrement_array { \find(#allmodal ((modal operator))|{{ .. - #e[#e0]++; + ++#e[#e0]; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. @@ -14491,7 +14491,7 @@ Choices: programRules:Java} == postincrement_assignment (postincrement_assignment) ========================================= postincrement_assignment { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #lhs1++; + #lhs0 = ++#lhs1; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#lhs0 (program LeftHandSide)))) \replacewith(#allmodal ((modal operator))|{{ .. @@ -14505,7 +14505,7 @@ Choices: programRules:Java} == postincrement_assignment_array (postincrement_assignment_array) ========================================= postincrement_assignment_array { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e[#e0]++; + #lhs0 = ++#e[#e0]; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#lhs0 (program LeftHandSide))), \new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. @@ -14521,14 +14521,14 @@ Choices: programRules:Java} == postincrement_assignment_attribute (postincrement_assignment_attribute) ========================================= postincrement_assignment_attribute { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = #e.#attribute++; + #lhs0 = ++#e.#attribute; ... }}| (post)) \varcond(\new(#v1 (program Variable), \typeof(#lhs0 (program LeftHandSide))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#lhs0) #v1 = #v.#attribute; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute + - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); #lhs0 = #v1; ... }}| (post)) \heuristics(simplify_expression) @@ -14537,13 +14537,13 @@ Choices: programRules:Java} == postincrement_attribute (postincrement_attribute) ========================================= postincrement_attribute { \find(#allmodal ((modal operator))|{{ .. - #e.#attribute++; + ++#e.#attribute; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute + - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14777,10 +14777,10 @@ Choices: true} == predecrement (predecrement) ========================================= predecrement { \find(#allmodal ((modal operator))|{{ .. - --#lhs1; + ++#lhs1; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 - 1); + #lhs1 = (#typeof(#lhs1)) (#lhs1 + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14788,13 +14788,13 @@ Choices: programRules:Java} == predecrement_array (predecrement_array) ========================================= predecrement_array { \find(#allmodal ((modal operator))|{{ .. - --#e[#e0]; + ++#e[#e0]; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#e0) #v0 = #e0; - #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] - 1); + #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14802,10 +14802,10 @@ Choices: programRules:Java} == predecrement_assignment (predecrement_assignment) ========================================= predecrement_assignment { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = --#lhs1; + #lhs0 = ++#lhs1; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs1 = (#typeof(#lhs1)) (#lhs1 - 1); + #lhs1 = (#typeof(#lhs1)) (#lhs1 + 1); #lhs0 = #lhs1; ... }}| (post)) \heuristics(simplify_expression) @@ -14814,13 +14814,13 @@ Choices: programRules:Java} == predecrement_assignment_array (predecrement_assignment_array) ========================================= predecrement_assignment_array { \find(#allmodal ((modal operator))|{{ .. - #lhs0 = --#e[#e0]; + #lhs0 = ++#e[#e0]; ... }}| (post)) \varcond(\new(#v0 (program Variable), \typeof(#e0 (program Expression))), \new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; #typeof(#e0) #v0 = #e0; - #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] - 1); + #v[#v0] = (#typeof(#e[#e0])) (#v[#v0] + 1); #lhs0 = #v[#v0]; ... }}| (post)) \heuristics(simplify_expression) @@ -14834,8 +14834,8 @@ predecrement_assignment_attribute { \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute - - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute - 1); #lhs = #v.#attribute; ... }}| (post)) \heuristics(simplify_expression) @@ -14844,13 +14844,13 @@ Choices: programRules:Java} == predecrement_attribute (predecrement_attribute) ========================================= predecrement_attribute { \find(#allmodal ((modal operator))|{{ .. - --#e.#attribute; + ++#e.#attribute; ... }}| (post)) \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute - - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -14915,8 +14915,8 @@ preincrement_assignment_attribute { \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute + - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); #lhs0 = #v.#attribute; ... }}| (post)) \heuristics(simplify_expression) @@ -14930,8 +14930,8 @@ preincrement_attribute { \varcond(\new(#v (program Variable), \typeof(#e (program Expression)))) \replacewith(#allmodal ((modal operator))|{{ .. #typeof(#e) #v = #e; - #v.#attribute = (#typeof(#attribute)) (#v.#attribute + - 1); + #v.#attribute = + (#typeof(#attribute)) (#v.#attribute + 1); ... }}| (post)) \heuristics(simplify_expression) Choices: programRules:Java} @@ -15186,7 +15186,7 @@ Choices: (programRules:Java & runtimeExceptions:ban)} referencedObjectIsCreatedRighFinalEQ { \assumes ([equals(deltaObject::final(o,f),EQ)]==>[equals(EQ,null)]) \find(==>equals(boolean::select(h,EQ,java.lang.Object::#$created),TRUE)) -\add []==>[or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(o,null))] +\add []==>[or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(o,null))] \heuristics(concrete) Choices: programRules:Java} ----------------------------------------------------- @@ -15210,7 +15210,7 @@ Choices: programRules:Java} referencedObjectIsCreatedRightFinal { \assumes ([]==>[equals(deltaObject::final(o,f),null)]) \find(==>equals(boolean::select(h,deltaObject::final(o,f),java.lang.Object::#$created),TRUE)) -\replacewith([]==>[or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(o,null))]) +\replacewith([]==>[or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(o,null))]) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -15311,7 +15311,7 @@ remove_parentheses_lhs_left { (#lhs) = #e; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = #e; + #lhs *= #e; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -15322,7 +15322,7 @@ remove_parentheses_right { #lhs = (#e); ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - #lhs = #e; + #lhs *= #e; ... }}| (post)) \heuristics(simplify_prog) Choices: programRules:Java} @@ -15698,14 +15698,14 @@ Choices: true} == selectCreatedOfAnon (selectCreatedOfAnon) ========================================= selectCreatedOfAnon { \find(boolean::select(anon(h,s,h2),o,java.lang.Object::#$created)) -\replacewith(if-then-else(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),TRUE,boolean::select(h2,o,java.lang.Object::#$created))) +\replacewith(if-then-else(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),TRUE,boolean::select(h2,o,java.lang.Object::#$created))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- == selectCreatedOfAnonAsFormula (selectCreatedOfAnonAsFormula) ========================================= selectCreatedOfAnonAsFormula { \find(equals(boolean::select(anon(h,s,h2),o,java.lang.Object::#$created),TRUE)) -\replacewith(or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(boolean::select(h2,o,java.lang.Object::#$created),TRUE))) +\replacewith(or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(boolean::select(h2,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_ENLARGING) Choices: programRules:Java} ----------------------------------------------------- @@ -15713,7 +15713,7 @@ Choices: programRules:Java} selectCreatedOfAnonAsFormulaEQ { \assumes ([equals(anon(h,s,h2),EQ)]==>[]) \find(equals(boolean::select(EQ,o,java.lang.Object::#$created),TRUE)) -\sameUpdateLevel\replacewith(or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(boolean::select(h2,o,java.lang.Object::#$created),TRUE))) +\sameUpdateLevel\replacewith(or(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),equals(boolean::select(h2,o,java.lang.Object::#$created),TRUE))) \heuristics(simplify_ENLARGING) Choices: programRules:Java} ----------------------------------------------------- @@ -15721,14 +15721,14 @@ Choices: programRules:Java} selectCreatedOfAnonEQ { \assumes ([equals(anon(h,s,h2),EQ)]==>[]) \find(boolean::select(EQ,o,java.lang.Object::#$created)) -\sameUpdateLevel\replacewith(if-then-else(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),TRUE,boolean::select(h2,o,java.lang.Object::#$created))) +\sameUpdateLevel\replacewith(if-then-else(equals(boolean::select(h,o,java.lang.Object::#$created),TRUE),TRUE,boolean::select(h2,o,java.lang.Object::#$created))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- == selectOfAnon (selectOfAnon) ========================================= selectOfAnon { \find(beta::select(anon(h,s,h2),o,f)) -\replacewith(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f))) +\replacewith(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f))) \heuristics(semantics_blasting) Choices: programRules:Java} ----------------------------------------------------- @@ -15736,14 +15736,14 @@ Choices: programRules:Java} selectOfAnonEQ { \assumes ([equals(anon(h,s,h2),EQ)]==>[]) \find(beta::select(EQ,o,f)) -\sameUpdateLevel\replacewith(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f))) +\sameUpdateLevel\replacewith(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- == selectOfCreate (selectOfCreate) ========================================= selectOfCreate { \find(beta::select(create(h,o),o2,f)) -\replacewith(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f))) +\replacewith(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f))) \heuristics(semantics_blasting) Choices: programRules:Java} ----------------------------------------------------- @@ -15751,14 +15751,14 @@ Choices: programRules:Java} selectOfCreateEQ { \assumes ([equals(create(h,o),EQ)]==>[]) \find(beta::select(EQ,o2,f)) -\sameUpdateLevel\replacewith(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f))) +\sameUpdateLevel\replacewith(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- == selectOfMemset (selectOfMemset) ========================================= selectOfMemset { \find(beta::select(memset(h,s,x),o,f)) -\replacewith(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o,f))) +\replacewith(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o,f))) \heuristics(semantics_blasting) Choices: programRules:Java} ----------------------------------------------------- @@ -15766,14 +15766,14 @@ Choices: programRules:Java} selectOfMemsetEQ { \assumes ([equals(memset(h,s,x),EQ)]==>[]) \find(beta::select(EQ,o,f)) -\sameUpdateLevel\replacewith(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o,f))) +\sameUpdateLevel\replacewith(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o,f))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- == selectOfStore (selectOfStore) ========================================= selectOfStore { \find(beta::select(store(h,o,f,x),o2,f2)) -\replacewith(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2))) +\replacewith(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2))) \heuristics(semantics_blasting) Choices: programRules:Java} ----------------------------------------------------- @@ -15781,7 +15781,7 @@ Choices: programRules:Java} selectOfStoreEQ { \assumes ([equals(store(h,o,f,x),EQ)]==>[]) \find(beta::select(EQ,o2,f2)) -\sameUpdateLevel\replacewith(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2))) +\sameUpdateLevel\replacewith(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2))) \heuristics(simplify_heap_high_costs) Choices: programRules:Java} ----------------------------------------------------- @@ -16135,7 +16135,7 @@ setJavaCardTransient { #jcsystemType.#setTransient(#se, #se1)@#jcsystemType; ... }}| (post)) \replacewith([]==>[not(equals(#se,null))]) ; -\replacewith([]==>[update-application(elem-update(heap)(store(heap,#se,java.lang.Object::#$transient,#se1)),#allmodal(post))]) +\replacewith([]==>[update-application(elem-update(heap)(store(heap,#se,java.lang.Object::#$transient,#se1)),#allmodal(post))]) \heuristics(simplify_prog) Choices: (programRules:Java & JavaCard:on)} ----------------------------------------------------- @@ -16345,7 +16345,7 @@ simplifySelectOfAnon { \find(beta::select(anon(h,s,h2),o,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16357,7 +16357,7 @@ simplifySelectOfAnonEQ { \find(beta::select(EQ,o,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(or(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),elementOf(o,f,freshLocs(h))),beta::select(h2,o,f),beta::select(h,o,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16368,7 +16368,7 @@ simplifySelectOfCreate { \find(beta::select(create(h,o),o2,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16380,7 +16380,7 @@ simplifySelectOfCreateEQ { \find(beta::select(EQ,o2,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),not(equals(o,null))),equals(f,java.lang.Object::#$created)),beta::cast(TRUE),beta::select(h,o2,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16391,7 +16391,7 @@ simplifySelectOfMemset { \find(beta::select(memset(h,s,x),o,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),x,beta::select(h,o,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),x,beta::select(h,o,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16403,7 +16403,7 @@ simplifySelectOfMemsetEQ { \find(beta::select(EQ,o,f)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),x,beta::select(h,o,f)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(elementOf(o,f,s),not(equals(f,java.lang.Object::#$created))),x,beta::select(h,o,f)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16414,7 +16414,7 @@ simplifySelectOfStore { \find(beta::select(store(h,o,f,x),o2,f2)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16426,7 +16426,7 @@ simplifySelectOfStoreEQ { \find(beta::select(EQ,o2,f2)) \inSequentState\replacewith(sk) \heuristics(concrete) -Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2)),sk)]==>[]) +Choices: programRules:Java}] \replacewith([equals(if-then-else(and(and(equals(o,o2),equals(f,f2)),not(equals(f,java.lang.Object::#$created))),beta::cast(x),beta::select(h,o2,f2)),sk)]==>[]) \heuristics(simplify_select) Choices: programRules:Java} ----------------------------------------------------- @@ -16759,7 +16759,7 @@ stringAssignment { \find(#normalassign ((modal operator))|{{ .. #v = #slit; ... }}| (post)) -\sameUpdateLevel\add [not(equals(strPool(#slit),null)),equals(boolean::select(heap,strPool(#slit),java.lang.Object::#$created),TRUE)]==>[] \replacewith(update-application(elem-update(#v (program Variable))(strPool(#slit)),#normalassign(post))) +\sameUpdateLevel\add [not(equals(strPool(#slit),null)),equals(boolean::select(heap,strPool(#slit),java.lang.Object::#$created),TRUE)]==>[] \replacewith(update-application(elem-update(#v (program Variable))(strPool(#slit)),#normalassign(post))) \heuristics(simplify_prog_subset, simplify_prog) Choices: true} ----------------------------------------------------- @@ -18544,7 +18544,7 @@ Choices: programRules:Java} == variableDeclarationGhost (ghostDeclaration) ========================================= variableDeclarationGhost { \find(#allmodal ((modal operator))|{{ .. - ghost #t #v0; + /*@ghost*/ #t #v0; ... }}| (post)) \addprogvars {#v0 (program Variable)} \replacewith(#allmodal(post)) \heuristics(simplify_prog_subset, simplify_prog) @@ -18553,10 +18553,10 @@ Choices: programRules:Java} == variableDeclarationGhostAssign (ghostDeclaration) ========================================= variableDeclarationGhostAssign { \find(#allmodal ((modal operator))|{{ .. - ghost #t #v0 = #vi; + /*@ghost*/ #t #v0 = #vi; ... }}| (post)) \replacewith(#allmodal ((modal operator))|{{ .. - ghost #t #v0; + /*@ghost*/ #t #v0; #v0 = #vi; ... }}| (post)) \heuristics(simplify_prog_subset, simplify_prog) @@ -18599,7 +18599,7 @@ Choices: programRules:Java} wellFormedMemsetArrayObject { \find(wellFormed(memset(h,arrayRange(ar,lo,up),x))) \succedentPolarity\varcond(\hasSort(\elemSort(ar (java.lang.Object term)), alpha)) -\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),arrayStoreValid(ar,x))))) +\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),arrayStoreValid(ar,x))))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -18615,7 +18615,7 @@ Choices: programRules:Java} wellFormedStoreArray { \find(wellFormed(store(h,o,arr(idx),x))) \succedentPolarity\varcond(\hasSort(\elemSort(o (java.lang.Object term)), alpha)) -\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),arrayStoreValid(o,x))))) +\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),arrayStoreValid(o,x))))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -18639,7 +18639,7 @@ Choices: programRules:Java} wellFormedStoreObject { \find(wellFormed(store(h,o,f,x))) \succedentPolarity\varcond(\fieldType(f (Field term), alpha)) -\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),equals(alpha::instance(x),TRUE))))) +\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),equals(alpha::instance(x),TRUE))))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- @@ -18648,7 +18648,7 @@ wellFormedStoreObjectEQ { \assumes ([equals(store(h,o,f,x),EQ)]==>[]) \find(wellFormed(EQ)) \sameUpdateLevel\succedentPolarity\varcond(\fieldType(f (Field term), alpha)) -\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),equals(alpha::instance(x),TRUE))))) +\replacewith(and(wellFormed(h),or(equals(x,null),and(equals(boolean::select(h,x,java.lang.Object::#$created),TRUE),equals(alpha::instance(x),TRUE))))) \heuristics(simplify_enlarging) Choices: programRules:Java} ----------------------------------------------------- From 73ee6c3f2a6fe0489ef326a0e54e4ac473d417d7 Mon Sep 17 00:00:00 2001 From: Alexander Weigl Date: Sat, 18 Apr 2026 01:23:29 +0200 Subject: [PATCH 7/7] fix some tests --- .../uka/ilkd/key/testgen/TestgenFacade.java | 3 ++- .../key/java/ast/expression/Assignment.java | 15 +++++++++++++ .../expression/operator/BinaryOperator.java | 14 +++++++++++++ .../operator/LogicFunctionalOperator.java | 15 +++++++++++++ .../expression/operator/UnaryOperator.java | 15 +++++++++++++ .../proof/io/consistency/DiskFileRepo.java | 21 +++++++++---------- .../key/rule/AuxiliaryContractBuilders.java | 3 ++- 7 files changed, 73 insertions(+), 13 deletions(-) diff --git a/key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/TestgenFacade.java b/key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/TestgenFacade.java index 748d43c4698..273d4d1962b 100644 --- a/key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/TestgenFacade.java +++ b/key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/TestgenFacade.java @@ -6,6 +6,7 @@ import java.io.IOException; import java.util.Collection; import java.util.List; +import java.util.NoSuchElementException; import java.util.concurrent.Callable; import de.uka.ilkd.key.control.KeYEnvironment; @@ -66,7 +67,7 @@ public void launcherStopped(SolverLauncher launcher, tg.generateJUnitTestSuite(finishedSolvers); reporter.writeln("Compile the generated files using a Java compiler."); - } catch (IOException e) { + } catch (NoSuchElementException | IOException e) { reporter.reportException(e); } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java index 0cef6407c8f..059822f6bd9 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/Assignment.java @@ -4,6 +4,7 @@ package de.uka.ilkd.key.java.ast.expression; import java.util.List; +import java.util.Objects; import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.Comment; @@ -130,4 +131,18 @@ public String reuseSignature(Services services, ExecutionContext ec) { return base; } } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Assignment that)) + return false; + if (!super.equals(o)) + return false; + return kind == that.kind && Objects.equals(that.children, children); + } + + @Override + protected int computeHashCode() { + return Objects.hash(kind, children); + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java index a700fbe0bef..ba781dc8214 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/BinaryOperator.java @@ -114,4 +114,18 @@ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { public void visit(Visitor v) { v.performActionOnBinaryOperator(this); } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof BinaryOperator b)) + return false; + return Objects.equals(getKind(), b.getKind()) && Objects.equals(children, b.children); + } + + @Override + protected int computeHashCode() { + return Objects.hash(kind, children); + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java index b428f353c07..3b49ef76d00 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/LogicFunctionalOperator.java @@ -4,6 +4,7 @@ package de.uka.ilkd.key.java.ast.expression.operator; import java.util.List; +import java.util.Objects; import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.Comment; @@ -105,4 +106,18 @@ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { public void visit(Visitor v) { v.performActionOnLogicFunctionalOperator(this); } + + @Override + public boolean equals(Object o) { + if (!(o instanceof LogicFunctionalOperator that)) + return false; + if (!super.equals(o)) + return false; + return function == that.function && Objects.equals(that.children, children); + } + + @Override + protected int computeHashCode() { + return Objects.hash(function, children); + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java index 317bbb53518..e7292047ef1 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java +++ b/key.core/src/main/java/de/uka/ilkd/key/java/ast/expression/operator/UnaryOperator.java @@ -4,6 +4,7 @@ package de.uka.ilkd.key.java.ast.expression.operator; import java.util.List; +import java.util.Objects; import de.uka.ilkd.key.java.Services; import de.uka.ilkd.key.java.ast.Comment; @@ -90,4 +91,18 @@ public KeYJavaType getKeYJavaType(Services javaServ, ExecutionContext ec) { public void visit(Visitor v) { v.performActionOnUnaryOperator(this); } + + @Override + public boolean equals(Object o) { + if (!(o instanceof UnaryOperator that)) + return false; + if (!super.equals(o)) + return false; + return kind == that.kind && Objects.equals(that.children, children); + } + + @Override + protected int computeHashCode() { + return Objects.hash(kind, children); + } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/proof/io/consistency/DiskFileRepo.java b/key.core/src/main/java/de/uka/ilkd/key/proof/io/consistency/DiskFileRepo.java index 2f670154d18..8fac64a82a5 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/proof/io/consistency/DiskFileRepo.java +++ b/key.core/src/main/java/de/uka/ilkd/key/proof/io/consistency/DiskFileRepo.java @@ -12,6 +12,7 @@ import java.nio.file.Paths; import java.util.Comparator; import java.util.HashMap; +import java.util.stream.Stream; import de.uka.ilkd.key.settings.GeneralSettings; @@ -342,17 +343,15 @@ protected void dispose() { */ private void deleteDiskContent() throws IOException { if (!isDisposed() && !GeneralSettings.keepFileRepos) { - try (var s = Files.walk(tmpDir)) { - s.sorted(Comparator.reverseOrder()) - // .map(Path::toFile) - .forEach(path -> { - try { - Files.delete(path); - // path.delete(); - } catch (IOException e) { - LOGGER.info("Failed to delete file", e); - } - }); + try (Stream s = Files.walk(tmpDir).sorted(Comparator.reverseOrder())) { + s.forEach(path -> { + try { + Files.deleteIfExists(path); + // path.delete(); + } catch (IOException e) { + LOGGER.info("Could not clean up temp directory {}", path); + } + }); } } } diff --git a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java index 9f0def4aace..7e04fbd2f61 100644 --- a/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java +++ b/key.core/src/main/java/de/uka/ilkd/key/rule/AuxiliaryContractBuilders.java @@ -1635,7 +1635,8 @@ private StatementBlock constructAbruptTerminationIfCascade() { KeYJavaASTFactory.returnClause(variables.result))); } ifCascade.add(KeYJavaASTFactory.ifThen( - new BinaryOperator(BinaryOperator.BinaryOperatorKind.NOT_EQUALS, variables.exception, + new BinaryOperator(BinaryOperator.BinaryOperatorKind.NOT_EQUALS, + variables.exception, NullLiteral.NULL), KeYJavaASTFactory.throwClause(variables.exception))); return new StatementBlock(ifCascade.toArray(new Statement[0]));