Skip to content

Commit 036e103

Browse files
committed
fix all eclipse compiler warnings
1 parent 5b2fc5c commit 036e103

File tree

16 files changed

+58
-47
lines changed

16 files changed

+58
-47
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/JavaModuleBuiltins.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
6565
import com.oracle.truffle.api.dsl.NodeFactory;
6666
import com.oracle.truffle.api.dsl.Specialization;
67-
import com.oracle.truffle.api.frame.VirtualFrame;
6867
import com.oracle.truffle.api.interop.TruffleObject;
6968

7069
@CoreFunctions(defineModule = "java")
@@ -121,7 +120,7 @@ Object doError(Object object) {
121120
@GenerateNodeFactory
122121
abstract static class AddToClassPathNode extends PythonBuiltinNode {
123122
@Specialization
124-
PNone add(VirtualFrame frame, Object[] args,
123+
PNone add(Object[] args,
125124
@Cached CastToJavaStringNode castToString) {
126125
Env env = getContext().getEnv();
127126
if (!env.isHostLookupAllowed()) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/TimeModuleBuiltins.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ public abstract static class PythonTimeNsNode extends PythonBuiltinNode {
194194
/**
195195
* The maximum date, which are systems able to handle is 2262 04 11. This corresponds to the
196196
* 64 bit long.
197-
*
198-
* @return
199197
*/
200198
@Specialization
201199
public long time() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,22 +1230,22 @@ public ZoneId asTimeZone(@Shared("getClassNode") @Cached GetLazyClassNode getCla
12301230
}
12311231

12321232
@TruffleBoundary
1233-
private ZoneId createZoneId(int utcDeltaInSeconds) {
1233+
private static ZoneId createZoneId(int utcDeltaInSeconds) {
12341234
return ZoneId.ofOffset("UTC", ZoneOffset.ofTotalSeconds(utcDeltaInSeconds));
12351235
}
12361236

12371237
@TruffleBoundary
1238-
private ZoneId createZoneId(String zone) {
1238+
private static ZoneId createZoneId(String zone) {
12391239
return ZoneId.of(zone);
12401240
}
12411241

12421242
@TruffleBoundary
1243-
private LocalTime createLocalTime(int hour, int min, int sec, int micro) {
1243+
private static LocalTime createLocalTime(int hour, int min, int sec, int micro) {
12441244
return LocalTime.of(hour, min, sec, micro);
12451245
}
12461246

12471247
@TruffleBoundary
1248-
private LocalDate createLocalDate(int year, int month, int day) {
1248+
private static LocalDate createLocalDate(int year, int month, int day) {
12491249
return LocalDate.of(year, month, day);
12501250
}
12511251

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/bytes/BytesBuiltins.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ boolean doGeneric(@SuppressWarnings("unused") Object self, @SuppressWarnings("un
664664
}
665665

666666
// the actual operation; will be overridden by subclasses
667+
@SuppressWarnings("unused")
667668
protected boolean doIt(byte[] bytes, byte[] prefix, int start, int end) {
668669
CompilerDirectives.transferToInterpreter();
669670
throw new IllegalStateException("should not reach");
@@ -679,7 +680,7 @@ private boolean doIt(byte[] self, PTuple substrs, int start, int stop, PythonObj
679680
return false;
680681
}
681682

682-
private byte[] getBytes(PythonObjectLibrary lib, Object object) {
683+
private static byte[] getBytes(PythonObjectLibrary lib, Object object) {
683684
try {
684685
return lib.getBufferBytes(object);
685686
} catch (UnsupportedMessageException e) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PyLongDigitsWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ final Object readArrayElement(long index,
147147
}
148148

149149
private static long byteAsULong(byte b) {
150-
return ((long) b) & 0xFFL;
150+
return 0xFFL & b;
151151
}
152152

153153
public static long getUInt32(byte[] bytes, int index) {
@@ -203,7 +203,7 @@ protected boolean hasNativeType() {
203203
@ExportMessage
204204
abstract static class GetNativeType {
205205

206-
static Object callGetUInt32ArrayTypeIDUncached(PyLongDigitsWrapper digitsWrapper) {
206+
static Object callGetUInt32ArrayTypeIDUncached(@SuppressWarnings("unused") PyLongDigitsWrapper digitsWrapper) {
207207
return PCallCapiFunction.getUncached().call(FUN_GET_UINT32_ARRAY_TYPE_ID, 0);
208208
}
209209

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtParseArgumentsNode.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,14 @@ static boolean isCStringSpecifier(char c) {
354354
}
355355

356356
@Specialization(guards = "c == FORMAT_LOWER_Y")
357-
static ParserState doBufferR(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
357+
static ParserState doBufferR(ParserState stateIn, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
358358
Object kwdnames, Object varargs,
359359
@Shared("getArgNode") @Cached GetArgNode getArgNode,
360360
@Cached GetVaArgsNode getVaArgNode,
361361
@Cached PCallCExtFunction callGetBufferRwNode,
362-
@Cached(value = "createTN(state)", uncached = "getUncachedTN(state)") CExtToNativeNode argToSulongNode,
362+
@Cached(value = "createTN(stateIn)", uncached = "getUncachedTN(stateIn)") CExtToNativeNode argToSulongNode,
363363
@Shared("raiseNode") @Cached PRaiseNativeNode raiseNode) throws InteropException, ParseArgumentsException {
364-
364+
ParserState state = stateIn;
365365
Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);
366366
if (isLookahead(format, format_idx, '*')) {
367367
/* format_idx++; */
@@ -373,37 +373,37 @@ static ParserState doBufferR(ParserState state, Object kwds, @SuppressWarnings("
373373
} else {
374374
// TODO(fa) convertbuffer: create a temporary 'Py_buffer' struct, call
375375
// 'get_buffer_r' and output the buffer's data pointer
376-
Object destDataPtr = getVaArgNode.execute(varargs, state.outIndex);
376+
getVaArgNode.execute(varargs, state.outIndex);
377377
if (isLookahead(format, format_idx, '#')) {
378378
/* format_idx++; */
379379
// 'y#'
380380
// TODO(fa) additionally store size
381-
Object pybufferPtr = getVaArgNode.execute(varargs, state.outIndex);
381+
getVaArgNode.execute(varargs, state.outIndex);
382382
state = state.incrementOutIndex();
383383
}
384384
}
385385
return state.incrementOutIndex();
386386
}
387387

388388
@Specialization(guards = "isCStringSpecifier(c)")
389-
static ParserState doCString(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
389+
static ParserState doCString(ParserState stateIn, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
390390
Object kwdnames, Object varargs,
391391
@Shared("getArgNode") @Cached GetArgNode getArgNode,
392392
@Cached GetVaArgsNode getVaArgNode,
393393
@Cached AsCharPointerNode asCharPointerNode,
394394
@Cached GetNativeNullNode getNativeNullNode,
395395
@Cached StringLenNode stringLenNode,
396396
@Shared("writeOutVarNode") @Cached WriteOutVarNode writeOutVarNode,
397-
@Cached(value = "createTN(state)", uncached = "getUncachedTN(state)") CExtToNativeNode toNativeNode,
397+
@Cached(value = "createTN(stateIn)", uncached = "getUncachedTN(stateIn)") CExtToNativeNode toNativeNode,
398398
@Shared("raiseNode") @Cached PRaiseNativeNode raiseNode) throws InteropException, ParseArgumentsException {
399-
399+
ParserState state = stateIn;
400400
Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);
401401
boolean z = c == FORMAT_LOWER_Z;
402402
if (isLookahead(format, format_idx, '*')) {
403403
/* format_idx++; */
404404
// 's*' or 'z*'
405405
if (!skipOptionalArg(arg, state.restOptional)) {
406-
Object pybuffer = getVaArgNode.execute(varargs, state.outIndex);
406+
getVaArgNode.execute(varargs, state.outIndex);
407407
// TODO(fa) create Py_buffer
408408
}
409409
} else if (isLookahead(format, format_idx, '#')) {
@@ -846,17 +846,18 @@ static ParserState doComplex(ParserState state, Object kwds, @SuppressWarnings("
846846
}
847847

848848
@Specialization(guards = "c == FORMAT_UPPER_O")
849-
static ParserState doObject(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
849+
static ParserState doObject(ParserState stateIn, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
850850
Object kwdnames, Object varargs,
851851
@Shared("getArgNode") @Cached GetArgNode getArgNode,
852852
@Cached GetVaArgsNode getVaArgNode,
853853
@Cached ExecuteConverterNode executeConverterNode,
854854
@Cached GetLazyClassNode getClassNode,
855855
@Cached IsSubtypeNode isSubtypeNode,
856-
@Cached(value = "createTJ(state)", uncached = "getUncachedTJ(state)") CExtToJavaNode typeToJavaNode,
857-
@Cached(value = "createTN(state)", uncached = "getUncachedTN(state)") CExtToNativeNode toNativeNode,
856+
@Cached(value = "createTJ(stateIn)", uncached = "getUncachedTJ(stateIn)") CExtToJavaNode typeToJavaNode,
857+
@Cached(value = "createTN(stateIn)", uncached = "getUncachedTN(stateIn)") CExtToNativeNode toNativeNode,
858858
@Shared("writeOutVarNode") @Cached WriteOutVarNode writeOutVarNode,
859859
@Shared("raiseNode") @Cached PRaiseNativeNode raiseNode) throws InteropException, ParseArgumentsException {
860+
ParserState state = stateIn;
860861
Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);
861862
if (isLookahead(format, format_idx, '!')) {
862863
/* format_idx++; */

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/VaListWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public VaListWrapper(CExtContext nativeContext, Object vaListPtr, Object outVarP
6464
}
6565

6666
@ExportMessage
67+
@SuppressWarnings("static-method")
6768
final long getArraySize() {
6869
return Long.MAX_VALUE;
6970
}
@@ -80,7 +81,7 @@ final Object readArrayElement(long index,
8081
if (index != pos) {
8182
throw InvalidArrayIndexException.create(index);
8283
}
83-
Object res = callGetVaargNode.execute(nativeContext, "get_next_vaarg", new Object[]{vaListPtr, outVarPtrPtr});
84+
callGetVaargNode.execute(nativeContext, "get_next_vaarg", new Object[]{vaListPtr, outVarPtrPtr});
8485
pos++;
8586
return outVarPtrPtr;
8687
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2565,7 +2565,7 @@ protected static boolean isInt(Object times) {
25652565
return times instanceof Integer;
25662566
}
25672567

2568-
private int toIndex(VirtualFrame frame, Object times, PRaiseNode raiseNode, PythonObjectLibrary lib) {
2568+
private static int toIndex(VirtualFrame frame, Object times, PRaiseNode raiseNode, PythonObjectLibrary lib) {
25692569
if (lib.canBeIndex(times)) {
25702570
return lib.asSizeWithState(times, PArguments.getThreadState(frame));
25712571
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex/ComplexBuiltins.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@
5858
import static com.oracle.graal.python.nodes.SpecialMethodNames.__RADD__;
5959
import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
6060
import static com.oracle.graal.python.nodes.SpecialMethodNames.__RMUL__;
61+
import static com.oracle.graal.python.nodes.SpecialMethodNames.__RSUB__;
6162
import static com.oracle.graal.python.nodes.SpecialMethodNames.__RTRUEDIV__;
6263
import static com.oracle.graal.python.nodes.SpecialMethodNames.__STR__;
6364
import static com.oracle.graal.python.nodes.SpecialMethodNames.__SUB__;
64-
import static com.oracle.graal.python.nodes.SpecialMethodNames.__RSUB__;
6565
import static com.oracle.graal.python.nodes.SpecialMethodNames.__TRUEDIV__;
6666

6767
import java.util.List;
@@ -439,11 +439,13 @@ PNotImplemented doComplex(Object left, Object right) {
439439
@GenerateNodeFactory
440440
@Builtin(name = __RSUB__, minNumOfPositionalArgs = 2)
441441
abstract static class RSubNode extends SubNode {
442+
@Override
442443
@Specialization
443444
PComplex doComplexDouble(PComplex left, double right) {
444445
return factory().createComplex(right - left.getReal(), -left.getImag());
445446
}
446447

448+
@Override
447449
@Specialization
448450
PComplex doComplex(PComplex left, long right) {
449451
return factory().createComplex(right - left.getReal(), -left.getImag());
@@ -497,6 +499,7 @@ PNotImplemented doGeneric(Object left, Object right) {
497499
@GenerateNodeFactory
498500
@Builtin(name = __GE__, minNumOfPositionalArgs = 2)
499501
abstract static class GeNode extends PythonBinaryBuiltinNode {
502+
@SuppressWarnings("unused")
500503
@Specialization
501504
PNotImplemented doComplex(PComplex left, PComplex right) {
502505
return PNotImplemented.NOT_IMPLEMENTED;
@@ -512,6 +515,7 @@ PNotImplemented doGeneric(Object left, Object right) {
512515
@GenerateNodeFactory
513516
@Builtin(name = __GT__, minNumOfPositionalArgs = 2)
514517
abstract static class GtNode extends PythonBinaryBuiltinNode {
518+
@SuppressWarnings("unused")
515519
@Specialization
516520
PNotImplemented doComplex(PComplex left, PComplex right) {
517521
return PNotImplemented.NOT_IMPLEMENTED;
@@ -527,6 +531,7 @@ PNotImplemented doGeneric(Object left, Object right) {
527531
@GenerateNodeFactory
528532
@Builtin(name = __LT__, minNumOfPositionalArgs = 2)
529533
abstract static class LtNode extends PythonBinaryBuiltinNode {
534+
@SuppressWarnings("unused")
530535
@Specialization
531536
PNotImplemented doComplex(PComplex left, PComplex right) {
532537
return PNotImplemented.NOT_IMPLEMENTED;
@@ -542,6 +547,7 @@ PNotImplemented doGeneric(Object left, Object right) {
542547
@GenerateNodeFactory
543548
@Builtin(name = __LE__, minNumOfPositionalArgs = 2)
544549
abstract static class LeNode extends PythonBinaryBuiltinNode {
550+
@SuppressWarnings("unused")
545551
@Specialization
546552
PNotImplemented doComplex(PComplex left, PComplex right) {
547553
return PNotImplemented.NOT_IMPLEMENTED;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/ObjectBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ LazyPythonClass setClass(@SuppressWarnings("unused") Object self, @SuppressWarni
141141
}
142142

143143
@Specialization
144-
PNone setClass(VirtualFrame frame, PythonObject self, PythonAbstractClass value,
144+
PNone setClass(PythonObject self, PythonAbstractClass value,
145145
@CachedLibrary(limit = "2") PythonObjectLibrary lib,
146146
@CachedLibrary(limit = "2") PythonObjectLibrary slotsLib,
147147
@Cached("create()") BranchProfile errorValueBranch,

0 commit comments

Comments
 (0)