Add more toString() methods and additional wrapping for Kotlin elements
This commit is contained in:
@@ -148,7 +148,7 @@ public abstract class KotlinLightField<T extends JetDeclaration, D extends PsiFi
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PsiField:" + getName();
|
||||
return "KotlinLightField:" + getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
@@ -125,4 +125,6 @@ open public class KotlinLightMethodForDeclaration(
|
||||
getContainingClass() == other.getContainingClass()
|
||||
|
||||
override fun hashCode(): Int = (getName().hashCode() * 31 + origin.hashCode()) * 31 + getContainingClass()!!.hashCode()
|
||||
|
||||
override fun toString(): String = "KotlinLightMethodForDeclaration:" + getName()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.asJava
|
||||
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.impl.light.LightField
|
||||
import com.intellij.psi.impl.light.LightMethod
|
||||
|
||||
|
||||
public class KotlinNoOriginLightMethod(manager: PsiManager, method: PsiMethod, containingClass: PsiClass) :
|
||||
LightMethod(manager, method, containingClass) {
|
||||
|
||||
override fun toString() = "KotlinNoOriginLightMethod:${getName()}" + if (isConstructor()) " ctor" else ""
|
||||
}
|
||||
|
||||
public class KotlinNoOriginLightField(manager: PsiManager, field: PsiField, containingClass: PsiClass) :
|
||||
LightField(manager, field, containingClass) {
|
||||
|
||||
override fun toString() = "KotlinNoOriginLightField:${getName()}"
|
||||
}
|
||||
+2
-4
@@ -22,8 +22,6 @@ import com.intellij.navigation.ItemPresentationProviders;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
import com.intellij.psi.impl.light.AbstractLightClass;
|
||||
import com.intellij.psi.impl.light.LightField;
|
||||
import com.intellij.psi.impl.light.LightMethod;
|
||||
import com.intellij.psi.impl.source.ClassInnerStuffCache;
|
||||
import com.intellij.psi.impl.source.PsiExtensibleClass;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
@@ -138,7 +136,7 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
|
||||
if (declaration != null) {
|
||||
return new KotlinLightFieldForDeclaration(myManager, declaration, field, KotlinWrappingLightClass.this);
|
||||
}
|
||||
return new LightField(myManager, field, KotlinWrappingLightClass.this);
|
||||
return new KotlinNoOriginLightField(myManager, field, KotlinWrappingLightClass.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -157,7 +155,7 @@ public abstract class KotlinWrappingLightClass extends AbstractLightClass implem
|
||||
new KotlinLightMethodForTraitFakeOverride(myManager, method, declaration, KotlinWrappingLightClass.this);
|
||||
}
|
||||
|
||||
return new LightMethod(myManager, method, KotlinWrappingLightClass.this);
|
||||
return new KotlinNoOriginLightMethod(myManager, method, KotlinWrappingLightClass.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user