Skip to content
Snippets Groups Projects
Commit eeec5f82 authored by Tor Norbye's avatar Tor Norbye Committed by Gerrit Code Review
Browse files

Merge "Using --output-kotlin-nulls=yes implies --format=v3"

parents 15b293b1 e61990aa
No related branches found
No related tags found
No related merge requests found
buildscript {
ext.gradle_version = '3.4.0-beta01'
ext.studio_version = '26.4.0-beta01'
ext.kotlin_version = '1.3.11'
ext.kotlin_version = '1.3.20'
repositories {
google()
jcenter()
......
......@@ -1249,18 +1249,19 @@ class Options(
true
else yesNo(arg.substring(ARG_INCLUDE_SIG_VERSION.length + 1))
} else if (arg.startsWith(ARG_FORMAT)) {
when (arg) {
outputFormat = when (arg) {
"$ARG_FORMAT=v1" -> {
FileFormat.V1.configureOptions(this, compatibility)
FileFormat.V1
}
"$ARG_FORMAT=v2" -> {
FileFormat.V2.configureOptions(this, compatibility)
FileFormat.V2
}
"$ARG_FORMAT=v3" -> {
FileFormat.V3.configureOptions(this, compatibility)
FileFormat.V3
}
else -> throw DriverException(stderr = "Unexpected signature format; expected v1, v2 or v3")
}
outputFormat.configureOptions(this, compatibility)
} else if (arg.startsWith("-")) {
// Compatibility flag; map to mutable properties in the Compatibility
// class and assign it
......@@ -1329,6 +1330,12 @@ class Options(
apiLevelJars = findAndroidJars(androidJarPatterns!!, currentApiLevel, currentCodeName, currentJar)
}
// outputKotlinStyleNulls implies format=v3
if (outputKotlinStyleNulls) {
outputFormat = FileFormat.V3
outputFormat.configureOptions(this, compatibility)
}
// If the caller has not explicitly requested that unannotated classes and
// members should be shown in the output then only show them if no annotations were provided.
if (!showUnannotated && showAnnotations.isEmpty()) {
......
......@@ -2,4 +2,4 @@
# Version definition
# This file is read by gradle build scripts, but also packaged with metalava
# as a resource for the Version classes to read.
metalavaVersion=1.2.6
metalavaVersion=1.2.7
......@@ -613,6 +613,7 @@ class ApiFileTest : DriverTest() {
androidxNullableSource
),
api = """
// Signature format: 3.0
package androidx.util {
public class NonNullableJavaPair<F, S> {
ctor public NonNullableJavaPair(F, S);
......@@ -712,6 +713,7 @@ class ApiFileTest : DriverTest() {
androidxNullableSource
),
api = """
// Signature format: 3.0
package test {
public class MyClass {
ctor public MyClass();
......
......@@ -653,6 +653,7 @@ class ApiFromTextTest : DriverTest() {
@Test
fun `Deprecated enum constant`() {
val source = """
// Signature format: 3.0
package androidx.annotation {
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.ANNOTATION_TYPE, java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.PACKAGE}) public @interface RestrictTo {
method public abstract androidx.annotation.RestrictTo.Scope[] value();
......@@ -677,8 +678,9 @@ class ApiFromTextTest : DriverTest() {
}
@Test
fun `Type parameters in v2 format`() {
fun `Type parameters in v3 format`() {
val source = """
// Signature format: 3.0
package androidx.collection {
public class Constants {
field public static final String GOOD_IRI_CHAR = "a-zA-Z0-9\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef";
......
......@@ -259,6 +259,7 @@ class NullnessMigrationTest : DriverTest() {
}
""",
api = """
// Signature format: 3.0
package test.pkg {
public class MyTest {
ctor public MyTest();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment