From 523c6cc52ba031bc1fdbb0f357a92e1850f688ef Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Mon, 18 May 2015 20:33:29 -0400 Subject: [PATCH] common: Add external annotations for Map.get()/.remove() Even if one declares a Map, Map.get() can return a null to indicate "there is no value for this key". Same applies to .remove() too. Since the base methods are not annotated, we either have to supply our own annotation, or make sure to always use @Nullable keys. The former is less error-prone, so let's do that. See http://stackoverflow.com/a/25371836/4227853 . Change-Id: I3bb7395d7dca053d354f2f418d8529696edd0346 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/57249 Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam --- .../annotations/java/util/Map.eea | 7 +++++++ .../annotations/java/util/TreeMap.eea | 4 ++++ 2 files changed, 11 insertions(+) create mode 100644 common/org.eclipse.tracecompass.common.core/annotations/java/util/Map.eea create mode 100644 common/org.eclipse.tracecompass.common.core/annotations/java/util/TreeMap.eea diff --git a/common/org.eclipse.tracecompass.common.core/annotations/java/util/Map.eea b/common/org.eclipse.tracecompass.common.core/annotations/java/util/Map.eea new file mode 100644 index 0000000000..97ab712eb8 --- /dev/null +++ b/common/org.eclipse.tracecompass.common.core/annotations/java/util/Map.eea @@ -0,0 +1,7 @@ +class java/util/Map +get + (Ljava/lang/Object;)TV; + (Ljava/lang/Object;)T0V; +remove + (Ljava/lang/Object;)TV; + (Ljava/lang/Object;)T0V; diff --git a/common/org.eclipse.tracecompass.common.core/annotations/java/util/TreeMap.eea b/common/org.eclipse.tracecompass.common.core/annotations/java/util/TreeMap.eea new file mode 100644 index 0000000000..4111a71f2e --- /dev/null +++ b/common/org.eclipse.tracecompass.common.core/annotations/java/util/TreeMap.eea @@ -0,0 +1,4 @@ +class java/util/TreeMap +get + (Ljava/lang/Object;)TV; + (Ljava/lang/Object;)T0V; -- 2.34.1