J2k for PackageViewDescriptorImpl: autoconvert
This commit is contained in:
+40
-65
@@ -14,97 +14,72 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.descriptors.impl;
|
package org.jetbrains.kotlin.descriptors.impl
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.descriptors.*;
|
import org.jetbrains.kotlin.name.FqName
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
import org.jetbrains.kotlin.resolve.scopes.ChainedScope
|
||||||
import org.jetbrains.kotlin.name.FqName;
|
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||||
import org.jetbrains.kotlin.resolve.scopes.ChainedScope;
|
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
|
||||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PackageViewDescriptorImpl extends DeclarationDescriptorImpl implements PackageViewDescriptor {
|
public class PackageViewDescriptorImpl(private val module: ModuleDescriptor, private val fqName: FqName, fragments: List<PackageFragmentDescriptor>) : DeclarationDescriptorImpl(Annotations.EMPTY, fqName.shortNameOrSpecial()), PackageViewDescriptor {
|
||||||
private final ModuleDescriptor module;
|
private val memberScope: JetScope
|
||||||
private final FqName fqName;
|
|
||||||
private final JetScope memberScope;
|
|
||||||
|
|
||||||
public PackageViewDescriptorImpl(
|
init {
|
||||||
@NotNull ModuleDescriptor module,
|
|
||||||
@NotNull FqName fqName,
|
|
||||||
@NotNull List<PackageFragmentDescriptor> fragments
|
|
||||||
) {
|
|
||||||
super(Annotations.EMPTY, fqName.shortNameOrSpecial());
|
|
||||||
this.module = module;
|
|
||||||
this.fqName = fqName;
|
|
||||||
|
|
||||||
List<JetScope> scopes = new ArrayList<JetScope>(fragments.size() + 1);
|
val scopes = ArrayList<JetScope>(fragments.size() + 1)
|
||||||
assert !fragments.isEmpty() : fqName + " in " + module;
|
assert(!fragments.isEmpty()) { fqName + " in " + module }
|
||||||
for (PackageFragmentDescriptor fragment : fragments) {
|
for (fragment in fragments) {
|
||||||
scopes.add(fragment.getMemberScope());
|
scopes.add(fragment.getMemberScope())
|
||||||
}
|
}
|
||||||
scopes.add(new SubpackagesScope(this));
|
scopes.add(SubpackagesScope(this))
|
||||||
|
|
||||||
memberScope = new ChainedScope(this, "package view scope for " + fqName + " in " + module.getName(),
|
memberScope = ChainedScope(this, "package view scope for " + fqName + " in " + module.getName(), *scopes.toArray<JetScope>(arrayOfNulls<JetScope>(scopes.size())))
|
||||||
scopes.toArray(new JetScope[scopes.size()]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
override fun getContainingDeclaration(): PackageViewDescriptor? {
|
||||||
@Override
|
return if (fqName.isRoot()) null else module.getPackage(fqName.parent())
|
||||||
public PackageViewDescriptor getContainingDeclaration() {
|
|
||||||
return fqName.isRoot() ? null : module.getPackage(fqName.parent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
override fun substitute(substitutor: TypeSubstitutor): DeclarationDescriptor? {
|
||||||
@Override
|
return this
|
||||||
public DeclarationDescriptor substitute(@NotNull TypeSubstitutor substitutor) {
|
|
||||||
return this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun <R, D> accept(visitor: DeclarationDescriptorVisitor<R, D>, data: D): R {
|
||||||
public <R, D> R accept(DeclarationDescriptorVisitor<R, D> visitor, D data) {
|
return visitor.visitPackageViewDescriptor(this, data)
|
||||||
return visitor.visitPackageViewDescriptor(this, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
override fun getFqName(): FqName {
|
||||||
@Override
|
return fqName
|
||||||
public FqName getFqName() {
|
|
||||||
return fqName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
override fun getMemberScope(): JetScope {
|
||||||
@Override
|
return memberScope
|
||||||
public JetScope getMemberScope() {
|
|
||||||
return memberScope;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun getModule(): ModuleDescriptor {
|
||||||
@NotNull
|
return module
|
||||||
public ModuleDescriptor getModule() {
|
|
||||||
return module;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
override fun equals(o: Any?): Boolean {
|
||||||
if (this == o) return true;
|
if (this == o) return true
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || javaClass != o.javaClass) return false
|
||||||
|
|
||||||
PackageViewDescriptorImpl that = (PackageViewDescriptorImpl) o;
|
val that = o as PackageViewDescriptorImpl
|
||||||
|
|
||||||
if (!fqName.equals(that.fqName)) return false;
|
if (fqName != that.fqName) return false
|
||||||
if (!module.equals(that.module)) return false;
|
if (module != that.module) return false
|
||||||
|
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
override fun hashCode(): Int {
|
||||||
public int hashCode() {
|
var result = module.hashCode()
|
||||||
int result = module.hashCode();
|
result = 31 * result + fqName.hashCode()
|
||||||
result = 31 * result + fqName.hashCode();
|
return result
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user