org.pkl.thirdparty.kotlin.jvm.internal.PropertyReference Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pkl-tools Show documentation
Show all versions of pkl-tools Show documentation
Fat Jar containing pkl-cli, pkl-codegen-java, pkl-codegen-kotlin, pkl-config-java, pkl-core, pkl-doc, and their shaded third-party dependencies.
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.pkl.thirdparty.kotlin.jvm.internal;
import org.pkl.thirdparty.kotlin.SinceKotlin;
import org.pkl.thirdparty.kotlin.reflect.KCallable;
import org.pkl.thirdparty.kotlin.reflect.KProperty;
@SuppressWarnings("rawtypes")
public abstract class PropertyReference extends CallableReference implements KProperty {
public PropertyReference() {
super();
}
@SinceKotlin(version = "1.1")
public PropertyReference(Object receiver) {
super(receiver);
}
@SinceKotlin(version = "1.4")
public PropertyReference(Object receiver, Class owner, String name, String signature, int flags) {
super(receiver, owner, name, signature, (flags & 1) == 1);
}
@Override
@SinceKotlin(version = "1.1")
protected KProperty getReflected() {
return (KProperty) super.getReflected();
}
@Override
@SinceKotlin(version = "1.1")
public boolean isLateinit() {
return getReflected().isLateinit();
}
@Override
@SinceKotlin(version = "1.1")
public boolean isConst() {
return getReflected().isConst();
}
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj instanceof PropertyReference) {
PropertyReference other = (PropertyReference) obj;
return getOwner().equals(other.getOwner()) &&
getName().equals(other.getName()) &&
getSignature().equals(other.getSignature()) &&
Intrinsics.areEqual(getBoundReceiver(), other.getBoundReceiver());
}
if (obj instanceof KProperty) {
return obj.equals(compute());
}
return false;
}
@Override
public int hashCode() {
return (getOwner().hashCode() * 31 + getName().hashCode()) * 31 + getSignature().hashCode();
}
@Override
public String toString() {
KCallable reflected = compute();
if (reflected != this) {
return reflected.toString();
}
return "property " + getName() + Reflection.REFLECTION_NOT_AVAILABLE;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy