Skip to content
Commits on Source (6)
......@@ -16,13 +16,31 @@
language: java
sudo: false
jdk:
- openjdk7
- oraclejdk8
- oraclejdk9
# Get latest install-jdk.sh script
before_install:
- wget -P ./target/ https://github.com/sormuras/bach/raw/master/install-jdk.sh
matrix:
include:
- env: JDK_RELEASE='OpenJDK 7'
jdk: openjdk7
- env: JDK_RELEASE='OracleJDK 8'
jdk: oraclejdk8
- env: JDK_RELEASE='OracleJDK 9'
jdk: oraclejdk9
- env: JDK_RELEASE='OracleJDK 10'
jdk: oraclejdk10
- env: JDK_RELEASE='OpenJDK 10'
jdk: openjdk10
# Java 11 "Oracle JDK" (not yet provided by Travis CI)
- env: JDK='Oracle JDK 11'
install: . ./target/install-jdk.sh -F 11 -L BCL
# some FastDateParser tests currently fail with java.text.ParseException: Unparseable date
allow_failures:
- env: JDK='Oracle JDK 11'
script:
- mvn
after_success:
- mvn clean cobertura:cobertura coveralls:report -Ptravis-cobertura
- mvn clean test jacoco:report coveralls:report -Ptravis-jacoco
......@@ -50,48 +50,66 @@ Getting Started
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss you're changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons Lang's scope.
+ Submit a ticket for your issue, assuming one does not already exist.
+ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons Lang's scope.
+ Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
+ Fork the repository on GitHub.
+ Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-),
[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository.
Making Changes
--------------
+ Create a topic branch from where you want to base your work (this is usually the master/trunk branch).
+ Create a _topic branch_ for your isolated work.
* Usually you should base your branch on the `master` or `trunk` branch.
* A good topic branch name can be the JIRA bug id plus a keyword, e.g. `LANG-123-InputStream`.
* If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
+ Make commits of logical units.
* Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
* e.g. `LANG-123: Close input stream earlier`
+ Respect the original code style:
+ Only use spaces for indentation.
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
+ Check for unnecessary whitespace with git diff --check before committing.
+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
+ Make sure you have added the necessary tests for your changes.
+ Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
+ Check for unnecessary whitespace with `git diff` -- check before committing.
+ Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
The JIRA tickets are used to generate the changelog for the next release.
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
Submitting Changes
------------------
+ Sign the [Contributor License Agreement][cla] if you haven't already.
+ Sign and submit the Apache [Contributor License Agreement][cla] if you haven't already.
* Note that small patches & typical bug fixes do not require a CLA as
clause 5 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html#contributions)
covers them.
+ Push your changes to a topic branch in your fork of the repository.
+ Submit a pull request to the repository in the apache organization.
+ Submit a _Pull Request_ to the corresponding repository in the `apache` organization.
* Verify _Files Changed_ shows only your intended changes and does not
include additional files like `target/*.class`
+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you prefer to not use GitHub, then you can instead use
`git format-patch` (or `svn diff`) and attach the patch file to the JIRA issue.
Additional Resources
--------------------
+ [Contributing patches](https://commons.apache.org/patches.html)
+ [Apache Commons Lang JIRA project page](https://issues.apache.org/jira/browse/LANG)
+ [Apache Commons Lang JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
+ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ #apachecommons IRC channel on freenode.org
+ `#apache-commons` IRC channel on `irc.freenode.net`
[cla]:https://www.apache.org/licenses/#clas
[jira]:https://issues.apache.org/jira/browse/LANG
Apache Commons Lang
Copyright 2001-2017 The Apache Software Foundation
Copyright 2001-2018 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
This product includes software from the Spring Framework,
under the Apache License 2.0 (see: StringUtils.containsWhitespace())
......@@ -43,10 +43,10 @@
Apache Commons Lang
===================
[![Build Status](https://travis-ci.org/apache/commons-lang.svg?branch=master)](https://travis-ci.org/apache/commons-lang)
[![Coverage Status](https://coveralls.io/repos/apache/commons-lang/badge.svg?branch=master)](https://coveralls.io/r/apache/commons-lang)
[![Build Status](https://travis-ci.org/apache/commons-lang.svg)](https://travis-ci.org/apache/commons-lang)
[![Coverage Status](https://coveralls.io/repos/apache/commons-lang/badge.svg)](https://coveralls.io/r/apache/commons-lang)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-lang3/)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-lang3/3.6.svg)](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.6)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-lang3/3.8.svg)](https://javadoc.io/doc/org.apache.commons/commons-lang3/3.8)
Apache Commons Lang, a package of Java utility classes for the
classes that are in java.lang's hierarchy, or are considered to be so
......@@ -55,13 +55,13 @@ Apache Commons Lang, a package of Java utility classes for the
Documentation
-------------
More information can be found on the [homepage](https://commons.apache.org/proper/commons-lang).
The [JavaDoc](https://commons.apache.org/proper/commons-lang/javadocs/api-release) can be browsed.
More information can be found on the [Apache Commons Lang homepage](https://commons.apache.org/proper/commons-lang3).
The [Javadoc](https://commons.apache.org/proper/commons-lang3/javadocs/api-release) can be browsed.
Questions related to the usage of Apache Commons Lang should be posted to the [user mailing list][ml].
Where can I get the latest release?
-----------------------------------
You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-lang/download_lang.cgi).
You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-lang3/download_lang3.cgi).
Alternatively you can pull it from the central Maven repositories:
......@@ -69,14 +69,14 @@ Alternatively you can pull it from the central Maven repositories:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
<version>3.8</version>
</dependency>
```
Contributing
------------
We accept PRs via github. The [developer mailing list][ml] is the main channel of communication for contributors.
We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors.
There are some guidelines which will make applying PRs easier for us:
+ No tabs! Please use spaces for indentation.
+ Respect the code style.
......@@ -88,7 +88,9 @@ You can learn more about contributing via GitHub in our [contribution guidelines
License
-------
Code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0.txt).
This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).
See the `NOTICE.txt` file for required notices and attributions.
Donations
---------
......@@ -97,10 +99,9 @@ You like Apache Commons Lang? Then [donate back to the ASF](https://www.apache.o
Additional Resources
--------------------
+ [Apache Commons Lang Homepage](https://commons.apache.org/proper/commons-lang)
+ [Apache Commons Lang Bugtracker (JIRA)](https://issues.apache.org/jira/browse/LANG)
+ [Apache Commons Homepage](https://commons.apache.org/)
+ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/LANG)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ #apachecommons IRC channel on freenode.org
+ `#apache-commons` IRC channel on `irc.freenode.org`
[ml]:https://commons.apache.org/mail-lists.html
......@@ -14,6 +14,75 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================
Apache Commons Lang
Version 3.8
Release Notes
INTRODUCTION:
This document contains the release notes for the 3.8 version of Apache Commons Lang.
Commons Lang is a set of utility functions and reusable components that should be of use in any
Java environment.
Lang 3.0 and onwards now targets Java 5.0, making use of features that arrived with Java 5.0 such as generics,
variable arguments, autoboxing, concurrency and formatted output.
For the advice on upgrading from 2.x to 3.x, see the following page:
http://commons.apache.org/lang/article3_0.html
Apache Commons Lang, a package of Java utility classes for the
classes that are in java.lang's hierarchy, or are considered to be so
standard as to justify existence in java.lang.
New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.
Changes in this version include:
New features:
o LANG-1352: EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added Thanks to Ruslan Sibgatullin.
o LANG-1372: Add ToStringSummary annotation Thanks to Sérgio Ozaki.
o LANG-1356: Add bypass option for classes to recursive and reflective EqualsBuilder Thanks to Yathos UG.
o LANG-1391: Improve Javadoc for StringUtils.isAnyEmpty(null) Thanks to Sauro Matulli, Oleg Chubaryov.
o LANG-1393: Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue) Thanks to Gary Gregory.
o LANG-1394: org.apache.commons.lang3.SystemUtils should not write to System.err. Thanks to Sebb, Gary Gregory.
o LANG-1238: Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern. Thanks to Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov.
o LANG-1390: StringUtils.join() with support for List<?> with configurable start/end indices. Thanks to Jochen Schalanda.
o LANG-1392: Methods for getting first non empty or non blank value Thanks to Jeff Nelson.
o LANG-1408: Rounding utilities for converting to BigDecimal
Fixed Bugs:
o LANG-1380: FastDateParser too strict on abbreviated short month symbols Thanks to Markus Jelsma.
o LANG-1396: JsonToStringStyle does not escape string names
o LANG-1395: JsonToStringStyle does not escape double quote in a string value Thanks to Jim Gan.
o LANG-1384: New Java version ("11") must be handled Thanks to Ian Young.
o LANG-1364: ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists Thanks to Zheng Xie.
o LANG-1060: NumberUtils.isNumber assumes number starting with Zero Thanks to Piotr Kosmala.
o LANG-1375: defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr) Thanks to Jerry Zhao.
o LANG-1374: Parsing Json Array failed Thanks to Jaswanth Bala.
o LANG-1371: Fix TypeUtils#parameterize to work correctly with narrower-typed array Thanks to Dmitry Ovchinnikov.
o LANG-1370: Fix EventCountCircuitBreaker increment batch Thanks to Andre Dieb.
o LANG-1385: NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException Thanks to Rohan Padhye.
o LANG-1397: WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE. Thanks to Takanobu Asanuma.
o LANG-1401: Typo in JavaDoc for lastIndexOf Thanks to Roman Golyshev, Alex Mamedov.
Changes:
o LANG-1367: ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size Thanks to Gary Gregory.
o LANG-1405: Remove checks for java versions below the minimum supported one Thanks to Lars Grefer.
o LANG-1402: Null/index safe get methods for ArrayUtils Thanks to Mark Dacek.
Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
http://commons.apache.org/proper/commons-lang/
=============================================================================
Apache Commons Lang
Version 3.7
......@@ -59,13 +128,6 @@ o LANG-1346: Remove deprecation from RandomStringUtils
o LANG-1361: ExceptionUtils.getThrowableList() is using deprecated ExceptionUtils.getCause() Thanks to Ana.
Historical list of changes: http://commons.apache.org/proper/commons-lang/changes-report.html
For complete information on Apache Commons Lang, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons Lang website:
http://commons.apache.org/proper/commons-lang/
=============================================================================
Apache Commons Lang
......@@ -173,7 +235,7 @@ o LANG-1034: Add support for recursive comparison to
o LANG-1067: Add a reflection-based variant of DiffBuilder.
o LANG-740: Implementation of a Memomizer. Thanks to James Sawle.
o LANG-1258: Add ArrayUtils#toStringArray method.
Thanks to IG, Grzegorz Rożniecki.
Thanks to IG, Grzegorz Ro?niecki.
o LANG-1160: StringUtils#abbreviate should support 'custom ellipses' parameter.
o LANG-1293: Add StringUtils#isAllEmpty and #isAllBlank methods.
Thanks to Pierre Templier, Martin Tarjanyi.
......@@ -202,7 +264,7 @@ o LANG-1292: WordUtils.wrap throws StringIndexOutOfBoundsException.
o LANG-1287: RandomStringUtils#random can enter infinite loop if end parameter
is to small. Thanks to Ivan Morozov.
o LANG-1285: NullPointerException in FastDateParser$TimeZoneStrategy.
Thanks to Francesco Chicchiriccò.
Thanks to Francesco Chicchiriccò.
o LANG-1281: Javadoc of StringUtils.ordinalIndexOf is contradictory.
Thanks to Andreas Lundblad.
o LANG-1188: StringUtils#join(T...): warning: [unchecked] Possible heap
......@@ -446,7 +508,7 @@ o LANG-1232: DiffBuilder: Add null check on fieldName when appending Object or
Object[]. Thanks to Nick Manley.
o LANG-1178: ArrayUtils.removeAll(Object array, int... indices) should do the
clone, not its callers. Thanks to Henri Yandell.
o LANG-1120: StringUtils.stripAccents should remove accents from "Ł" and "ł".
o LANG-1120: StringUtils.stripAccents should remove accents from "?" and "?".
Thanks to kaching88.
o LANG-1205: NumberUtils.createNumber() behaves inconsistently with
NumberUtils.isNumber(). Thanks to pbrose.
......@@ -494,7 +556,7 @@ o LANG-1111: Fix FindBugs warnings in DurationFormatUtils.
o LANG-1162: StringUtils#equals fails with Index OOBE on non-Strings with
identical leading prefix..
o LANG-1163: There are no tests for CharSequenceUtils.regionMatches.
o LANG-1200: Fix JavaDoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1200: Fix Javadoc of StringUtils.ordinalIndexOf. Thanks to BarkZhang.
o LANG-1191: Incorrect Javadoc
StringUtils.containsAny(CharSequence, CharSequence...). Thanks to
qed, Brent Worden and Gary Gregory.
......@@ -504,7 +566,7 @@ CHANGES
o LANG-1197: Prepare Java 9 detection.
o LANG-1262: CompareToBuilder.append(Object, Object, Comparator) method is too
big to be inlined. Thanks to Ruslan Cheremin.
o LANG-1259: JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
o LANG-1259: Javadoc for ArrayUtils.isNotEmpty() is slightly misleading. Thanks
to Dominik Stadler.
o LANG-1247: FastDatePrinter generates extra Date objects. Thanks to
Benoit Wiart.
......@@ -520,21 +582,21 @@ o LANG-1176: Improve ArrayUtils removeElements time complexity to O(n). Thanks
to Jeffery Yuan.
o LANG-1234: getLevenshteinDistance with a threshold: optimize implementation
if the strings lengths differ more than the threshold. Thanks to
Jonatan Jönsson.
Jonatan Jönsson.
o LANG-1151: Performance improvements for NumberUtils.isParsable. Thanks to
Juan Pablo Santos Rodríguez.
Juan Pablo Santos Rodríguez.
o LANG-1218: EqualsBuilder.append(Object,Object) is too big to be inlined,
which prevents whole builder to be scalarized. Thanks to
Ruslan Cheremin.
o LANG-1210: StringUtils#startsWithAny has error in Javadoc. Thanks to
Matthias Niehoff.
o LANG-1208: StrSubstitutor can preserve escapes. Thanks to Samuel Karp.
o LANG-1182: Clarify JavaDoc of StringUtils.containsAny(). Thanks to
o LANG-1182: Clarify Javadoc of StringUtils.containsAny(). Thanks to
Larry West and Pascal Schumacher.
o LANG-1183: Making replacePattern/removePattern methods null safe in
StringUtils.
o LANG-1057: Replace StringBuilder with String concatenation for better
optimization. Thanks to Otávio Santana.
optimization. Thanks to Otávio Santana.
o LANG-1075: Deprecate SystemUtils.FILE_SEPARATOR and
SystemUtils.PATH_SEPARATOR.
o LANG-979: TypeUtils.parameterizeWithOwner - wrong format descriptor for
......@@ -581,13 +643,13 @@ o LANG-1080: Add NoClassNameToStringStyle implementation of ToStringStyle.
Thanks to Innokenty Shuvalov.
o LANG-883: Add StringUtils.containsAny(CharSequence, CharSequence...) method.
Thanks to Daniel Stewart.
o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
o LANG-1052: Multiline recursive to string style. Thanks to Jan Matèrne.
o LANG-536: Add isSorted() to ArrayUtils. Thanks to James Sawle.
o LANG-1033: Add StringUtils.countMatches(CharSequence, char)
o LANG-1021: Provide methods to retrieve all fields/methods annotated with a
specific type. Thanks to Alexander Müller.
specific type. Thanks to Alexander Müller.
o LANG-1016: NumberUtils#isParsable method(s). Thanks to
Juan Pablo Santos Rodríguez.
Juan Pablo Santos Rodríguez.
o LANG-999: Add fuzzy String matching logic to StringUtils. Thanks to
Ben Ripkens.
o LANG-994: Add zero copy read method to StrBuilder. Thanks to
......@@ -657,7 +719,7 @@ o LANG-1096: Update maven-pmd-plugin to 3.4. Thanks to Micha? Kordas.
o LANG-1095: Update maven-antrun-plugin to 1.8. Thanks to Micha? Kordas.
o LANG-877: Performance improvements for StringEscapeUtils. Thanks to
Fabian Lange.
o LANG-1071: Fix wrong examples in JavaDoc of
o LANG-1071: Fix wrong examples in Javadoc of
StringUtils.replaceEachRepeatedly(...),
StringUtils.replaceEach(...) Thanks to Arno Noordover.
o LANG-827: CompareToBuilder's doc doesn't specify precedence of fields it
......@@ -762,12 +824,12 @@ o LANG-943: Test DurationFormatUtilsTest.testEdgeDuration fails in
o LANG-613: ConstructorUtils.getAccessibleConstructor() Does Not Check the
Accessibility of Enclosing Classes
o LANG-951: Fragments are wrong by 1 day when using fragment YEAR or MONTH.
Thanks to Sebastian Götz.
Thanks to Sebastian Götz.
o LANG-950: FastDateParser does not handle two digit year parsing like
SimpleDateFormat
o LANG-949: FastDateParserTest.testParses does not test FastDateParser
o LANG-915: Wrong locale handling in LocaleUtils.toLocale().
Thanks to Sergio Fernández.
Thanks to Sergio Fernández.
CHANGES
=========
......@@ -776,7 +838,7 @@ o LANG-961: org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Fie
does not clean up after itself
o LANG-958: FastDateParser javadoc incorrectly states that SimpleDateFormat
is used internally
o LANG-956: Improve JavaDoc of WordUtils.wrap methods
o LANG-956: Improve Javadoc of WordUtils.wrap methods
o LANG-939: Move Documentation from user guide to package-info files
o LANG-953: Convert package.html files to package-info.java files
o LANG-940: Fix deprecation warnings
......@@ -866,7 +928,7 @@ o LANG-462: FastDateFormat supports parse methods.
BUG FIXES
===========
o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
o LANG-932: Spelling fixes. Thanks to Ville Skyttä.
o LANG-929: OctalUnescaper tried to parse all of \279.
o LANG-928: OctalUnescaper had bugs when parsing octals starting with a zero.
o LANG-905: EqualsBuilder returned true when comparing arrays, even when the
......
libcommons-lang3-java (3.8-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Fixes another issue with Java 11 (Closes: #903769)
- Refreshed the patches
- Ignore japicmp-maven-plugin
* Standards-Version updated to 4.2.1
-- Emmanuel Bourg <ebourg@apache.org> Wed, 19 Sep 2018 15:40:32 +0200
libcommons-lang3-java (3.7-1) unstable; urgency=medium
* New upstream release
......
......@@ -15,7 +15,7 @@ Build-Depends-Indep:
libeasymock-java,
libmaven-bundle-plugin-java,
libmaven-javadoc-plugin-java
Standards-Version: 4.1.4
Standards-Version: 4.2.1
Vcs-Git: https://salsa.debian.org/java-team/libcommons-lang3-java.git
Vcs-Browser: https://salsa.debian.org/java-team/libcommons-lang3-java
Homepage: http://commons.apache.org/lang/
......
......@@ -14,6 +14,7 @@
# from the POM
# junit junit jar s/3\\..*/3.x/
com.github.siom79.japicmp japicmp-maven-plugin * * * *
org.apache.maven.plugins maven-antrun-plugin * * * *
org.apache.maven.plugins maven-assembly-plugin * * * *
org.apache.maven.plugins maven-changes-plugin * * * *
......
......@@ -5,7 +5,7 @@ Last-Update: 2012-05-27
Forwarded: not-needed
--- a/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SystemUtilsTest.java
@@ -99,6 +99,7 @@
@@ -118,6 +118,7 @@
* Assumes no security manager exists.
*/
@Test
......
......@@ -3,7 +3,7 @@ Author: Emmanuel Bourg <ebourg@apache.org>
Forwarded: not-needed
--- a/pom.xml
+++ b/pom.xml
@@ -690,6 +690,14 @@
@@ -711,6 +711,14 @@
<excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile>
</configuration>
</plugin>
......
......@@ -22,11 +22,11 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>42</version>
<version>47</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
<version>3.8</version>
<name>Apache Commons Lang</name>
<inceptionYear>2001</inceptionYear>
......@@ -47,7 +47,7 @@
<connection>scm:git:http://git-wip-us.apache.org/repos/asf/commons-lang.git</connection>
<developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/commons-lang.git</developerConnection>
<url>https://git-wip-us.apache.org/repos/asf?p=commons-lang.git</url>
<tag>LANG_3_6</tag>
<tag>LANG_3_8</tag>
</scm>
<developers>
......@@ -525,7 +525,7 @@
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.5</version>
<version>3.6</version>
<scope>test</scope>
</dependency>
......@@ -567,12 +567,14 @@
The above seems to change the download page name but not any other
properties that depend on the componentid.
N.B. The componentid is also used by the parent pom as part of the OSGI symbolic name.
-->
<commons.componentid>lang3</commons.componentid>
<commons.module.name>org.apache.commons.lang3</commons.module.name>
<!-- Current 3.x release series -->
<commons.release.version>3.7</commons.release.version>
<commons.release.desc>(Java 7.0+)</commons.release.desc>
<commons.release.version>3.8</commons.release.version>
<commons.release.desc>(Java 7+)</commons.release.desc>
<!-- Previous 2.x release series -->
<commons.release.2.version>2.6</commons.release.2.version>
<commons.release.2.desc>(Requires Java 1.2 or later)</commons.release.2.desc>
......@@ -586,13 +588,25 @@
<commons.scmPubCheckoutDirectory>site-content</commons.scmPubCheckoutDirectory>
<commons.encoding>utf-8</commons.encoding>
<!-- Override clirr version to be able to build the site on Java 8 -->
<commons.clirr.version>2.8</commons.clirr.version>
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
<checkstyle.plugin.version>3.0.0</checkstyle.plugin.version>
<japicmp.skip>false</japicmp.skip>
<!-- JMH Benchmark related properties, version, target compiler and name of the benchmarking uber jar. -->
<jmh.version>1.19</jmh.version>
<jmh.version>1.21</jmh.version>
<uberjar.name>benchmarks</uberjar.name>
<!-- generate report even if there are binary incompatible changes -->
<commons.japicmp.breakBuildOnBinaryIncompatibleModifications>false</commons.japicmp.breakBuildOnBinaryIncompatibleModifications>
<!-- 0.12.0 dies with a NullPointerException -->
<commons.japicmp.version>0.11.1</commons.japicmp.version>
<!-- Commons Release Plugin -->
<commons.bc.version>3.7</commons.bc.version>
<commons.rc.version>RC1</commons.rc.version>
<commons.release.isDistModule>true</commons.release.isDistModule>
<commons.distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/lang</commons.distSvnStagingUrl>
<commons.releaseManagerName>Rob Tompkins</commons.releaseManagerName>
<commons.releaseManagerKey>B6E73D84EA4FCC47166087253FAAD2CD5ECBB314</commons.releaseManagerKey>
</properties>
......@@ -613,6 +627,14 @@
</excludes>
</configuration>
</plugin>
<!-- override skip property of parent pom -->
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
......@@ -654,11 +676,10 @@
</goals>
</execution>
</executions>
<!-- Temporary fix for LANG-1338, remove this after this has implemented in parent pom -->
<configuration>
<archive combine.children="append">
<manifestEntries>
<Automatic-Module-Name>org.apache.commons.lang3</Automatic-Module-Name>
<Automatic-Module-Name>${commons.module.name}</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
......@@ -724,7 +745,7 @@
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
<version>3.9.0</version>
<configuration>
<targetJdk>${maven.compiler.target}</targetJdk>
</configuration>
......@@ -828,20 +849,29 @@
</profile>
<profile>
<id>java9</id>
<id>java9+</id>
<activation>
<jdk>9</jdk>
<jdk>[9,)</jdk>
</activation>
<properties>
<!-- LANG-1265: allow tests to access private fields/methods of java.base classes via reflection -->
<argLine>-Xmx512m --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED</argLine>
<!-- versions below 3.0.0 do not work with java 9 -->
<commons.javadoc.version>3.0.0-M1</commons.javadoc.version>
<!-- coverall version 4.3.0 does not work with java 9, see https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->
<coveralls.skip>true</coveralls.skip>
</properties>
</profile>
<profile>
<id>java11+</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<properties>
<!-- jacoco does not work with java 11 yet, see https://github.com/jacoco/jacoco/issues/663 -->
<jacoco.skip>true</jacoco.skip>
</properties>
</profile>
<profile>
<id>benchmark</id>
<properties>
......
......@@ -45,6 +45,35 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
<release version="3.8" date="2018-08-15" description="New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.">
<action issue="LANG-1380" type="fix" dev="chas" due-to="Markus Jelsma">FastDateParser too strict on abbreviated short month symbols</action>
<action issue="LANG-1396" type="fix" dev="sebb">JsonToStringStyle does not escape string names</action>
<action issue="LANG-1395" type="fix" dev="sebb" due-to="Jim Gan">JsonToStringStyle does not escape double quote in a string value</action>
<action issue="LANG-1384" type="fix" dev="erans" due-to="Ian Young">New Java version ("11") must be handled</action>
<action issue="LANG-1364" type="fix" dev="pschumacher" due-to="Zheng Xie">ExceptionUtils#getRootCause(Throwable t) should return t if no lower level cause exists</action>
<action issue="LANG-1060" type="fix" dev="pschumacher" due-to="Piotr Kosmala">NumberUtils.isNumber assumes number starting with Zero</action>
<action issue="LANG-1375" type="fix" dev="kinow" due-to="Jerry Zhao">defaultString(final String str) in StringUtils to reuse defaultString(final String str, final String defaultStr)</action>
<action issue="LANG-1374" type="fix" dev="kinow" due-to="Jaswanth Bala">Parsing Json Array failed</action>
<action issue="LANG-1371" type="fix" dev="pschumacher" due-to="Dmitry Ovchinnikov">Fix TypeUtils#parameterize to work correctly with narrower-typed array</action>
<action issue="LANG-1370" type="fix" dev="kinow" due-to="Andre Dieb">Fix EventCountCircuitBreaker increment batch</action>
<action issue="LANG-1385" type="fix" dev="ggregory" due-to="Rohan Padhye">NumberUtils.createNumber() throws StringIndexOutOfBoundsException instead of NumberFormatException</action>
<action issue="LANG-1397" type="fix" dev="ggregory" due-to="Takanobu Asanuma">WordUtils.wrap throws StringIndexOutOfBoundsException when wrapLength is Integer.MAX_VALUE.</action>
<action issue="LANG-1401" type="fix" dev="pschumacher" due-to="Roman Golyshev, Alex Mamedov">Typo in JavaDoc for lastIndexOf</action>
<action issue="LANG-1367" type="update" dev="ggregory" due-to="Gary Gregory">ObjectUtils.identityToString(Object) and friends should allocate builders and buffers with a size</action>
<action issue="LANG-1352" type="add" dev="pschumacher" due-to="Ruslan Sibgatullin">EnumUtils.getEnumIgnoreCase and isValidEnumIgnoreCase methods added</action>
<action issue="LANG-1372" type="add" dev="pschumacher" due-to="Sérgio Ozaki">Add ToStringSummary annotation</action>
<action issue="LANG-1356" type="add" dev="pschumacher" due-to="Yathos UG">Add bypass option for classes to recursive and reflective EqualsBuilder</action>
<action issue="LANG-1391" type="add" dev="ggregory" due-to="Sauro Matulli, Oleg Chubaryov">Improve Javadoc for StringUtils.isAnyEmpty(null)</action>
<action issue="LANG-1393" type="add" dev="ggregory" due-to="Gary Gregory">Add API SystemUtils.String getEnvironmentVariable(final String name, final String defaultValue)</action>
<action issue="LANG-1394" type="add" dev="ggregory" due-to="Sebb, Gary Gregory">org.apache.commons.lang3.SystemUtils should not write to System.err.</action>
<action issue="LANG-1238" type="add" dev="ggregory" due-to="Christopher Cordeiro, Gary Gregory, Bruno P. Kinoshita, Oleg Chubaryov">Add RegexUtils class instead of overloading methods in StringUtils that take a regex to take precompiled Pattern.</action>
<action issue="LANG-1390" type="add" dev="ggregory" due-to="Jochen Schalanda">StringUtils.join() with support for List&lt;?> with configurable start/end indices.</action>
<action issue="LANG-1392" type="add" dev="pschumacher" due-to="Jeff Nelson">Methods for getting first non empty or non blank value</action>
<action issue="LANG-1405" type="update" dev="ggregory" due-to="Lars Grefer">Remove checks for java versions below the minimum supported one</action>
<action issue="LANG-1402" type="update" dev="chtompki" due-to="Mark Dacek">Null/index safe get methods for ArrayUtils</action>
<action issue="LANG-1408" type="add" dev="chtompki">Rounding utilities for converting to BigDecimal</action>
</release>
<release version="3.7" date="2017-11-04" description="New features and bug fixes. Requires Java 7, supports Java 8, 9, 10.">
<action issue="LANG-1362" type="fix" dev="ggregory" due-to="Stephen Colebourne">Fix tests DateUtilsTest for Java 9 with en_GB locale</action>
<action issue="LANG-1365" type="fix" dev="ggregory" due-to="Gary Gregory">Fix NullPointerException in isJavaVersionAtLeast on Java 10, add SystemUtils.IS_JAVA_10, add JavaVersion.JAVA_10</action>
......@@ -127,7 +156,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1224" type="add" dev="pschumacher" due-to="Caleb Cushing">Extend RandomStringUtils with methods that generate strings between a min and max length</action>
<action issue="LANG-1214" type="fix" dev="pschumacher" due-to="Henry Tung">Handle "void" in ClassUtils.getClass()</action>
<action issue="LANG-1250" type="fix" dev="pschumacher" due-to="Glease Wang">SerializationUtils#deserialize has unnecessary code and a comment for that</action>
<action issue="LANG-1259" type="update" dev="britter" due-to="Dominik Stadler">JavaDoc for ArrayUtils.isNotEmpty() is slightly misleading</action>
<action issue="LANG-1259" type="update" dev="britter" due-to="Dominik Stadler">Javadoc for ArrayUtils.isNotEmpty() is slightly misleading</action>
<action issue="LANG-1257" type="add" dev="ggregory" due-to="Gary Gregory">Add APIs StringUtils.wrapIfMissing(String, char|String)</action>
<action issue="LANG-1190" type="fix" dev="pschumacher" due-to="pschumacher">TypeUtils.isAssignable throws NullPointerException when fromType has type variables and toType generic superclass specifies type variable</action>
<action issue="LANG-1226" type="fix" dev="pschumacher" due-to="pschumacher">StringUtils#normalizeSpace does not trim the string anymore</action>
......@@ -177,7 +206,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1194" type="fix" dev="chas">Limit max heap memory for consistent Travis CI build</action>
<action issue="LANG-1186" type="fix" dev="chas" due-to="NickManley">Fix NullPointerException in FastDateParser$TimeZoneStrategy</action>
<action issue="LANG-1193" type="fix" dev="sebb" due-to="Qin Li">ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0); revert fix for LANG-1077</action>
<action issue="LANG-1182" type="update" dev="britter" due-to="Larry West, Pascal Schumacher">Clarify JavaDoc of StringUtils.containsAny()</action>
<action issue="LANG-1182" type="update" dev="britter" due-to="Larry West, Pascal Schumacher">Clarify Javadoc of StringUtils.containsAny()</action>
<action issue="LANG-1169" type="add" dev="lguibert" due-to="Rafal Glowinski, Robert Parr, Arman Sharif">Add StringUtils methods to compare a string to multiple strings</action>
<action issue="LANG-1185" type="add" dev="lguibert">Add remove by regular expression methods in StringUtils</action>
<action issue="LANG-1183" type="update" dev="lguibert">Making replacePattern/removePattern methods null safe in StringUtils</action>
......@@ -224,7 +253,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1107" type="update" dev="chas">Fix parsing edge cases in FastDateParser</action>
<action issue="LANG-1162" type="fix" dev="sebb">StringUtils#equals fails with Index OOBE on non-Strings with identical leading prefix</action>
<action issue="LANG-1163" type="fix" dev="sebb">There are no tests for CharSequenceUtils.regionMatches</action>
<action issue="LANG-1200" type="fix" dev="ggregory" due-to="BarkZhang">StringUtils.ordinalIndexOf: Add missing right parenthesis in JavaDoc example</action>
<action issue="LANG-1200" type="fix" dev="ggregory" due-to="BarkZhang">StringUtils.ordinalIndexOf: Add missing right parenthesis in Javadoc example</action>
<action issue="LANG-1191" type="fix" dev="ggregory" due-to="qed, Brent Worden, Gary Gregory">Incorrect Javadoc StringUtils.containsAny(CharSequence, CharSequence...)</action>
<action type="update" dev="ebourg" due-to="Jake Wang">Added new property IS_OS_MAC_OSX_EL_CAPITAN in SystemUtils</action>
</release>
......@@ -258,7 +287,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1083" type="fix" dev="britter" due-to="Jonathan Baker">Add (T) casts to get unit tests to pass in old JDK</action>
<action issue="LANG-1015" type="add" dev="britter" due-to="Thiago Andrade">Add JsonToStringStyle implementation to ToStringStyle</action>
<action issue="LANG-1080" type="add" dev="britter" due-to="Innokenty Shuvalov">Add NoClassNameToStringStyle implementation of ToStringStyle</action>
<action issue="LANG-1071" type="update" dev="britter" due-to="Arno Noordover">Fix wrong examples in JavaDoc of StringUtils.replaceEachRepeatedly(...), StringUtils.replaceEach(...)</action>
<action issue="LANG-1071" type="update" dev="britter" due-to="Arno Noordover">Fix wrong examples in Javadoc of StringUtils.replaceEachRepeatedly(...), StringUtils.replaceEach(...)</action>
<action issue="LANG-883" type="add" dev="britter" due-to="Daniel Stewart">Add StringUtils.containsAny(CharSequence, CharSequence...) method</action>
<action issue="LANG-1073" type="fix" dev="kinow" due-to="haiyang li">Read wrong component type of array in add in ArrayUtils</action>
<action issue="LANG-1077" type="fix" dev="kinow" due-to="haiyang li">StringUtils.ordinalIndexOf("aaaaaa", "aa", 2) != 3 in StringUtils</action>
......@@ -324,7 +353,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-958" type="update" dev="chas">FastDateParser javadoc incorrectly states that SimpleDateFormat is used internally</action>
<action issue="LANG-637" type="add" dev="djones">There should be a DifferenceBuilder with a ReflectionDifferenceBuilder implementation</action>
<action issue="LANG-954" type="fix" due-to="Michael Keppler" dev="sebb">uncaught PatternSyntaxException in FastDateFormat on Android</action>
<action issue="LANG-956" type="update" dev="britter">Improve JavaDoc of WordUtils.wrap methods</action>
<action issue="LANG-956" type="update" dev="britter">Improve Javadoc of WordUtils.wrap methods</action>
<action issue="LANG-944" type="add" dev="britter" due-to="Rekha Joshi">Add the Jaro-Winkler string distance algorithm to StringUtils</action>
<action issue="LANG-936" type="fix" dev="bayard" due-to="Yaniv Kunda, Eli Lindsey">StringUtils.getLevenshteinDistance with too big of a threshold returns wrong result</action>
<action issue="LANG-943" type="fix" dev="kinow">Test DurationFormatUtilsTest.testEdgeDuration fails in JDK 1.6, 1.7 and 1.8, BRST time zone</action>
......
......@@ -85,13 +85,11 @@ private static void init_PPC_64Bit() {
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
private static void addProcessor(final String key, final Processor processor) throws IllegalStateException {
if (!ARCH_TO_PROCESSOR.containsKey(key)) {
ARCH_TO_PROCESSOR.put(key, processor);
} else {
final String msg = "Key " + key + " already exists in processor map";
throw new IllegalStateException(msg);
private static void addProcessor(final String key, final Processor processor) {
if (ARCH_TO_PROCESSOR.containsKey(key)) {
throw new IllegalStateException("Key " + key + " already exists in processor map");
}
ARCH_TO_PROCESSOR.put(key, processor);
}
/**
......@@ -101,7 +99,7 @@ private static void addProcessor(final String key, final Processor processor) th
* @param processor The {@link Processor} to add.
* @throws IllegalStateException If the key already exists.
*/
private static void addProcessors(final Processor processor, final String... keys) throws IllegalStateException {
private static void addProcessors(final Processor processor, final String... keys) {
for (final String key : keys) {
addProcessor(key, processor);
}
......
......@@ -3870,7 +3870,7 @@ public static int indexOf(final double[] array, final double valueToFind, final
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final double[] array, final double valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -3902,7 +3902,7 @@ public static int indexOf(final double[] array, final double valueToFind, int st
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -3964,7 +3964,7 @@ public static int lastIndexOf(final double[] array, final double valueToFind, fi
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -3998,7 +3998,7 @@ public static int lastIndexOf(final double[] array, final double valueToFind, in
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final double[] array, final double valueToFind, int startIndex, final double tolerance) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -4077,7 +4077,7 @@ public static int indexOf(final float[] array, final float valueToFind) {
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int indexOf(final float[] array, final float valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -4120,7 +4120,7 @@ public static int lastIndexOf(final float[] array, final float valueToFind) {
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final float[] array, final float valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -4181,7 +4181,7 @@ public static int indexOf(final boolean[] array, final boolean valueToFind) {
* array input
*/
public static int indexOf(final boolean[] array, final boolean valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -4225,7 +4225,7 @@ public static int lastIndexOf(final boolean[] array, final boolean valueToFind)
* {@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input
*/
public static int lastIndexOf(final boolean[] array, final boolean valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
if (isEmpty(array)) {
return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
......@@ -7436,7 +7436,7 @@ static Object removeAll(final Object array, final int... indices) {
*/
// package protected for access by unit tests
static Object removeAll(final Object array, final BitSet indices) {
final int srcLength = ArrayUtils.getLength(array);
final int srcLength = getLength(array);
// No need to check maxIndex here, because method only currently called from removeElements()
// which guarantee to generate on;y valid bit entries.
// final int maxIndex = indices.length();
......@@ -8672,4 +8672,20 @@ public static void shuffle(final double[] array, final Random random) {
swap(array, i - 1, random.nextInt(i), 1);
}
}
/**
* Returns whether a given array can safely be accessed at the given index.
* @param <T> the component type of the array
* @param array the array to inspect, may be null
* @param index the index of the array to be inspected
* @return Whether the given index is safely-accessible in the given array
* @since 3.8
*/
public static <T> boolean isArrayIndexValid(T[] array, int index){
if(getLength(array) == 0 || array.length <= index){
return false;
}
return index >= 0;
}
}
......@@ -84,7 +84,7 @@ public class BitField {
*/
public BitField(final int mask) {
_mask = mask;
_shift_count = mask != 0 ? Integer.numberOfTrailingZeros(mask) : 0;
_shift_count = mask == 0 ? 0 : Integer.numberOfTrailingZeros(mask);
}
/**
......
......@@ -30,7 +30,7 @@ public class CharUtils {
private static final String[] CHAR_STRING_ARRAY = new String[128];
private static final char[] HEX_DIGITS = new char[] {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
/**
* {@code \u000a} linefeed LF ('\n').
......
......@@ -429,8 +429,8 @@ public static String getAbbreviatedName(final Class<?> cls, final int len) {
* If enough space is available, rightmost sub-packages will be displayed in full
* length.</p>
*
* <p>The following table illustrates the algorithm:</p>
* <table summary="abbreviation examples">
* <table>
* <caption>Examples</caption>
* <tr><td>className</td><td>len</td><td>return</td></tr>
* <tr><td> null</td><td> 1</td><td>""</td></tr>
* <tr><td>"java.lang.String"</td><td> 5</td><td>"j.l.String"</td></tr>
......@@ -641,7 +641,7 @@ public static List<String> convertClassesToClassNames(final List<Class<?>> class
* @return {@code true} if assignment possible
*/
public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) {
return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
return isAssignable(classArray, toClassArray, true);
}
/**
......@@ -757,7 +757,7 @@ public static boolean isPrimitiveWrapper(final Class<?> type) {
* @return {@code true} if assignment possible
*/
public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) {
return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5));
return isAssignable(cls, toClass, true);
}
/**
......@@ -1084,7 +1084,7 @@ public static Class<?> getClass(final String className, final boolean initialize
* or if the method doesn't conform with the requirements
*/
public static Method getPublicMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes)
throws SecurityException, NoSuchMethodException {
throws NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName, parameterTypes);
if (Modifier.isPublic(declaredMethod.getDeclaringClass().getModifiers())) {
......@@ -1263,7 +1263,7 @@ public static String getShortCanonicalName(final Class<?> cls) {
* @since 2.4
*/
public static String getShortCanonicalName(final String canonicalName) {
return ClassUtils.getShortClassName(getCanonicalName(canonicalName));
return getShortClassName(getCanonicalName(canonicalName));
}
// Package name
......@@ -1308,7 +1308,7 @@ public static String getPackageCanonicalName(final Class<?> cls) {
* @since 2.4
*/
public static String getPackageCanonicalName(final String canonicalName) {
return ClassUtils.getPackageName(getCanonicalName(canonicalName));
return getPackageName(getCanonicalName(canonicalName));
}
/**
......@@ -1347,7 +1347,7 @@ private static String getCanonicalName(String className) {
? className.length() - 1
: className.length());
} else {
if (className.length() > 0) {
if (!className.isEmpty()) {
className = reverseAbbreviationMap.get(className.substring(0, 1));
}
}
......
......@@ -60,27 +60,27 @@
* so far.
* </p>
*
* @since Lang 3.2
* @since 3.2
*/
public class Conversion {
private static final boolean[] TTTT = new boolean[] { true, true, true, true };
private static final boolean[] FTTT = new boolean[] { false, true, true, true };
private static final boolean[] TFTT = new boolean[] { true, false, true, true };
private static final boolean[] FFTT = new boolean[] { false, false, true, true };
private static final boolean[] TTFT = new boolean[] { true, true, false, true };
private static final boolean[] FTFT = new boolean[] { false, true, false, true };
private static final boolean[] TFFT = new boolean[] { true, false, false, true };
private static final boolean[] FFFT = new boolean[] { false, false, false, true };
private static final boolean[] TTTF = new boolean[] { true, true, true, false };
private static final boolean[] FTTF = new boolean[] { false, true, true, false };
private static final boolean[] TFTF = new boolean[] { true, false, true, false };
private static final boolean[] FFTF = new boolean[] { false, false, true, false };
private static final boolean[] TTFF = new boolean[] { true, true, false, false };
private static final boolean[] FTFF = new boolean[] { false, true, false, false };
private static final boolean[] TFFF = new boolean[] { true, false, false, false };
private static final boolean[] FFFF = new boolean[] { false, false, false, false };
private static final boolean[] TTTT = {true, true, true, true};
private static final boolean[] FTTT = {false, true, true, true};
private static final boolean[] TFTT = {true, false, true, true};
private static final boolean[] FFTT = {false, false, true, true};
private static final boolean[] TTFT = {true, true, false, true};
private static final boolean[] FTFT = {false, true, false, true};
private static final boolean[] TFFT = {true, false, false, true};
private static final boolean[] FFFT = {false, false, false, true};
private static final boolean[] TTTF = {true, true, true, false};
private static final boolean[] FTTF = {false, true, true, false};
private static final boolean[] TFTF = {true, false, true, false};
private static final boolean[] FFTF = {false, false, true, false};
private static final boolean[] TTFF = {true, true, false, false};
private static final boolean[] FTFF = {false, true, false, false};
private static final boolean[] TFFF = {true, false, false, false};
private static final boolean[] FFFF = {false, false, false, false};
/**
* <p>
......
......@@ -87,15 +87,24 @@ public static <E extends Enum<E>> List<E> getEnumList(final Class<E> enumClass)
* @return true if the enum name is valid, otherwise false
*/
public static <E extends Enum<E>> boolean isValidEnum(final Class<E> enumClass, final String enumName) {
if (enumName == null) {
return false;
}
try {
Enum.valueOf(enumClass, enumName);
return true;
} catch (final IllegalArgumentException ex) {
return false;
return getEnum(enumClass, enumName) != null;
}
/**
* <p>Checks if the specified name is a valid enum for the class.</p>
*
* <p>This method differs from {@link Enum#valueOf} in that checks if the name is
* a valid enum without needing to catch the exception
* and performs case insensitive matching of the name.</p>
*
* @param <E> the type of the enumeration
* @param enumClass the class of the enum to query, not null
* @param enumName the enum name, null returns false
* @return true if the enum name is valid, otherwise false
* @since 3.8
*/
public static <E extends Enum<E>> boolean isValidEnumIgnoreCase(final Class<E> enumClass, final String enumName) {
return getEnumIgnoreCase(enumClass, enumName) != null;
}
/**
......@@ -120,6 +129,30 @@ public static <E extends Enum<E>> E getEnum(final Class<E> enumClass, final Stri
}
}
/**
* <p>Gets the enum for the class, returning {@code null} if not found.</p>
*
* <p>This method differs from {@link Enum#valueOf} in that it does not throw an exception
* for an invalid enum name and performs case insensitive matching of the name.</p>
*
* @param <E> the type of the enumeration
* @param enumClass the class of the enum to query, not null
* @param enumName the enum name, null returns null
* @return the enum, null if not found
* @since 3.8
*/
public static <E extends Enum<E>> E getEnumIgnoreCase(final Class<E> enumClass, final String enumName) {
if (enumName == null || !enumClass.isEnum()) {
return null;
}
for (final E each : enumClass.getEnumConstants()) {
if (each.name().equalsIgnoreCase(enumName)) {
return each;
}
}
return null;
}
/**
* <p>Creates a long bit vector representation of the given subset of an Enum.</p>
*
......
......@@ -94,6 +94,13 @@ public enum JavaVersion {
*/
JAVA_10(10.0f, "10"),
/**
* Java 11
*
* @since 3.8
*/
JAVA_11(11.0f, "11"),
/**
* The most recent java version. Mainly introduced to avoid to break when a new version of Java is used.
*/
......@@ -180,6 +187,8 @@ static JavaVersion get(final String nom) {
return JAVA_9;
} else if ("10".equals(nom)) {
return JAVA_10;
} else if ("11".equals(nom)) {
return JAVA_11;
}
if (nom == null) {
return null;
......@@ -191,6 +200,8 @@ static JavaVersion get(final String nom) {
if (Float.parseFloat(nom.substring(firstComma + 1, end)) > .9f) {
return JAVA_RECENT;
}
} else if (v > 10) {
return JAVA_RECENT;
}
return null;
}
......