Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static KeYJavaPipeline createDefault(TransformationPipelineServices pipel
p.add(new EnumClassBuilder(pipelineServices));
p.add(new RecordClassBuilder(pipelineServices));
p.add(new JMLTransformer(pipelineServices));
p.add(new LambdaReplacer(pipelineServices));
p.add(new JmlDocRemoval(pipelineServices));
p.add(new ImplicitFieldAdder(pipelineServices));
p.add(new InstanceAllocationMethodBuilder(pipelineServices));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import com.github.javaparser.resolution.types.ResolvedType;
import org.jspecify.annotations.NonNull;
import de.uka.ilkd.key.speclang.PositionedString;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.Nullable;
import org.key_project.util.collection.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -523,4 +526,33 @@ private static boolean isInside(Node container, Node declaration) {
container.containsWithinRange(declaration);
}
}


/**
* Generates unique names for generated inner classes.
*/
class NameGenerator {

private final Set<String> generatedNames = new HashSet<>();

public String generate(String prefix, Position pos) {
return generate(prefix, pos, null);
}

private String generate(String prefix, Position pos, Integer counter) {
Integer line = pos != null ? pos.line : null;

String newName = prefix + "L" + line;
if (counter != null) {
newName += "_" + counter;
}

if (generatedNames.contains(newName)) {
return generate(prefix, pos, counter == null ? 0 : counter + 1);
}

generatedNames.add(newName);
return newName;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.List;
import org.jmlspecs.openjml.JmlTree;
import org.jmlspecs.openjml.JmlTreeTranslator;

public class DeclarationEmbeddingTranslator extends JmlTreeTranslator {
private final JmlTree.Maker maker;
private final java.util.List<? extends JCTree> embeddable;

public DeclarationEmbeddingTranslator(Context context, java.util.List<? extends JCTree> embeddable) {
maker = JmlTree.Maker.instance(context);
this.embeddable = embeddable;
}

@Override
public JCTree translate(JCTree tree) {
if (tree instanceof JCTree.JCClassDecl) {
JCTree.JCClassDecl classDecl = (JCTree.JCClassDecl) tree;
List<JCTree> newDefs = classDecl.defs.appendList(List.from(embeddable));
return maker.ClassDef(classDecl.mods, classDecl.name, classDecl.typarams, classDecl.extending, classDecl.implementing, newDefs);
}
return super.translate(tree);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import com.sun.org.apache.bcel.internal.generic.Select;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.Name;
import org.jmlspecs.openjml.JmlTree;
import org.jmlspecs.openjml.JmlTreeTranslator;

/**
* Converts all Identifiers, that reference class-fields into field accesses.
* Example `class Test { int a; void m() {a = 2; }}` will become
* `class Test { int a; void m() {this.a = 2; }}`
* Usage: identifierToFieldAccessNormalizer.translate(myAst)
*/
public class IdentifierToFieldAccessNormalizer {
@Override
public JCTree translate(JCTree tree) {
if (tree instanceof JCTree.JCIdent) {
JCTree.JCIdent ident = (JCTree.JCIdent) tree;
if (ident.sym != null
&& ident.sym.owner instanceof Symbol.ClassSymbol
&& !ident.name.toString().equals("this")
&& !(ident.type instanceof Type.ClassType)
) {
JCTree.JCFieldAccess select = maker.Select(maker.This(ident.sym.owner.type), ident.name);
select.sym = ident.sym;
return select;
}
}
return super.translate(tree);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package de.uka.ilkd.key.java.transformations.pipeline.lambda;

import com.sun.tools.javac.util.List;

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

package com.sun.tools.javac.util is not visible

Check failure on line 3 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

package com.sun.tools.javac.util is not visible

public class LambdaContractExtractor extends JmlTreeScanner {

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

cannot find symbol

Check failure on line 5 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

cannot find symbol
public List<JmlTree.JmlSpecificationCase> spec;

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

package JmlTree does not exist

Check failure on line 6 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

package JmlTree does not exist

@Override
public void visitJmlBlock(JmlTree.JmlBlock that) {

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

package JmlTree does not exist

Check failure on line 9 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

package JmlTree does not exist
super.visitJmlBlock(that);
}

@Override
public void visitJmlStatementSpec(JmlTree.JmlStatementSpec tree) {

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

package JmlTree does not exist

Check failure on line 14 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

package JmlTree does not exist
this.spec = tree.statementSpecs.cases;
tree.statementSpecs.cases = List.nil();
super.visitJmlStatementSpec(tree);
}

@Override
public void visitJmlStatement(JmlTree.JmlStatement that) {

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.ui)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.isabelletranslation)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllFunProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.caching)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.example)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.infflow)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.ui.testgen)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllWdProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testRunAllInfProofs, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.testgen)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / integration-tests (testProveRules, ubuntu-latest, 21)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.slicing)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.proofmanagement)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, key.core.wd)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / unit-tests (ubuntu-latest, 21, keyext.exploration)

package JmlTree does not exist

Check failure on line 21 in key.core/src/main/java/de/uka/ilkd/key/java/transformations/pipeline/lambda/LambdaContractExtractor.java

View workflow job for this annotation

GitHub Actions / checkerFramework

package JmlTree does not exist
System.out.println("ads");
super.visitJmlStatement(that);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package de.uka.ilkd.key.java.transformations.pipeline.lambda;

import de.uka.ilkd.key.java.ast.CompilationUnit;
import de.uka.ilkd.key.java.ast.declaration.ClassDeclaration;
import de.uka.ilkd.key.java.transformations.pipeline.JavaTransformer;
import transform.NormalizedLambda;
import transform.Replacement;

import java.util.ArrayList;
import java.util.List;

public class LambdaReplacer implements JavaTransformer {
private final List<ClassDeclaration> exportedDeclarations = new ArrayList<>();
private final NameGenerator nameGenerator;
private final CompilationUnit compilationUnit;

public LambdaReplacer(CompilationUnit compilationUnit, NameGenerator nameGenerator) {
this.compilationUnit = compilationUnit;
this.nameGenerator = nameGenerator;
}

@Override
public void apply(com.github.javaparser.ast.CompilationUnit cu) {
JavaTransformer.super.apply(cu);
}

@Override
public JCTree translate(JCTree tree) {
if (tree instanceof JCTree.JCLambda) {
JCTree.JCLambda lambda = (JCTree.JCLambda) tree;

// Replaces other Lambdas in Lambda's Body
LambdaReplacer lambdaBodyReplacer = new LambdaReplacer(context, compilationUnit);
lambda.body = lambdaBodyReplacer.translate(lambda.body);
//TODO: api.typecheck() generated program. Does not seem to help?

NormalizedLambda normalizedLambda = new NormalizedLambda(lambda, nameGenerator, context);
Replacement lambdaReplacement = new Replacement(normalizedLambda, nameGenerator, context);
exportedDeclarations.add(lambdaReplacement.getReplacementInnerClass());
exportedDeclarations.addAll(lambdaBodyReplacer.getExportedDeclarations());
return lambdaReplacement.getReplacementReference();
}
return super.translate(tree);
}

public List<JCTree.JCClassDecl> getExportedDeclarations() {
return exportedDeclarations;
}
}
Loading
Loading