Skip to content

Commit b978d3f

Browse files
committed
spotless
1 parent fa93341 commit b978d3f

9 files changed

Lines changed: 41 additions & 28 deletions

File tree

key.core/src/main/java/de/uka/ilkd/key/nparser/builder/IncludeFinder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ private void addInclude(String filename) throws MalformedURLException {
5757
filename = filename.replace('/', File.separatorChar); // Not required for Windows, but
5858
// whatsoever
5959
filename = filename.replace('\\', File.separatorChar); // Special handling for Linux
60-
var path = base.resolve(filename).normalize();
60+
var path = base.resolve(filename).normalize().toAbsolutePath();
6161

6262
var url = path.toUri().toURL();
63+
// url = URI.create(path.toString()).toURL();
6364
source = RuleSourceFactory.initRuleFile(url);
6465
if (ldt) {
6566
includes.putLDT(filename, source);

key.core/src/main/java/de/uka/ilkd/key/proof/Node.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ public int getChildNr(Node child) {
504504
return -1;
505505
}
506506

507-
public StringBuffer getUniqueTacletId() {
508-
StringBuffer id = new StringBuffer();
507+
public StringBuilder getUniqueTacletId() {
508+
StringBuilder id = new StringBuilder(32);
509509
int c = 0;
510510
Node n = this;
511511

key.core/src/main/java/de/uka/ilkd/key/proof/TacletIndex.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import java.util.*;
77
import java.util.function.Function;
8+
import java.util.stream.Collectors;
89
import java.util.stream.Stream;
910

1011
import de.uka.ilkd.key.java.ast.JavaProgramElement;
@@ -265,23 +266,16 @@ public Object clone() {
265266
}
266267

267268
@Override
268-
public @NonNull Set<NoPosTacletApp> allNoPosTacletApps() {
269-
Set<NoPosTacletApp> result = new LinkedHashSet<>();
270-
for (ImmutableList<NoPosTacletApp> tacletApps : rwList.values()) {
271-
tacletApps.forEach(result::add);
272-
}
273-
274-
for (ImmutableList<NoPosTacletApp> tacletApps : antecList.values()) {
275-
tacletApps.forEach(result::add);
276-
}
277-
278-
for (ImmutableList<NoPosTacletApp> tacletApps : succList.values()) {
279-
tacletApps.forEach(result::add);
280-
}
281-
282-
noFindList.forEach(result::add);
269+
public Set<NoPosTacletApp> allNoPosTacletApps() {
270+
return allNoPosTacletAppsStream().collect(Collectors.toUnmodifiableSet());
271+
}
283272

284-
return result;
273+
public Stream<NoPosTacletApp> allNoPosTacletAppsStream() {
274+
Stream<NoPosTacletApp> s1 = rwList.values().stream().flatMap(ImmutableList::stream);
275+
Stream<NoPosTacletApp> s2 = antecList.values().stream().flatMap(ImmutableList::stream);
276+
Stream<NoPosTacletApp> s3 = succList.values().stream().flatMap(ImmutableList::stream);
277+
Stream<NoPosTacletApp> s4 = noFindList.stream();
278+
return Stream.concat(Stream.concat(Stream.concat(s1, s2), s3), s4);
285279
}
286280

287281
/**

key.core/src/main/java/de/uka/ilkd/key/proof/init/ProblemInitializer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,8 @@ private InitConfig prepare(EnvInput envInput, InitConfig referenceConfig)
617617
if (type instanceof ClassDeclaration || type instanceof InterfaceDeclaration) {
618618
for (Field f : javaInfo.getAllFields((TypeDeclaration) type)) {
619619
final ProgramVariable pv = (ProgramVariable) f.getProgramVariable();
620-
if (pv instanceof LocationVariable lv) {
621-
heapLDT.getFieldSymbolForPV(lv, initConfig.getServices());
620+
if (pv instanceof LocationVariable lv) {
621+
heapLDT.getFieldSymbolForPV(lv, initConfig.getServices());
622622
}
623623
}
624624
}

key.core/src/main/java/de/uka/ilkd/key/proof/io/IntermediateProofReplayer.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,25 @@ private TacletApp constructTacletApp(TacletAppIntermediate currInterm, Goal curr
456456
TacletApp ourApp;
457457
PosInOccurrence pos = null;
458458

459-
Taclet t = proof.getInitConfig().lookupActiveTaclet(new Name(tacletName));
459+
Name nTacletName = new Name(tacletName);
460+
Taclet t = proof.getInitConfig().lookupActiveTaclet(nTacletName);
460461
if (t == null) {
461-
ourApp = currGoal.indexOfTaclets().lookup(tacletName);
462+
var possibleApps = currGoal.indexOfTaclets().allNoPosTacletAppsStream()
463+
.filter(it -> it.taclet().name().equals(nTacletName))
464+
.toList();
465+
466+
if (possibleApps.isEmpty()) {
467+
ourApp = null;
468+
} else if (possibleApps.size() == 1) {
469+
ourApp = possibleApps.getFirst();
470+
} else {
471+
var taclets = possibleApps.stream().map(TacletApp::toString)
472+
.collect(Collectors.joining("\n---\n"));
473+
throw new TacletAppConstructionException(
474+
"There are more than one possible taclet available with name \"" + tacletName
475+
+ "\". " +
476+
"Most three similar names are: " + taclets);
477+
}
462478
} else {
463479
ourApp = NoPosTacletApp.createNoPosTacletApp(t);
464480
}

key.core/src/main/java/de/uka/ilkd/key/rule/executor/javadl/TacletExecutor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ protected void applyAddrule(ImmutableList<? extends org.key_project.prover.rules
167167
var matchCond = (MatchConditions) p_matchCond;
168168
for (var tacletToAdd : rules) {
169169
final Node n = goal.node();
170-
tacletToAdd = tacletToAdd
171-
.setName(tacletToAdd.name() + AUTO_NAME + n.getUniqueTacletId());
170+
String name = tacletToAdd.name() + AUTO_NAME + n.getUniqueTacletId();
171+
System.out.println(name);
172+
tacletToAdd = tacletToAdd.setName(name);
172173

173174

174175
// the new Taclet may contain variables with a known

key.core/src/main/java/de/uka/ilkd/key/util/ExceptionTools.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
import java.net.URI;
99
import java.net.URISyntaxException;
1010
import java.nio.file.Paths;
11-
import java.util.regex.Matcher;
1211
import java.util.regex.Pattern;
1312

14-
import de.uka.ilkd.key.java.Position;
1513
import de.uka.ilkd.key.parser.Location;
1614
import de.uka.ilkd.key.proof.io.ProblemLoaderException;
1715
import de.uka.ilkd.key.util.parsing.HasLocation;

key.ncore.calculus/src/main/java/org/key_project/prover/rules/Taclet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import java.util.Iterator;
77

8-
import org.jspecify.annotations.NonNull;
98
import org.key_project.logic.ChoiceExpr;
109
import org.key_project.logic.Name;
1110
import org.key_project.logic.SyntaxElement;
@@ -24,6 +23,7 @@
2423
import org.checkerframework.checker.calledmethods.qual.RequiresCalledMethods;
2524
import org.checkerframework.checker.initialization.qual.UnderInitialization;
2625
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
26+
import org.jspecify.annotations.NonNull;
2727
import org.jspecify.annotations.Nullable;
2828

2929
import static org.key_project.util.Strings.formatAsList;

key.ui/src/main/java/de/uka/ilkd/key/core/Log.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ public static void configureLogging(@Nullable Integer verbosity) {
5555
.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
5656
if (verbosity != null) {
5757
Appender<ILoggingEvent> consoleAppender = root.getAppender("STDOUT");
58+
if (consoleAppender == null) {
59+
return;
60+
}
5861
consoleAppender.clearAllFilters();
5962
var filter = new ThresholdFilter();
6063
consoleAppender.addFilter(filter);

0 commit comments

Comments
 (0)