Add support -adaptclassstrings [class_filter] (w/ different parsing).
First, user-given rules w/ that option in pg config will be converted
to ProguardClassNameList, which is in turn used to match classes.
After the normal minifier process is done, IdentifierMinifier, a newly
introduced minifier that uses aforementioned matched classes and naming
lense that is generated from the other minifiers, will walk through
candidate classes to find string literal usages:
1) in <clinit> (for static field initialization), and
2) in method's code_item.
Those string literals will be replaced with the renamed ones only if
1) they correspond to class identifiers; and
2) corresponding types are indeed renamed by the previous minifier.
Bug: 36799092
Change-Id: I3f09a22fa0d0eda6671f4c60d29b9363fb991df3
diff --git a/src/test/examples/adaptclassstrings/A.java b/src/test/examples/adaptclassstrings/A.java
new file mode 100644
index 0000000..a1d95ef
--- /dev/null
+++ b/src/test/examples/adaptclassstrings/A.java
@@ -0,0 +1,24 @@
+// 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 adaptclassstrings;
+
+public class A {
+ protected static final String ITSELF = "Ladaptclassstrings/A;";
+ protected static final String OTHER = "adaptclassstrings.C";
+
+ protected int f;
+
+ A(int f) {
+ this.f = f;
+ }
+
+ protected int foo() {
+ return f * 9;
+ }
+
+ void bar() {
+ System.out.println("adaptclassstrings.C");
+ System.out.println("adaptclassstrings.D");
+ }
+}