Update class version file comparison

This also allows preview features in the supported class file
versions, as the signed handling of minor version implicitly
supported it.

Fixes: 195726500
Change-Id: Iffc89d50df5f7ea54ab1a41ee63d1c4e3bc75eec
diff --git a/src/main/java/com/android/tools/r8/cf/CfVersion.java b/src/main/java/com/android/tools/r8/cf/CfVersion.java
index 47eebe9..07610dd 100644
--- a/src/main/java/com/android/tools/r8/cf/CfVersion.java
+++ b/src/main/java/com/android/tools/r8/cf/CfVersion.java
@@ -25,10 +25,15 @@
   public static final CfVersion V9 = new CfVersion(Opcodes.V9);
   public static final CfVersion V10 = new CfVersion(Opcodes.V10);
   public static final CfVersion V11 = new CfVersion(Opcodes.V11);
+  public static final CfVersion V11_PREVIEW = new CfVersion(Opcodes.V11 | Opcodes.V_PREVIEW);
   public static final CfVersion V12 = new CfVersion(Opcodes.V12);
+  public static final CfVersion V12_PREVIEW = new CfVersion(Opcodes.V12 | Opcodes.V_PREVIEW);
   public static final CfVersion V13 = new CfVersion(Opcodes.V13);
+  public static final CfVersion V13_PREVIEW = new CfVersion(Opcodes.V13 | Opcodes.V_PREVIEW);
   public static final CfVersion V14 = new CfVersion(Opcodes.V14);
+  public static final CfVersion V14_PREVIEW = new CfVersion(Opcodes.V14 | Opcodes.V_PREVIEW);
   public static final CfVersion V15 = new CfVersion(Opcodes.V15);
+  public static final CfVersion V15_PREVIEW = new CfVersion(Opcodes.V15 | Opcodes.V_PREVIEW);
 
   private final int version;
 
@@ -64,19 +69,25 @@
   }
 
   public int minor() {
-    return version >> 16;
+    return version >>> 16;
   }
 
   public int raw() {
     return version;
   }
 
+  public boolean isPreview() {
+    return minor() == Opcodes.V_PREVIEW >>> 16;
+  }
+
   private static void specify(StructuralSpecification<CfVersion, ?> spec) {
     spec.withInt(CfVersion::major).withInt(CfVersion::minor);
   }
 
   public static Iterable<CfVersion> rangeInclusive(CfVersion from, CfVersion to) {
     assert from.isLessThanOrEqualTo(to);
+    assert !from.isPreview() : "This method does not handle preview versions";
+    assert !to.isPreview() : "This method does not handle preview versions";
     return Arrays.stream(versions)
         .filter(version -> version.isGreaterThanOrEqualTo(from))
         .filter(version -> version.isLessThanOrEqualTo(to))
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index 3f89fd2..513cfe8 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -123,7 +123,7 @@
     }
   }
 
-  public static final CfVersion SUPPORTED_CF_VERSION = CfVersion.V15;
+  public static final CfVersion SUPPORTED_CF_VERSION = CfVersion.V15_PREVIEW;
   public static final CfVersion EXPERIMENTAL_CF_VERSION = CfVersion.V12;
 
   public static final int SUPPORTED_DEX_VERSION =