Allow parsing mapping files with . as identifier start

Bug: b/309080420
Change-Id: I6b69a66120714afd554314866bdde751355b424e
diff --git a/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java b/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
index 559d7f0..7d60962 100644
--- a/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
+++ b/src/main/java/com/android/tools/r8/naming/ProguardMapReader.java
@@ -652,6 +652,24 @@
 
   // Parsing of components
 
+  private static boolean isAllowedIdentifierStart(int codePoint) {
+    if (IdentifierUtils.isDexIdentifierStart(codePoint)) {
+      return true;
+    }
+    // Proguard sometimes outputs a ? as a method name. We have tools (dexsplitter) that depends
+    // on being able to map class names back to the original, but does not care if methods are
+    // correctly mapped. Using this on proguard output for anything else might not give correct
+    // remappings.
+    if (IdentifierUtils.isQuestionMark(codePoint)) {
+      return true;
+    }
+    // Some mapping files contain entries starting with a '.', allow those for compatibility.
+    if (codePoint == '.') {
+      return true;
+    }
+    return false;
+  }
+
   private void skipIdentifier(boolean allowInit) {
     boolean isInit = false;
     if (allowInit && peekChar(0) == '<') {
@@ -659,12 +677,7 @@
       nextChar();
       isInit = true;
     }
-    // Proguard sometimes outputs a ? as a method name. We have tools (dexsplitter) that depends
-    // on being able to map class names back to the original, but does not care if methods are
-    // correctly mapped. Using this on proguard output for anything else might not give correct
-    // remappings.
-    if (!IdentifierUtils.isDexIdentifierStart(peekCodePoint())
-        && !IdentifierUtils.isQuestionMark(peekCodePoint())) {
+    if (!isAllowedIdentifierStart(peekCodePoint())) {
       throw new ParseException("Identifier expected");
     }
     nextCodePoint();
diff --git a/src/test/java/com/android/tools/r8/retrace/InvalidMappingRangesB309080420Test.java b/src/test/java/com/android/tools/r8/retrace/InvalidMappingRangesB309080420Test.java
index 09ca4e0..c5eaf59 100644
--- a/src/test/java/com/android/tools/r8/retrace/InvalidMappingRangesB309080420Test.java
+++ b/src/test/java/com/android/tools/r8/retrace/InvalidMappingRangesB309080420Test.java
@@ -36,7 +36,9 @@
           "    11:2:void a() -> a", // Unexpected line range [11:2] - interpreting as [2:11]
           "    12:21:void a(android.content.Intent) -> a",
           // Allow identifier content to follow <init>/<clinit>.
-          "    22:41:void <clinit>$more$stuff() -> clinit$move$stuff");
+          "    22:41:void <clinit>$more$stuff() -> clinit$move$stuff",
+          // Allow type identifiers to start with '.'
+          ".Foo -> o.bar:");
 
   @Test
   public void test() throws Exception {