Apply the given pg-map via graph lense. While visiting types in a subtyping order, mappings in the pg-map will be converted to a custom graph lense. One caveat is to detect mapping conflicts, e.g., so-called diamond problem. Another caveat is to apply class mappings on-the-fly. We should rename all the occurrences of renamed types while applying member mappings. Yet another caveat is uses of renamed lib classes inside pgr classes. We have a separate step that fixes trees by explicitly substitute those type appearances with applied names. ------ Note that, instead of way too general support (http://go/r8g/4880), we decided to support only the simple use case: compile a new piece of code (e.g., test) against an obfuscated app. See http://b/64802420#comment7 for more details. Bug: 64802420 Change-Id: Ib3cb35811061c046e94a4fc9a021a783f15050dc
diff --git a/src/test/examples/applymapping044/Main.java b/src/test/examples/applymapping044/Main.java new file mode 100644 index 0000000..9d5f577 --- /dev/null +++ b/src/test/examples/applymapping044/Main.java
@@ -0,0 +1,20 @@ +// Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. +package applymapping044; + +import naming044.A; +import naming044.B; +import naming044.sub.SubB; + +public class Main { + public static void main(String[] args) { + B.m(); + SubB.n(); + A a = new A(); + B b = new B(); + b.f(a); + AsubB subB = new AsubB(); + subB.f(a); + } +}