Skip to content

Commit 7f9e2eb

Browse files
Rename getCurrentThreadID to getCurrentThreadId
to comply with Google Java coding guidelines.
1 parent 1e24501 commit 7f9e2eb

File tree

7 files changed

+17
-19
lines changed

7 files changed

+17
-19
lines changed
Binary file not shown.

jbmc/regression/jbmc-concurrency/get-current-thread/A.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class A
88
// expected verification success
99
public void me()
1010
{
11-
int g = CProver.getCurrentThreadID();
11+
int g = CProver.getCurrentThreadId();
1212
assert(g == 0);
1313
}
1414

@@ -40,7 +40,7 @@ public void me_bug()
4040
public void me2()
4141
{
4242
CProver.startThread(333);
43-
g = CProver.getCurrentThreadID();
43+
g = CProver.getCurrentThreadId();
4444
assert(g == 1);
4545
CProver.endThread(333);
4646
}
@@ -51,7 +51,7 @@ public void me2()
5151
public void me3()
5252
{
5353
CProver.startThread(333);
54-
int i = CProver.getCurrentThreadID();
54+
int i = CProver.getCurrentThreadId();
5555
assert(g == 1);
5656
CProver.endThread(333);
5757
}
@@ -83,7 +83,7 @@ public void me6()
8383

8484
public void check()
8585
{
86-
g = CProver.getCurrentThreadID();
86+
g = CProver.getCurrentThreadId();
8787
assert(g == 1);
8888
}
8989
}
@@ -94,7 +94,7 @@ class B implements Runnable
9494
@Override
9595
public void run()
9696
{
97-
g = CProver.getCurrentThreadID();
97+
g = CProver.getCurrentThreadId();
9898
assert(g == 1);
9999
}
100100
}
@@ -106,7 +106,7 @@ class C extends Thread
106106
@Override
107107
public void run()
108108
{
109-
g = CProver.getCurrentThreadID();
109+
g = CProver.getCurrentThreadId();
110110
assert(g == 1);
111111
}
112112
}
Binary file not shown.
Binary file not shown.

jbmc/src/java_bytecode/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ calls to the these functions are well-formed, more specifically, each call to
201201

202202
The instrumentation process (described here) will transform the aforementioned
203203
function calls, synchronized blocks/methods and calls to
204-
`java.lang.Thread.getCurrentThreadID:()I` into appropriate codet. As part of
204+
`java.lang.Thread.getCurrentThreadId:()I` into appropriate codet. As part of
205205
this process a new variable per thread is created along with a single global
206206
variable that is used keep track of thread identifiers. These
207207
variables are needed to handle calls to
208-
`java.lang.Thread.getCurrentThreadID:()I`.
208+
`java.lang.Thread.getCurrentThreadId:()I`.
209209

210210
Hold on, how do we go from Java threads to `CProver.startThread:(I)V` and
211211
`CProver.endThread:(I)V`? Well, two ways
@@ -264,13 +264,13 @@ is transformed into the following codet:
264264
```
265265
266266
The ID of the thread is made accessible to the Java program by having calls
267-
to the function `CProver.getCurrentThreadID()I` replaced by the variable
267+
to the function `CProver.getCurrentThreadId()I` replaced by the variable
268268
`__CPROVER__thread_id`.
269269
270270
Example, the following Java code:
271271
272272
```java
273-
int g = java.lang.thead.getCurrentThreadID();
273+
int g = java.lang.thead.getCurrentThreadId();
274274
```
275275

276276
is transformed into the following codet:

jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ static void instrument_end_thread(
362362
}
363363

364364
/// Transforms the codet stored in in \p f_code, which is a call to function
365-
/// CProver.getCurrentThreadID:()I into a code_assignt as described by the
365+
/// CProver.getCurrentThreadId:()I into a code_assignt as described by the
366366
/// documentation of the function convert_thread_block.
367367
///
368368
/// The resulting code_blockt is stored in the output parameter \p code.
369369
///
370-
/// \param f_code: function call to CProver.getCurrentThreadID:()I
370+
/// \param f_code: function call to CProver.getCurrentThreadId:()I
371371
/// \param [out] code: resulting transformation
372372
/// \param symbol_table: a symbol table
373373
static void instrument_get_current_thread_id(
@@ -409,10 +409,10 @@ static void instrument_get_current_thread_id(
409409
/// variable __CPROVER__next_thread_id.
410410
///
411411
/// The ID of the thread is made accessible to the Java program by having calls
412-
/// to the function 'CProver.getCurrentThreadID()I' replaced by the variable
412+
/// to the function 'CProver.getCurrentThreadId()I' replaced by the variable
413413
/// __CPROVER__thread_id. We also perform this substitution in here. The
414414
/// substitution that we perform here assumes that calls to
415-
/// getCurrentThreadID() are ONLY made in the RHS of an expression.
415+
/// getCurrentThreadId() are ONLY made in the RHS of an expression.
416416
///
417417
/// Example:
418418
///
@@ -495,7 +495,7 @@ void convert_threadblock(symbol_tablet &symbol_table)
495495
std::placeholders::_1,
496496
std::placeholders::_2,
497497
std::placeholders::_3);
498-
else if(f_name == "org.cprover.CProver.getCurrentThreadID:()I")
498+
else if(f_name == "org.cprover.CProver.getCurrentThreadId:()I")
499499
cb = std::bind(
500500
&instrument_get_current_thread_id,
501501
std::placeholders::_1,

jbmc/src/java_bytecode/java_utils.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,7 @@ bool is_non_null_library_global(const irep_idt &symbolid)
529529

530530
/// Methods belonging to the class org.cprover.CProver that should be ignored
531531
/// (not converted), leaving the driver program to stub them if it wishes.
532-
const std::unordered_set<std::string> cprover_methods_to_ignore
533-
{
532+
const std::unordered_set<std::string> cprover_methods_to_ignore{
534533
"nondetBoolean",
535534
"nondetByte",
536535
"nondetChar",
@@ -546,8 +545,7 @@ const std::unordered_set<std::string> cprover_methods_to_ignore
546545
"atomicEnd",
547546
"startThread",
548547
"endThread",
549-
"getCurrentThreadID"
550-
};
548+
"getCurrentThreadId"};
551549

552550
/// \param type: type of new symbol
553551
/// \param basename_prefix: new symbol will be named

0 commit comments

Comments
 (0)