diff --git a/buildSrc/src/main/resources/forbidden/all-signatures.txt b/buildSrc/src/main/resources/forbidden/all-signatures.txt index f9fba0ab3f7..4233112f0ab 100644 --- a/buildSrc/src/main/resources/forbidden/all-signatures.txt +++ b/buildSrc/src/main/resources/forbidden/all-signatures.txt @@ -38,9 +38,13 @@ org.apache.lucene.index.DocsEnum org.apache.lucene.index.DocsAndPositionsEnum org.apache.lucene.queries.TermFilter org.apache.lucene.queries.TermsFilter +org.apache.lucene.search.Filter +org.apache.lucene.search.FilteredQuery org.apache.lucene.search.TermRangeFilter org.apache.lucene.search.NumericRangeFilter org.apache.lucene.search.PrefixFilter +org.apache.lucene.search.QueryWrapperFilter +org.apache.lucene.search.join.BitDocIdSetCachingWrapperFilter java.nio.file.Paths @ Use org.elasticsearch.common.io.PathUtils.get() instead. java.nio.file.FileSystems#getDefault() @ use org.elasticsearch.common.io.PathUtils.getDefaultFileSystem() instead. @@ -90,3 +94,9 @@ java.net.InetSocketAddress#getHostName() @ Use getHostString() instead, which av @defaultMessage Do not violate java's access system java.lang.reflect.AccessibleObject#setAccessible(boolean) java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean) + +@defaultMessage this should not have been added to lucene in the first place +org.apache.lucene.index.IndexReader#getCombinedCoreAndDeletesKey() + +@defaultMessage this method needs special permission +java.lang.Thread#getAllStackTraces() diff --git a/buildSrc/src/main/resources/forbidden/core-signatures.txt b/buildSrc/src/main/resources/forbidden/core-signatures.txt index 3a925e64d3c..08c548f1dcc 100644 --- a/buildSrc/src/main/resources/forbidden/core-signatures.txt +++ b/buildSrc/src/main/resources/forbidden/core-signatures.txt @@ -36,6 +36,10 @@ org.apache.lucene.index.IndexReader#decRef() org.apache.lucene.index.IndexReader#incRef() org.apache.lucene.index.IndexReader#tryIncRef() +@defaultMessage Close listeners can only installed via ElasticsearchDirectoryReader#addReaderCloseListener +org.apache.lucene.index.IndexReader#addReaderClosedListener(org.apache.lucene.index.IndexReader$ReaderClosedListener) +org.apache.lucene.index.IndexReader#removeReaderClosedListener(org.apache.lucene.index.IndexReader$ReaderClosedListener) + @defaultMessage Pass the precision step from the mappings explicitly instead org.apache.lucene.search.NumericRangeQuery#newDoubleRange(java.lang.String,java.lang.Double,java.lang.Double,boolean,boolean) org.apache.lucene.search.NumericRangeQuery#newFloatRange(java.lang.String,java.lang.Float,java.lang.Float,boolean,boolean) diff --git a/buildSrc/src/main/resources/forbidden/test-signatures.txt b/buildSrc/src/main/resources/forbidden/test-signatures.txt index 3cde7352618..bd6744ee05f 100644 --- a/buildSrc/src/main/resources/forbidden/test-signatures.txt +++ b/buildSrc/src/main/resources/forbidden/test-signatures.txt @@ -21,3 +21,5 @@ com.carrotsearch.randomizedtesting.annotations.Repeat @ Don't commit hardcoded r org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead org.apache.lucene.util.LuceneTestCase$Slow @ Don't write slow tests org.junit.Ignore @ Use AwaitsFix instead + +org.junit.Test @defaultMessage Just name your test method testFooBar diff --git a/dev-tools/src/main/resources/forbidden/all-signatures.txt b/dev-tools/src/main/resources/forbidden/all-signatures.txt deleted file mode 100644 index 4233112f0ab..00000000000 --- a/dev-tools/src/main/resources/forbidden/all-signatures.txt +++ /dev/null @@ -1,102 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you 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. - -@defaultMessage Convert to URI -java.net.URL#getPath() -java.net.URL#getFile() - -@defaultMessage Usage of getLocalHost is discouraged -java.net.InetAddress#getLocalHost() - -@defaultMessage Use java.nio.file instead of java.io.File API -java.util.jar.JarFile -java.util.zip.ZipFile -java.io.File -java.io.FileInputStream -java.io.FileOutputStream -java.io.PrintStream#(java.lang.String,java.lang.String) -java.io.PrintWriter#(java.lang.String,java.lang.String) -java.util.Formatter#(java.lang.String,java.lang.String,java.util.Locale) -java.io.RandomAccessFile -java.nio.file.Path#toFile() - -@defaultMessage Don't use deprecated lucene apis -org.apache.lucene.index.DocsEnum -org.apache.lucene.index.DocsAndPositionsEnum -org.apache.lucene.queries.TermFilter -org.apache.lucene.queries.TermsFilter -org.apache.lucene.search.Filter -org.apache.lucene.search.FilteredQuery -org.apache.lucene.search.TermRangeFilter -org.apache.lucene.search.NumericRangeFilter -org.apache.lucene.search.PrefixFilter -org.apache.lucene.search.QueryWrapperFilter -org.apache.lucene.search.join.BitDocIdSetCachingWrapperFilter - -java.nio.file.Paths @ Use org.elasticsearch.common.io.PathUtils.get() instead. -java.nio.file.FileSystems#getDefault() @ use org.elasticsearch.common.io.PathUtils.getDefaultFileSystem() instead. - -@defaultMessage Specify a location for the temp file/directory instead. -java.nio.file.Files#createTempDirectory(java.lang.String,java.nio.file.attribute.FileAttribute[]) -java.nio.file.Files#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[]) - -@defaultMessage Don't use java serialization - this can break BWC without noticing it -java.io.ObjectOutputStream -java.io.ObjectOutput -java.io.ObjectInputStream -java.io.ObjectInput - -java.nio.file.Files#isHidden(java.nio.file.Path) @ Dependent on the operating system, use FileSystemUtils.isHidden instead - -java.nio.file.Files#getFileStore(java.nio.file.Path) @ Use org.elasticsearch.env.Environment.getFileStore() instead, impacted by JDK-8034057 -java.nio.file.Files#isWritable(java.nio.file.Path) @ Use org.elasticsearch.env.Environment.isWritable() instead, impacted by JDK-8034057 - -@defaultMessage Resolve hosts explicitly to the address(es) you want with InetAddress. -java.net.InetSocketAddress#(java.lang.String,int) -java.net.Socket#(java.lang.String,int) -java.net.Socket#(java.lang.String,int,java.net.InetAddress,int) - -@defaultMessage Don't bind to wildcard addresses. Be specific. -java.net.DatagramSocket#() -java.net.DatagramSocket#(int) -java.net.InetSocketAddress#(int) -java.net.MulticastSocket#() -java.net.MulticastSocket#(int) -java.net.ServerSocket#(int) -java.net.ServerSocket#(int,int) - -@defaultMessage use NetworkAddress format/formatAddress to print IP or IP+ports -java.net.InetAddress#toString() -java.net.InetAddress#getHostAddress() -java.net.Inet4Address#getHostAddress() -java.net.Inet6Address#getHostAddress() -java.net.InetSocketAddress#toString() - -@defaultMessage avoid DNS lookups by accident: if you have a valid reason, then @SuppressWarnings with that reason so its completely clear -java.net.InetAddress#getHostName() -java.net.InetAddress#getCanonicalHostName() - -java.net.InetSocketAddress#getHostName() @ Use getHostString() instead, which avoids a DNS lookup - -@defaultMessage Do not violate java's access system -java.lang.reflect.AccessibleObject#setAccessible(boolean) -java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean) - -@defaultMessage this should not have been added to lucene in the first place -org.apache.lucene.index.IndexReader#getCombinedCoreAndDeletesKey() - -@defaultMessage this method needs special permission -java.lang.Thread#getAllStackTraces() diff --git a/dev-tools/src/main/resources/forbidden/core-signatures.txt b/dev-tools/src/main/resources/forbidden/core-signatures.txt deleted file mode 100644 index 08c548f1dcc..00000000000 --- a/dev-tools/src/main/resources/forbidden/core-signatures.txt +++ /dev/null @@ -1,89 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you 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. - -# For third-party dependencies, please put signatures in third-party.txt instead of here. - -@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 - -java.util.concurrent.Executors#newFixedThreadPool(int) -java.util.concurrent.Executors#newSingleThreadExecutor() -java.util.concurrent.Executors#newCachedThreadPool() -java.util.concurrent.Executors#newSingleThreadScheduledExecutor() -java.util.concurrent.Executors#newScheduledThreadPool(int) -java.util.concurrent.Executors#defaultThreadFactory() -java.util.concurrent.Executors#privilegedThreadFactory() - -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 -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 - -java.io.StringReader#(java.lang.String) @ Use FastStringReader instead - -@defaultMessage Reference management is tricky, leave it to SearcherManager -org.apache.lucene.index.IndexReader#decRef() -org.apache.lucene.index.IndexReader#incRef() -org.apache.lucene.index.IndexReader#tryIncRef() - -@defaultMessage Close listeners can only installed via ElasticsearchDirectoryReader#addReaderCloseListener -org.apache.lucene.index.IndexReader#addReaderClosedListener(org.apache.lucene.index.IndexReader$ReaderClosedListener) -org.apache.lucene.index.IndexReader#removeReaderClosedListener(org.apache.lucene.index.IndexReader$ReaderClosedListener) - -@defaultMessage Pass the precision step from the mappings explicitly instead -org.apache.lucene.search.NumericRangeQuery#newDoubleRange(java.lang.String,java.lang.Double,java.lang.Double,boolean,boolean) -org.apache.lucene.search.NumericRangeQuery#newFloatRange(java.lang.String,java.lang.Float,java.lang.Float,boolean,boolean) -org.apache.lucene.search.NumericRangeQuery#newIntRange(java.lang.String,java.lang.Integer,java.lang.Integer,boolean,boolean) -org.apache.lucene.search.NumericRangeQuery#newLongRange(java.lang.String,java.lang.Long,java.lang.Long,boolean,boolean) -org.apache.lucene.search.NumericRangeFilter#newDoubleRange(java.lang.String,java.lang.Double,java.lang.Double,boolean,boolean) -org.apache.lucene.search.NumericRangeFilter#newFloatRange(java.lang.String,java.lang.Float,java.lang.Float,boolean,boolean) -org.apache.lucene.search.NumericRangeFilter#newIntRange(java.lang.String,java.lang.Integer,java.lang.Integer,boolean,boolean) -org.apache.lucene.search.NumericRangeFilter#newLongRange(java.lang.String,java.lang.Long,java.lang.Long,boolean,boolean) - -@defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead. -java.lang.Object#wait() -java.lang.Object#wait(long) -java.lang.Object#wait(long,int) -java.lang.Object#notify() -java.lang.Object#notifyAll() - -@defaultMessage Beware of the behavior of this method on MIN_VALUE -java.lang.Math#abs(int) -java.lang.Math#abs(long) - -@defaultMessage Please do not try to stop the world -java.lang.System#gc() - -@defaultMessage Use Channels.* methods to write to channels. Do not write directly. -java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) -java.nio.channels.FileChannel#write(java.nio.ByteBuffer, long) -java.nio.channels.GatheringByteChannel#write(java.nio.ByteBuffer[], int, int) -java.nio.channels.GatheringByteChannel#write(java.nio.ByteBuffer[]) -java.nio.channels.ReadableByteChannel#read(java.nio.ByteBuffer) -java.nio.channels.ScatteringByteChannel#read(java.nio.ByteBuffer[]) -java.nio.channels.ScatteringByteChannel#read(java.nio.ByteBuffer[], int, int) -java.nio.channels.FileChannel#read(java.nio.ByteBuffer, long) - -@defaultMessage Use Lucene.parseLenient instead it strips off minor version -org.apache.lucene.util.Version#parseLeniently(java.lang.String) - -@defaultMessage Spawns a new thread which is solely under lucenes control use ThreadPool#estimatedTimeInMillisCounter instead -org.apache.lucene.search.TimeLimitingCollector#getGlobalTimerThread() -org.apache.lucene.search.TimeLimitingCollector#getGlobalCounter() - -@defaultMessage Don't interrupt threads use FutureUtils#cancel(Future) instead -java.util.concurrent.Future#cancel(boolean) - -@defaultMessage Don't try reading from paths that are not configured in Environment, resolve from Environment instead -org.elasticsearch.common.io.PathUtils#get(java.lang.String, java.lang.String[]) -org.elasticsearch.common.io.PathUtils#get(java.net.URI) diff --git a/dev-tools/src/main/resources/forbidden/test-signatures.txt b/dev-tools/src/main/resources/forbidden/test-signatures.txt deleted file mode 100644 index bd6744ee05f..00000000000 --- a/dev-tools/src/main/resources/forbidden/test-signatures.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you 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. - -com.carrotsearch.randomizedtesting.RandomizedTest#globalTempDir() @ Use newTempDirPath() instead -com.carrotsearch.randomizedtesting.annotations.Seed @ Don't commit hardcoded seeds -com.carrotsearch.randomizedtesting.annotations.Repeat @ Don't commit hardcoded repeats - -org.apache.lucene.codecs.Codec#setDefault(org.apache.lucene.codecs.Codec) @ Use the SuppressCodecs("*") annotation instead -org.apache.lucene.util.LuceneTestCase$Slow @ Don't write slow tests -org.junit.Ignore @ Use AwaitsFix instead - -org.junit.Test @defaultMessage Just name your test method testFooBar diff --git a/dev-tools/src/main/resources/forbidden/third-party-signatures.txt b/dev-tools/src/main/resources/forbidden/third-party-signatures.txt deleted file mode 100644 index ac1ce33ac92..00000000000 --- a/dev-tools/src/main/resources/forbidden/third-party-signatures.txt +++ /dev/null @@ -1,66 +0,0 @@ -# Licensed to Elasticsearch under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch licenses this file to you 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. - -@defaultMessage unsafe encoders/decoders have problems in the lzf compress library. Use variants of encode/decode functions which take Encoder/Decoder. -com.ning.compress.lzf.impl.UnsafeChunkEncoders#createEncoder(int) -com.ning.compress.lzf.impl.UnsafeChunkEncoders#createNonAllocatingEncoder(int) -com.ning.compress.lzf.impl.UnsafeChunkEncoders#createEncoder(int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.impl.UnsafeChunkEncoders#createNonAllocatingEncoder(int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.impl.UnsafeChunkDecoder#() -com.ning.compress.lzf.parallel.CompressTask -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance() -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(int) -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalNonAllocatingInstance(int) -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(com.ning.compress.BufferRecycler) -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalInstance(int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.util.ChunkEncoderFactory#optimalNonAllocatingInstance(int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.util.ChunkDecoderFactory#optimalInstance() -com.ning.compress.lzf.util.LZFFileInputStream#(java.io.File) -com.ning.compress.lzf.util.LZFFileInputStream#(java.io.FileDescriptor) -com.ning.compress.lzf.util.LZFFileInputStream#(java.lang.String) -com.ning.compress.lzf.util.LZFFileOutputStream#(java.io.File) -com.ning.compress.lzf.util.LZFFileOutputStream#(java.io.File, boolean) -com.ning.compress.lzf.util.LZFFileOutputStream#(java.io.FileDescriptor) -com.ning.compress.lzf.util.LZFFileOutputStream#(java.lang.String) -com.ning.compress.lzf.util.LZFFileOutputStream#(java.lang.String, boolean) -com.ning.compress.lzf.LZFEncoder#encode(byte[]) -com.ning.compress.lzf.LZFEncoder#encode(byte[], int, int) -com.ning.compress.lzf.LZFEncoder#encode(byte[], int, int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.LZFEncoder#appendEncoded(byte[], int, int, byte[], int) -com.ning.compress.lzf.LZFEncoder#appendEncoded(byte[], int, int, byte[], int, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.LZFCompressingInputStream#(java.io.InputStream) -com.ning.compress.lzf.LZFDecoder#fastDecoder() -com.ning.compress.lzf.LZFDecoder#decode(byte[]) -com.ning.compress.lzf.LZFDecoder#decode(byte[], int, int) -com.ning.compress.lzf.LZFDecoder#decode(byte[], byte[]) -com.ning.compress.lzf.LZFDecoder#decode(byte[], int, int, byte[]) -com.ning.compress.lzf.LZFInputStream#(java.io.InputStream) -com.ning.compress.lzf.LZFInputStream#(java.io.InputStream, boolean) -com.ning.compress.lzf.LZFInputStream#(java.io.InputStream, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.LZFInputStream#(java.io.InputStream, com.ning.compress.BufferRecycler, boolean) -com.ning.compress.lzf.LZFOutputStream#(java.io.OutputStream) -com.ning.compress.lzf.LZFOutputStream#(java.io.OutputStream, com.ning.compress.BufferRecycler) -com.ning.compress.lzf.LZFUncompressor#(com.ning.compress.DataHandler) -com.ning.compress.lzf.LZFUncompressor#(com.ning.compress.DataHandler, com.ning.compress.BufferRecycler) - -@defaultMessage Constructing a DateTime without a time zone is dangerous -org.joda.time.DateTime#() -org.joda.time.DateTime#(long) -org.joda.time.DateTime#(int, int, int, int, int) -org.joda.time.DateTime#(int, int, int, int, int, int) -org.joda.time.DateTime#(int, int, int, int, int, int, int) -org.joda.time.DateTime#now() -org.joda.time.DateTimeZone#getDefault()