From 42dcfb8f577f71d2e9fa8ba8fd3a43ce44e21af5 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Mon, 29 Apr 2019 22:37:00 +0100 Subject: [PATCH] Handle removed classes when looking for deprecated at birth APIs. Removed APIs cause a KeyError when looking them up in the current API surface. Instead, check if they're there first and if not just move on since they no longer exist. Bug: 129975435 Test: looked for new and deprecated system APIs Change-Id: I46daa83ec8376190112418720f848afdf7cd7df2 --- tools/apilint/apilint.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py index 97ca6dc7bf341..f41426d84af1b 100644 --- a/tools/apilint/apilint.py +++ b/tools/apilint/apilint.py @@ -2132,6 +2132,10 @@ def show_deprecations_at_birth(cur, prev): # Remove all existing things so we're left with new for prev_clazz in prev.values(): + if prev_clazz.fullname not in cur: + # The class was removed this release; we can safely ignore it. + continue + cur_clazz = cur[prev_clazz.fullname] if not is_interesting(cur_clazz): continue