Rendering package FQ names instead of short names.

This commit is contained in:
Evgeny Gerashchenko
2013-12-04 17:43:32 +04:00
parent 212d303c7b
commit e175ebf60a
28 changed files with 44 additions and 33 deletions
@@ -4,7 +4,7 @@ internal final class A {
/*primary*/ public constructor A()
}
package p {
package test.p {
internal fun foo(): jet.Unit
internal fun foo(/*0*/ a: test.p.C): jet.Unit
@@ -12,6 +12,6 @@ public trait StringConstantInParam : java.lang.Object {
}
}
package StringConstantInParam {
package test.StringConstantInParam {
public val HEL: jet.String
}
@@ -22,10 +22,10 @@ public trait Nested : java.lang.Object {
}
}
package Nested {
package test.Nested {
public /*synthesized*/ fun Runnable(/*0*/ function: () -> jet.Unit): test.Nested.Runnable
package Deeper2 {
package test.Nested.Deeper2 {
public /*synthesized*/ fun Runnable(/*0*/ function: () -> jet.Unit): test.Nested.Deeper2.Runnable
}
}
@@ -15,7 +15,7 @@ public trait SamSubinterfaceOfTwo : java.lang.Object {
}
}
package SamSubinterfaceOfTwo {
package test.SamSubinterfaceOfTwo {
public /*synthesized*/ fun Sub(/*0*/ function: () -> jet.String?): test.SamSubinterfaceOfTwo.Sub
public /*synthesized*/ fun Super1(/*0*/ function: () -> jet.CharSequence?): test.SamSubinterfaceOfTwo.Super1
public /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: () -> T?): test.SamSubinterfaceOfTwo.Super2<T>
@@ -6,7 +6,7 @@ public open class Basic : java.lang.Object {
public open fun foo(/*0*/ p0: java.lang.Runnable?): jet.Unit
}
package Basic {
package test.Basic {
public /*synthesized*/ fun bar(/*0*/ p0: (() -> jet.Unit)?): jet.Unit
public open fun bar(/*0*/ p0: java.lang.Runnable?): jet.Unit
}
@@ -13,7 +13,7 @@ public trait DeepSamLoop : java.lang.Object {
}
}
package DeepSamLoop {
package test.DeepSamLoop {
public /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo?) -> jet.Unit): test.DeepSamLoop.Bar
public /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar?) -> jet.Unit): test.DeepSamLoop.Foo
}
@@ -4,7 +4,7 @@ public open class SeveralSamParameters : java.lang.Object {
public constructor SeveralSamParameters()
}
package SeveralSamParameters {
package test.SeveralSamParameters {
public /*synthesized*/ fun findMaxAndInvokeCallback(/*0*/ p0: ((jet.String, jet.String) -> jet.Int)?, /*1*/ p1: jet.String?, /*2*/ p2: jet.String?, /*3*/ p3: (() -> jet.Unit)?): jet.String?
public open fun findMaxAndInvokeCallback(/*0*/ p0: java.util.Comparator<jet.String>?, /*1*/ p1: jet.String?, /*2*/ p2: jet.String?, /*3*/ p3: java.lang.Runnable?): jet.String?
}
@@ -4,7 +4,7 @@ public open class TypeParameterOfMethod : java.lang.Object {
public constructor TypeParameterOfMethod()
}
package TypeParameterOfMethod {
package test.TypeParameterOfMethod {
public /*synthesized*/ fun </*0*/ T> max(/*0*/ p0: ((T, T) -> jet.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
public open fun </*0*/ T> max(/*0*/ p0: java.util.Comparator<T>?, /*1*/ p1: T?, /*2*/ p2: T?): T?
public /*synthesized*/ fun </*0*/ T : jet.CharSequence?> max2(/*0*/ p0: ((T, T) -> jet.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
@@ -13,6 +13,6 @@ public trait AdapterDoesntOverrideDeclaration : java.lang.Object {
}
}
package AdapterDoesntOverrideDeclaration {
package test.AdapterDoesntOverrideDeclaration {
public /*synthesized*/ fun Super(/*0*/ function: ((() -> jet.Unit)?) -> jet.Unit): test.AdapterDoesntOverrideDeclaration.Super
}
@@ -18,7 +18,7 @@ public trait InheritedSameAdapters : java.lang.Object {
}
}
package InheritedSameAdapters {
package test.InheritedSameAdapters {
public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> jet.Unit): test.InheritedSameAdapters.Sub
public /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable?) -> jet.Unit): test.InheritedSameAdapters.Super1
public /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable?) -> jet.Unit): test.InheritedSameAdapters.Super2
@@ -23,7 +23,7 @@ public trait InheritedSameAdaptersWithSubstitution : java.lang.Object {
}
}
package InheritedSameAdaptersWithSubstitution {
package test.InheritedSameAdaptersWithSubstitution {
public /*synthesized*/ fun Sub(/*0*/ function: (java.util.Comparator<jet.String>?) -> jet.Unit): test.InheritedSameAdaptersWithSubstitution.Sub
public /*synthesized*/ fun Super1(/*0*/ function: (java.util.Comparator<jet.String>?) -> jet.Unit): test.InheritedSameAdaptersWithSubstitution.Super1
public /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: (java.util.Comparator<T>?) -> jet.Unit): test.InheritedSameAdaptersWithSubstitution.Super2<T>
@@ -13,7 +13,7 @@ public trait InheritedSimple : java.lang.Object {
}
}
package InheritedSimple {
package test.InheritedSimple {
public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> jet.Unit): test.InheritedSimple.Sub
public /*synthesized*/ fun Super(/*0*/ function: (java.lang.Runnable?) -> jet.Unit): test.InheritedSimple.Super
}
@@ -13,6 +13,6 @@ public open class RawSuperType : java.lang.Object {
}
}
package RawSuperType {
package test.RawSuperType {
public /*synthesized*/ fun </*0*/ T> Super(/*0*/ function: (T?) -> jet.Unit): test.RawSuperType.Super<T>
}
@@ -15,6 +15,6 @@ public trait TwoSuperclassesInconsistentGenericTypes : java.lang.Object {
}
}
package TwoSuperclassesInconsistentGenericTypes {
package test.TwoSuperclassesInconsistentGenericTypes {
public /*synthesized*/ fun Other(/*0*/ function: () -> jet.MutableList<jet.String>?): test.TwoSuperclassesInconsistentGenericTypes.Other
}
@@ -16,7 +16,7 @@ public trait TwoSuperclassesVarargAndNot : java.lang.Object {
}
}
package TwoSuperclassesVarargAndNot {
package test.TwoSuperclassesVarargAndNot {
public /*synthesized*/ fun Super1(/*0*/ function: (jet.Array<jet.String?>) -> jet.Unit): test.TwoSuperclassesVarargAndNot.Super1
public /*synthesized*/ fun Super2(/*0*/ function: (jet.Array<out jet.String?>?) -> jet.Unit): test.TwoSuperclassesVarargAndNot.Super2
}
@@ -12,11 +12,11 @@ public open class DeeplyNestedStatic : java.lang.Object {
}
}
package DeeplyNestedStatic {
package test.DeeplyNestedStatic {
package Foo {
package test.DeeplyNestedStatic.Foo {
package Bar {
package test.DeeplyNestedStatic.Foo.Bar {
public open fun method(): jet.Unit
}
}
@@ -5,6 +5,6 @@ public open class Simple : java.lang.Object {
public open fun foo(): jet.Unit
}
package Simple {
package test.Simple {
public open fun bar(): jet.Unit
}
@@ -4,6 +4,6 @@ public open class StaticFinal : java.lang.Object {
public constructor StaticFinal()
}
package StaticFinal {
package test.StaticFinal {
public val foo: jet.String
}
@@ -24,7 +24,7 @@ public final enum class StaticMembersInEnum : jet.Enum<test.StaticMembersInEnum>
}
}
package StaticMembersInEnum {
package test.StaticMembersInEnum {
public val CONSTANT: test.StaticMembersInEnum
public var STATIC_FIELD: jet.Int
public open fun foo(): jet.Unit
@@ -16,18 +16,18 @@ public trait SamInterface : java.lang.Object {
public abstract fun instanceMethod(): jet.Unit
}
package JavaClass {
package test.JavaClass {
public open fun staticMethod(): jet.Unit
}
package sub {
package test.sub {
public open class JavaClassInSubpackage : java.lang.Object {
public constructor JavaClassInSubpackage()
public open fun instanceMethod(): jet.Unit
}
package JavaClassInSubpackage {
package test.sub.JavaClassInSubpackage {
public open fun staticMethod(): jet.Unit
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ public class WithReified<reified A, reified out B>
public trait TwoUpperBounds<T> where T : Number, T : Any
//package rendererTest defined in root package
//package rendererTest
//internal final annotation class TheAnnotation : jet.Annotation defined in rendererTest
//public constructor TheAnnotation() defined in rendererTest.TheAnnotation
//rendererTest.TheAnnotation public open class TheClass<out T : jet.Int, X> defined in rendererTest
+1 -1
View File
@@ -4,7 +4,7 @@ private enum class TheEnum(val rgb: Int) {
VAL1: TheEnum(0xFF0000)
}
//package rendererTest defined in root package
//package rendererTest
//private final enum class TheEnum : jet.Enum<rendererTest.TheEnum> defined in rendererTest
//private constructor TheEnum(rgb: jet.Int) defined in rendererTest.TheEnum
//value-parameter val rgb: jet.Int defined in rendererTest.TheEnum.<init>
@@ -19,7 +19,7 @@ fun <P> funTypeParameterWithTwoUpperBounds() where P : Foo, P : Bar = 17
deprecated("") fun deprecatedFun()
//package rendererTest defined in root package
//package rendererTest
//public fun pub(): jet.Unit defined in rendererTest
//internal fun int(): jet.String defined in rendererTest
//internal fun int2(vararg ints: jet.Int): jet.Int defined in rendererTest
@@ -16,7 +16,7 @@ deprecated("") val deprecatedVal = 5
public val <T> T.extWithTwoUpperBounds: Int where T : CharSequence, T : Number
get() {}
//package rendererTest defined in root package
//package rendererTest
//public val pub: jet.String defined in rendererTest
//internal var int: jet.String defined in rendererTest
//internal val int2: jet.Int defined in rendererTest
@@ -128,6 +128,7 @@ public final class FqName extends FqNameBase {
return path;
}
@Override
@NotNull
public List<Name> pathSegments() {
return fqName.pathSegments();
@@ -18,6 +18,8 @@ package org.jetbrains.jet.lang.resolve.name;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public abstract class FqNameBase {
protected FqNameBase() {
@@ -49,4 +51,7 @@ public abstract class FqNameBase {
public final boolean equalsTo(@NotNull FqNameUnsafe that) {
return toFqNameUnsafe().equals(that);
}
@NotNull
public abstract List<Name> pathSegments();
}
@@ -179,6 +179,7 @@ public final class FqNameUnsafe extends FqNameBase {
return path;
}
@Override
@NotNull
public List<Name> pathSegments() {
final List<Name> path = Lists.newArrayList();
@@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameBase;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.types.*;
@@ -158,7 +159,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
}
@NotNull
private String renderFqName(@NotNull FqNameUnsafe fqName) {
private String renderFqName(@NotNull FqNameBase fqName) {
return renderFqName(fqName.pathSegments());
}
@@ -287,6 +288,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
/* METHODS FOR ALL KINDS OF DESCRIPTORS */
private void appendDefinedIn(@NotNull DeclarationDescriptor descriptor, @NotNull StringBuilder builder) {
if (descriptor instanceof PackageFragmentDescriptor || descriptor instanceof PackageViewDescriptor) {
return;
}
if (descriptor instanceof ModuleDescriptor) {
builder.append(" is a module");
return;
@@ -684,7 +688,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private void renderPackageView(@NotNull PackageViewDescriptor packageView, @NotNull StringBuilder builder) {
builder.append(renderKeyword("package")).append(" ");
renderName(packageView, builder);
builder.append(renderFqName(packageView.getFqName()));
if (debugMode) {
builder.append(" in context of ");
renderName(packageView.getModule(), builder);
@@ -693,9 +697,9 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
private void renderPackageFragment(@NotNull PackageFragmentDescriptor fragment, @NotNull StringBuilder builder) {
builder.append(renderKeyword("package-fragment")).append(" ");
renderName(fragment, builder);
builder.append(renderFqName(fragment.getFqName()));
if (debugMode) {
builder.append(" in context of ");
builder.append(" in ");
renderName(fragment.getContainingDeclaration(), builder);
}
}