
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Some Guava features were really useful for Java 7 application because Guava was bringing APIs missing in the JDK. Java 8 fixed some of these limitations. When migrating an application to Java 8 or even when starting a new one, it's recommended to prefer Java 8 APIs over Guava ones to ease its maintenance: developers don't need to learn how to use two APIs and can stick to the standard one.
|
|
|
|
|
|
Java 9 brought even more useful methods to the standard Java library and if Java version is equal to or higher than 9, these standard methods should be used.
|
|
|
|
|
|
This rule raises an issue when the following Guava APIs are used:
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|Guava API | Java 8 API
|
|
|
|
|com.google.common.io.BaseEncoding#base64() | java.util.Base64
|
|
|com.google.common.io.BaseEncoding#base64Url() | java.util.Base64
|
|
|com.google.common.base.Joiner.on() | java.lang.String#join() or java.util.stream.Collectors#joining()
|
|
|com.google.common.base.Optional#of() | java.util.Optional#of()
|
|
|com.google.common.base.Optional#absent() | java.util.Optional#empty()
|
|
|com.google.common.base.Optional#fromNullable() | java.util.Optional#ofNullable()
|
|
|com.google.common.base.Optional | java.util.Optional
|
|
|com.google.common.base.Predicate | java.util.function.Predicate
|
|
|com.google.common.base.Function | java.util.function.Function
|
|
|com.google.common.base.Supplier | java.util.function.Supplier
|
|
|com.google.common.io.Files.createTempDir | java.nio.file.Files.createTempDirectory
|
|
|===
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|Guava API | Java 9 API
|
|
|
|
| com.google.common.collect.ImmutableSet#of() | java.util.Set#of()
|
|
| com.google.common.collect.ImmutableList#of() | java.util.List#of()
|
|
| com.google.common.collect.ImmutableMap#of() | java.util.Map#of() or java.util.Map#ofEntries()
|
|
|===
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use "<Java 8 API>" instead.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 3 Aug 2018, 22:44:11 Alexandre Gigleux wrote:
|
|
This rule should not be triggered on project based on Java7 or less.
|
|
|
|
=== on 1 Nov 2018, 10:06:57 Jean-Baptiste Lievremont wrote:
|
|
Could you please have a look at the updated metadata?
|
|
|
|
endif::env-github,rspecator-view[]
|