Skip to content

Commit 2cfdfe0

Browse files
committed
wip picocli
1 parent b630de0 commit 2cfdfe0

File tree

56 files changed

+745
-1928
lines changed

Some content is hidden

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

56 files changed

+745
-1928
lines changed

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/Constants.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,26 @@
55

66
import org.key_project.util.java.StringUtil;
77

8-
public interface Constants {
9-
8+
public class Constants {
109
/**
1110
* Constant for the line break which is used by the operating system.
1211
* <p>
1312
* <b>Do not use {@code \n}!</b>
1413
*/
15-
String NEW_LINE = StringUtil.NEW_LINE;
16-
String NULLABLE = "/*@ nullable */";
17-
String ALL_OBJECTS = "allObjects";
18-
String ALL_INTS = "allInts";
19-
String ALL_BOOLS = "allBools";
20-
String ALL_HEAPS = "allHeaps";
21-
String ALL_FIELDS = "allFields";
22-
String ALL_SEQ = "allSeq";
23-
String ALL_LOCSETS = "allLocSets";
24-
25-
String OBJENESIS_NAME = "objenesis-2.2.jar";
26-
27-
String OLDMap = "old";
28-
29-
String TAB = " ";
14+
public static final String NEW_LINE = StringUtil.NEW_LINE;
15+
public static final String NULLABLE = "/*@ nullable */";
16+
public static final String ALL_OBJECTS = "allObjects";
17+
public static final String ALL_INTS = "allInts";
18+
public static final String ALL_BOOLS = "allBools";
19+
public static final String ALL_HEAPS = "allHeaps";
20+
public static final String ALL_FIELDS = "allFields";
21+
public static final String ALL_SEQ = "allSeq";
22+
public static final String ALL_LOCSETS = "allLocSets";
23+
public static final String OBJENESIS_NAME = "objenesis-2.2.jar";
24+
public static final String OLD_MAP = "old";
25+
public static final String TAB = " ";
26+
public static final String DUMMY_POSTFIX = "DummyImpl";
3027

31-
String DUMMY_POSTFIX = "DummyImpl";
28+
private Constants() {
29+
}
3230
}

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/Format.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/ModelGenerator.java

Lines changed: 0 additions & 191 deletions
This file was deleted.

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/OutputEnvironment.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* This file is part of KeY - https://key-project.org
2+
* KeY is licensed under the GNU General Public License Version 2
3+
* SPDX-License-Identifier: GPL-2.0-only */
14
package de.uka.ilkd.key.testgen;
25

36
import java.io.IOException;
@@ -7,30 +10,38 @@
710
import java.util.Objects;
811

912
/**
13+
* This class manages the different paths in the output folder.
1014
* @author Alexander Weigl
1115
* @version 1 (02.02.24)
1216
*/
1317
public record OutputEnvironment(Path targetFolder) {
18+
/** Returns the source code folder */
1419
public Path getSourceDir() {
1520
return targetFolder.resolve("src");
1621
}
1722

23+
/** Returns the test code folder */
1824
public Path getTestSourceDir() {
1925
return targetFolder.resolve("test");
2026
}
2127

28+
/** Returns the path to the ANT build.xml file */
2229
public Path getAntFile() {
2330
return targetFolder.resolve("build.xml");
2431
}
2532

33+
/** Returns the path to the README.md file */
2634
public Path getReadmeFile() {
2735
return targetFolder.resolve("README.md");
2836
}
2937

38+
/**
39+
* Initialize/create the necessary directories.
40+
* @throws IOException if the output folder is not write or the folders can not be created.
41+
*/
3042
public void init() throws IOException {
3143
Files.createDirectories(getSourceDir());
3244
Files.createDirectories(getTestSourceDir());
33-
3445
installAntFile();
3546
}
3647

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/ProofInfo.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525

2626
import org.key_project.logic.sort.Sort;
2727

28-
import org.jspecify.annotations.Nullable;
29-
30-
import org.key_project.logic.sort.Sort;
31-
32-
import org.jspecify.annotations.Nullable;
3328
import org.jspecify.annotations.Nullable;
3429
import org.slf4j.Logger;
3530
import org.slf4j.LoggerFactory;
@@ -46,8 +41,8 @@ public ProofInfo(Proof proof) {
4641
public IProgramMethod getMUT() {
4742
SpecificationRepository spec = services.getSpecificationRepository();
4843
IObserverFunction f = spec.getTargetOfProof(proof);
49-
if (f instanceof IProgramMethod) {
50-
return (IProgramMethod) f;
44+
if (f instanceof IProgramMethod pm) {
45+
return pm;
5146
} else {
5247
return null;
5348
}
@@ -64,8 +59,8 @@ public String getMUTCall() {
6459
StringBuilder params = new StringBuilder();
6560
for (ParameterDeclaration p : m.getParameters()) {
6661
for (VariableSpecification v : p.getVariables()) {
67-
IProgramVariable var = v.getProgramVariable();
68-
params.append(",").append(var.name());
62+
IProgramVariable pvar = v.getProgramVariable();
63+
params.append(",").append(pvar.name());
6964
}
7065
}
7166
if (!params.isEmpty()) {
@@ -122,9 +117,8 @@ public Term getPreConTerm() {
122117
Contract c = getContract();
123118
if (c instanceof FunctionalOperationContract t) {
124119
OriginalVariables orig = t.getOrigVars();
125-
Term post = t.getPre(services.getTypeConverter().getHeapLDT().getHeap(), orig.self,
120+
return t.getPre(services.getTypeConverter().getHeapLDT().getHeap(), orig.self,
126121
orig.params, orig.atPres, services);
127-
return post;
128122
}
129123
// no pre <==> false
130124
return services.getTermBuilder().ff();

key.core.testgen/src/main/java/de/uka/ilkd/key/testgen/ReflectionClassCreator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.HashSet;
88
import javax.lang.model.element.Modifier;
99

10-
import de.uka.ilkd.key.logic.sort.Sort;
10+
import org.key_project.logic.sort.Sort;
1111

1212
import com.squareup.javapoet.*;
1313

@@ -77,8 +77,8 @@ public void addSort(String s) {
7777
*/
7878
private HashSet<String> sortsToString() {
7979
final HashSet<String> result = new HashSet<>();
80-
for (final Sort var : usedObjectSorts) {
81-
String sort = var.toString();
80+
for (final Sort s : usedObjectSorts) {
81+
String sort = s.toString();
8282
// We only want Object-Types
8383
if (!" jbyte jint jlong jfloat jdouble jboolean jchar ".contains(" " + sort + " ")) {
8484
if (" jbyte[] jint[] jlong[] jfloat[] jdouble[] jboolean[] jchar[] "
@@ -191,8 +191,6 @@ private void staticInitializer(boolean ghostMapActive, TypeSpec.Builder clazz) {
191191
* All calls to create objects for the given sorts
192192
*/
193193
private void instances(final HashSet<String> sorts, TypeSpec.Builder clazz) {
194-
// r.append(NEW_LINE).append(" // ---The methods for object creation---").append(NEW_LINE)
195-
// .append(NEW_LINE);
196194
for (final String sort : sorts) {
197195
clazz.addMethod(newRef(sort));
198196
}

0 commit comments

Comments
 (0)