[Fb-contrib-commit] SF.net SVN: fb-contrib:[1827] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2017-09-24 01:16:37
|
Revision: 1827
http://sourceforge.net/p/fb-contrib/code/1827
Author: dbrosius
Date: 2017-09-24 01:16:34 +0000 (Sun, 24 Sep 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/OI_Sample.java
trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/build.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.4" />
+ <property name="fb-contrib.version" value="7.0.5" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-09-24 01:16:34 UTC (rev 1827)
@@ -107,6 +107,7 @@
+0 BugPattern LO_STUTTERED_MESSAGE
+0 BugPattern LO_SUSPECT_LOG_CLASS
+0 BugPattern LO_SUSPECT_LOG_PARAMETER
++0 BugPattern LO_TOSTRING_PARAMETER
+2 BugPattern LSC_LITERAL_STRING_COMPARISON
+0 BugPattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION
+2 BugPattern MAC_MANUAL_ARRAY_COPY
@@ -152,6 +153,7 @@
+0 BugPattern OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED
+0 BugPattern OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION
+0 BugPattern OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION
++0 BugPattern OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL
+0 BugPattern OPM_OVERLY_PERMISSIVE_METHOD
+0 BugPattern PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP
+2 BugPattern PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -176,7 +176,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" speed="fast" reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING,LO_TOSTRING_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -309,7 +309,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED,OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
@@ -482,7 +482,8 @@
<BugPattern abbrev="LO" type="LO_EXCEPTION_WITH_LOGGER_PARMS" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_APPENDED_STRING_IN_FORMAT_STRING" category="PERFORMANCE" />
<BugPattern abbrev="LO" type="LO_INVALID_STRING_FORMAT_NOTATION" category="CORRECTNESS" />
- <BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" />
+ <BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" category="CORRECTNESS"/>
+ <BugPattern abbrev="LO" type="LO_TOSTRING_PARAMETER" category="CORRECTNESS" />
<BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" />
<BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" />
<BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" />
@@ -601,6 +602,7 @@
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL" category="CORRECTNESS" />
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS"/>
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
<BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/messages.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -4117,6 +4117,21 @@
</Details>
</BugPattern>
+ <BugPattern type="LO_TOSTRING_PARAMETER">
+ <ShortDescription>Method explicitly calls toString() on a logger parameter</ShortDescription>
+ <LongDescription>Method {1} explicitly calls toString() on a logger parameter</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses parameterized logging to avoid the cost of string concatenation in the case that
+ the log level does not meet the needed level. However, one or more of the parameters passed to the logging
+ method uses .toString() to present a String representation for the parameter. This is unneeded as the logger
+ will do this for you, and because it is explicitly done, will always be called even if the log statement is
+ not actually written. Also, by dropping the '.toString()' you may avoid unnecessary NPEs.
+ Just pass the variable as a parameter instead.
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
<ShortDescription>Class relies on internal API classes</ShortDescription>
<LongDescription>Class {0} relies on internal API classes</LongDescription>
@@ -5880,6 +5895,18 @@
</Details>
</BugPattern>
+ <BugPattern type="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL">
+ <ShortDescription>Method uses Optional.orElseGet(null)</ShortDescription>
+ <LongDescription>Method {1} uses Optional.orElseGet(null)</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses Optional.orElseGet(null). This method is supposed to to receive a lambda expression for what to execute
+ when the Optional is not there. If you want to just return null, use Optional.orElse(null) instead.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT">
<ShortDescription>Method constructs a Date object, merely to convert it to an Instant object</ShortDescription>
<LongDescription>Method {1} constructs a Date object, merely to convert it to an Instant object</LongDescription>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.4 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.5 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/htdocs/repository.html 2017-09-24 01:16:34 UTC (rev 1827)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.4 or 7.0.4.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.5 or 7.0.5.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/pom.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.4</version>
+ <version>7.0.5</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -141,8 +141,8 @@
String clsName = SignatureUtils.stripSignature(signature);
JavaClass cls = Repository.lookupClass(clsName);
if ((cls.implementationOf(mapInterface) && !name.endsWith("map")) || (cls.implementationOf(setInterface) && !name.endsWith("set"))
- || (cls.implementationOf(listInterface) && !name.endsWith("list"))
- || (cls.implementationOf(queueInterface) && !name.endsWith("queue"))) {
+ || ((cls.implementationOf(listInterface) || cls.implementationOf(queueInterface)) && !name.endsWith("list")
+ && !name.endsWith("queue"))) {
return true;
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -160,9 +160,10 @@
public void sawOpcode(int seen) {
String ldcClassName = null;
String seenMethodName = null;
+ boolean seenToString = false;
int exMessageReg = -1;
Integer arraySize = null;
- Boolean simpleFormat = null;
+ boolean simpleFormat = false;
try {
stack.precomputation(this);
@@ -182,7 +183,7 @@
if (format != null) {
Matcher m = NON_SIMPLE_FORMAT.matcher(format);
if (!m.matches()) {
- simpleFormat = Boolean.TRUE;
+ simpleFormat = true;
}
}
}
@@ -218,6 +219,10 @@
seenMethodName = mthName;
}
}
+
+ if (seenMethodName == null) {
+ seenToString = true;
+ }
}
} else if (seen == INVOKESPECIAL) {
checkForLoggerParam();
@@ -245,7 +250,7 @@
LOUserValue<String> uv = (LOUserValue<String>) item.getUserValue();
if (uv != null) {
if (((uv.getType() == LOUserValue.LOType.METHOD_NAME) && Values.TOSTRING.equals(uv.getValue()))
- || (uv.getType() == LOUserValue.LOType.SIMPLE_FORMAT)) {
+ || (uv.getType() == LOUserValue.LOType.SIMPLE_FORMAT) || (uv.getType() == LOUserValue.LOType.TOSTRING)) {
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.NULL, null));
}
}
@@ -267,8 +272,10 @@
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.MESSAGE_REG, Integer.valueOf(exMessageReg)));
} else if (arraySize != null) {
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.ARRAY_SIZE, arraySize));
- } else if (simpleFormat != null) {
- item.setUserValue(new LOUserValue<>(LOUserValue.LOType.SIMPLE_FORMAT, simpleFormat));
+ } else if (simpleFormat) {
+ item.setUserValue(new LOUserValue<>(LOUserValue.LOType.SIMPLE_FORMAT, Boolean.TRUE));
+ } else if (seenToString) {
+ item.setUserValue(new LOUserValue<>(LOUserValue.LOType.TOSTRING, null));
}
}
}
@@ -352,11 +359,28 @@
}
}
}
+
+ boolean foundToString = false;
+ for (int i = 0; i < (numParms - 1); i++) {
+ OpcodeStack.Item itm = stack.getStackItem(i);
+ LOUserValue<?> uv = (LOUserValue<?>) itm.getUserValue();
+ foundToString = ((uv != null)
+ && ((uv.getType() == LOUserValue.LOType.TOSTRING) || (uv.getType() == LOUserValue.LOType.METHOD_NAME)));
+ if (foundToString) {
+ break;
+ }
+ }
+
+ if (foundToString) {
+ bugReporter.reportBug(new BugInstance(this, BugType.LO_TOSTRING_PARAMETER.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
+ .addSourceLine(this));
+ }
}
}
}
}
+
}
/**
@@ -553,7 +577,7 @@
static class LOUserValue<T> {
enum LOType {
- CLASS_NAME, METHOD_NAME, MESSAGE_REG, ARRAY_SIZE, SIMPLE_FORMAT, NULL
+ CLASS_NAME, METHOD_NAME, MESSAGE_REG, ARRAY_SIZE, SIMPLE_FORMAT, TOSTRING, NULL
};
LOType type;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -206,14 +206,20 @@
if (!activeStackOps.isEmpty()) {
ActiveStackOp op = activeStackOps.getLast();
- Method getMethod = getLambdaMethod(op.getMethod().getMethodName());
- if (getMethod != null) {
- byte[] byteCode = getMethod.getCode().getCode();
- if (byteCode.length <= 4) {
- // we are looking for ALOAD, GETFIELD, or LDC followed by ARETURN, that should fit in 4 bytes
- if (!hasInvoke(byteCode)) {
- bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION.name(), LOW_PRIORITY)
- .addClass(this).addMethod(this).addSourceLine(this));
+ FQMethod method = op.getMethod();
+ if (method == null) {
+ bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL.name(), LOW_PRIORITY)
+ .addClass(this).addMethod(this).addSourceLine(this));
+ } else {
+ Method getMethod = getLambdaMethod(method.getMethodName());
+ if (getMethod != null) {
+ byte[] byteCode = getMethod.getCode().getCode();
+ if (byteCode.length <= 4) {
+ // we are looking for ALOAD, GETFIELD, or LDC followed by ARETURN, that should fit in 4 bytes
+ if (!hasInvoke(byteCode)) {
+ bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION.name(), LOW_PRIORITY)
+ .addClass(this).addMethod(this).addSourceLine(this));
+ }
}
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -45,7 +45,8 @@
private final List<String> knownExceptions = UnmodifiableList.create(
// @formatter:off
- "uk/org/lidalia/"
+ "uk/org/lidalia/",
+ "au/com/bytecode/"
// @formatter:on
);
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -140,6 +140,7 @@
LO_STUTTERED_MESSAGE,
LO_SUSPECT_LOG_CLASS,
LO_SUSPECT_LOG_PARAMETER,
+ LO_TOSTRING_PARAMETER,
LSC_LITERAL_STRING_COMPARISON,
LSYC_LOCAL_SYNCHRONIZED_COLLECTION,
@@ -188,6 +189,7 @@
OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED,
OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,
OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,
+ OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL,
OPM_OVERLY_PERMISSIVE_METHOD,
PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP,
Modified: trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -1,6 +1,8 @@
package ex;
+
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -13,6 +15,8 @@
// tag CNC_COLLECTION_NAMING_CONFUSION
List<Double> bernoulliSet;
+ LinkedList<String> mLinkedList = new LinkedList<>();
+
// tag 3xCNC_COLLECTION_NAMING_CONFUSION
public void testCNC(Map<String, String> argSet, Set<String> nameList, List<String> nameMap) {
Modified: trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/LO_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/LO_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -102,6 +102,16 @@
l3.error(String.format("The error was %s", poo));
}
+ public void testToStringInParm(List<Long> data) {
+ l3.info("This is a parm: {}", data.toString());
+ }
+
+ public String testReuseToStringInParm(List<Long> data) {
+ String info = data.toString();
+ l3.info("This is a parm: {}", info);
+ return info;
+ }
+
public void testFPReuseofSimpleFormatter(String poo) {
String s = String.format("The error was %s", poo);
l3.error(s);
Modified: trunk/fb-contrib/src/samples/java/ex/OI_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/OI_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/OI_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -1,4 +1,6 @@
package ex;
+
+import java.util.Date;
import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
@@ -36,6 +38,10 @@
return Optional.of(3.14);
}
+ public Date orElseGetNull(Optional<Date> o) {
+ return o.orElseGet(null);
+ }
+
public String fpDelayedOK(Optional<String> o, String a, String b) {
return o.orElseGet(() -> String.format("%s boo %s hiss", a, b));
@@ -54,5 +60,4 @@
public Long fpBoxingIsTooCommon(Optional<Long> o) {
return o.orElse(0L);
}
-
}
Modified: trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -2,6 +2,12 @@
public class UCPM_Sample {
+ private static final String A;
+
+ static {
+ A = "A";
+ }
+
private StringBuffer sb; // made this a field to avoid "unnecessary use of
// synchronized class"
@@ -67,4 +73,10 @@
StringBuilder sb = new StringBuilder();
return sb.append("(").append(value).append(")").toString();
}
+
+ public String fpStaticFinalField236() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(A);
+ return sb.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|