You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forbidden-signatures.txt 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. # (C) Copyright Uwe Schindler (Generics Policeman) and others.
  2. # Parts of this work are licensed to the Apache Software Foundation (ASF)
  3. # under one or more contributor license agreements.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # This file contains API signatures which are specific to POI.
  18. # The goal is to minimize implicit defaults
  19. @ignoreMissingClasses
  20. @defaultMessage POI forbidden APIs
  21. # Locale related interfaces which we want to avoid to not have code which depends on the locale of the current machine
  22. java.util.Locale#getDefault() @ Do not use methods that depend on the current Locale, either use Locale.ROOT or let the user define the locale, see class LocaleUtil for details
  23. java.util.Locale#setDefault(java.util.Locale) @ Do not use methods that depend on the current Locale, either use Locale.ROOT or let the user define the locale, see class LocaleUtil for details
  24. java.util.TimeZone#getDefault() @ Do not use methods that depend on the current Locale, either use Locale.ROOT or let the user define the locale, see class LocaleUtil for details
  25. java.util.Date#toString() @ Do not use methods that depend on the current Locale, either use Locale.ROOT or let the user define the locale, see class LocaleUtil for details
  26. java.text.DecimalFormatSymbols#<init>() @ use DecimalFormatSymbols.getInstance()
  27. java.text.DecimalFormatSymbols#<init>(java.util.Locale) @ use DecimalFormatSymbols.getInstance()
  28. # the following are taken from the Elasticsearch source at https://github.com/elastic/elasticsearch/tree/master/buildSrc/src/main/resources/forbidden
  29. @defaultMessage Convert to URI
  30. java.net.URL#getPath()
  31. java.net.URL#getFile()
  32. @defaultMessage Usage of getLocalHost is discouraged
  33. java.net.InetAddress#getLocalHost()
  34. @defaultMessage Specify a location for the temp file/directory instead.
  35. java.nio.file.Files#createTempDirectory(java.lang.String,java.nio.file.attribute.FileAttribute[])
  36. java.nio.file.Files#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[])
  37. @defaultMessage Specify a location for the temp file/directory instead.
  38. java.nio.file.Files#createTempDirectory(java.lang.String,java.nio.file.attribute.FileAttribute[])
  39. java.nio.file.Files#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[])
  40. @defaultMessage Don't use java serialization - this can break BWC without noticing it
  41. java.io.ObjectOutputStream
  42. java.io.ObjectOutput
  43. java.io.ObjectInputStream
  44. java.io.ObjectInput
  45. @defaultMessage Resolve hosts explicitly to the address(es) you want with InetAddress.
  46. java.net.InetSocketAddress#<init>(java.lang.String,int)
  47. java.net.Socket#<init>(java.lang.String,int)
  48. java.net.Socket#<init>(java.lang.String,int,java.net.InetAddress,int)
  49. @defaultMessage Don't bind to wildcard addresses. Be specific.
  50. java.net.DatagramSocket#<init>()
  51. java.net.DatagramSocket#<init>(int)
  52. java.net.InetSocketAddress#<init>(int)
  53. java.net.MulticastSocket#<init>()
  54. java.net.MulticastSocket#<init>(int)
  55. java.net.ServerSocket#<init>(int)
  56. java.net.ServerSocket#<init>(int,int)
  57. @defaultMessage use NetworkAddress format/formatAddress to print IP or IP+ports
  58. java.net.InetAddress#toString()
  59. java.net.InetAddress#getHostAddress()
  60. java.net.Inet4Address#getHostAddress()
  61. java.net.Inet6Address#getHostAddress()
  62. java.net.InetSocketAddress#toString()
  63. @defaultMessage avoid DNS lookups by accident: if you have a valid reason, then @SuppressWarnings with that reason so its completely clear
  64. java.net.InetAddress#getHostName()
  65. java.net.InetAddress#getCanonicalHostName()
  66. java.net.InetSocketAddress#getHostName() @ Use getHostString() instead, which avoids a DNS lookup
  67. java.lang.Thread#getAllStackTraces() @ this method needs special permission
  68. java.lang.Thread#getContextClassLoader() @ use getClass().getClassLoader() instead of getContextClassLoader() (see https://stackoverflow.com/a/36228195/2066598)
  69. @defaultMessage Avoid unchecked warnings by using Collections#empty(List|Map|Set) methods
  70. java.util.Collections#EMPTY_LIST
  71. java.util.Collections#EMPTY_MAP
  72. java.util.Collections#EMPTY_SET
  73. @defaultMessage spawns threads with vague names; use a custom thread factory and name threads so that you can tell (by its name) which executor it is associated with
  74. java.util.concurrent.Executors#newFixedThreadPool(int)
  75. java.util.concurrent.Executors#newSingleThreadExecutor()
  76. java.util.concurrent.Executors#newCachedThreadPool()
  77. java.util.concurrent.Executors#newSingleThreadScheduledExecutor()
  78. java.util.concurrent.Executors#newScheduledThreadPool(int)
  79. java.util.concurrent.Executors#defaultThreadFactory()
  80. java.util.concurrent.Executors#privilegedThreadFactory()
  81. java.lang.Character#codePointBefore(char[],int) @ Implicit start offset is error-prone when the char[] is a buffer and the first chars are random chars
  82. java.lang.Character#codePointAt(char[],int) @ Implicit end offset is error-prone when the char[] is a buffer and the last chars are random chars
  83. @defaultMessage specify a locale when using toUpperCase / to LowerCase
  84. java.lang.Character#isLowerCase(char)
  85. java.lang.Character#isUpperCase(char)
  86. java.lang.Character#toLowerCase(char)
  87. java.lang.Character#toUpperCase(char)
  88. java.lang.String#toLowerCase()
  89. java.lang.String#toUpperCase()
  90. @defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead.
  91. java.lang.Object#wait()
  92. java.lang.Object#wait(long)
  93. java.lang.Object#wait(long,int)
  94. java.lang.Object#notify()
  95. java.lang.Object#notifyAll()
  96. @defaultMessage Don't interrupt threads use FutureUtils#cancel(Future<T>) instead
  97. java.util.concurrent.Future#cancel(boolean)
  98. @defaultMessage Don't use ...InputStream.available() as it gives wrong result for certain streams - use IOUtils.toByteArray to read the stream fully and then count the available bytes
  99. java.io.InputStream#available()
  100. @defaultMessage Use newInstance, as newFactory does not seem to work on Android - https://github.com/centic9/poi-on-android/issues/44#issuecomment-426517981
  101. javax.xml.stream.XMLEventFactory#newFactory()
  102. javax.xml.stream.XMLInputFactory#newFactory()
  103. javax.xml.stream.XMLOutputFactory#newFactory()
  104. @defaultMessage Unnecessary, inefficient, and confusing conversion of String.toString
  105. java.lang.String#toString()
  106. #@defaultMessage Deprecated Java APIs
  107. #java.lang.StringBuffer
  108. #java.util.Hashtable
  109. @defaultMessage DatatypeConverter is not available in Java 9+ without adding add-opens - use java.util.Base64
  110. javax.xml.bind.DatatypeConverter
  111. @defaultMessage don't rely on the threads ContextClassLoader - provide the classloader via load(Class, Classloader)
  112. java.util.ServiceLoader#load(java.lang.Class)
  113. @defaultMessage use java.nio.charset.StandardCharsets instead
  114. org.apache.commons.codec.Charsets