Migrate your code from legacy Guava to Java 8
Guava was great library for Java 7 users. But now we have Java 8 and it has many useful features like
Lambda. So some features in Guava should be replaced with them.
Other parts in Guava are useful even for Java 8, especially collections. But Guava is designed for Java 6+, so it does not provide
java.util.stream.Collector for Guava collections. So when you want to collect stream to Guava collections, you need some hack which makes your code nonintuitive.
This toolset solves these two problems. For former problem, this toolset provides SpotBugs plugin which reports dependency on deprecated Guava classes. For latter problem, this toolset provides
GuavaCollectors class which provides many
java.util.stream.Collector instances for Guava collections.
This toolset will help your development with Java 8 and good parts of Guava library.
SpotBugs plugin helps developer to find dependency on deprecated guava classes, which should be replaced with Java 8. List of deprecated guava classes is in DependencyOnDeprecatedGuavaClassDetector.java.
To use this module in your Maven project, please add following configuration to your
<plugin> <groupId>com.github.spotbugs</groupId> <artifactId>spotbugs-maven-plugin</artifactId> <version>3.1.5</version> <configuration> <plugins> <plugin> <groupId>jp.skypencil.guava</groupId> <artifactId>spotbugs-plugin</artifactId> <version>1.0.6</version> </plugin> </plugins> </configuration> </plugin>
Helper module provides collectors which is useful to use Guava with Java 8.
ImmutableMap<String, Integer> map = Stream.of(1, 2) .collect(GuavaCollectors.toImmutableMap(Object::toString, UnaryOperator.identity()));
<dependency> <groupId>jp.skypencil.guava</groupId> <artifactId>helper</artifactId> <version>1.0.6</version> </dependency>
See sonarqube-plugin/README.md for detail.
Please visit release page.
Copyright and license
Copyright 2015-2018 Kengo TODA Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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.