Skip to content

Commit 1b3f51f

Browse files
authored
Merging tool for code style XML files, remove formatter version lock (#3532)
2 parents 0ae2058 + eded0d9 commit 1b3f51f

File tree

14 files changed

+218
-18
lines changed

14 files changed

+218
-18
lines changed

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,15 @@ subprojects {
348348
toggleOffOn()
349349

350350
removeUnusedImports()
351-
/* At the moment, we have to ensure that version 4.22 of the eclipse formatter is run, since newer versions
352-
* of the formatter crash in SymbolicExecutionTreeBuilder (seems to be a but in the formatter)!
351+
352+
/* When new options are added in new versions of the Eclipse formatter, the easiest way is to export the new
353+
* style file from the Eclipse GUI and then use the CodeStyleMerger tool in
354+
* "$rootDir/scripts/tools/checkstyle/CodeStyleMerger.java" to merge the old and the new style files,
355+
* i.e. "java CodeStyleMerger.java <oldStyleFile> <newStyleFile> keyCodeStyle.xml". The tool adds all
356+
* entries with keys that were not present in the old file and optionally overwrites the old entries. The
357+
* file is output with ordered keys, such that the file can easily be diffed using git.
353358
*/
354-
eclipse("4.22").configFile("$rootDir/scripts/tools/checkstyle/keyCodeStyle.xml")
359+
eclipse().configFile("$rootDir/scripts/tools/checkstyle/keyCodeStyle.xml")
355360
trimTrailingWhitespace() // not sure how to set this in the xml file ...
356361
//googleJavaFormat().aosp().reflowLongStrings()
357362

key.core.symbolic_execution/src/test/java/de/uka/ilkd/key/symbolic_execution/testcase/util/TestSymbolicExecutionUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class TestSymbolicExecutionUtil extends AbstractSymbolicExecutionTestCase
4343
public void test1ImproveReadability() throws ProblemLoaderException {
4444
File location = new File(testCaseDirectory,
4545
"/readability/InnerAndAnonymousTypeTest/InnerAndAnonymousTypeTest.java")
46-
.getAbsoluteFile();
46+
.getAbsoluteFile();
4747
assertTrue(location.exists(), "Could not find required resource: " + location);
4848

4949
KeYEnvironment<?> environment = KeYEnvironment.load(location, null, null, null);

key.core/src/main/java/de/uka/ilkd/key/macros/scripts/MacroCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public static PosInOccurrence extractMatchingPio(final Sequent sequent, final St
131131
for (int i = 1; i < sequent.size() + 1; i++) {
132132
final boolean matchesRegex = formatTermString(
133133
LogicPrinter.quickPrintTerm(sequent.getFormulabyNr(i).formula(), services))
134-
.matches(".*" + matchRegEx + ".*");
134+
.matches(".*" + matchRegEx + ".*");
135135
if (matchesRegex) {
136136
if (matched) {
137137
throw new ScriptException("More than one occurrence of a matching term.");

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ public void beginExpr(ProofElementID eid, String str) {
210210
errors.add(e);
211211
}
212212
}
213-
case MERGE_ABSTRACTION_PREDICATES -> ((BuiltinRuleInformation) ruleInfo).currAbstractionPredicates =
214-
str;
213+
case MERGE_ABSTRACTION_PREDICATES ->
214+
((BuiltinRuleInformation) ruleInfo).currAbstractionPredicates =
215+
str;
215216
case MERGE_USER_CHOICES -> ((BuiltinRuleInformation) ruleInfo).currUserChoices = str;
216217
case NOTES -> {
217218
ruleInfo.notes = str;

key.core/src/main/java/de/uka/ilkd/key/rule/inst/SVInstantiations.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public SVInstantiations addInteresting(SchemaVariable sv, InstantiationEntry<?>
270270
Services services) {
271271
return new SVInstantiations(map.put(sv, entry), interesting().put(sv, entry),
272272
getUpdateContext(), getGenericSortInstantiations(), getGenericSortConditions())
273-
.checkSorts(sv, entry, false, services);
273+
.checkSorts(sv, entry, false, services);
274274
}
275275

276276

@@ -653,7 +653,7 @@ public String toString() {
653653
public SVInstantiations add(GenericSortCondition p_c, Services services) throws SortException {
654654
return new SVInstantiations(map, interesting(), getUpdateContext(),
655655
getGenericSortInstantiations(), getGenericSortConditions().prepend(p_c))
656-
.checkCondition(p_c, false, services);
656+
.checkCondition(p_c, false, services);
657657
}
658658

659659
public ExecutionContext getExecutionContext() {

key.core/src/main/java/de/uka/ilkd/key/speclang/jml/translation/JMLSpecFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ public ImmutableSet<LoopContract> createJMLLoopContracts(final IProgramMethod me
14271427
clauses.continues, clauses.returns, clauses.signals, clauses.signalsOnly,
14281428
clauses.diverges, clauses.assignables, clauses.assignablesFree, clauses.hasAssignable,
14291429
clauses.hasFreeAssignable, clauses.decreases, services)
1430-
.create();
1430+
.create();
14311431
}
14321432

14331433
/**
@@ -1462,7 +1462,7 @@ public ImmutableSet<LoopContract> createJMLLoopContracts(IProgramMethod method,
14621462
clauses.continues, clauses.returns, clauses.signals, clauses.signalsOnly,
14631463
clauses.diverges, clauses.assignables, clauses.assignablesFree, clauses.hasAssignable,
14641464
clauses.hasFreeAssignable, clauses.decreases, services)
1465-
.create();
1465+
.create();
14661466
}
14671467

14681468
private ProgramVariableCollection createProgramVariablesForStatement(Statement statement,

key.core/src/main/java/recoder/service/KeYCrossReferenceSourceInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public Variable getVariable(String name, ProgramElement context) {
280280
*/
281281
EnumConstantSpecification ecs = (EnumConstantSpecification) ((EnumDeclaration) getType(
282282
((Case) context.getASTParent()).getParent().getExpression()))
283-
.getVariableInScope(name);
283+
.getVariableInScope(name);
284284
// must not resolve! qualifying enum constant in case-statements is forbidden!
285285
return ecs;
286286
}

key.core/src/test/java/de/uka/ilkd/key/logic/TestSemisequent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public void testListReplaceAddRedundantList() {
294294
// [exp.: p,q,a,b,c,r]
295295
Semisequent expected = extract(extract(
296296
extract(extract(origin.insertLast(con[4])).insertLast(con[5])).insertLast(con[6]))
297-
.insertLast(con[2]));
297+
.insertLast(con[2]));
298298
// insert:[a,b,c,r,r,q,p]
299299
ImmutableList<SequentFormula> insertionList =
300300
ImmutableSLList.<SequentFormula>nil().prepend(con[0]).prepend(con[1]).prepend(con[2])

key.core/src/test/java/de/uka/ilkd/key/proof/runallproofs/performance/DataRecordingTestFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private static ApplyStrategyInfo applyStrategy(Proof proof, Strategy strategy) {
5050
proof.setActiveStrategy(strategy);
5151
return new ApplyStrategy(
5252
proof.getInitConfig().getProfile().getSelectedGoalChooserBuilder().create())
53-
.start(proof, proof.openGoals().head());
53+
.start(proof, proof.openGoals().head());
5454
}
5555

5656
public final ProfilingDirectories getProfileDirectories() {

key.ui/src/main/java/de/uka/ilkd/key/gui/actions/SendFeedbackAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void appendDataToZipOutputStream(ZipOutputStream stream) throws IOException {
118118
zipEntryFileName += ".exception";
119119
data = (e.getClass().getSimpleName() + " occured while trying to read data.\n"
120120
+ e.getMessage() + "\n" + serializeStackTrace(e))
121-
.getBytes(StandardCharsets.UTF_8);
121+
.getBytes(StandardCharsets.UTF_8);
122122
}
123123
stream.putNextEntry(new ZipEntry(zipEntryFileName));
124124
stream.write(data);

0 commit comments

Comments
 (0)