Fixed compiler warnings
Removed unnecessary !! operations, ?. calls and "out" declarations.
This commit is contained in:
committed by
Pavel V. Talanov
parent
1cab2d1245
commit
6576eb8ce3
@@ -60,7 +60,7 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public open fun getClassIdentifiers(): Set<String> {
|
public open fun getClassIdentifiers(): Set<String> {
|
||||||
return Collections.unmodifiableSet(classIdentifiers)!!
|
return Collections.unmodifiableSet(classIdentifiers)
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun getMethodReturnType(): PsiType? {
|
public open fun getMethodReturnType(): PsiType? {
|
||||||
@@ -88,11 +88,11 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public open fun fileToFile(javaFile: PsiJavaFile): File {
|
public open fun fileToFile(javaFile: PsiJavaFile): File {
|
||||||
return fileToFile(javaFile, Collections.emptyList<String>()!!)
|
return fileToFile(javaFile, Collections.emptyList<String>())
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun fileToFileWithCompatibilityImport(javaFile: PsiJavaFile): File {
|
public open fun fileToFileWithCompatibilityImport(javaFile: PsiJavaFile): File {
|
||||||
return fileToFile(javaFile, Collections.singletonList("kotlin.compatibility.*")!!)
|
return fileToFile(javaFile, Collections.singletonList("kotlin.compatibility.*"))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fileToFile(javaFile: PsiJavaFile, additionalImports: List<String>): File {
|
private fun fileToFile(javaFile: PsiJavaFile, additionalImports: List<String>): File {
|
||||||
@@ -218,20 +218,20 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
members.add(Constructor(Identifier.EMPTY_IDENTIFIER, arrayList(), Collections.emptySet<Modifier>()!!,
|
members.add(Constructor(Identifier.EMPTY_IDENTIFIER, arrayList(), Collections.emptySet<Modifier>(),
|
||||||
ClassType(name, Collections.emptyList<Element>()!!, false),
|
ClassType(name, Collections.emptyList<Element>(), false),
|
||||||
Collections.emptyList<Element>()!!,
|
Collections.emptyList<Element>(),
|
||||||
ParameterList(createParametersFromFields(finalOrWithEmptyInitializer)),
|
ParameterList(createParametersFromFields(finalOrWithEmptyInitializer)),
|
||||||
Block(createInitStatementsFromFields(finalOrWithEmptyInitializer)),
|
Block(createInitStatementsFromFields(finalOrWithEmptyInitializer)),
|
||||||
true))
|
true))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psiClass.isInterface()) {
|
if (psiClass.isInterface()) {
|
||||||
return Trait(this, name, docComments, modifiers, typeParameters, extendsTypes, Collections.emptyList<Expression>()!!, implementsTypes, members)
|
return Trait(this, name, docComments, modifiers, typeParameters, extendsTypes, Collections.emptyList<Expression>(), implementsTypes, members)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psiClass.isEnum()) {
|
if (psiClass.isEnum()) {
|
||||||
return Enum(this, name, docComments, modifiers, typeParameters, Collections.emptyList<Type>()!!, Collections.emptyList<Expression>()!!, implementsTypes, members)
|
return Enum(this, name, docComments, modifiers, typeParameters, Collections.emptyList<Type>(), Collections.emptyList<Expression>(), implementsTypes, members)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Class(this, name, docComments, modifiers, typeParameters, extendsTypes, baseClassParams, implementsTypes, members)
|
return Class(this, name, docComments, modifiers, typeParameters, extendsTypes, baseClassParams, implementsTypes, members)
|
||||||
@@ -242,7 +242,7 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun fieldsToFieldList(fields: Array<PsiField>, psiClass: PsiClass): List<Field> {
|
private fun fieldsToFieldList(fields: Array<PsiField>, psiClass: PsiClass): List<Field> {
|
||||||
return fields.map { fieldToField(it!!, psiClass) }
|
return fields.map { fieldToField(it, psiClass) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fieldToField(field: PsiField, psiClass: PsiClass?): Field {
|
private fun fieldToField(field: PsiField, psiClass: PsiClass?): Field {
|
||||||
@@ -452,7 +452,7 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public open fun parametersToParameterList(parameters: Array<PsiParameter>): List<Parameter?> {
|
public open fun parametersToParameterList(parameters: Array<PsiParameter>): List<Parameter?> {
|
||||||
return parameters.map { parameterToParameter(it!!) }
|
return parameters.map { parameterToParameter(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
public open fun parameterToParameter(parameter: PsiParameter, forceNotNull: Boolean = false): Parameter {
|
public open fun parameterToParameter(parameter: PsiParameter, forceNotNull: Boolean = false): Parameter {
|
||||||
@@ -534,7 +534,7 @@ public open class Converter() {
|
|||||||
return packageName.split("\\.").map { Identifier(it).toKotlin() }.makeString(".")
|
return packageName.split("\\.").map { Identifier(it).toKotlin() }.makeString(".")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFinalOrWithEmptyInitializer(fields: List<out Field>): List<Field> {
|
private fun getFinalOrWithEmptyInitializer(fields: List<Field>): List<Field> {
|
||||||
val result = ArrayList<Field>()
|
val result = ArrayList<Field>()
|
||||||
for (f : Field in fields)
|
for (f : Field in fields)
|
||||||
if (f.isVal() || f.initializer.toKotlin().isEmpty()) {
|
if (f.isVal() || f.initializer.toKotlin().isEmpty()) {
|
||||||
@@ -548,7 +548,7 @@ public open class Converter() {
|
|||||||
return fields.map { Parameter(Identifier("_" + it.identifier.name), it.`type`, true) }
|
return fields.map { Parameter(Identifier("_" + it.identifier.name), it.`type`, true) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun createInitStatementsFromFields(fields: List<out Field>): List<Element> {
|
private fun createInitStatementsFromFields(fields: List<Field>): List<Element> {
|
||||||
val result = ArrayList<Element>()
|
val result = ArrayList<Element>()
|
||||||
for (f : Field in fields) {
|
for (f : Field in fields) {
|
||||||
val identifierToKotlin: String? = f.identifier.toKotlin()
|
val identifierToKotlin: String? = f.identifier.toKotlin()
|
||||||
@@ -644,7 +644,7 @@ public open class Converter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isInheritFromObject(method: PsiMethod): Boolean {
|
private fun isInheritFromObject(method: PsiMethod): Boolean {
|
||||||
var superSignatures: List<HierarchicalMethodSignature?> = method.getHierarchicalMethodSignature().getSuperSignatures()!!
|
var superSignatures: List<HierarchicalMethodSignature?> = method.getHierarchicalMethodSignature().getSuperSignatures()
|
||||||
for (s : HierarchicalMethodSignature? in superSignatures) {
|
for (s : HierarchicalMethodSignature? in superSignatures) {
|
||||||
var containingClass: PsiClass? = s?.getMethod()?.getContainingClass()
|
var containingClass: PsiClass? = s?.getMethod()?.getContainingClass()
|
||||||
var qualifiedName: String? = (if (containingClass != null)
|
var qualifiedName: String? = (if (containingClass != null)
|
||||||
@@ -819,7 +819,7 @@ public fun isMainMethod(method: PsiMethod?): Boolean {
|
|||||||
if (parameters?.size!! != 1)
|
if (parameters?.size!! != 1)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
val `type`: PsiType? = parameters!![0]?.getType()
|
val `type`: PsiType? = parameters!![0].getType()
|
||||||
if (`type` !is PsiArrayType)
|
if (`type` !is PsiArrayType)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
@@ -833,7 +833,7 @@ public fun countWritingAccesses(element: PsiElement?, container: PsiElement?): I
|
|||||||
val visitor: ReferenceCollector = ReferenceCollector()
|
val visitor: ReferenceCollector = ReferenceCollector()
|
||||||
container.accept(visitor)
|
container.accept(visitor)
|
||||||
for (e : PsiReferenceExpression in visitor.getCollectedReferences())
|
for (e : PsiReferenceExpression in visitor.getCollectedReferences())
|
||||||
if (e?.isReferenceTo(element)!! && PsiUtil.isAccessedForWriting(e)) {
|
if (e.isReferenceTo(element) && PsiUtil.isAccessedForWriting(e)) {
|
||||||
counter++
|
counter++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -864,7 +864,7 @@ public fun isAnnotatedAsNotNull(modifierList: PsiModifierList?): Boolean {
|
|||||||
if (modifierList != null) {
|
if (modifierList != null) {
|
||||||
val annotations: Array<PsiAnnotation> = modifierList.getAnnotations()
|
val annotations: Array<PsiAnnotation> = modifierList.getAnnotations()
|
||||||
for (a : PsiAnnotation in annotations) {
|
for (a : PsiAnnotation in annotations) {
|
||||||
val qualifiedName: String? = a?.getQualifiedName()
|
val qualifiedName: String? = a.getQualifiedName()
|
||||||
if (qualifiedName != null && Converter.NOT_NULL_ANNOTATIONS.contains(qualifiedName)) {
|
if (qualifiedName != null && Converter.NOT_NULL_ANNOTATIONS.contains(qualifiedName)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ public open class AnonymousClass(converter : Converter, members : List<Node>)
|
|||||||
: Class(converter,
|
: Class(converter,
|
||||||
Identifier("anonClass"),
|
Identifier("anonClass"),
|
||||||
arrayList(),
|
arrayList(),
|
||||||
Collections.emptySet<Modifier>()!!,
|
Collections.emptySet<Modifier>(),
|
||||||
Collections.emptyList<Element>()!!,
|
Collections.emptyList<Element>(),
|
||||||
Collections.emptyList<Type>()!!,
|
Collections.emptyList<Type>(),
|
||||||
Collections.emptyList<Expression>()!!,
|
Collections.emptyList<Expression>(),
|
||||||
Collections.emptyList<Type>()!!, members) {
|
Collections.emptyList<Type>(), members) {
|
||||||
public override fun toKotlin() = bodyToKotlin()
|
public override fun toKotlin() = bodyToKotlin()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ public open class ArrayInitializerExpression(val `type` : Type, val initializers
|
|||||||
|
|
||||||
class object {
|
class object {
|
||||||
private open fun getConversion(afterReplace : String) : String {
|
private open fun getConversion(afterReplace : String) : String {
|
||||||
if (afterReplace.contains("double")!!)
|
if (afterReplace.contains("double"))
|
||||||
return "." + OperatorConventions.DOUBLE + "()"
|
return "." + OperatorConventions.DOUBLE + "()"
|
||||||
|
|
||||||
if (afterReplace.contains("float")!!)
|
if (afterReplace.contains("float"))
|
||||||
return "." + OperatorConventions.FLOAT + "()"
|
return "." + OperatorConventions.FLOAT + "()"
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ public open class NewClassExpression(val name: Element,
|
|||||||
val qualifier: Expression = Expression.EMPTY_EXPRESSION,
|
val qualifier: Expression = Expression.EMPTY_EXPRESSION,
|
||||||
val anonymousClass: AnonymousClass? = null): Expression() {
|
val anonymousClass: AnonymousClass? = null): Expression() {
|
||||||
public override fun toKotlin(): String {
|
public override fun toKotlin(): String {
|
||||||
val callOperator: String? = (if (qualifier.isNullable()!!)
|
val callOperator: String? = (if (qualifier.isNullable())
|
||||||
"?."
|
"?."
|
||||||
else
|
else
|
||||||
".")
|
".")
|
||||||
val qualifier: String? = (if (qualifier.isEmpty()!!)
|
val qualifier: String? = (if (qualifier.isEmpty())
|
||||||
""
|
""
|
||||||
else
|
else
|
||||||
qualifier.toKotlin() + callOperator)
|
qualifier.toKotlin() + callOperator)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.jetbrains.jet.j2k.ast.Identifier
|
|||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
|
|
||||||
public open class ClassType(val `type` : Identifier, val parameters : List<out Element>, nullable : Boolean) : Type(nullable) {
|
public open class ClassType(val `type` : Identifier, val parameters : List<Element>, nullable : Boolean) : Type(nullable) {
|
||||||
public override fun toKotlin() : String {
|
public override fun toKotlin() : String {
|
||||||
// TODO change to map() when KT-2051 is fixed
|
// TODO change to map() when KT-2051 is fixed
|
||||||
val parametersToKotlin = ArrayList<String>()
|
val parametersToKotlin = ArrayList<String>()
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public open class ElementVisitor(val myConverter : Converter) : JavaElementVisit
|
|||||||
myResult = ReferenceElement(Identifier(theReference.getReferenceName()!!), types)
|
myResult = ReferenceElement(Identifier(theReference.getReferenceName()!!), types)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var result : String = Identifier(reference?.getReferenceName()!!).toKotlin()
|
var result : String = Identifier(reference.getReferenceName()!!).toKotlin()
|
||||||
var qualifier : PsiElement? = theReference.getQualifier()
|
var qualifier : PsiElement? = theReference.getQualifier()
|
||||||
while (qualifier != null)
|
while (qualifier != null)
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ public open class ElementVisitor(val myConverter : Converter) : JavaElementVisit
|
|||||||
|
|
||||||
public override fun visitTypeParameter(classParameter : PsiTypeParameter?) : Unit {
|
public override fun visitTypeParameter(classParameter : PsiTypeParameter?) : Unit {
|
||||||
myResult = TypeParameter(Identifier(classParameter!!.getName()!!),
|
myResult = TypeParameter(Identifier(classParameter!!.getName()!!),
|
||||||
classParameter!!.getExtendsListTypes().map { myConverter.typeToType(it) } )
|
classParameter.getExtendsListTypes().map { myConverter.typeToType(it) } )
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun visitParameterList(list : PsiParameterList?) : Unit {
|
public override fun visitParameterList(list : PsiParameterList?) : Unit {
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
|||||||
{
|
{
|
||||||
return NewClassExpression(getConverter().elementToElement(classReference),
|
return NewClassExpression(getConverter().elementToElement(classReference),
|
||||||
getConverter().argumentsToExpressionList(expression!!),
|
getConverter().argumentsToExpressionList(expression!!),
|
||||||
getConverter().expressionToExpression(expression?.getQualifier()),
|
getConverter().expressionToExpression(expression.getQualifier()),
|
||||||
(if (anonymousClass != null)
|
(if (anonymousClass != null)
|
||||||
getConverter().anonymousClassToAnonymousClass(anonymousClass)
|
getConverter().anonymousClassToAnonymousClass(anonymousClass)
|
||||||
else
|
else
|
||||||
@@ -178,7 +178,7 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
|||||||
val typeParameters: List<Type> = (if (reference != null)
|
val typeParameters: List<Type> = (if (reference != null)
|
||||||
getConverter().typesToTypeList(reference.getTypeParameters())
|
getConverter().typesToTypeList(reference.getTypeParameters())
|
||||||
else
|
else
|
||||||
Collections.emptyList<Type>()!!)
|
Collections.emptyList<Type>())
|
||||||
return CallChainExpression(Identifier(constructor.getName(), false),
|
return CallChainExpression(Identifier(constructor.getName(), false),
|
||||||
MethodCallExpression(Identifier("init"), getConverter().expressionsToExpressionList(arguments), typeParameters, false))
|
MethodCallExpression(Identifier("init"), getConverter().expressionsToExpressionList(arguments), typeParameters, false))
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
|||||||
|
|
||||||
public override fun visitPostfixExpression(expression: PsiPostfixExpression?): Unit {
|
public override fun visitPostfixExpression(expression: PsiPostfixExpression?): Unit {
|
||||||
myResult = PostfixOperator(getOperatorString(expression!!.getOperationSign().getTokenType()!!),
|
myResult = PostfixOperator(getOperatorString(expression!!.getOperationSign().getTokenType()!!),
|
||||||
getConverter().expressionToExpression(expression?.getOperand()))
|
getConverter().expressionToExpression(expression.getOperand()))
|
||||||
}
|
}
|
||||||
|
|
||||||
public override fun visitPrefixExpression(expression: PsiPrefixExpression?): Unit {
|
public override fun visitPrefixExpression(expression: PsiPrefixExpression?): Unit {
|
||||||
@@ -214,16 +214,16 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override fun visitReferenceExpression(expression: PsiReferenceExpression?): Unit {
|
public override fun visitReferenceExpression(expression: PsiReferenceExpression?): Unit {
|
||||||
val isFieldReference: Boolean = isFieldReference(expression!!, getContainingClass(expression!!))
|
val isFieldReference: Boolean = isFieldReference(expression!!, getContainingClass(expression))
|
||||||
val insideSecondaryConstructor: Boolean = isInsideSecondaryConstructor(expression!!)
|
val insideSecondaryConstructor: Boolean = isInsideSecondaryConstructor(expression)
|
||||||
val hasReceiver: Boolean = isFieldReference && insideSecondaryConstructor
|
val hasReceiver: Boolean = isFieldReference && insideSecondaryConstructor
|
||||||
val isThis: Boolean = isThisExpression(expression!!)
|
val isThis: Boolean = isThisExpression(expression)
|
||||||
val isNullable: Boolean = getConverter().typeToType(expression?.getType()).nullable
|
val isNullable: Boolean = getConverter().typeToType(expression.getType()).nullable
|
||||||
val className: String = getClassNameWithConstructor(expression!!)
|
val className: String = getClassNameWithConstructor(expression)
|
||||||
val referencedName = expression?.getReferenceName()!!
|
val referencedName = expression.getReferenceName()!!
|
||||||
var identifier: Expression = Identifier(referencedName, isNullable)
|
var identifier: Expression = Identifier(referencedName, isNullable)
|
||||||
val __: String = "__"
|
val __: String = "__"
|
||||||
val qualifier = expression?.getQualifierExpression()
|
val qualifier = expression.getQualifierExpression()
|
||||||
if (hasReceiver){
|
if (hasReceiver){
|
||||||
identifier = CallChainExpression(Identifier(__, false), Identifier(referencedName, isNullable))
|
identifier = CallChainExpression(Identifier(__, false), Identifier(referencedName, isNullable))
|
||||||
}
|
}
|
||||||
@@ -234,11 +234,11 @@ public open class ExpressionVisitor(converter: Converter): StatementVisitor(conv
|
|||||||
identifier = Identifier("size", isNullable)
|
identifier = Identifier("size", isNullable)
|
||||||
}
|
}
|
||||||
else if (qualifier == null) {
|
else if (qualifier == null) {
|
||||||
val resolved = expression?.getReference()?.resolve()
|
val resolved = expression.getReference()?.resolve()
|
||||||
if (resolved is PsiMember && resolved.hasModifierProperty(PsiModifier.STATIC) &&
|
if (resolved is PsiMember && resolved.hasModifierProperty(PsiModifier.STATIC) &&
|
||||||
resolved.getContainingClass() != null &&
|
resolved.getContainingClass() != null &&
|
||||||
PsiTreeUtil.getParentOfType(expression, javaClass<PsiClass>()) != resolved.getContainingClass() &&
|
PsiTreeUtil.getParentOfType(expression, javaClass<PsiClass>()) != resolved.getContainingClass() &&
|
||||||
!isStaticallyImported(resolved, expression!!)) {
|
!isStaticallyImported(resolved, expression)) {
|
||||||
var member = resolved as PsiMember
|
var member = resolved as PsiMember
|
||||||
var result = Identifier(referencedName).toKotlin()
|
var result = Identifier(referencedName).toKotlin()
|
||||||
while(member.getContainingClass() != null) {
|
while(member.getContainingClass() != null) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public open class ExpressionVisitorForDirectObjectInheritors(converter: Converte
|
|||||||
}
|
}
|
||||||
else if (superMethodInvocation(methodExpression, "toString")) {
|
else if (superMethodInvocation(methodExpression, "toString")) {
|
||||||
myResult = DummyStringExpression(java.lang.String.format("getJavaClass<%s>.getName() + '@' + Integer.toHexString(hashCode())",
|
myResult = DummyStringExpression(java.lang.String.format("getJavaClass<%s>.getName() + '@' + Integer.toHexString(hashCode())",
|
||||||
ExpressionVisitor.getClassName(methodExpression))!!)
|
ExpressionVisitor.getClassName(methodExpression)))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
convertMethodCallExpression(expression!!)
|
convertMethodCallExpression(expression!!)
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public open class StatementVisitor(converter: Converter): ElementVisitor(convert
|
|||||||
null)
|
null)
|
||||||
if (initialization is PsiDeclarationStatement && initialization.getFirstChild() == initialization.getLastChild() &&
|
if (initialization is PsiDeclarationStatement && initialization.getFirstChild() == initialization.getLastChild() &&
|
||||||
condition != null && update != null && update.getChildren().size == 1 &&
|
condition != null && update != null && update.getChildren().size == 1 &&
|
||||||
(isPlusPlusExpression(update.getChildren()[0]!!)) && (operationTokenType == JavaTokenType.LT || operationTokenType == JavaTokenType.LE) &&
|
(isPlusPlusExpression(update.getChildren()[0])) && (operationTokenType == JavaTokenType.LT || operationTokenType == JavaTokenType.LE) &&
|
||||||
initialization.getFirstChild() != null && (initialization.getFirstChild() is PsiLocalVariable) &&
|
initialization.getFirstChild() != null && (initialization.getFirstChild() is PsiLocalVariable) &&
|
||||||
firstChild != null && firstChild.getNameIdentifier() != null && onceWritableIterator) {
|
firstChild != null && firstChild.getNameIdentifier() != null && onceWritableIterator) {
|
||||||
val end: Expression = getConverter().expressionToExpression((condition as PsiBinaryExpression).getROperand())
|
val end: Expression = getConverter().expressionToExpression((condition as PsiBinaryExpression).getROperand())
|
||||||
@@ -188,7 +188,7 @@ public open class StatementVisitor(converter: Converter): ElementVisitor(convert
|
|||||||
val catchBlocks = statement?.getCatchBlocks()!!
|
val catchBlocks = statement?.getCatchBlocks()!!
|
||||||
val catchBlockParameters = statement?.getCatchBlockParameters()!!
|
val catchBlockParameters = statement?.getCatchBlockParameters()!!
|
||||||
for (i in 0..catchBlocks.size - 1) {
|
for (i in 0..catchBlocks.size - 1) {
|
||||||
catches.add(CatchStatement(getConverter().parameterToParameter(catchBlockParameters[i]!!, true),
|
catches.add(CatchStatement(getConverter().parameterToParameter(catchBlockParameters[i], true),
|
||||||
getConverter().blockToBlock(catchBlocks[i], true)))
|
getConverter().blockToBlock(catchBlocks[i], true)))
|
||||||
}
|
}
|
||||||
myResult = TryStatement(getConverter().blockToBlock(statement?.getTryBlock(), true),
|
myResult = TryStatement(getConverter().blockToBlock(statement?.getTryBlock(), true),
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ public open class TypeVisitor(private val myConverter : Converter) : PsiTypeVisi
|
|||||||
for (p : PsiTypeParameter? in (resolve as PsiClass).getTypeParameters()) {
|
for (p : PsiTypeParameter? in (resolve as PsiClass).getTypeParameters()) {
|
||||||
val superTypes = p!!.getSuperTypes()
|
val superTypes = p!!.getSuperTypes()
|
||||||
val boundType : Type = (if (superTypes.size > 0)
|
val boundType : Type = (if (superTypes.size > 0)
|
||||||
ClassType(Identifier(getClassTypeName(superTypes[0]!!)),
|
ClassType(Identifier(getClassTypeName(superTypes[0])),
|
||||||
myConverter.typesToTypeList(superTypes[0]!!.getParameters()),
|
myConverter.typesToTypeList(superTypes[0].getParameters()),
|
||||||
true)
|
true)
|
||||||
else
|
else
|
||||||
StarProjectionType())
|
StarProjectionType())
|
||||||
@@ -101,11 +101,11 @@ public open class TypeVisitor(private val myConverter : Converter) : PsiTypeVisi
|
|||||||
|
|
||||||
public override fun visitWildcardType(wildcardType : PsiWildcardType?) : Type {
|
public override fun visitWildcardType(wildcardType : PsiWildcardType?) : Type {
|
||||||
if (wildcardType!!.isExtends()) {
|
if (wildcardType!!.isExtends()) {
|
||||||
myResult = OutProjectionType(myConverter.typeToType(wildcardType!!.getExtendsBound()))
|
myResult = OutProjectionType(myConverter.typeToType(wildcardType.getExtendsBound()))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (wildcardType!!.isSuper()) {
|
if (wildcardType.isSuper()) {
|
||||||
myResult = InProjectionType(myConverter.typeToType(wildcardType?.getSuperBound()))
|
myResult = InProjectionType(myConverter.typeToType(wildcardType.getSuperBound()))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myResult = StarProjectionType()
|
myResult = StarProjectionType()
|
||||||
|
|||||||
Reference in New Issue
Block a user