Skip to content

Commit b839cb1

Browse files
committed
Fixed style issues
1 parent 486d7ae commit b839cb1

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/random/PRandom.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ int getIndex() {
142142
return index;
143143
}
144144

145-
void restore(int[] state, int index) {
146-
assert state.length == N;
147-
this.state = state;
148-
this.index = index;
145+
void restore(int[] new_state, int new_index) {
146+
assert new_state.length == N;
147+
assert new_index >= 0 && new_index <= N;
148+
state = new_state;
149+
index = new_index;
149150
}
150151
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/random/RandomBuiltins.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ PNone setstate(PRandom random, PTuple tuple,
187187
}
188188

189189
@Fallback
190+
@SuppressWarnings("unused")
190191
Object setstate(Object random, Object state) {
191192
throw raise(TypeError, ErrorMessages.STATE_VECTOR_MUST_BE_A_TUPLE);
192193
}
@@ -202,7 +203,7 @@ PTuple getstate(PRandom random) {
202203
}
203204

204205
@TruffleBoundary
205-
private Object[] encodeState(PRandom random) {
206+
private static Object[] encodeState(PRandom random) {
206207
int[] state = random.getState();
207208
Object[] encodedState = new Object[PRandom.N + 1];
208209
for (int i = 0; i < PRandom.N; ++i) {
@@ -252,7 +253,7 @@ int genInt(PRandom random, int k) {
252253

253254
@Specialization(guards = "k == 32")
254255
@TruffleBoundary
255-
long gen32Bits(PRandom random, int k) {
256+
long gen32Bits(PRandom random, @SuppressWarnings("unused") int k) {
256257
return random.nextInt() & 0xFFFFFFFFL;
257258
}
258259

0 commit comments

Comments
 (0)