diff --git a/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java b/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java index 1dfcdc8e6f7..bca83885f37 100644 --- a/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java +++ b/byte-buddy-agent/src/main/java/net/bytebuddy/agent/VirtualMachine.java @@ -2058,8 +2058,10 @@ public int getOwnerIdOf(File file) { try { // The binding for 'stat' is very platform dependant. To avoid the complexity of binding the correct method, // stat is called as a separate command. This is less efficient but more portable. - String statUserSwitch = Platform.isMac() ? "-f" : "-c"; - Process process = Runtime.getRuntime().exec("stat " + statUserSwitch + " %u " + file.getAbsolutePath()); + Process process = Runtime.getRuntime().exec(new String[]{"stat", + Platform.isMac() ? "-f" : "-c", + "%u", + file.getAbsolutePath()}); int attempts = this.attempts; boolean exited = false; String line = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8")).readLine(); diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java b/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java index c75c81b43f4..2145249095a 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/ByteBuddy.java @@ -1382,6 +1382,7 @@ public ByteBuddy with(ClassWriterStrategy classWriterStrategy) { * @param ignoredMethods A matcher for identifying methods to be excluded from instrumentation. * @return A new Byte Buddy instance that excludes any method from instrumentation if it is matched by the supplied matcher. */ + @SuppressWarnings("overloads") public ByteBuddy ignore(ElementMatcher ignoredMethods) { return ignore(new LatentMatcher.Resolved(ignoredMethods)); } @@ -1397,6 +1398,7 @@ public ByteBuddy ignore(ElementMatcher ignoredMethods * @param ignoredMethods A matcher for identifying methods to be excluded from instrumentation. * @return A new Byte Buddy instance that excludes any method from instrumentation if it is matched by the supplied matcher. */ + @SuppressWarnings("overloads") public ByteBuddy ignore(LatentMatcher ignoredMethods) { return new ByteBuddy(classFileVersion, namingStrategy, diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java b/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java index d23b7ac6d3a..61f6fca1c6d 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/AgentBuilder.java @@ -153,6 +153,7 @@ public interface AgentBuilder { * @param locationStrategy The location strategy to use. * @return A new instance of this agent builder which uses the given location strategy for looking up class files. */ + @SuppressWarnings("overloads") AgentBuilder with(LocationStrategy locationStrategy); /** @@ -231,6 +232,7 @@ public interface AgentBuilder { * @param fallbackStrategy The fallback strategy to be used. * @return A new agent builder that applies the supplied fallback strategy. */ + @SuppressWarnings("overloads") AgentBuilder with(FallbackStrategy fallbackStrategy); /** @@ -257,6 +259,7 @@ public interface AgentBuilder { * @param injectionStrategy The injection strategy to use. * @return A new agent builder with the supplied injection strategy configured. */ + @SuppressWarnings("overloads") AgentBuilder with(InjectionStrategy injectionStrategy); /** @@ -1404,6 +1407,7 @@ interface WithImplicitDiscoveryStrategy extends RedefinitionListenable { * @param redefinitionDiscoveryStrategy The redefinition discovery strategy to use. * @return A new instance of this agent builder which makes use of the specified discovery strategy. */ + @SuppressWarnings("overloads") RedefinitionListenable with(RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy); } @@ -1420,6 +1424,7 @@ interface WithoutBatchStrategy extends WithImplicitDiscoveryStrategy { * @param redefinitionBatchAllocator The batch allocator to use. * @return A new instance of this agent builder which makes use of the specified batch allocator. */ + @SuppressWarnings("overloads") WithImplicitDiscoveryStrategy with(RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator); } } @@ -2944,6 +2949,7 @@ public ForAdvice include(List classFileLocators) { * @param name The fully-qualified, binary name of the advice class. * @return A new instance of this advice transformer that applies the given advice to all matched methods of an instrumented type. */ + @SuppressWarnings("overloads") public ForAdvice advice(ElementMatcher matcher, String name) { return advice(new LatentMatcher.Resolved(matcher), name); } @@ -2955,6 +2961,7 @@ public ForAdvice advice(ElementMatcher matcher, Strin * @param name The fully-qualified, binary name of the advice class. * @return A new instance of this advice transformer that applies the given advice to all matched methods of an instrumented type. */ + @SuppressWarnings("overloads") public ForAdvice advice(LatentMatcher matcher, String name) { return new ForAdvice(advice, exceptionHandler, @@ -2973,6 +2980,7 @@ public ForAdvice advice(LatentMatcher matcher, String * @param exit The fully-qualified, binary name of the exit advice class. * @return A new instance of this advice transformer that applies the given advice to all matched methods of an instrumented type. */ + @SuppressWarnings("overloads") public ForAdvice advice(ElementMatcher matcher, String enter, String exit) { return advice(new LatentMatcher.Resolved(matcher), enter, exit); } @@ -2985,6 +2993,7 @@ public ForAdvice advice(ElementMatcher matcher, Strin * @param exit The fully-qualified, binary name of the exit advice class. * @return A new instance of this advice transformer that applies the given advice to all matched methods of an instrumented type. */ + @SuppressWarnings("overloads") public ForAdvice advice(LatentMatcher matcher, String enter, String exit) { return new ForAdvice(advice, exceptionHandler, diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/ResettableClassFileTransformer.java b/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/ResettableClassFileTransformer.java index 0b734932adb..b082313d114 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/ResettableClassFileTransformer.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/agent/builder/ResettableClassFileTransformer.java @@ -91,6 +91,7 @@ Iterator iterator(TypeDescription typeDescription, * @param redefinitionBatchAllocator The batch allocator to use. * @return {@code true} if a reset was applied and this transformer was not previously removed. */ + @SuppressWarnings("overloads") boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator); @@ -117,6 +118,7 @@ boolean reset(Instrumentation instrumentation, * @param redefinitionDiscoveryStrategy The discovery strategy for the types to reset. * @return {@code true} if a reset was applied and this transformer was not previously removed. */ + @SuppressWarnings("overloads") boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy); @@ -172,6 +174,7 @@ boolean reset(Instrumentation instrumentation, * @param redefinitionListener The redefinition listener to apply. * @return {@code true} if a reset was applied and this transformer was not previously removed. */ + @SuppressWarnings("overloads") boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.DiscoveryStrategy redefinitionDiscoveryStrategy, @@ -200,6 +203,7 @@ boolean reset(Instrumentation instrumentation, * @param redefinitionListener The redefinition listener to apply. * @return {@code true} if a reset was applied and this transformer was not previously removed. */ + @SuppressWarnings("overloads") boolean reset(Instrumentation instrumentation, AgentBuilder.RedefinitionStrategy redefinitionStrategy, AgentBuilder.RedefinitionStrategy.BatchAllocator redefinitionBatchAllocator, diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java index e828a37efc6..2bc65f1d983 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/DynamicType.java @@ -971,6 +971,7 @@ interface Builder { * @param matcher The matcher that determines what declared fields are affected by the subsequent specification. * @return A builder that allows for changing a field's definition. */ + @SuppressWarnings("overloads") FieldDefinition.Valuable field(ElementMatcher matcher); /** @@ -993,6 +994,7 @@ interface Builder { * @param matcher The matcher that determines what declared fields are affected by the subsequent specification. * @return A builder that allows for changing a field's definition. */ + @SuppressWarnings("overloads") FieldDefinition.Valuable field(LatentMatcher matcher); /** @@ -1009,6 +1011,7 @@ interface Builder { * @return A new builder that is equal to this builder but that is excluding any method that is matched by the supplied matcher from * instrumentation. */ + @SuppressWarnings("overloads") Builder ignoreAlso(ElementMatcher ignoredMethods); /** @@ -1027,6 +1030,7 @@ interface Builder { * @return A new builder that is equal to this builder but that is excluding any method that is matched by the supplied matcher from * instrumentation. */ + @SuppressWarnings("overloads") Builder ignoreAlso(LatentMatcher ignoredMethods); /** @@ -1270,6 +1274,7 @@ interface Builder { * @param matcher The matcher that determines what methods or constructors are affected by the subsequent specification. * @return A builder that allows for changing a method's or constructor's definition. */ + @SuppressWarnings("overloads") MethodDefinition.ImplementationDefinition invokable(ElementMatcher matcher); /** @@ -1302,6 +1307,7 @@ interface Builder { * @param matcher The matcher that determines what declared methods or constructors are affected by the subsequent specification. * @return A builder that allows for changing a method's or constructor's definition. */ + @SuppressWarnings("overloads") MethodDefinition.ImplementationDefinition invokable(LatentMatcher matcher); /** @@ -1370,6 +1376,7 @@ interface Builder { * @param matcher The matcher that determines what declared record components are affected by the subsequent specification. * @return A builder that allows for changing a record component's definition. */ + @SuppressWarnings("overloads") RecordComponentDefinition recordComponent(ElementMatcher matcher); /** @@ -1391,6 +1398,7 @@ interface Builder { * @param matcher The matcher that determines what declared record components are affected by the subsequent specification. * @return A builder that allows for changing a record component's definition. */ + @SuppressWarnings("overloads") RecordComponentDefinition recordComponent(LatentMatcher matcher); /** diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/LoadedTypeInitializer.java b/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/LoadedTypeInitializer.java index 34bf896d4d7..a0072e7e150 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/LoadedTypeInitializer.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/LoadedTypeInitializer.java @@ -98,6 +98,7 @@ class ForStaticField implements LoadedTypeInitializer, Serializable { /** * The value of the field. */ + @SuppressWarnings("serial") private final Object value; /** @@ -197,6 +198,7 @@ class Compound implements LoadedTypeInitializer, Serializable { /** * The loaded type initializers that are represented by this compound type initializer. */ + @SuppressWarnings("serial") private final List loadedTypeInitializers; /** diff --git a/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java b/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java index 6a05af56609..bc2297a0fc6 100644 --- a/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java +++ b/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodCall.java @@ -176,6 +176,7 @@ public static WithoutSpecifiedTarget invoke(MethodDescription methodDescription) * @param matcher The matcher to identify the method to invoke. * @return A method call for the uniquely identified method. */ + @SuppressWarnings("overloads") public static WithoutSpecifiedTarget invoke(ElementMatcher matcher) { return invoke(matcher, MethodGraph.Compiler.DEFAULT); } @@ -199,6 +200,7 @@ public static WithoutSpecifiedTarget invoke(ElementMatcher(ClassLoader.getSystemClassLoader())); } @Test diff --git a/byte-buddy-dep/src/test/java/net/bytebuddy/matcher/ElementMatchersTest.java b/byte-buddy-dep/src/test/java/net/bytebuddy/matcher/ElementMatchersTest.java index b93c82f172b..5dffe3fe1a2 100644 --- a/byte-buddy-dep/src/test/java/net/bytebuddy/matcher/ElementMatchersTest.java +++ b/byte-buddy-dep/src/test/java/net/bytebuddy/matcher/ElementMatchersTest.java @@ -1416,8 +1416,8 @@ public String toString() { return super.toString(); } - @Override - @SuppressWarnings("deprecation") + //@Override + @SuppressWarnings({"deprecation", "removal"}) protected void finalize() throws Throwable { super.finalize(); }