-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[J2KT] Add readable test to cover b/289049603 - a problem in Kotlin c…
…ompiler with packages starting with "java". PiperOrigin-RevId: 550813436
- Loading branch information
1 parent
ae767f7
commit 0887558
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
transpiler/javatests/com/google/j2cl/readable/java/j2ktnotpassing/PackageWithJavaPrefix.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,28 @@ | ||
/* | ||
* Copyright 2023 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 | ||
* | ||
* https://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 javapkg; | ||
|
||
// TODO(b/289049603): Kotlin compiler crashes with | ||
// "Companion object javapkg.PackageWithJavaPrefix$Companion cannot be interpreted" message. | ||
// However, it's already fixed in 1.9.20. | ||
// Move this file to "j2kt" when 1.9.20 toolchain is available for JVM and Native. | ||
public class PackageWithJavaPrefix { | ||
public static final int VALUE = 128; | ||
|
||
public static int value() { | ||
return VALUE; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...l/readable/java/j2ktnotpassing/output_kt/javapkg/PackageWithJavaPrefix+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,26 @@ | ||
// Generated by J2KT from "javapkg/PackageWithJavaPrefix.java" | ||
|
||
#import <Foundation/NSObjCRuntime.h> | ||
|
||
#import "third_party/java_src/j2objc/jre_emul/Classes/J2ObjC_types.h" | ||
|
||
@class J2ktJavapkgPackageWithJavaPrefix; | ||
@class J2ktJavapkgPackageWithJavaPrefixCompanion; | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@compatibility_alias JavapkgPackageWithJavaPrefix J2ktJavapkgPackageWithJavaPrefix; | ||
|
||
@compatibility_alias JavapkgPackageWithJavaPrefixCompanion J2ktJavapkgPackageWithJavaPrefixCompanion; | ||
|
||
#define JavapkgPackageWithJavaPrefix_VALUE 128 | ||
|
||
NS_INLINE jint JavapkgPackageWithJavaPrefix_get_VALUE(void) { | ||
return J2ktJavapkgPackageWithJavaPrefixCompanion.shared.VALUE_; | ||
} | ||
|
||
NS_INLINE jint JavapkgPackageWithJavaPrefix_value(void) { | ||
return [J2ktJavapkgPackageWithJavaPrefixCompanion.shared value]; | ||
} | ||
|
||
NS_ASSUME_NONNULL_END |
41 changes: 41 additions & 0 deletions
41
...m/google/j2cl/readable/java/j2ktnotpassing/output_kt/javapkg/PackageWithJavaPrefix.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,41 @@ | ||
// Generated from "javapkg/PackageWithJavaPrefix.java" | ||
@file:OptIn(ExperimentalObjCName::class) | ||
@file:Suppress( | ||
"ALWAYS_NULL", | ||
"PARAMETER_NAME_CHANGED_ON_OVERRIDE", | ||
"REPEATED_BOUND", | ||
"SENSELESS_COMPARISON", | ||
"UNCHECKED_CAST", | ||
"UNNECESSARY_LATEINIT", | ||
"UNNECESSARY_NOT_NULL_ASSERTION", | ||
"UNREACHABLE_CODE", | ||
"UNUSED_PARAMETER", | ||
"UNUSED_VARIABLE", | ||
"USELESS_CAST", | ||
"VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL", | ||
"VARIABLE_WITH_REDUNDANT_INITIALIZER") | ||
|
||
package javapkg | ||
|
||
import javaemul.lang.* | ||
import kotlin.Int | ||
import kotlin.OptIn | ||
import kotlin.Suppress | ||
import kotlin.experimental.ExperimentalObjCName | ||
import kotlin.jvm.JvmStatic | ||
import kotlin.native.ObjCName | ||
|
||
@ObjCName("J2ktJavapkgPackageWithJavaPrefix", exact = true) | ||
open class PackageWithJavaPrefix { | ||
@ObjCName("J2ktJavapkgPackageWithJavaPrefixCompanion", exact = true) | ||
companion object { | ||
@ObjCName("VALUE_") | ||
const val VALUE: Int = 128 | ||
|
||
@JvmStatic | ||
@ObjCName("value") | ||
fun value(): Int { | ||
return PackageWithJavaPrefix.VALUE | ||
} | ||
} | ||
} |