-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable autovalue readable tests for J2KT
For now I need to remove methods that use `@Memoized` as those will cause J2KT to fail. PiperOrigin-RevId: 708326385
- Loading branch information
1 parent
a2ac36b
commit 091a9d7
Showing
42 changed files
with
1,869 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
transpiler/javatests/com/google/j2cl/readable/java/autovalue/J2ktIncompatible.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024 Google Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package autovalue; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Retention(RetentionPolicy.CLASS) | ||
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) | ||
public @interface J2ktIncompatible {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...atests/com/google/j2cl/readable/java/autovalue/output_closure/SimpleAutoValue.java.js.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...m/google/j2cl/readable/java/autovalue/output_kt/$AutoValue_AutoValueWithExtensions.kt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Generated from "autovalue/$AutoValue_AutoValueWithExtensions.java" | ||
@file:OptIn(ExperimentalObjCName::class) | ||
@file:Suppress( | ||
"ALWAYS_NULL", | ||
"PARAMETER_NAME_CHANGED_ON_OVERRIDE", | ||
"SENSELESS_COMPARISON", | ||
"UNCHECKED_CAST", | ||
"UNNECESSARY_LATEINIT", | ||
"UNNECESSARY_NOT_NULL_ASSERTION", | ||
"UNREACHABLE_CODE", | ||
"UNUSED_ANONYMOUS_PARAMETER", | ||
"UNUSED_PARAMETER", | ||
"UNUSED_VARIABLE", | ||
"USELESS_CAST", | ||
"VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL", | ||
"VARIABLE_WITH_REDUNDANT_INITIALIZER", | ||
"REDUNDANT_ELSE_IN_WHEN") | ||
|
||
package autovalue | ||
|
||
import javaemul.lang.* | ||
import autovalue.AutoValueWithExtensions | ||
import java.lang.NullPointerException | ||
import kotlin.Any | ||
import kotlin.Boolean | ||
import kotlin.Int | ||
import kotlin.OptIn | ||
import kotlin.String | ||
import kotlin.Suppress | ||
import kotlin.experimental.ExperimentalObjCName | ||
import kotlin.native.ObjCName | ||
|
||
@ObjCName("J2ktAutovalue_AutoValue_AutoValueWithExtensions", exact = true) | ||
abstract class ___AutoValue_AutoValueWithExtensions: AutoValueWithExtensions { | ||
private val intField: Int | ||
|
||
private val stringField: String? | ||
|
||
internal constructor(intField: Int, stringField: String?) { | ||
this.intField = intField | ||
if (stringField == null) { | ||
throw NullPointerException("Null stringField") | ||
} | ||
this.stringField = stringField | ||
} | ||
|
||
override fun getIntField(): Int { | ||
return this.intField | ||
} | ||
|
||
override fun getStringField(): String? { | ||
return this.stringField | ||
} | ||
|
||
override fun toString(): String { | ||
return "AutoValueWithExtensions{" + "intField=" + this.intField + ", " + "stringField=" + this.stringField + "}" | ||
} | ||
|
||
override fun equals(o: Any?): Boolean { | ||
if (o === this) { | ||
return true | ||
} | ||
if (o is AutoValueWithExtensions) { | ||
val that: AutoValueWithExtensions? = o as AutoValueWithExtensions? | ||
return this.intField == that!!.getIntField() && this.stringField!!.equals(that!!.getStringField()) | ||
} | ||
return false | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var h___: Int = 1 | ||
h___ = h___ * 1000003 | ||
h___ = h___.xor(this.intField) | ||
h___ = h___ * 1000003 | ||
h___ = h___.xor(this.stringField!!.hashCode()) | ||
return h___ | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ests/com/google/j2cl/readable/java/autovalue/output_kt/AutoValueJsType+J2ObjCCompat.h.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Generated by J2KT from "autovalue/AutoValueJsType.java" | ||
|
||
#import <Foundation/NSObjCRuntime.h> | ||
|
||
@class J2ktAutovalueAutoValueJsType; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@compatibility_alias AutovalueAutoValueJsType J2ktAutovalueAutoValueJsType; | ||
|
||
NS_ASSUME_NONNULL_END |
42 changes: 42 additions & 0 deletions
42
...spiler/javatests/com/google/j2cl/readable/java/autovalue/output_kt/AutoValueJsType.kt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Generated from "autovalue/AutoValueJsType.java" | ||
@file:OptIn(ExperimentalObjCName::class) | ||
@file:Suppress( | ||
"ALWAYS_NULL", | ||
"PARAMETER_NAME_CHANGED_ON_OVERRIDE", | ||
"SENSELESS_COMPARISON", | ||
"UNCHECKED_CAST", | ||
"UNNECESSARY_LATEINIT", | ||
"UNNECESSARY_NOT_NULL_ASSERTION", | ||
"UNREACHABLE_CODE", | ||
"UNUSED_ANONYMOUS_PARAMETER", | ||
"UNUSED_PARAMETER", | ||
"UNUSED_VARIABLE", | ||
"USELESS_CAST", | ||
"VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL", | ||
"VARIABLE_WITH_REDUNDANT_INITIALIZER", | ||
"REDUNDANT_ELSE_IN_WHEN") | ||
|
||
package autovalue | ||
|
||
import javaemul.lang.* | ||
import jsinterop.annotations.JsIgnore | ||
import jsinterop.annotations.JsMethod | ||
import jsinterop.annotations.JsType | ||
import kotlin.Int | ||
import kotlin.OptIn | ||
import kotlin.Suppress | ||
import kotlin.experimental.ExperimentalObjCName | ||
import kotlin.native.ObjCName | ||
|
||
@ObjCName("J2ktAutovalueAutoValueJsType", exact = true) | ||
@JsType | ||
abstract class AutoValueJsType { | ||
@JsIgnore | ||
constructor() | ||
|
||
@ObjCName("getField") | ||
abstract fun getField(): Int | ||
|
||
@JsMethod(name = "getField2") | ||
internal abstract fun getWithJsMethod_pp_autovalue(): Int | ||
} |
14 changes: 14 additions & 0 deletions
14
...com/google/j2cl/readable/java/autovalue/output_kt/AutoValueWithBuilder+J2ObjCCompat.h.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Generated by J2KT from "autovalue/AutoValueWithBuilder.java" | ||
|
||
#import <Foundation/NSObjCRuntime.h> | ||
|
||
@class J2ktAutovalueAutoValueWithBuilder; | ||
@class J2ktAutovalueAutoValueWithBuilderCompanion; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@compatibility_alias AutovalueAutoValueWithBuilder J2ktAutovalueAutoValueWithBuilder; | ||
|
||
@compatibility_alias AutovalueAutoValueWithBuilderCompanion J2ktAutovalueAutoValueWithBuilderCompanion; | ||
|
||
NS_ASSUME_NONNULL_END |
65 changes: 65 additions & 0 deletions
65
...r/javatests/com/google/j2cl/readable/java/autovalue/output_kt/AutoValueWithBuilder.kt.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Generated from "autovalue/AutoValueWithBuilder.java" | ||
@file:OptIn(ExperimentalObjCName::class) | ||
@file:Suppress( | ||
"ALWAYS_NULL", | ||
"PARAMETER_NAME_CHANGED_ON_OVERRIDE", | ||
"SENSELESS_COMPARISON", | ||
"UNCHECKED_CAST", | ||
"UNNECESSARY_LATEINIT", | ||
"UNNECESSARY_NOT_NULL_ASSERTION", | ||
"UNREACHABLE_CODE", | ||
"UNUSED_ANONYMOUS_PARAMETER", | ||
"UNUSED_PARAMETER", | ||
"UNUSED_VARIABLE", | ||
"USELESS_CAST", | ||
"VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL", | ||
"VARIABLE_WITH_REDUNDANT_INITIALIZER", | ||
"REDUNDANT_ELSE_IN_WHEN") | ||
|
||
package autovalue | ||
|
||
import javaemul.lang.* | ||
import autovalue.AutoValue_AutoValueWithBuilder | ||
import kotlin.Boolean | ||
import kotlin.Double | ||
import kotlin.OptIn | ||
import kotlin.Suppress | ||
import kotlin.experimental.ExperimentalObjCName | ||
import kotlin.jvm.JvmStatic | ||
import kotlin.native.ObjCName | ||
|
||
@ObjCName("J2ktAutovalueAutoValueWithBuilder", exact = true) | ||
abstract class AutoValueWithBuilder { | ||
@ObjCName("getBooleanField") | ||
abstract fun getBooleanField(): Boolean | ||
|
||
@ObjCName("getNullableField") | ||
abstract fun getNullableField(): Double? | ||
|
||
@ObjCName("toBuilder") | ||
abstract fun toBuilder(): AutoValueWithBuilder.Builder? | ||
|
||
@ObjCName("J2ktAutovalueAutoValueWithBuilderCompanion", exact = true) | ||
companion object { | ||
@JvmStatic | ||
internal fun create_pp_autovalue(): AutoValueWithBuilder? { | ||
return AutoValue_AutoValueWithBuilder.Builder().setBooleanField(true)!!.build() | ||
} | ||
} | ||
|
||
@ObjCName("J2ktAutovalueAutoValueWithBuilder_Builder", exact = true) | ||
abstract class Builder internal constructor() { | ||
@ObjCName("setBooleanField") | ||
abstract fun setBooleanField( | ||
@ObjCName("withBoolean") x: Boolean | ||
): AutoValueWithBuilder.Builder? | ||
|
||
@ObjCName("setNullableField") | ||
abstract fun setNullableField( | ||
@ObjCName("withJavaLangDouble") x: Double? | ||
): AutoValueWithBuilder.Builder? | ||
|
||
@ObjCName("build") | ||
abstract fun build(): AutoValueWithBuilder? | ||
} | ||
} |
Oops, something went wrong.