File tree Expand file tree Collapse file tree
main/java/de/uka/ilkd/key/util
test/java/de/uka/ilkd/key/proof/replay Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: GPL-2.0-only */
44package de .uka .ilkd .key .util ;
55
6+ import java .lang .reflect .Field ;
67import java .nio .file .Path ;
78import java .util .HashMap ;
89import java .util .Map ;
@@ -290,4 +291,10 @@ public static KeYEnvironment<DefaultUserInterfaceControl> createKeYEnvironment()
290291 return KeYEnvironment .load (DUMMY_KEY_FILE );
291292 }
292293
294+ public static Field getPrivateField (Object o , String fieldName ) throws NoSuchFieldException {
295+ final Field field = o .getClass ().getDeclaredField (fieldName );
296+ field .setAccessible (true );
297+ return field ;
298+ }
299+
293300}
Original file line number Diff line number Diff line change 1313import de .uka .ilkd .key .proof .Counter ;
1414import de .uka .ilkd .key .proof .Proof ;
1515import de .uka .ilkd .key .settings .GeneralSettings ;
16+ import de .uka .ilkd .key .util .HelperClassForTests ;
1617
1718import org .key_project .util .helper .FindResources ;
1819
@@ -40,8 +41,8 @@ public void resetCounters(Proof proof) {
4041 }
4142
4243 try {
43- final Field countersField = proof . getServices (). getClass (). getDeclaredField ( "counters" );
44- countersField . setAccessible ( true );
44+ final Field countersField =
45+ HelperClassForTests . getPrivateField ( proof . getServices (), "counters" );
4546 // noinspection unchecked
4647 ((HashMap <String , Counter >) countersField .get (proof .getServices ())).clear ();
4748 } catch (NoSuchFieldException | IllegalAccessException e ) {
You can’t perform that action at this time.
0 commit comments