Skip to content

Commit 8716afd

Browse files
committed
[GR-13337] Update to latest mx (and thus SpotBugs) version.
PullRequest: fastr/1922
2 parents 8cd3cbd + 85adbc5 commit 8716afd

File tree

24 files changed

+91
-56
lines changed

24 files changed

+91
-56
lines changed

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RFileTypeDetector.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,10 +31,12 @@
3131
public final class RFileTypeDetector extends FileTypeDetector {
3232
@Override
3333
public String probeContentType(Path path) throws IOException {
34-
35-
String fileName = path.getFileName().toString();
36-
if (fileName.endsWith(".R") || fileName.endsWith(".r")) {
37-
return RRuntime.R_TEXT_MIME;
34+
Path fileNamePath = path.getFileName();
35+
if (fileNamePath != null) {
36+
String fileName = fileNamePath.toString();
37+
if (fileName.endsWith(".R") || fileName.endsWith(".r")) {
38+
return RRuntime.R_TEXT_MIME;
39+
}
3840
}
3941
return null;
4042
}

com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -251,7 +251,7 @@ private Object findCallerFromFrame(Frame frame) {
251251
caller = caller.getParent();
252252
}
253253
}
254-
if (caller != null && caller.isValidCaller()) {
254+
if (caller.isValidCaller()) {
255255
// This is where we need to ensure that we have an RLanguage object with a rep that
256256
// is an RSyntaxNode.
257257
return getSyntaxCaller(caller);

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/llvm/TruffleLLVM_DLL.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ public static LLVMArchive getZipLLVMIR(String path) throws IOException {
224224
continue;
225225
}
226226
Path zipName = Paths.get(entry.getName());
227-
String name = zipName.getFileName().toString();
227+
Path fileNamePath = zipName.getFileName();
228+
assert fileNamePath != null;
229+
String name = fileNamePath.toString();
228230
int ix = name.indexOf('.');
229231
if (ix > 0) {
230232
name = name.substring(0, ix);
@@ -378,7 +380,9 @@ public DLCloseNode createDLCloseNode() {
378380
}
379381

380382
private static String getLibName(String path) {
381-
String fileName = FileSystems.getDefault().getPath(path).getFileName().toString();
383+
Path fileNamePath = FileSystems.getDefault().getPath(path).getFileName();
384+
assert fileNamePath != null;
385+
String fileName = fileNamePath.toString();
382386
int ix = fileName.lastIndexOf(".");
383387
return fileName.substring(0, ix);
384388
}

com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/CountFields.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ protected Object count(int conn, Object sep, Object quote, int nskipArg, boolean
114114
}
115115
}
116116

117+
@SuppressFBWarnings(value = "UC_USELESS_CONDITION", justification = "incomplete implementation")
117118
private static Object countFields(RConnection file, char sepChar, String quoteSet, @SuppressWarnings("unused") int nskip, boolean blskip, char comChar) throws IOException {
118119
LocalData data = new LocalData();
119120
data.sepchar = sepChar;

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/EagerResourceHandlerFactory.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
2626
import java.io.File;
2727
import java.io.InputStream;
2828
import java.net.URL;
29+
import java.nio.file.Path;
2930
import java.nio.file.Paths;
3031
import java.security.CodeSource;
3132
import java.util.Enumeration;
@@ -74,7 +75,9 @@ public URL getResource(Class<?> accessor, String name) {
7475
@Override
7576
public InputStream getResourceAsStream(Class<?> accessor, String name) {
7677
// actual resource
77-
String fileName = Paths.get(name).getFileName().toString();
78+
Path fileNamePath = Paths.get(name).getFileName();
79+
assert fileNamePath != null;
80+
String fileName = fileNamePath.toString();
7881
FileInfo fileInfo = files.get(fileName);
7982
if (fileInfo == null || fileInfo.data == null) {
8083
return null;
@@ -108,7 +111,9 @@ private static void gatherResources() {
108111
}
109112
// using a proper jar URL causes build image problems
110113
// and no-one really cares what the URL is - we have the data already
111-
String fileName = Paths.get(name).getFileName().toString();
114+
Path fileNamePath = Paths.get(name).getFileName();
115+
assert fileNamePath != null;
116+
String fileName = fileNamePath.toString();
112117
files.put(fileName, new FileInfo(fileName, new URL("file://" + name), buf));
113118
}
114119
}

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CompileFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@ protected boolean disassemble(@SuppressWarnings("unused") String symbol) {
136136
public abstract static class BcVersion extends RBuiltinNode.Arg0 {
137137

138138
static {
139-
Casts casts = new Casts(BcVersion.class);
139+
Casts.noCasts(BcVersion.class);
140140
}
141141

142142
@Specialization

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -705,7 +705,7 @@ public int[] apply(Frame f) {
705705
int currentCallIdx = currentCall.getDepth() - 1;
706706
RCaller parent = currentCall.getParent();
707707
RCaller previous = currentCall;
708-
while (parent != null & parent.isPromise()) {
708+
while (parent != null && parent.isPromise()) {
709709
if (parent.hasSysParent()) {
710710
// parent.frame explicitly set by Rf_eval(quote(foo()), env) to
711711
// env

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1995-2012, The R Core Team
33
* Copyright (c) 2003, The R Foundation
4-
* Copyright (c) 2014, 2018, Oracle and/or its affiliates
4+
* Copyright (c) 2014, 2019, Oracle and/or its affiliates
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -470,7 +470,8 @@ public Object getSessionRef() {
470470
if (!rc) {
471471
throw error(Message.GENERIC, "zlib compress error");
472472
}
473-
} else if (compression == 3) {
473+
} else {
474+
assert compression == 3;
474475
ctype = RCompression.Type.XZ;
475476
offset = 5;
476477
outLen = data.length;
@@ -479,8 +480,6 @@ public Object getSessionRef() {
479480
if (!rc) {
480481
throw error(Message.GENERIC, "lzma compress error");
481482
}
482-
} else {
483-
throw RInternalError.shouldNotReachHere();
484483
}
485484
int[] intData = new int[2];
486485
intData[1] = outLen + offset; // include length + type (compression == 3)

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LaFunctions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ protected Object doSvd(String ju, RAbstractDoubleVector x, RAbstractDoubleVector
853853

854854
int lwork = (int) tmp[0];
855855
double[] work = new double[lwork];
856-
dgesddNode.execute(ju.charAt(0), n, p, xvals, n, sdata, udata, ldu, vtdata, ldvt, work, lwork, iwork);
856+
info = dgesddNode.execute(ju.charAt(0), n, p, xvals, n, sdata, udata, ldu, vtdata, ldvt, work, lwork, iwork);
857857
if (info != 0) {
858858
error(Message.LAPACK_ERROR, info, "dgesdd");
859859
}

com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RowsumFunctions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Copyright (c) 1995, 1996 Robert Gentleman and Ross Ihaka
33
* Copyright (c) 1997-2015, The R Core Team
4-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates
4+
* Copyright (c) 2016, 2019, Oracle and/or its affiliates
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -90,7 +90,7 @@ protected Object rowsum(RAbstractVector xv, RAbstractVector g, RAbstractVector u
9090
int[] matches = new int[n];
9191
for (int i = 0; i < n; i++) {
9292
Integer hi = table.get(g.getDataAtAsObject(i));
93-
matches[i] = xv == null ? 0 : hi + 1;
93+
matches[i] = hi + 1;
9494
}
9595
int offset = 0;
9696
int offsetg = 0;

0 commit comments

Comments
 (0)