mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-12 15:51:07 +00:00
Compare commits
13 Commits
rr/faster_
...
jspecify
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16f714c4b8 | ||
|
|
93d3cd4d1f | ||
|
|
6bef864fe3 | ||
|
|
b4112210fe | ||
|
|
0f2f68836c | ||
|
|
6d6805677b | ||
|
|
3d8354b3d5 | ||
|
|
e454a5bfb7 | ||
|
|
dab8ed64fe | ||
|
|
38806ecb1b | ||
|
|
cc7fa10c8a | ||
|
|
d0daace46f | ||
|
|
18a9fb2aac |
@@ -67,6 +67,7 @@ public class JavaValueParameterImpl extends JavaElementImpl<PsiParameter>
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JavaAnnotation> getAnnotations() {
|
||||
// here there is a problem
|
||||
return JavaElementUtil.getRegularAndExternalAnnotations(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.load.java.structure.impl.classFiles
|
||||
|
||||
import org.jetbrains.kotlin.load.java.structure.*
|
||||
import org.jetbrains.kotlin.load.java.structure.impl.classFiles.BinaryJavaAnnotation.Companion.translatePath
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -25,11 +26,11 @@ import org.jetbrains.org.objectweb.asm.*
|
||||
import java.lang.reflect.Array
|
||||
|
||||
internal class AnnotationsAndParameterCollectorMethodVisitor(
|
||||
private val member: BinaryJavaMethodBase,
|
||||
private val context: ClassifierResolutionContext,
|
||||
private val signatureParser: BinaryClassSignatureParser,
|
||||
private val parametersToSkipNumber: Int,
|
||||
private val parametersCountInMethodDesc: Int
|
||||
private val member: BinaryJavaMethodBase,
|
||||
private val context: ClassifierResolutionContext,
|
||||
private val signatureParser: BinaryClassSignatureParser,
|
||||
private val parametersToSkipNumber: Int,
|
||||
private val parametersCountInMethodDesc: Int
|
||||
) : MethodVisitor(ASM_API_VERSION_FOR_CLASS_READING) {
|
||||
private var parameterIndex = 0
|
||||
|
||||
@@ -57,8 +58,8 @@ internal class AnnotationsAndParameterCollectorMethodVisitor(
|
||||
|
||||
override fun visitAnnotation(desc: String, visible: Boolean) =
|
||||
BinaryJavaAnnotation.addAnnotation(
|
||||
member.annotations as MutableCollection<JavaAnnotation>,
|
||||
desc, context, signatureParser
|
||||
member.annotations as MutableCollection<JavaAnnotation>,
|
||||
desc, context, signatureParser
|
||||
)
|
||||
|
||||
@Suppress("NOTHING_TO_OVERRIDE")
|
||||
@@ -77,15 +78,75 @@ internal class AnnotationsAndParameterCollectorMethodVisitor(
|
||||
if (index < 0) return null
|
||||
|
||||
val annotations =
|
||||
member.valueParameters[index].annotations as MutableCollection<JavaAnnotation>?
|
||||
member.valueParameters[index].annotations as MutableCollection<JavaAnnotation>?
|
||||
?: return null
|
||||
|
||||
return BinaryJavaAnnotation.addAnnotation(annotations, desc, context, signatureParser)
|
||||
}
|
||||
|
||||
override fun visitTypeAnnotation(typeRef: Int, typePath: TypePath?, desc: String, visible: Boolean): AnnotationVisitor? {
|
||||
// TODO: support annotations on type arguments
|
||||
if (typePath != null) return null
|
||||
if (typePath != null) {
|
||||
val typeReference = TypeReference(typeRef)
|
||||
val translatedPath = translatePath(typePath)
|
||||
|
||||
when (typeReference.sort) {
|
||||
TypeReference.METHOD_RETURN -> {
|
||||
var baseType = member.safeAs<BinaryJavaMethod>()?.returnType ?: return null
|
||||
|
||||
for (element in translatedPath) {
|
||||
when (element.first) {
|
||||
PathElementType.TYPE_ARGUMENT -> {
|
||||
if (baseType is JavaClassifierType) {
|
||||
baseType = baseType.typeArguments[element.second!!]!!
|
||||
}
|
||||
}
|
||||
PathElementType.WILDCARD_BOUND -> {
|
||||
if (baseType is JavaWildcardType) {
|
||||
baseType = baseType.bound!!
|
||||
}
|
||||
}
|
||||
PathElementType.ARRAY_ELEMENT -> {
|
||||
if (baseType is JavaArrayType) {
|
||||
baseType = baseType.componentType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BinaryJavaAnnotation.addTypeAnnotation(baseType, desc, context, signatureParser)
|
||||
}
|
||||
|
||||
TypeReference.METHOD_FORMAL_PARAMETER -> {
|
||||
var baseType = member.valueParameters[typeReference.formalParameterIndex].type
|
||||
|
||||
for (element in translatedPath) {
|
||||
when (element.first) {
|
||||
PathElementType.TYPE_ARGUMENT -> {
|
||||
if (baseType is JavaClassifierType) {
|
||||
baseType = baseType.typeArguments[element.second!!]!!
|
||||
}
|
||||
}
|
||||
PathElementType.WILDCARD_BOUND -> {
|
||||
if (baseType is JavaWildcardType) {
|
||||
baseType = baseType.bound!!
|
||||
}
|
||||
}
|
||||
PathElementType.ARRAY_ELEMENT -> {
|
||||
if (baseType is JavaArrayType) {
|
||||
baseType = baseType.componentType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BinaryJavaAnnotation.addTypeAnnotation(
|
||||
baseType,
|
||||
desc, context, signatureParser
|
||||
)
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
val typeReference = TypeReference(typeRef)
|
||||
|
||||
@@ -94,29 +155,105 @@ internal class AnnotationsAndParameterCollectorMethodVisitor(
|
||||
BinaryJavaAnnotation.addTypeAnnotation(it, desc, context, signatureParser)
|
||||
}
|
||||
|
||||
TypeReference.METHOD_TYPE_PARAMETER -> {
|
||||
BinaryJavaAnnotation.addTypeAnnotation(
|
||||
member.typeParameters[typeReference.typeParameterIndex],
|
||||
desc, context, signatureParser
|
||||
)
|
||||
}
|
||||
|
||||
TypeReference.METHOD_FORMAL_PARAMETER ->
|
||||
BinaryJavaAnnotation.addTypeAnnotation(
|
||||
member.valueParameters[typeReference.formalParameterIndex].type,
|
||||
desc, context, signatureParser
|
||||
)
|
||||
BinaryJavaAnnotation.addTypeAnnotation(
|
||||
member.valueParameters[typeReference.formalParameterIndex].type,
|
||||
desc, context, signatureParser
|
||||
)
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
enum class PathElementType { ARRAY_ELEMENT, WILDCARD_BOUND, ENCLOSING_CLASS, TYPE_ARGUMENT }
|
||||
|
||||
// private fun translatePath(path: TypePath?): ByteArray? {
|
||||
// var typeText: String = myTypeInfo.text
|
||||
// var arrayLevel: Int = myTypeInfo.arrayCount + if (myTypeInfo.isEllipsis) 1 else 0
|
||||
// var qualifiedName = PsiNameHelper.getQualifiedClassName(typeText, false)
|
||||
// var depth: Int = myFirstPassData.getInnerDepth(qualifiedName)
|
||||
// var atWildcard = false
|
||||
// if (path == null) {
|
||||
// if (depth == 0 || arrayLevel > 0) {
|
||||
// return ArrayUtil.EMPTY_BYTE_ARRAY
|
||||
// }
|
||||
// val result = ByteArray(depth)
|
||||
// Arrays.fill(result, TypeAnnotationContainer.Collector.ENCLOSING_CLASS)
|
||||
// return result
|
||||
// }
|
||||
// val result = ByteArrayOutputStream()
|
||||
// val length = path.length
|
||||
// for (i in 0 until length) {
|
||||
// val step = path.getStep(i).toByte()
|
||||
// when (step) {
|
||||
// TypePath.INNER_TYPE -> {
|
||||
// if (depth == 0) return null
|
||||
// depth--
|
||||
// }
|
||||
// TypePath.ARRAY_ELEMENT -> {
|
||||
// if (arrayLevel <= 0 || atWildcard) return null
|
||||
// arrayLevel--
|
||||
// result.write(TypeAnnotationContainer.Collector.ARRAY_ELEMENT)
|
||||
// }
|
||||
// TypePath.WILDCARD_BOUND -> {
|
||||
// if (!atWildcard) return null
|
||||
// atWildcard = false
|
||||
// result.write(TypeAnnotationContainer.Collector.WILDCARD_BOUND)
|
||||
// }
|
||||
// TypePath.TYPE_ARGUMENT -> {
|
||||
// if (atWildcard || arrayLevel > 0) return null
|
||||
// while (depth-- > 0) {
|
||||
// result.write(TypeAnnotationContainer.Collector.ENCLOSING_CLASS)
|
||||
// typeText = PsiNameHelper.getOuterClassReference(typeText)
|
||||
// }
|
||||
// val argumentIndex = path.getStepArgument(i)
|
||||
// val arguments = PsiNameHelper.getClassParametersText(typeText)
|
||||
// if (argumentIndex >= arguments.size) return null
|
||||
// val argument = TypeInfo.fromString(arguments[argumentIndex], false)
|
||||
// arrayLevel = argument.arrayCount.toInt()
|
||||
// typeText = argument.text
|
||||
// if (typeText.startsWith("? extends ")) {
|
||||
// typeText = typeText.substring("? extends ".length)
|
||||
// atWildcard = true
|
||||
// } else if (typeText.startsWith("? super ")) {
|
||||
// typeText = typeText.substring("? super ".length)
|
||||
// atWildcard = true
|
||||
// }
|
||||
// qualifiedName = PsiNameHelper.getQualifiedClassName(typeText, false)
|
||||
// depth = myFirstPassData.getInnerDepth(qualifiedName)
|
||||
// result.write(TypeAnnotationContainer.Collector.TYPE_ARGUMENT)
|
||||
// result.write(argumentIndex)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (!atWildcard && arrayLevel == 0) {
|
||||
// while (depth-- > 0) {
|
||||
// result.write(TypeAnnotationContainer.Collector.ENCLOSING_CLASS)
|
||||
// }
|
||||
// }
|
||||
// return result.toByteArray()
|
||||
// }
|
||||
}
|
||||
|
||||
class BinaryJavaAnnotation private constructor(
|
||||
desc: String,
|
||||
private val context: ClassifierResolutionContext,
|
||||
override val arguments: Collection<JavaAnnotationArgument>
|
||||
desc: String,
|
||||
private val context: ClassifierResolutionContext,
|
||||
override val arguments: Collection<JavaAnnotationArgument>
|
||||
) : JavaAnnotation {
|
||||
|
||||
companion object {
|
||||
|
||||
fun createAnnotationAndVisitor(
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
): Pair<JavaAnnotation, AnnotationVisitor> {
|
||||
val arguments = mutableListOf<JavaAnnotationArgument>()
|
||||
val annotation = BinaryJavaAnnotation(desc, context, arguments)
|
||||
@@ -125,10 +262,10 @@ class BinaryJavaAnnotation private constructor(
|
||||
}
|
||||
|
||||
fun addAnnotation(
|
||||
annotations: MutableCollection<JavaAnnotation>,
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
annotations: MutableCollection<JavaAnnotation>,
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
): AnnotationVisitor {
|
||||
val (javaAnnotation, annotationVisitor) = createAnnotationAndVisitor(desc, context, signatureParser)
|
||||
annotations.add(javaAnnotation)
|
||||
@@ -137,18 +274,61 @@ class BinaryJavaAnnotation private constructor(
|
||||
}
|
||||
|
||||
fun addTypeAnnotation(
|
||||
type: JavaType,
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
type: JavaType,
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
): AnnotationVisitor? {
|
||||
type as? PlainJavaClassifierType ?: return null
|
||||
return when (type) {
|
||||
is PlainJavaClassifierType -> {
|
||||
val (javaAnnotation, annotationVisitor) = createAnnotationAndVisitor(desc, context, signatureParser)
|
||||
type.addAnnotation(javaAnnotation)
|
||||
annotationVisitor
|
||||
}
|
||||
is PlainJavaArrayType -> {
|
||||
val (javaAnnotation, annotationVisitor) = createAnnotationAndVisitor(desc, context, signatureParser)
|
||||
type.addAnnotation(javaAnnotation)
|
||||
annotationVisitor
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun addTypeAnnotation(
|
||||
type: JavaTypeParameter,
|
||||
desc: String,
|
||||
context: ClassifierResolutionContext,
|
||||
signatureParser: BinaryClassSignatureParser
|
||||
): AnnotationVisitor? {
|
||||
if (type !is BinaryJavaTypeParameter) return null
|
||||
|
||||
val (javaAnnotation, annotationVisitor) = createAnnotationAndVisitor(desc, context, signatureParser)
|
||||
type.addAnnotation(javaAnnotation)
|
||||
|
||||
return annotationVisitor
|
||||
}
|
||||
|
||||
internal fun translatePath(path: TypePath): List<Pair<AnnotationsAndParameterCollectorMethodVisitor.PathElementType, Int?>> {
|
||||
val length = path.length
|
||||
val list = mutableListOf<Pair<AnnotationsAndParameterCollectorMethodVisitor.PathElementType, Int?>>()
|
||||
for (i in 0 until length) {
|
||||
when (path.getStep(i)) {
|
||||
TypePath.INNER_TYPE -> {
|
||||
continue
|
||||
}
|
||||
TypePath.ARRAY_ELEMENT -> {
|
||||
list.add(AnnotationsAndParameterCollectorMethodVisitor.PathElementType.ARRAY_ELEMENT to null)
|
||||
}
|
||||
TypePath.WILDCARD_BOUND -> {
|
||||
list.add(AnnotationsAndParameterCollectorMethodVisitor.PathElementType.WILDCARD_BOUND to null)
|
||||
}
|
||||
TypePath.TYPE_ARGUMENT -> {
|
||||
list.add(AnnotationsAndParameterCollectorMethodVisitor.PathElementType.TYPE_ARGUMENT to path.getStepArgument(i))
|
||||
}
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
}
|
||||
|
||||
private val classifierResolutionResult by lazy(LazyThreadSafetyMode.NONE) {
|
||||
@@ -224,37 +404,37 @@ abstract class PlainJavaAnnotationArgument(name: String?) : JavaAnnotationArgume
|
||||
}
|
||||
|
||||
class PlainJavaLiteralAnnotationArgument(
|
||||
name: String?,
|
||||
override val value: Any?
|
||||
name: String?,
|
||||
override val value: Any?
|
||||
) : PlainJavaAnnotationArgument(name), JavaLiteralAnnotationArgument
|
||||
|
||||
class PlainJavaClassObjectAnnotationArgument(
|
||||
name: String?,
|
||||
private val type: Type,
|
||||
private val signatureParser: BinaryClassSignatureParser,
|
||||
private val context: ClassifierResolutionContext
|
||||
name: String?,
|
||||
private val type: Type,
|
||||
private val signatureParser: BinaryClassSignatureParser,
|
||||
private val context: ClassifierResolutionContext
|
||||
) : PlainJavaAnnotationArgument(name), JavaClassObjectAnnotationArgument {
|
||||
override fun getReferencedType() = signatureParser.mapAsmType(type, context)
|
||||
}
|
||||
|
||||
class PlainJavaArrayAnnotationArgument(
|
||||
name: String?,
|
||||
private val elements: List<JavaAnnotationArgument>
|
||||
name: String?,
|
||||
private val elements: List<JavaAnnotationArgument>
|
||||
) : PlainJavaAnnotationArgument(name), JavaArrayAnnotationArgument {
|
||||
override fun getElements(): List<JavaAnnotationArgument> = elements
|
||||
}
|
||||
|
||||
class PlainJavaAnnotationAsAnnotationArgument(
|
||||
name: String?,
|
||||
private val annotation: JavaAnnotation
|
||||
name: String?,
|
||||
private val annotation: JavaAnnotation
|
||||
) : PlainJavaAnnotationArgument(name), JavaAnnotationAsAnnotationArgument {
|
||||
override fun getAnnotation() = annotation
|
||||
}
|
||||
|
||||
class PlainJavaEnumValueAnnotationArgument(
|
||||
name: String?,
|
||||
override val enumClassId: ClassId,
|
||||
entryName: String
|
||||
name: String?,
|
||||
override val enumClassId: ClassId,
|
||||
entryName: String
|
||||
) : PlainJavaAnnotationArgument(name), JavaEnumValueAnnotationArgument {
|
||||
override val entryName = Name.identifier(entryName)
|
||||
}
|
||||
|
||||
@@ -67,6 +67,49 @@ class BinaryJavaClass(
|
||||
|
||||
override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false
|
||||
|
||||
override fun visitTypeAnnotation(typeRef: Int, typePath: TypePath?, descriptor: String?, visible: Boolean): AnnotationVisitor? {
|
||||
val typeReference = TypeReference(typeRef)
|
||||
if (descriptor == null)
|
||||
return null
|
||||
|
||||
return when (typeReference.sort) {
|
||||
TypeReference.CLASS_TYPE_PARAMETER -> {
|
||||
BinaryJavaAnnotation.addTypeAnnotation(
|
||||
typeParameters[typeReference.typeParameterIndex],
|
||||
descriptor, context, signatureParser
|
||||
)
|
||||
}
|
||||
TypeReference.CLASS_TYPE_PARAMETER_BOUND -> {
|
||||
val isThereImplicitObjectUpperBound =
|
||||
typeParameters[typeReference.typeParameterIndex].upperBounds.none { it.classifierQualifiedName == "java.lang.Object" } &&
|
||||
typeParameters[typeReference.typeParameterIndex].upperBounds.none {
|
||||
(it.classifier as? BinaryJavaClass)?.constructors?.size != 0
|
||||
}
|
||||
val typeParameterBoundIndex =
|
||||
if (isThereImplicitObjectUpperBound) typeReference.typeParameterBoundIndex - 1 else typeReference.typeParameterBoundIndex
|
||||
val bound = typeParameters[typeReference.typeParameterIndex].upperBounds.toList()[typeParameterBoundIndex]
|
||||
|
||||
if (typePath == null) {
|
||||
BinaryJavaAnnotation.addTypeAnnotation(bound, descriptor, context, signatureParser)
|
||||
} else {
|
||||
val translatedPath = BinaryJavaAnnotation.translatePath(typePath)
|
||||
var baseType = bound
|
||||
|
||||
for (element in translatedPath) {
|
||||
when (element.first) {
|
||||
AnnotationsAndParameterCollectorMethodVisitor.PathElementType.TYPE_ARGUMENT -> {
|
||||
baseType = (baseType.typeArguments[element.second!!] as JavaClassifierType?)!!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BinaryJavaAnnotation.addTypeAnnotation(baseType, descriptor, context, signatureParser)
|
||||
}
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitEnd() {
|
||||
methods.trimToSize()
|
||||
fields.trimToSize()
|
||||
|
||||
@@ -42,9 +42,18 @@ class BinaryJavaTypeParameter(
|
||||
override val name: Name,
|
||||
override val upperBounds: Collection<JavaClassifierType>
|
||||
) : JavaTypeParameter {
|
||||
// TODO: support annotations on type parameters
|
||||
override val annotations get() = emptyList<JavaAnnotation>()
|
||||
override fun findAnnotation(fqName: FqName) = null
|
||||
override val annotations get() = _annotations
|
||||
override fun findAnnotation(fqName: FqName) = annotations.find { it.classId?.asSingleFqName() == fqName }
|
||||
|
||||
private var _annotations = emptyList<JavaAnnotation>()
|
||||
|
||||
internal fun addAnnotation(annotation: JavaAnnotation) {
|
||||
if (_annotations.isEmpty()) {
|
||||
_annotations = SmartList()
|
||||
}
|
||||
|
||||
(_annotations as MutableList).add(annotation)
|
||||
}
|
||||
|
||||
override val isDeprecatedInJavaDoc get() = false
|
||||
}
|
||||
|
||||
@@ -24,14 +24,29 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
// They are only used for java class files, but potentially may be used in other cases
|
||||
// It would be better to call them like JavaSomeTypeImpl, but these names are already occupied by the PSI based types
|
||||
internal class PlainJavaArrayType(override val componentType: JavaType) : JavaArrayType
|
||||
internal class PlainJavaArrayType(override val componentType: JavaType) : JavaArrayType {
|
||||
private var _annotations = emptyList<JavaAnnotation>()
|
||||
override val annotations get() = _annotations
|
||||
|
||||
override fun findAnnotation(fqName: FqName) = annotations.find { it.classId?.asSingleFqName() == fqName }
|
||||
override val isDeprecatedInJavaDoc = false
|
||||
|
||||
internal fun addAnnotation(annotation: JavaAnnotation) {
|
||||
if (_annotations.isEmpty()) {
|
||||
_annotations = SmartList()
|
||||
}
|
||||
|
||||
(_annotations as MutableList).add(annotation)
|
||||
}
|
||||
}
|
||||
|
||||
internal class PlainJavaWildcardType(override val bound: JavaType?, override val isExtends: Boolean) : JavaWildcardType
|
||||
internal class PlainJavaPrimitiveType(override val type: PrimitiveType?) : JavaPrimitiveType
|
||||
|
||||
internal class PlainJavaClassifierType(
|
||||
// calculation of classifier and canonicalText
|
||||
classifierComputation: () -> ClassifierResolutionContext.Result,
|
||||
override val typeArguments: List<JavaType>
|
||||
// calculation of classifier and canonicalText
|
||||
classifierComputation: () -> ClassifierResolutionContext.Result,
|
||||
override val typeArguments: List<JavaType>
|
||||
) : JavaClassifierType {
|
||||
private val classifierResolverResult by lazy(LazyThreadSafetyMode.NONE, classifierComputation)
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@ import org.jspecify.annotations.*;
|
||||
|
||||
@DefaultNonNull
|
||||
public class AnnotatedBoundsOfWildcard {
|
||||
public void superAsIs(Test<? super @NullnessUnspecified Base, ? super @NullnessUnspecified Base, ? super @NullnessUnspecified Base> a) {}
|
||||
public void superAsIs(Test<? super Base, ? super @Nullable Base, ? super @NullnessUnspecified Base> a) {}
|
||||
public void superNotNull(Test<? super Base, ? super Base, ? super Base> a) {}
|
||||
public void superNullable(Test<? super @Nullable Base, ? super @Nullable Base, ? super @Nullable Base> a) {}
|
||||
|
||||
public void extendsAsIs(Test<? extends @NullnessUnspecified Base, ? extends @NullnessUnspecified Base, ? extends @NullnessUnspecified Base> a) {}
|
||||
public void extendsAsIs(Test<? extends Base, ? extends @Nullable Base, ? extends @NullnessUnspecified Base> a) {}
|
||||
public void extendsNotNull(Test<? extends Base, ? extends Base, ? extends Base> a) {}
|
||||
public void extendsNullable(Test<? extends @Nullable Base, ? extends @Nullable Base, ? extends @Nullable Base> a) {}
|
||||
|
||||
public void noBounds(Test<@NullnessUnspecified ?, @NullnessUnspecified ?, @NullnessUnspecified ?> a) {}
|
||||
public void noBounds(Test<? extends @NullnessUnspecified Object, ? extends @NullnessUnspecified Object, ? extends @NullnessUnspecified Object> a) {}
|
||||
}
|
||||
|
||||
class Base {}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedInnerOfNonParameterized {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
class Nested {
|
||||
class DoublyNested {}
|
||||
}
|
||||
|
||||
@Nullable Nested x4;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable AnnotatedInnerOfNonParameterized.Nested x5;
|
||||
|
||||
AnnotatedInnerOfNonParameterized.@Nullable Nested x6;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable AnnotatedInnerOfNonParameterized.Nested.DoublyNested x7;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
AnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested x8;
|
||||
|
||||
AnnotatedInnerOfNonParameterized.Nested.@Nullable DoublyNested x9;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<@Nullable AnnotatedInnerOfNonParameterized.Nested.DoublyNested> l1;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<AnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested> l2;
|
||||
|
||||
Lib<AnnotatedInnerOfNonParameterized.Nested.DoublyNested> l3;
|
||||
|
||||
void takeNotNull(Object o) { }
|
||||
void takeLibNotNull(Lib<Object> l) { }
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(AnnotatedInnerOfNonParameterized o) {
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x4);
|
||||
o.takeNotNull(o.x5);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x6);
|
||||
o.takeNotNull(o.x7);
|
||||
o.takeNotNull(o.x8);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x9);
|
||||
|
||||
o.takeLibNotNull(o.l1);
|
||||
o.takeLibNotNull(o.l2);
|
||||
o.takeLibNotNull(o.l3);
|
||||
}
|
||||
}
|
||||
71
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedInnerOfParameterized.java
vendored
Normal file
71
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedInnerOfParameterized.java
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedInnerOfParameterized<T> {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
class Nested {
|
||||
class DoublyNested {}
|
||||
}
|
||||
|
||||
@Nullable Nested x4;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable AnnotatedInnerOfParameterized<?>.Nested x5;
|
||||
|
||||
AnnotatedInnerOfParameterized<?>.@Nullable Nested x6;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable AnnotatedInnerOfParameterized<?>.Nested.DoublyNested x7;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
AnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested x8;
|
||||
|
||||
AnnotatedInnerOfParameterized<?>.Nested.@Nullable DoublyNested x9;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<@Nullable AnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l1;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<AnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested> l2;
|
||||
|
||||
Lib<AnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l3;
|
||||
|
||||
void takeNotNull(Object o) { }
|
||||
void takeLibNotNull(Lib<Object> l) { }
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(AnnotatedInnerOfParameterized<?> o) {
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x4);
|
||||
o.takeNotNull(o.x5);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x6);
|
||||
o.takeNotNull(o.x7);
|
||||
o.takeNotNull(o.x8);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeNotNull(o.x9);
|
||||
|
||||
o.takeLibNotNull(o.l1);
|
||||
o.takeLibNotNull(o.l2);
|
||||
o.takeLibNotNull(o.l3);
|
||||
}
|
||||
}
|
||||
42
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedTypeParameter.java
vendored
Normal file
42
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedTypeParameter.java
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedTypeParameter {
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib1<@Nullable T> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib2<@Nullable T extends Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib3<@Nullable T extends @Nullable Object> {}
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(
|
||||
// jspecify_nullness_mismatch
|
||||
AnnotatedTypeParameter.Lib1<@Nullable String> x1,
|
||||
// jspecify_nullness_mismatch
|
||||
AnnotatedTypeParameter.Lib2<@Nullable String> x2,
|
||||
AnnotatedTypeParameter.Lib3<@Nullable String> x3
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
43
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedTypeParameterUnspec.java
vendored
Normal file
43
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedTypeParameterUnspec.java
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedTypeParameterUnspec {
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib1<@NullnessUnspecified T> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib2<@NullnessUnspecified T extends Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib3<@NullnessUnspecified T extends @Nullable Object> {}
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(
|
||||
// jspecify_nullness_mismatch
|
||||
AnnotatedTypeParameterUnspec.Lib1<@Nullable String> x1,
|
||||
// jspecify_nullness_mismatch
|
||||
AnnotatedTypeParameterUnspec.Lib2<@Nullable String> x2,
|
||||
AnnotatedTypeParameterUnspec.Lib3<@Nullable String> x3
|
||||
) {
|
||||
|
||||
}
|
||||
}
|
||||
54
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedWildcard.java
vendored
Normal file
54
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedWildcard.java
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedWildcard {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ?> x1;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? extends Object> x2;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? super Object> x3;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? extends @Nullable Object> x4;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? super @Nullable Object> x5;
|
||||
|
||||
void takeLibExtendsNotNull(Lib<? extends Object> l) { }
|
||||
|
||||
void takeLibSuperNullable(Lib<? super @Nullable Object> l) { }
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(AnnotatedWildcard o) {
|
||||
o.takeLibExtendsNotNull(o.x1);
|
||||
o.takeLibExtendsNotNull(o.x2);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeLibSuperNullable(o.x3);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeLibExtendsNotNull(o.x4);
|
||||
o.takeLibSuperNullable(o.x5);
|
||||
}
|
||||
}
|
||||
55
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedWildcardUnspec.java
vendored
Normal file
55
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/AnnotatedWildcardUnspec.java
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class AnnotatedWildcardUnspec {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ?> x1;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? extends Object> x2;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? super Object> x3;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? extends @Nullable Object> x4;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? super @Nullable Object> x5;
|
||||
|
||||
void takeLibExtendsNotNull(Lib<? extends Object> l) { }
|
||||
|
||||
void takeLibSuperNullable(Lib<? super @Nullable Object> l) { }
|
||||
}
|
||||
|
||||
static class Checker {
|
||||
void main(AnnotatedWildcardUnspec o) {
|
||||
o.takeLibExtendsNotNull(o.x1);
|
||||
o.takeLibExtendsNotNull(o.x2);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeLibSuperNullable(o.x3);
|
||||
// jspecify_nullness_mismatch
|
||||
o.takeLibExtendsNotNull(o.x4);
|
||||
o.takeLibSuperNullable(o.x5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class AugmentedInferenceAgreesWithBaseInference {
|
||||
void x(Foo<Object> a, Foo<@Nullable Object> b) {
|
||||
// List of possibly heterogeneous Foo types.
|
||||
List<Foo<?>> l1 = makeList(a, b);
|
||||
|
||||
/*
|
||||
* List of some unspecified homogeneous Foo type. There is such a type under plain Java (since
|
||||
* the base type for both is Foo<Object>) but not under JSpecify (since one is Foo<Object> and
|
||||
* the other is Foo<@Nullable Object>).
|
||||
*
|
||||
* Notice that `makeList(a, b)` is fine "in a vacuum" even under JSpecify (as shown above). Only
|
||||
* here, where the type of the expression is forced to conform to the target type, is there a
|
||||
* problem.
|
||||
*/
|
||||
// jspecify_nullness_mismatch
|
||||
List<? extends Foo<?>> l2 = makeList(a, b);
|
||||
}
|
||||
|
||||
abstract <T extends @Nullable Object> List<T> makeList(T a, T b);
|
||||
|
||||
interface Foo<T extends @Nullable Object> {}
|
||||
|
||||
interface List<T> {}
|
||||
}
|
||||
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/CaptureConversionForSubtyping.java
vendored
Normal file
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/CaptureConversionForSubtyping.java
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class CaptureConversionForSubtyping {
|
||||
interface Supplier<T extends @Nullable Object, U extends T> {
|
||||
U get();
|
||||
}
|
||||
|
||||
Object x(Supplier<? extends Object, ?> bar) {
|
||||
return bar.get();
|
||||
}
|
||||
}
|
||||
68
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ClassToObject.java
vendored
Normal file
68
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ClassToObject.java
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ClassToObject {
|
||||
Object x0(ClassToObject x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
Object x1(@NullnessUnspecified ClassToObject x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Object x2(@Nullable ClassToObject x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x3(ClassToObject x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x4(@NullnessUnspecified ClassToObject x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x5(@Nullable ClassToObject x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x6(ClassToObject x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x7(@NullnessUnspecified ClassToObject x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x8(@Nullable ClassToObject x) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
70
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ClassToSelf.java
vendored
Normal file
70
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ClassToSelf.java
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ClassToSelf {
|
||||
Lib x0(Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib x1(@NullnessUnspecified Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib x2(@Nullable Lib x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x3(Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x4(@NullnessUnspecified Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x5(@Nullable Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x6(Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x7(@NullnessUnspecified Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x8(@Nullable Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
267
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ComplexParametric.java
vendored
Normal file
267
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ComplexParametric.java
vendored
Normal file
@@ -0,0 +1,267 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ComplexParametric {
|
||||
interface SuperSuper<T extends @Nullable Object> {
|
||||
Lib<T> t();
|
||||
|
||||
Lib<@NullnessUnspecified T> tUnspec();
|
||||
|
||||
Lib<@Nullable T> tUnionNull();
|
||||
|
||||
void checkT(Lib<T> lib);
|
||||
|
||||
void checkTUnspec(Lib<@NullnessUnspecified T> lib);
|
||||
|
||||
void checkTUnionNull(Lib<@Nullable T> lib);
|
||||
|
||||
// And some method that do not use T:
|
||||
|
||||
void checkNeverNull(Lib<? extends Object> lib);
|
||||
|
||||
<U> void checkUnspecNull(Lib<@NullnessUnspecified U> lib);
|
||||
}
|
||||
|
||||
interface SuperNeverNever<T extends Object & Foo> extends SuperSuper<T> {
|
||||
default void x() {
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface SuperNeverUnspec<T extends Object & @NullnessUnspecified Foo> extends SuperSuper<T> {
|
||||
default void x() {
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface SuperNeverUnionNull<T extends Object & @Nullable Foo> extends SuperSuper<T> {
|
||||
default void x() {
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface SuperUnspecNever<T extends @NullnessUnspecified Object & Foo> extends SuperSuper<T> {
|
||||
default void x() {
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface SuperUnspecUnspec<T extends @NullnessUnspecified Object & @NullnessUnspecified Foo>
|
||||
extends SuperSuper<T> {
|
||||
// TODO(cpovirk): Add method calls like in the other classes.
|
||||
}
|
||||
|
||||
interface SuperUnspecUnionNull<T extends @NullnessUnspecified Object & @Nullable Foo>
|
||||
extends SuperSuper<T> {
|
||||
// TODO(cpovirk): Add method calls like in the other classes.
|
||||
}
|
||||
|
||||
interface SuperUnionNullNever<T extends @Nullable Object & Foo> extends SuperSuper<T> {
|
||||
default void x() {
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface SuperUnionNullUnspec<T extends @Nullable Object & @NullnessUnspecified Foo>
|
||||
extends SuperSuper<T> {
|
||||
// TODO(cpovirk): Add method calls like in the other classes.
|
||||
}
|
||||
|
||||
interface SuperUnionNullUnionNull<T extends @Nullable Object & @Nullable Foo>
|
||||
extends SuperSuper<T> {
|
||||
default void x() {
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkUnspecNull(t());
|
||||
checkT(t());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(t());
|
||||
// jspecify_nullness_mismatch
|
||||
checkTUnionNull(t());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkUnspecNull(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkT(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnspec());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnionNull(tUnspec());
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
checkNeverNull(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
this.<T>checkUnspecNull(tUnionNull());
|
||||
// jspecify_nullness_mismatch
|
||||
checkT(tUnionNull());
|
||||
// jspecify_nullness_not_enough_information
|
||||
checkTUnspec(tUnionNull());
|
||||
checkTUnionNull(tUnionNull());
|
||||
}
|
||||
}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
}
|
||||
27
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ConflictingAnnotations.java
vendored
Normal file
27
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ConflictingAnnotations.java
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ConflictingAnnotations {
|
||||
// jspecify_conflicting_annotations
|
||||
@Nullable @NullnessUnspecified Object x1;
|
||||
// jspecify_conflicting_annotations
|
||||
@NullnessUnspecified @Nullable Object x2;
|
||||
}
|
||||
48
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/Constants.java
vendored
Normal file
48
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/Constants.java
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
|
||||
class Constants {
|
||||
@DefaultNonNull
|
||||
class User {
|
||||
Object x0() {
|
||||
return "";
|
||||
}
|
||||
|
||||
Object x1() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
Object x2() {
|
||||
return 'a';
|
||||
}
|
||||
|
||||
Object x3() {
|
||||
return true;
|
||||
}
|
||||
|
||||
Object x4() {
|
||||
return Color.RED;
|
||||
}
|
||||
}
|
||||
|
||||
enum Color {
|
||||
RED,
|
||||
GREEN,
|
||||
BLUE,
|
||||
}
|
||||
}
|
||||
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentExtends.java
vendored
Normal file
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentExtends.java
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ContainmentExtends {
|
||||
void x() {
|
||||
new Check<Lib<? extends Foo>, Lib<? extends Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
new Check<Lib<? extends Foo>, Lib<? extends @Nullable Foo>>();
|
||||
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends @Nullable Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends @Nullable Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends F> {}
|
||||
}
|
||||
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentSuper.java
vendored
Normal file
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentSuper.java
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ContainmentSuper {
|
||||
void x() {
|
||||
new Check<Lib<? super Foo>, Lib<? super Foo>>();
|
||||
|
||||
new Check<Lib<? super Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super Foo>, Lib<? super @Nullable Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super @Nullable Foo>>();
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super @Nullable Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends F> {}
|
||||
}
|
||||
40
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentSuperVsExtends.java
vendored
Normal file
40
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContainmentSuperVsExtends.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class ContainmentSuperVsExtends {
|
||||
void x() {
|
||||
// jspecify_nullness_mismatch
|
||||
new Check<Lib<? extends Object>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Object>, Lib<? super Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Object>, Lib<? super Foo>>();
|
||||
|
||||
new Check<Lib<?>, Lib<? super Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends F> {}
|
||||
}
|
||||
44
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContravariantReturns.java
vendored
Normal file
44
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/ContravariantReturns.java
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
interface ContravariantReturns {
|
||||
Object makeObject();
|
||||
|
||||
Lib<? extends Object> makeImplicitlyObjectBounded();
|
||||
|
||||
Lib<? extends Object> makeExplicitlyObjectBounded();
|
||||
|
||||
interface Subtype extends ContravariantReturns {
|
||||
@Override
|
||||
@Nullable
|
||||
// jspecify_nullness_mismatch
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
// jspecify_nullness_mismatch
|
||||
Lib<?> makeImplicitlyObjectBounded();
|
||||
|
||||
@Override
|
||||
// jspecify_nullness_mismatch
|
||||
Lib<? extends @Nullable Object> makeExplicitlyObjectBounded();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
}
|
||||
51
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/CovariantReturns.java
vendored
Normal file
51
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/CovariantReturns.java
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
interface CovariantReturns {
|
||||
@Nullable
|
||||
Object makeObject();
|
||||
|
||||
Lib<?> makeImplicitlyObjectBounded();
|
||||
|
||||
Lib<? extends @Nullable Object> makeExplicitlyObjectBounded();
|
||||
|
||||
interface Subtype extends CovariantReturns {
|
||||
@Override
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
Lib<? extends Object> makeImplicitlyObjectBounded();
|
||||
|
||||
@Override
|
||||
Lib<? extends Object> makeExplicitlyObjectBounded();
|
||||
}
|
||||
|
||||
default void go(Subtype s) {
|
||||
checkObject(s.makeObject());
|
||||
checkLibOfObject(s.makeImplicitlyObjectBounded());
|
||||
checkLibOfObject(s.makeExplicitlyObjectBounded());
|
||||
}
|
||||
|
||||
void checkObject(Object o);
|
||||
|
||||
void checkLibOfObject(Lib<? extends Object> o);
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
}
|
||||
40
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceClass.java
vendored
Normal file
40
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceClass.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class DereferenceClass {
|
||||
void x0(Lib x) {
|
||||
x.run();
|
||||
}
|
||||
|
||||
void x1(@NullnessUnspecified Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
x.run();
|
||||
}
|
||||
|
||||
void x2(@Nullable Lib x) {
|
||||
// jspecify_nullness_mismatch
|
||||
x.run();
|
||||
}
|
||||
|
||||
interface Lib {
|
||||
void run();
|
||||
}
|
||||
}
|
||||
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceIntersection.java
vendored
Normal file
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceIntersection.java
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class DereferenceIntersection {
|
||||
void x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x6(UnspecBounded<? extends Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x9(NullableBounded<? extends Lib> x) {
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
void x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x.get()) {
|
||||
}
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
135
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceTypeVariable.java
vendored
Normal file
135
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/DereferenceTypeVariable.java
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class DereferenceTypeVariable<
|
||||
Never1T,
|
||||
ChildOfNever1T extends Never1T,
|
||||
UnspecChildOfNever1T extends @NullnessUnspecified Never1T,
|
||||
NullChildOfNever1T extends @Nullable Never1T,
|
||||
//
|
||||
Never2T extends Object,
|
||||
ChildOfNever2T extends Never2T,
|
||||
UnspecChildOfNever2T extends @NullnessUnspecified Never2T,
|
||||
NullChildOfNever2T extends @Nullable Never2T,
|
||||
//
|
||||
UnspecT extends @NullnessUnspecified Object,
|
||||
ChildOfUnspecT extends UnspecT,
|
||||
UnspecChildOfUnspecT extends @NullnessUnspecified UnspecT,
|
||||
NullChildOfUnspecT extends @Nullable UnspecT,
|
||||
//
|
||||
ParametricT extends @Nullable Object,
|
||||
ChildOfParametricT extends ParametricT,
|
||||
UnspecChildOfParametricT extends @NullnessUnspecified ParametricT,
|
||||
NullChildOfParametricT extends @Nullable ParametricT,
|
||||
//
|
||||
UnusedT> {
|
||||
void x0(Never1T x) {
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x1(ChildOfNever1T x) {
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x2(UnspecChildOfNever1T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x3(NullChildOfNever1T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x4(Never2T x) {
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x5(ChildOfNever2T x) {
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x6(UnspecChildOfNever2T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x7(NullChildOfNever2T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x8(UnspecT x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x9(ChildOfUnspecT x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x10(UnspecChildOfUnspecT x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x11(NullChildOfUnspecT x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x12(ParametricT x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x13(ChildOfParametricT x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x14(UnspecChildOfParametricT x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
|
||||
void x15(NullChildOfParametricT x) {
|
||||
// jspecify_nullness_mismatch
|
||||
synchronized (x) {
|
||||
}
|
||||
}
|
||||
}
|
||||
92
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObject.java
vendored
Normal file
92
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObject.java
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToObject {
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
100
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObjectUnionNull.java
vendored
Normal file
100
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObjectUnionNull.java
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToObjectUnionNull {
|
||||
@Nullable
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObjectUnspec.java
vendored
Normal file
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToObjectUnspec.java
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToObjectUnspec {
|
||||
@NullnessUnspecified
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
92
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOther.java
vendored
Normal file
92
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOther.java
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToOther {
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
100
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOtherUnionNull.java
vendored
Normal file
100
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOtherUnionNull.java
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToOtherUnionNull {
|
||||
@Nullable
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOtherUnspec.java
vendored
Normal file
104
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionToOtherUnspec.java
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class IntersectionToOtherUnspec {
|
||||
@NullnessUnspecified
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnionNullToObject.java
vendored
Normal file
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnionNullToObject.java
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToObject {
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToObjectUnionNull {
|
||||
@Nullable
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToObjectUnspec {
|
||||
@NullnessUnspecified
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnionNullToOther.java
vendored
Normal file
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnionNullToOther.java
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToOther {
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToOtherUnionNull {
|
||||
@Nullable
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnionNullToOtherUnspec {
|
||||
@NullnessUnspecified
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unionNull(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @Nullable T unionNull(T input);
|
||||
}
|
||||
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToObject.java
vendored
Normal file
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToObject.java
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToObject {
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToObjectUnionNull {
|
||||
@Nullable
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
114
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToObjectUnspec.java
vendored
Normal file
114
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToObjectUnspec.java
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToObjectUnspec {
|
||||
@NullnessUnspecified
|
||||
Object x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToOther.java
vendored
Normal file
102
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToOther.java
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToOther {
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToOtherUnionNull {
|
||||
@Nullable
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
114
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToOtherUnspec.java
vendored
Normal file
114
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/IntersectionUnspecToOtherUnspec.java
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
abstract class IntersectionUnspecToOtherUnspec {
|
||||
@NullnessUnspecified
|
||||
Lib x0(ImplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x1(ImplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x2(ImplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x3(ExplicitlyObjectBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x4(ExplicitlyObjectBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x5(ExplicitlyObjectBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x6(UnspecBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x7(UnspecBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x8(UnspecBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x9(NullableBounded<? extends Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x10(NullableBounded<? extends @NullnessUnspecified Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x11(NullableBounded<? extends @Nullable Lib> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return unspec(x.get());
|
||||
}
|
||||
|
||||
interface ImplicitlyObjectBounded<T> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface ExplicitlyObjectBounded<T extends Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface UnspecBounded<T extends @NullnessUnspecified Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface NullableBounded<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
|
||||
abstract <T extends @Nullable Object> @NullnessUnspecified T unspec(T input);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToObject {
|
||||
<T extends Object & Lib> Object x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Object x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Object x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Object x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Object x4(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Object x5(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Object x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Object x7(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Object x8(T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToObjectUnionNull {
|
||||
<T extends Object & Lib> @Nullable Object x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Object x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Object x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Object x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Object x4(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Object x5(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Object x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Object x7(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Object x8(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToObjectUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Object x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Object x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Object x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x4(
|
||||
T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Object x5(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Object x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x7(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Object x8(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
64
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiBoundTypeVariableToOther.java
vendored
Normal file
64
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiBoundTypeVariableToOther.java
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToOther {
|
||||
<T extends Object & Lib> Lib x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Lib x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Lib x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Lib x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Lib x4(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Lib x5(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Lib x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Lib x7(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Lib x8(T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToOtherUnionNull {
|
||||
<T extends Object & Lib> @Nullable Lib x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Lib x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Lib x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Lib x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Lib x4(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Lib x5(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Lib x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Lib x7(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Lib x8(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToOtherUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Lib x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Lib x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Lib x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x4(
|
||||
T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Lib x5(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Lib x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x7(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Lib x8(T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
60
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiBoundTypeVariableToSelf.java
vendored
Normal file
60
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiBoundTypeVariableToSelf.java
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToSelf {
|
||||
<T extends Object & Lib> T x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> T x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> T x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> T x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> T x4(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> T x5(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> T x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> T x7(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> T x8(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToSelfUnionNull {
|
||||
<T extends Object & Lib> @Nullable T x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable T x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable T x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable T x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable T x4(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable T x5(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable T x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable T x7(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable T x8(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableToSelfUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified T x0(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified T x1(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified T x2(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified T x3(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified T x4(
|
||||
T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified T x5(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified T x6(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified T x7(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified T x8(T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToObject {
|
||||
<T extends Object & Lib> Object x0(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Object x1(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Object x2(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Object x3(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Object x4(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Object x5(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Object x6(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Object x7(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Object x8(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToObjectUnionNull {
|
||||
<T extends Object & Lib> @Nullable Object x0(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Object x1(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Object x2(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Object x3(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Object x4(
|
||||
@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Object x5(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Object x6(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Object x7(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Object x8(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToObjectUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Object x0(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x1(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Object x2(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Object x3(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x4(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Object x5(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Object x6(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x7(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Object x8(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToOther {
|
||||
<T extends Object & Lib> Lib x0(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Lib x1(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Lib x2(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Lib x3(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Lib x4(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Lib x5(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Lib x6(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Lib x7(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Lib x8(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToOtherUnionNull {
|
||||
<T extends Object & Lib> @Nullable Lib x0(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Lib x1(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Lib x2(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Lib x3(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Lib x4(
|
||||
@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Lib x5(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Lib x6(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Lib x7(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Lib x8(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToOtherUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Lib x0(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x1(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Lib x2(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Lib x3(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x4(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Lib x5(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Lib x6(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x7(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Lib x8(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToSelf {
|
||||
<T extends Object & Lib> T x0(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> T x1(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> T x2(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> T x3(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> T x4(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> T x5(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> T x6(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> T x7(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> T x8(@Nullable T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToSelfUnionNull {
|
||||
<T extends Object & Lib> @Nullable T x0(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable T x1(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable T x2(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable T x3(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable T x4(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable T x5(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable T x6(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable T x7(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable T x8(@Nullable T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnionNullToSelfUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified T x0(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified T x1(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified T x2(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified T x3(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified T x4(
|
||||
@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified T x5(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified T x6(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified T x7(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified T x8(@Nullable T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToObject {
|
||||
<T extends Object & Lib> Object x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Object x1(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Object x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Object x3(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Object x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Object x5(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Object x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Object x7(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Object x8(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToObjectUnionNull {
|
||||
<T extends Object & Lib> @Nullable Object x0(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Object x1(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Object x2(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Object x3(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Object x4(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Object x5(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Object x6(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Object x7(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Object x8(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToObjectUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Object x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x1(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Object x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Object x3(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Object x5(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Object x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Object x7(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Object x8(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToOther {
|
||||
<T extends Object & Lib> Lib x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> Lib x1(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> Lib x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> Lib x3(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> Lib x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> Lib x5(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> Lib x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> Lib x7(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> Lib x8(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToOtherUnionNull {
|
||||
<T extends Object & Lib> @Nullable Lib x0(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable Lib x1(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable Lib x2(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable Lib x3(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable Lib x4(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable Lib x5(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable Lib x6(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable Lib x7(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable Lib x8(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToOtherUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified Lib x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x1(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified Lib x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified Lib x3(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified Lib x5(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified Lib x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified Lib x7(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified Lib x8(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToSelf {
|
||||
<T extends Object & Lib> T x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> T x1(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> T x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> T x3(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> T x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> T x5(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> T x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> T x7(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> T x8(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToSelfUnionNull {
|
||||
<T extends Object & Lib> @Nullable T x0(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @Nullable T x1(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @Nullable T x2(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @Nullable T x3(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @Nullable T x4(
|
||||
@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @Nullable T x5(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @Nullable T x6(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @Nullable T x7(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @Nullable T x8(@NullnessUnspecified T x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiBoundTypeVariableUnspecToSelfUnspec {
|
||||
<T extends Object & Lib> @NullnessUnspecified T x0(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @NullnessUnspecified Lib> @NullnessUnspecified T x1(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends Object & @Nullable Lib> @NullnessUnspecified T x2(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & Lib> @NullnessUnspecified T x3(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @NullnessUnspecified Lib> @NullnessUnspecified T x4(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @NullnessUnspecified Object & @Nullable Lib> @NullnessUnspecified T x5(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & Lib> @NullnessUnspecified T x6(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @NullnessUnspecified Lib> @NullnessUnspecified T x7(
|
||||
@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
<T extends @Nullable Object & @Nullable Lib> @NullnessUnspecified T x8(@NullnessUnspecified T x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib {}
|
||||
}
|
||||
74
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiplePathsToTypeVariable.java
vendored
Normal file
74
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/MultiplePathsToTypeVariable.java
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class MultiplePathsToTypeVariable {
|
||||
interface TBounded<T, U extends T> {
|
||||
U get();
|
||||
}
|
||||
|
||||
interface TUnspecBounded<T, U extends @NullnessUnspecified T> {
|
||||
U get();
|
||||
}
|
||||
|
||||
interface TUnionNullBounded<T, U extends @Nullable T> {
|
||||
U get();
|
||||
}
|
||||
|
||||
<T> Object x0(TBounded<T, ? extends T> t) {
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x1(TBounded<T, ? extends @NullnessUnspecified T> t) {
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x2(TBounded<T, ? extends @Nullable T> t) {
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x3(TUnspecBounded<T, ? extends T> t) {
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x4(TUnspecBounded<T, ? extends @NullnessUnspecified T> t) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x5(TUnspecBounded<T, ? extends @Nullable T> t) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x6(TUnionNullBounded<T, ? extends T> t) {
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x7(TUnionNullBounded<T, ? extends @NullnessUnspecified T> t) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return t.get();
|
||||
}
|
||||
|
||||
<T> Object x8(TUnionNullBounded<T, ? extends @Nullable T> t) {
|
||||
// jspecify_nullness_mismatch
|
||||
return t.get();
|
||||
}
|
||||
}
|
||||
32
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NonConstantPrimitives.java
vendored
Normal file
32
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NonConstantPrimitives.java
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
|
||||
@DefaultNonNull
|
||||
class NonConstantPrimitives {
|
||||
Object x0(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
Object x1(char c) {
|
||||
return c;
|
||||
}
|
||||
|
||||
Object x2(boolean b) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
class NotNullAwareAnnotatedInnerOfNonParameterized {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
class Nested {
|
||||
class DoublyNested {}
|
||||
}
|
||||
|
||||
@Nullable Nested x4;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable NotNullAwareAnnotatedInnerOfNonParameterized.Nested x5;
|
||||
|
||||
NotNullAwareAnnotatedInnerOfNonParameterized.@Nullable Nested x6;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable NotNullAwareAnnotatedInnerOfNonParameterized.Nested.DoublyNested x7;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
NotNullAwareAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested x8;
|
||||
|
||||
NotNullAwareAnnotatedInnerOfNonParameterized.Nested.@Nullable DoublyNested x9;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<@Nullable NotNullAwareAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l1;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<NotNullAwareAnnotatedInnerOfNonParameterized.@Nullable Nested.DoublyNested> l2;
|
||||
|
||||
Lib<NotNullAwareAnnotatedInnerOfNonParameterized.Nested.DoublyNested> l3;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
class NotNullAwareAnnotatedInnerOfParameterized<T> {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
class Nested {
|
||||
class DoublyNested {}
|
||||
}
|
||||
|
||||
@Nullable Nested x4;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable NotNullAwareAnnotatedInnerOfParameterized<?>.Nested x5;
|
||||
|
||||
NotNullAwareAnnotatedInnerOfParameterized<?>.@Nullable Nested x6;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable NotNullAwareAnnotatedInnerOfParameterized<?>.Nested.DoublyNested x7;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
NotNullAwareAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested x8;
|
||||
|
||||
NotNullAwareAnnotatedInnerOfParameterized<?>.Nested.@Nullable DoublyNested x9;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<@Nullable NotNullAwareAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l1;
|
||||
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
Lib<NotNullAwareAnnotatedInnerOfParameterized<?>.@Nullable Nested.DoublyNested> l2;
|
||||
|
||||
Lib<NotNullAwareAnnotatedInnerOfParameterized<?>.Nested.DoublyNested> l3;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
class NotNullAwareAnnotatedTypeParameter {
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib1<@Nullable T> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib2<@Nullable T extends Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib3<@Nullable T extends @Nullable Object> {}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareAnnotatedTypeParameterUnspec {
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib1<@NullnessUnspecified T> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib2<@NullnessUnspecified T extends Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
interface Lib3<@NullnessUnspecified T extends @Nullable Object> {}
|
||||
}
|
||||
36
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareAnnotatedWildcard.java
vendored
Normal file
36
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareAnnotatedWildcard.java
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
class NotNullAwareAnnotatedWildcard {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ?> x1;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? extends Object> x2;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? super Object> x3;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? extends @Nullable Object> x4;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@Nullable ? super @Nullable Object> x5;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareAnnotatedWildcardUnspec {
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ?> x1;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? extends Object> x2;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? super Object> x3;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? extends @Nullable Object> x4;
|
||||
|
||||
// jspecify_unrecognized_location
|
||||
Lib<@NullnessUnspecified ? super @Nullable Object> x5;
|
||||
}
|
||||
72
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareClassToSelf.java
vendored
Normal file
72
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareClassToSelf.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareClassToSelf {
|
||||
Lib x0(Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib x1(@NullnessUnspecified Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib x2(@Nullable Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x3(Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x4(@NullnessUnspecified Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Lib x5(@Nullable Lib x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x6(Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x7(@NullnessUnspecified Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib x8(@Nullable Lib x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
@DefaultNonNull
|
||||
interface Lib {}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareContainmentExtends {
|
||||
void x() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends Foo>, Lib<? extends Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends Foo>, Lib<? extends @Nullable Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Foo>, Lib<? extends @Nullable Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Foo>, Lib<? extends @Nullable Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends @Nullable F> {}
|
||||
}
|
||||
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareContainmentSuper.java
vendored
Normal file
52
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareContainmentSuper.java
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareContainmentSuper {
|
||||
void x() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super Foo>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super Foo>, Lib<? super @Nullable Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super @NullnessUnspecified Foo>, Lib<? super @Nullable Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super @NullnessUnspecified Foo>>();
|
||||
|
||||
new Check<Lib<? super @Nullable Foo>, Lib<? super @Nullable Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends @Nullable F> {}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareContainmentSuperVsExtends {
|
||||
void x() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends Object>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<? extends @NullnessUnspecified Object>, Lib<? super Foo>>();
|
||||
|
||||
new Check<Lib<? extends @Nullable Object>, Lib<? super Foo>>();
|
||||
|
||||
// jspecify_nullness_not_enough_information
|
||||
new Check<Lib<?>, Lib<? super Foo>>();
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Foo {}
|
||||
|
||||
static class Check<F extends @Nullable Object, A extends @Nullable F> {}
|
||||
}
|
||||
75
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareOverrides.java
vendored
Normal file
75
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareOverrides.java
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareOverrides {
|
||||
interface Super {
|
||||
Object makeObject();
|
||||
|
||||
@NullnessUnspecified
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Nullable
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObject extends Super {
|
||||
@Override
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObjectUnspec extends Super {
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObjectUnionNull extends Super {
|
||||
@Override
|
||||
@Nullable
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
}
|
||||
72
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareTypeVariableBound.java
vendored
Normal file
72
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareTypeVariableBound.java
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareTypeVariableBound {
|
||||
class UnspecBounded1<T> {
|
||||
@DefaultNonNull
|
||||
abstract class Nested {
|
||||
abstract T get();
|
||||
}
|
||||
}
|
||||
|
||||
class UnspecBounded2<T extends Object> {
|
||||
@DefaultNonNull
|
||||
abstract class Nested {
|
||||
abstract T get();
|
||||
}
|
||||
}
|
||||
|
||||
class UnspecBounded3<T extends @NullnessUnspecified Object> {
|
||||
@DefaultNonNull
|
||||
abstract class Nested {
|
||||
abstract T get();
|
||||
}
|
||||
}
|
||||
|
||||
class NullBounded<T extends @Nullable Object> {
|
||||
@DefaultNonNull
|
||||
abstract class Nested {
|
||||
abstract T get();
|
||||
}
|
||||
}
|
||||
|
||||
@DefaultNonNull
|
||||
class Callers {
|
||||
Object x0(UnspecBounded1<?>.Nested x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x0(UnspecBounded2<?>.Nested x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x0(UnspecBounded3<?>.Nested x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x.get();
|
||||
}
|
||||
|
||||
Object x0(NullBounded<?>.Nested x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
62
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareUnboxing.java
vendored
Normal file
62
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareUnboxing.java
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareUnboxing {
|
||||
@DefaultNonNull
|
||||
interface Super {
|
||||
Integer getInteger();
|
||||
|
||||
@NullnessUnspecified
|
||||
Integer getIntegerUnspec();
|
||||
|
||||
@Nullable
|
||||
Integer getIntegerUnionNull();
|
||||
}
|
||||
|
||||
abstract class Sub implements Super {
|
||||
int x0() {
|
||||
return getInteger();
|
||||
}
|
||||
|
||||
int x1() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return getIntegerUnspec();
|
||||
}
|
||||
|
||||
int x2() {
|
||||
// jspecify_nullness_mismatch
|
||||
return getIntegerUnionNull();
|
||||
}
|
||||
|
||||
long x3() {
|
||||
return getInteger();
|
||||
}
|
||||
|
||||
long x4() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return getIntegerUnspec();
|
||||
}
|
||||
|
||||
long x5() {
|
||||
// jspecify_nullness_mismatch
|
||||
return getIntegerUnionNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
87
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareUseOfTypeVariable.java
vendored
Normal file
87
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NotNullAwareUseOfTypeVariable.java
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareUseOfTypeVariable {
|
||||
interface Super<T extends @Nullable Object> {
|
||||
T get();
|
||||
}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObject extends Super<Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObjectUnspec extends Super<@NullnessUnspecified Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObjectUnionNull extends Super<@Nullable Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
class Caller {
|
||||
Object x0(SubObject s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x1(SubObjectUnspec s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x2(SubObjectUnionNull s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x3(Super<Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x4(Super<@NullnessUnspecified Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x5(Super<@Nullable Object> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x6(Super<? extends Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x7(Super<? extends @NullnessUnspecified Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x8(Super<? extends @Nullable Object> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
Object x9(Super<?> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareUseOfTypeVariableAsTypeArgument {
|
||||
@DefaultNonNull
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Super<T extends @Nullable Object> {
|
||||
Lib<T> get();
|
||||
}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObject extends Super<Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObjectUnspec extends Super<@NullnessUnspecified Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
interface SubObjectUnionNull extends Super<@Nullable Object> {}
|
||||
|
||||
@DefaultNonNull
|
||||
class Caller {
|
||||
@Nullable
|
||||
Lib<? extends Object> x0(SubObject s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x1(SubObjectUnspec s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x2(SubObjectUnionNull s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x3(Super<Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x4(Super<@NullnessUnspecified Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x5(Super<@Nullable Object> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x6(Super<? extends Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x7(Super<? extends @NullnessUnspecified Object> s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x8(Super<? extends @Nullable Object> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends Object> x9(Super<?> s) {
|
||||
// jspecify_nullness_mismatch
|
||||
return s.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
class NotNullAwareUseOfWildcardAsTypeArgument {
|
||||
@DefaultNonNull
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
|
||||
interface Super {
|
||||
Lib<?> get();
|
||||
}
|
||||
|
||||
@DefaultNonNull
|
||||
class Caller {
|
||||
@Nullable
|
||||
Lib<? extends Object> x0(Super s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends @NullnessUnspecified Object> x1(Super s) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<? extends @Nullable Object> x2(Super s) {
|
||||
return s.get();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Lib<?> x3(Super s) {
|
||||
return s.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
38
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToClass.java
vendored
Normal file
38
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToClass.java
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class NullLiteralToClass {
|
||||
Object x0() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Object x1() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Object x2() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
123
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToTypeVariable.java
vendored
Normal file
123
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToTypeVariable.java
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class NullLiteralToTypeVariable<
|
||||
Never1T,
|
||||
ChildOfNever1T extends Never1T,
|
||||
UnspecChildOfNever1T extends @NullnessUnspecified Never1T,
|
||||
NullChildOfNever1T extends @Nullable Never1T,
|
||||
//
|
||||
Never2T extends Object,
|
||||
ChildOfNever2T extends Never2T,
|
||||
UnspecChildOfNever2T extends @NullnessUnspecified Never2T,
|
||||
NullChildOfNever2T extends @Nullable Never2T,
|
||||
//
|
||||
UnspecT extends @NullnessUnspecified Object,
|
||||
ChildOfUnspecT extends UnspecT,
|
||||
UnspecChildOfUnspecT extends @NullnessUnspecified UnspecT,
|
||||
NullChildOfUnspecT extends @Nullable UnspecT,
|
||||
//
|
||||
ParametricT extends @Nullable Object,
|
||||
ChildOfParametricT extends ParametricT,
|
||||
UnspecChildOfParametricT extends @NullnessUnspecified ParametricT,
|
||||
NullChildOfParametricT extends @Nullable ParametricT,
|
||||
//
|
||||
UnusedT> {
|
||||
Never1T x0() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
ChildOfNever1T x1() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
UnspecChildOfNever1T x2() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
NullChildOfNever1T x3() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
Never2T x4() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
ChildOfNever2T x5() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
UnspecChildOfNever2T x6() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
NullChildOfNever2T x7() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
UnspecT x8() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
ChildOfUnspecT x9() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
UnspecChildOfUnspecT x10() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
NullChildOfUnspecT x11() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
ParametricT x12() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
ChildOfParametricT x13() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
UnspecChildOfParametricT x14() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
|
||||
NullChildOfParametricT x15() {
|
||||
// jspecify_nullness_mismatch
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class NullLiteralToTypeVariableUnionNull<
|
||||
Never1T,
|
||||
ChildOfNever1T extends Never1T,
|
||||
UnspecChildOfNever1T extends @NullnessUnspecified Never1T,
|
||||
NullChildOfNever1T extends @Nullable Never1T,
|
||||
//
|
||||
Never2T extends Object,
|
||||
ChildOfNever2T extends Never2T,
|
||||
UnspecChildOfNever2T extends @NullnessUnspecified Never2T,
|
||||
NullChildOfNever2T extends @Nullable Never2T,
|
||||
//
|
||||
UnspecT extends @NullnessUnspecified Object,
|
||||
ChildOfUnspecT extends UnspecT,
|
||||
UnspecChildOfUnspecT extends @NullnessUnspecified UnspecT,
|
||||
NullChildOfUnspecT extends @Nullable UnspecT,
|
||||
//
|
||||
ParametricT extends @Nullable Object,
|
||||
ChildOfParametricT extends ParametricT,
|
||||
UnspecChildOfParametricT extends @NullnessUnspecified ParametricT,
|
||||
NullChildOfParametricT extends @Nullable ParametricT,
|
||||
//
|
||||
UnusedT> {
|
||||
@Nullable
|
||||
Never1T x0() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ChildOfNever1T x1() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UnspecChildOfNever1T x2() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
NullChildOfNever1T x3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Never2T x4() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ChildOfNever2T x5() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UnspecChildOfNever2T x6() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
NullChildOfNever2T x7() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UnspecT x8() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ChildOfUnspecT x9() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UnspecChildOfUnspecT x10() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
NullChildOfUnspecT x11() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ParametricT x12() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
ChildOfParametricT x13() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UnspecChildOfParametricT x14() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
NullChildOfParametricT x15() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
139
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToTypeVariableUnspec.java
vendored
Normal file
139
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/NullLiteralToTypeVariableUnspec.java
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class NullLiteralToTypeVariableUnspec<
|
||||
Never1T,
|
||||
ChildOfNever1T extends Never1T,
|
||||
UnspecChildOfNever1T extends @NullnessUnspecified Never1T,
|
||||
NullChildOfNever1T extends @Nullable Never1T,
|
||||
//
|
||||
Never2T extends Object,
|
||||
ChildOfNever2T extends Never2T,
|
||||
UnspecChildOfNever2T extends @NullnessUnspecified Never2T,
|
||||
NullChildOfNever2T extends @Nullable Never2T,
|
||||
//
|
||||
UnspecT extends @NullnessUnspecified Object,
|
||||
ChildOfUnspecT extends UnspecT,
|
||||
UnspecChildOfUnspecT extends @NullnessUnspecified UnspecT,
|
||||
NullChildOfUnspecT extends @Nullable UnspecT,
|
||||
//
|
||||
ParametricT extends @Nullable Object,
|
||||
ChildOfParametricT extends ParametricT,
|
||||
UnspecChildOfParametricT extends @NullnessUnspecified ParametricT,
|
||||
NullChildOfParametricT extends @Nullable ParametricT,
|
||||
//
|
||||
UnusedT> {
|
||||
@NullnessUnspecified
|
||||
Never1T x0() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
ChildOfNever1T x1() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
UnspecChildOfNever1T x2() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
NullChildOfNever1T x3() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
Never2T x4() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
ChildOfNever2T x5() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
UnspecChildOfNever2T x6() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
NullChildOfNever2T x7() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
UnspecT x8() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
ChildOfUnspecT x9() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
UnspecChildOfUnspecT x10() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
NullChildOfUnspecT x11() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
ParametricT x12() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
ChildOfParametricT x13() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
UnspecChildOfParametricT x14() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
|
||||
@NullnessUnspecified
|
||||
NullChildOfParametricT x15() {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -3,27 +3,30 @@ import org.jspecify.annotations.*;
|
||||
@DefaultNonNull
|
||||
public class NullnessUnspecifiedTypeParameter<T> {
|
||||
public void foo(T t) {}
|
||||
|
||||
public void bar(Test s, T t) {} // t should not become not nullable
|
||||
public void bar(Test s, T t) {}
|
||||
}
|
||||
|
||||
class Test {}
|
||||
|
||||
class Use {
|
||||
void main(NullnessUnspecifiedTypeParameter<Object> a1, NullnessUnspecifiedTypeParameter<@Nullable Object> a2, Test x) {
|
||||
// jspecify_nullness_mismatch
|
||||
a1.foo(null);
|
||||
a1.foo(1);
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
a2.foo(null);
|
||||
a2.foo(1);
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
a1.bar(null, null);
|
||||
// jspecify_nullness_mismatch
|
||||
a1.bar(x, null);
|
||||
a1.bar(x, 1);
|
||||
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar(null, null);
|
||||
// jspecify_nullness_mismatch
|
||||
a2.bar(x, null);
|
||||
a2.bar(x, 1);
|
||||
}
|
||||
|
||||
75
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/Overrides.java
vendored
Normal file
75
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/Overrides.java
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class Overrides {
|
||||
interface Super {
|
||||
Object makeObject();
|
||||
|
||||
@NullnessUnspecified
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Nullable
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObject extends Super {
|
||||
@Override
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObjectUnspec extends Super {
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
@NullnessUnspecified
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
|
||||
interface SubObjectUnionNull extends Super {
|
||||
@Override
|
||||
@Nullable
|
||||
// jspecify_nullness_mismatch
|
||||
Object makeObject();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
// jspecify_nullness_not_enough_information
|
||||
Object makeObjectUnspec();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
Object makeObjectUnionNull();
|
||||
}
|
||||
}
|
||||
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/PrimitiveAnnotations.java
vendored
Normal file
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/PrimitiveAnnotations.java
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
@DefaultNonNull
|
||||
class PrimitiveAnnotations {
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable int x1;
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@Nullable int[] x2;
|
||||
|
||||
int x3;
|
||||
int[] x4;
|
||||
}
|
||||
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/PrimitiveAnnotationsUnspec.java
vendored
Normal file
29
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/PrimitiveAnnotationsUnspec.java
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class PrimitiveAnnotationsUnspec {
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@NullnessUnspecified int x1;
|
||||
// jspecify_nullness_intrinsically_not_nullable
|
||||
@NullnessUnspecified int[] x2;
|
||||
|
||||
int x3;
|
||||
int[] x4;
|
||||
}
|
||||
172
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/README.md
vendored
Normal file
172
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/README.md
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
# Sample inputs
|
||||
|
||||
## Disclaimers
|
||||
|
||||
**These sample inputs are an experiment.**
|
||||
|
||||
They use annotations whose names and meanings are not finalized.
|
||||
|
||||
They have not been code reviewed.
|
||||
|
||||
We do not know if this is even the format that we want our sample inputs to be
|
||||
in.
|
||||
|
||||
Whatever our final samples look like, we do **not** expect to present them as
|
||||
"conformance tests" that require any behavior from tools: The goal of our
|
||||
project is to provide one source of nullness information. Tools may use some,
|
||||
all, or none of that information. They may also use information from other
|
||||
sources. Based on the information they have available for any given piece of
|
||||
code, tools always have the option to issue a warning / error / other diagnostic
|
||||
for that code, and they always have the option not to.
|
||||
|
||||
The hope is that samples like these may be useful to those who wish to discuss
|
||||
the spec or implement tools. To that end, we welcome comments on both the format
|
||||
of these files and their content.
|
||||
|
||||
## Directory structure
|
||||
|
||||
See
|
||||
[jspecify: test-data format: Directory structure](https://docs.google.com/document/d/1JVH2p61kReO8bW4AKnbkpybPYlUulVmyNrR1WRIEE_k/edit#bookmark=id.2t1r58i5a03s).
|
||||
TODO(#134): Inline that here if Tagir can sign the CLA and contribute it.
|
||||
|
||||
Additionally:
|
||||
|
||||
Fully qualified class names must be unique across all directories.
|
||||
|
||||
> This permits all files to be compiled in a single tool invocation.
|
||||
|
||||
TODO: Consider requiring that all individual-file samples be in the top-level
|
||||
directory.
|
||||
|
||||
Each file must contain a single top-level class. TODO(#133): Consider relaxing
|
||||
this.
|
||||
|
||||
TODO: Consider requiring a file's path to match its package and class:
|
||||
|
||||
- individual-file samples: `Foo.java` for `Foo`
|
||||
|
||||
- full-directory samples: `sampleFoo/Foo.java` for `Foo`,
|
||||
`sampleFoo/bar/Foo.java` for `bar.Foo`
|
||||
|
||||
- We may need additional accommodations for JPMS support to demonstrate
|
||||
module-level defaulting.
|
||||
|
||||
## Restrictions
|
||||
|
||||
Files must be UTF-8 encoded.
|
||||
|
||||
Files must contain only printable ASCII characters and `\n`.
|
||||
|
||||
Files must be compatible with Java 8. TODO(#131): Decide how to label files that
|
||||
require a higher version so that we can allow them. (But still encourage
|
||||
sticking to Java 8 except for tests that specifically exercise newer features.)
|
||||
|
||||
Files must compile without error using stock javac.
|
||||
|
||||
Files must not depend on any classes other than the JSpecify annotations. This
|
||||
includes the Java platform APIs. Exception: Files may use `java.lang.Object`,
|
||||
but they still must not use its methods.
|
||||
|
||||
> For example, files may use `Object` as a bound, parameter, or return type.
|
||||
|
||||
Files should avoid depending on the presence of absence of "smart" checker
|
||||
features, such as:
|
||||
|
||||
- looking inside the body of a method to determine what parameters it
|
||||
dereferences or what it returns
|
||||
|
||||
- To that end, prefer abstract methods when practical.
|
||||
|
||||
- flow-sensitive typing
|
||||
|
||||
We also encourage writing files that demonstrate individual behaviors in
|
||||
isolation. For example, we encourage writing files to minimize how much they
|
||||
rely on type inference -- except, of course, for any files explicitly intended
|
||||
to demonstrate type inference.
|
||||
|
||||
## What sample inputs demonstrate
|
||||
|
||||
Sample inputs demonstrate 2 cases:
|
||||
|
||||
1. JSpecify annotations are applied in a way that is
|
||||
[structurally illegal](https://docs.google.com/document/d/15NND5nBxMkZ-Us6wz3Pfbt4ODIaWaJ6JDs4w6h9kUaY/edit#heading=h.ib00ltjpj1xa).
|
||||
|
||||
<!-- TODO: Are we happy with the term "illegal?" -->
|
||||
|
||||
2. The second case is more nuanced: Based on JSpecify annotations and rules,
|
||||
the code's types can all be augmented with nullness information. We could
|
||||
then apply normal JLS rules to those types. (For example, the value of a
|
||||
`return` statement must be convertible to the method's return type.) We
|
||||
could adapt those rules to use JSpecify rules for subtyping. Based on that,
|
||||
we could identify type checks that would fail. (For example, `return null`
|
||||
in a method that must return a non-nullable type.)
|
||||
|
||||
<!-- TODO: Update links to point to the markup-format spec and glossary. -->
|
||||
|
||||
## Syntax
|
||||
|
||||
We define a format for Java comments to identify code that demonstrates the
|
||||
cases above.
|
||||
|
||||
A comment on a given line provides information about the following line.
|
||||
|
||||
Such a comment contains one of 5 special sequences. The first 3 cover case 1
|
||||
from above:
|
||||
|
||||
- `jspecify_conflicting_annotations`: for cases like `@Nullable
|
||||
@NullnessUnspecified Foo`
|
||||
|
||||
- `jspecify_unrecognized_location`: for cases like `class @Nullable Foo {}`,
|
||||
in which JSpecify does not currently specify meaning for annotations on a
|
||||
given location but we can imagine uses for them
|
||||
|
||||
- `jspecify_nullness_intrinsically_not_nullable`: for cases like `@Nullable
|
||||
int`
|
||||
|
||||
The remaining 2 cover case 2:
|
||||
|
||||
- `jspecify_nullness_mismatch`: for certain instances of case 2
|
||||
|
||||
- `jspecify_nullness_not_enough_information`: for certain instances of case 2
|
||||
|
||||
The difference between the "mismatch" and "not enough information" cases arises
|
||||
from
|
||||
[unspecified nullness](https://docs.google.com/document/d/1KQrBxwaVIPIac_6SCf--w-vZBeHkTvtaqPSU_icIccc/edit#bookmark=id.xb9w6p3ilsq3).
|
||||
The rough idea is that a type with unspecified nullness means: "When this code
|
||||
is annotated for nullness, either the type should have `@Nullable` on it, or it
|
||||
shouldn't."
|
||||
|
||||
- In a "mismatch," the type check described above would fail no matter how the
|
||||
unspecified types are eventually annotated. (This is trivially the case
|
||||
whenever a failing type check involves no unspecified types.)
|
||||
|
||||
- In a "not enough information," there is at least one way that the
|
||||
unspecified types could be annotated that would _fail_ the type checks, and
|
||||
there is at least one way that the unspecified types could be annotated that
|
||||
would _pass_ the type checks.
|
||||
|
||||
Another way to look at it is how tools are likely (but not obligated!) to
|
||||
behave:
|
||||
|
||||
- For "mismatch," all tools are likely to report an error. (This assumes that
|
||||
a tool implements a given type check: For example, if a tool doesn't check
|
||||
type arguments at all, then naturally it wouldn't report errors for them)
|
||||
|
||||
- For "not enough information," tools might not report anything, or they might
|
||||
report a warning, or they might report an error. We've sometimes spoken of
|
||||
these different behaviors as the difference between a "strict mode" and a
|
||||
"lenient mode."
|
||||
|
||||
TODO: Consider additional features:
|
||||
|
||||
- multiline comments
|
||||
- other locations for comments
|
||||
- multiple findings per line/comment
|
||||
- comments that apply to larger ranges -- possibly to syntax elements (like
|
||||
statements) rather than lines
|
||||
- comments that apply only to a particular part of the line
|
||||
|
||||
## More TODOs
|
||||
|
||||
TODO: Consider how to map between samples and related GitHub issues (comments,
|
||||
filenames?).
|
||||
67
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/SameTypeObject.java
vendored
Normal file
67
compiler/testData/foreignAnnotationsJava8/tests/jspecify/java/SameTypeObject.java
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2020 The JSpecify Authors.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.jspecify.annotations.DefaultNonNull;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.jspecify.annotations.NullnessUnspecified;
|
||||
|
||||
@DefaultNonNull
|
||||
class SameTypeObject {
|
||||
Lib<Object> x0(Lib<Object> x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<Object> x1(Lib<@NullnessUnspecified Object> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<Object> x2(Lib<@Nullable Object> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@NullnessUnspecified Object> x3(Lib<Object> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@NullnessUnspecified Object> x4(Lib<@NullnessUnspecified Object> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@NullnessUnspecified Object> x5(Lib<@Nullable Object> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@Nullable Object> x6(Lib<Object> x) {
|
||||
// jspecify_nullness_mismatch
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@Nullable Object> x7(Lib<@NullnessUnspecified Object> x) {
|
||||
// jspecify_nullness_not_enough_information
|
||||
return x;
|
||||
}
|
||||
|
||||
Lib<@Nullable Object> x8(Lib<@Nullable Object> x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
interface Lib<T extends @Nullable Object> {}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user