Skip to content

Commit

Permalink
Merge branch 'main' into mulbrichPolymorphic
Browse files Browse the repository at this point in the history
* main: (33 commits)
  Update key.core/src/main/java/de/uka/ilkd/key/nparser/builder/TacletPBuilder.java
  spotless
  update oracle for taclet equality test
  change gradle github action to new syntax
  adding comments to jml spec factory default contracts
  repair soundness of assignment2UpdateRules with checked overflows
  spotless
  EQ version of seqSwapPreservesSeqPerm + proof
  added rule for sequences: swap preserves perm
  Changed types in replacement map for WD taclets, since PR #3436 made casting TermSV to ProgramVariable not applicable
  Fix and test goToNext()
  Fix goToNextSibling() (thx Tobias)
  Format
  Add comments and next() method
  Remove SVSubstitute
  Clean up inheritance
  Implement missing methods
  Start implementation of traversal
  Implement cursor
  Increase Java version
  ...
  • Loading branch information
wadoon committed Jun 26, 2024
2 parents 566a3b8 + ed267fd commit 6b2b6e0
Show file tree
Hide file tree
Showing 152 changed files with 1,700 additions and 377 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
java-version: 21
distribution: 'corretto'
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: -DENABLE_NULLNESS=true compileTest
run: ./gradlew -DENABLE_NULLNESS=true compileTest


qodana:
Expand All @@ -48,10 +48,10 @@ jobs:
distribution: 'corretto'
java-version: '21'
cache: 'gradle'
- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue spotlessCheck
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: SpotlessCheck
run: ./gradlew --continue spotlessCheck

# checkstyle:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -80,11 +80,10 @@ jobs:
distribution: 'corretto'
java-version: '21'
cache: 'gradle'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue checkstyleMainChanged
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Checkstyle
run: ./gradlew --continue checkstyleMainChanged
- run: |
npx violations-command-line -sarif sarif-report.json \
-v "CHECKSTYLE" "." ".*/build/reports/checkstyle/main_diff.xml$" "Checkstyle"
Expand All @@ -108,10 +107,10 @@ jobs:
distribution: 'corretto'
java-version: '21'
cache: 'gradle'
- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue pmdMainChanged
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: PMD checks
run: ./gradlew --continue pmdMainChanged

# - run: python3 ./.github/printAnnotations.py */build/reports/pmd/main.xml

Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ jobs:
cache: 'gradle'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Assemble with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: assemble
run: ./gradlew assemble

# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: publish
run: ./gradlew publish
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 4 additions & 5 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
java-version: '21'
distribution: 'corretto'
cache: 'gradle'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: alldoc
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Build Documentation with Gradle
run: ./gradlew alldoc

- name: Package
run: tar cvfj javadoc.tar.bz2 build/docs/javadoc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightlydeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
java-version: 17
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --parallel assemble
run: ./gradlew --parallel assemble

- name: Delete previous nightly release
continue-on-error: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/opttest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
distribution: 'corretto'
cache: 'gradle'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue ${{ matrix.tests }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Test with Gradle
run: ./gradlew --continue ${{ matrix.tests }}

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
distribution: 'corretto'
cache: 'gradle'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue -DjacocoEnabled=true -x :key.core.symbolic_execution:test -x :key.core.proof_references:test test
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: Test with Gradle
run: ./gradlew --continue -DjacocoEnabled=true -x :key.core.symbolic_execution:test -x :key.core.proof_references:test test

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -86,11 +86,10 @@ jobs:
run: .github/dlsmt.sh
shell: bash


- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: "Running tests: ${{ matrix.test }}"
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue ${{ matrix.test }}
run: ./gradlew --continue ${{ matrix.test }}

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/tests_winmac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ jobs:
distribution: 'corretto'
cache: 'gradle'

- name: Build with Gradle
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue -x :key.core.symbolic_execution:test -x :key.core.proof_references:test test
- name: Setup Gradle
uses:
gradle/actions/setup-gradle@v3.3.2
- name: Test with Gradle
run: ./gradlew --continue -x :key.core.symbolic_execution:test -x :key.core.proof_references:test test

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -74,10 +75,10 @@ jobs:
- name: Install SMT-Solvers
run: .github/dlsmt.sh

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: "Running tests: ${{ matrix.test }}"
uses: gradle/gradle-build-action@v3.3.2
with:
arguments: --continue ${{ matrix.test }}
run: ./gradlew --continue ${{ matrix.test }}

- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import de.uka.ilkd.key.symbolic_execution.util.SymbolicExecutionSideProofUtil;
import de.uka.ilkd.key.symbolic_execution.util.SymbolicExecutionUtil;

import org.key_project.logic.SyntaxElement;
import org.key_project.util.collection.ImmutableList;
import org.key_project.util.collection.ImmutableSLList;

Expand Down Expand Up @@ -76,7 +77,7 @@ public abstract class AbstractConditionalBreakpoint extends AbstractHitCountBrea
* A {@link Map} mapping from relevant variables for the condition to their runtime equivalent
* in KeY
*/
private Map<SVSubstitute, SVSubstitute> variableNamingMap;
private Map<SyntaxElement, SyntaxElement> variableNamingMap;

/**
* The list of parameter variables of the method that contains the associated breakpoint
Expand Down Expand Up @@ -162,14 +163,14 @@ private void putValuesFromGlobalVars(ProgramVariable varForCondition, Node node,
*
* @return the cloned map
*/
private Map<SVSubstitute, SVSubstitute> getOldMap() {
Map<SVSubstitute, SVSubstitute> oldMap = new HashMap<>();
for (Entry<SVSubstitute, SVSubstitute> svSubstituteSVSubstituteEntry : getVariableNamingMap()
private Map<SyntaxElement, SyntaxElement> getOldMap() {
Map<SyntaxElement, SyntaxElement> oldMap = new HashMap<>();
for (Entry<SyntaxElement, SyntaxElement> svSubstituteSVSubstituteEntry : getVariableNamingMap()
.entrySet()) {
Entry<?, ?> oldEntry = svSubstituteSVSubstituteEntry;
if (oldEntry.getKey() instanceof SVSubstitute
&& oldEntry.getValue() instanceof SVSubstitute) {
oldMap.put((SVSubstitute) oldEntry.getKey(), (SVSubstitute) oldEntry.getValue());
if (oldEntry.getKey() instanceof SyntaxElement
&& oldEntry.getValue() instanceof SyntaxElement) {
oldMap.put((SyntaxElement) oldEntry.getKey(), (SyntaxElement) oldEntry.getValue());
}
}
return oldMap;
Expand Down Expand Up @@ -200,7 +201,7 @@ private void freeVariablesAfterReturn(Node node, RuleApp ruleApp, boolean inScop
* @param oldMap the oldMap variableNamings
*/
private void putValuesFromRenamings(ProgramVariable varForCondition, Node node, boolean inScope,
Map<SVSubstitute, SVSubstitute> oldMap, RuleApp ruleApp) {
Map<SyntaxElement, SyntaxElement> oldMap, RuleApp ruleApp) {
// look for renamings KeY did
boolean found = false;
// get current renaming tables
Expand All @@ -215,7 +216,7 @@ private void putValuesFromRenamings(ProgramVariable varForCondition, Node node,
.getHashMap().entrySet()) {
Entry<?, ?> entry = value;
if (entry.getKey() instanceof LocationVariable
&& entry.getValue() instanceof SVSubstitute) {
&& entry.getValue() instanceof SyntaxElement) {
if ((VariableNamer.getBasename(((LocationVariable) entry.getKey()).name()))
.equals(varForCondition.name())
&& ((LocationVariable) entry.getKey()).name().toString()
Expand All @@ -229,7 +230,7 @@ private void putValuesFromRenamings(ProgramVariable varForCondition, Node node,
// add new value
toKeep.add((LocationVariable) entry.getValue());
getVariableNamingMap().put(varForCondition,
(SVSubstitute) entry.getValue());
(SyntaxElement) entry.getValue());
found = true;
break;
} else if (inScope && ((LocationVariable) entry.getKey()).name()
Expand All @@ -242,7 +243,7 @@ private void putValuesFromRenamings(ProgramVariable varForCondition, Node node,
// add new value
toKeep.add((LocationVariable) entry.getValue());
getVariableNamingMap().put(varForCondition,
(SVSubstitute) entry.getValue());
(SyntaxElement) entry.getValue());
found = true;
break;
}
Expand All @@ -263,7 +264,7 @@ private void putValuesFromRenamings(ProgramVariable varForCondition, Node node,
protected void refreshVarMaps(RuleApp ruleApp, Node node) {
boolean inScope = isInScope(node);
// collect old values
Map<SVSubstitute, SVSubstitute> oldMap = getOldMap();
Map<SyntaxElement, SyntaxElement> oldMap = getOldMap();
// put values into map which have to be replaced
for (ProgramVariable varForCondition : getVarsForCondition()) {
// put global variables only done when a variable is instantiated by
Expand Down Expand Up @@ -498,14 +499,14 @@ public Set<LocationVariable> getToKeep() {
/**
* @return the variableNamingMap
*/
public Map<SVSubstitute, SVSubstitute> getVariableNamingMap() {
public Map<SyntaxElement, SyntaxElement> getVariableNamingMap() {
return variableNamingMap;
}

/**
* @param variableNamingMap the variableNamingMap to set
*/
public void setVariableNamingMap(Map<SVSubstitute, SVSubstitute> variableNamingMap) {
public void setVariableNamingMap(Map<SyntaxElement, SyntaxElement> variableNamingMap) {
this.variableNamingMap = variableNamingMap;
}

Expand Down
12 changes: 12 additions & 0 deletions key.core/src/main/java/de/uka/ilkd/key/java/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

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

import org.key_project.logic.SyntaxElement;

/**
* Comment element of Java source code.
*/
Expand Down Expand Up @@ -71,4 +73,14 @@ public boolean equals(Object o) {
}
return (getText().equals(cmp.getText()));
}

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

@Override
public SyntaxElement getChild(int n) {
throw new IndexOutOfBoundsException("Comment has no children");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.java;

import org.key_project.logic.SyntaxElement;

/**
* Non terminal program element. taken from COMPOST and changed to achieve an immutable structure
*/
Expand All @@ -25,4 +27,8 @@ public interface NonTerminalProgramElement extends ProgramElement {
*/
ProgramElement getChildAt(int index);

@Override
default SyntaxElement getChild(int n) {
return getChildAt(n);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
package de.uka.ilkd.key.java;

import de.uka.ilkd.key.java.visitor.Visitor;
import de.uka.ilkd.key.logic.op.SVSubstitute;

import org.key_project.logic.SyntaxElement;

/**
* A source element is a piece of syntax. It does not necessarily have a semantics, at least none
* that is machinable, for instance a {@link recoder.java.Comment}. taken from RECODER and changed
* to achieve an immutable structure
*/

public interface SourceElement extends SVSubstitute {
public interface SourceElement extends SyntaxElement {


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
* SPDX-License-Identifier: GPL-2.0-only */
package de.uka.ilkd.key.java;

import org.key_project.logic.TerminalSyntaxElement;

/**
* Terminal program element. taken from COMPOST and changed to achieve an immutable structure
*/

public interface TerminalProgramElement extends ProgramElement {
public interface TerminalProgramElement extends ProgramElement, TerminalSyntaxElement {

}
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public SourceElement getFirstElement() {

@Override
public SourceElement getLastElement() {
return getChildAt(getChildCount() - 1).getLastElement();
return getChildAt(this.getChildCount() - 1).getLastElement();
}


Expand Down
Loading

0 comments on commit 6b2b6e0

Please sign in to comment.