You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/07/13 15:44:31 UTC
[camel] branch master updated: fix unchecked generic for varargs
compiler warning (#3997)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 4bfb469 fix unchecked generic for varargs compiler warning (#3997)
4bfb469 is described below
commit 4bfb469f82268c546688353cb08fea8d5c94f15f
Author: Yasser Zamani <ya...@apache.org>
AuthorDate: Mon Jul 13 20:14:17 2020 +0430
fix unchecked generic for varargs compiler warning (#3997)
* fix unchecked generic for varargs compiler warning
to get rid of "unchecked generics array creation for varargs parameter" compiler warning
* make SafeVarargs annotated method final
By requiring that the method is final, the developer can guarantee that the declaration he made (namely that its varargs use is safe) is actually always true (provided of course that the developer actually provided a safe varargs method), and that it wasn't actually broken by a subclass incorrectly re-implementing the method.
---
.../src/main/java/org/apache/camel/model/TryDefinition.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/TryDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/TryDefinition.java
index 5a202c7..57cf440 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/model/TryDefinition.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/TryDefinition.java
@@ -88,7 +88,8 @@ public class TryDefinition extends OutputDefinition<TryDefinition> {
* @param exceptionType the exception(s)
* @return the try builder
*/
- public TryDefinition doCatch(Class<? extends Throwable>... exceptionType) {
+ @SafeVarargs
+ public final TryDefinition doCatch(Class<? extends Throwable>... exceptionType) {
popBlock();
List<Class<? extends Throwable>> list = Arrays.asList(exceptionType);
CatchDefinition answer = new CatchDefinition(list);