cleanup
This commit is contained in:
@@ -198,7 +198,7 @@ public class Converter {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<Type> typesToNotNullableTypeList(PsiType[] types) {
|
||||
private static List<Type> typesToNotNullableTypeList(PsiType[] types) {
|
||||
List<Type> result = new LinkedList<Type>(typesToTypeList(types));
|
||||
for (Type p : result)
|
||||
p.setNullable(false);
|
||||
|
||||
@@ -12,9 +12,9 @@ import java.util.List;
|
||||
public class Class extends Node {
|
||||
String TYPE = "class";
|
||||
final Identifier myName;
|
||||
final List<Element> myTypeParameters;
|
||||
final List<Type> myExtendsTypes;
|
||||
final List<Type> myImplementsTypes;
|
||||
private final List<Element> myTypeParameters;
|
||||
private final List<Type> myExtendsTypes;
|
||||
private final List<Type> myImplementsTypes;
|
||||
final List<Class> myInnerClasses;
|
||||
final List<Function> myMethods;
|
||||
final List<Field> myFields;
|
||||
@@ -31,17 +31,17 @@ public class Class extends Node {
|
||||
|
||||
private boolean hasWhere() {
|
||||
for (Element t : myTypeParameters)
|
||||
if (t instanceof TypeParameter && ((TypeParameter)t).hasWhere())
|
||||
if (t instanceof TypeParameter && ((TypeParameter) t).hasWhere())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
String typeParameterWhereToKotlin() {
|
||||
if (hasWhere()) {
|
||||
List<String> wheres = new LinkedList<String >();
|
||||
List<String> wheres = new LinkedList<String>();
|
||||
for (Element t : myTypeParameters)
|
||||
if (t instanceof TypeParameter)
|
||||
wheres.add(((TypeParameter)t).getWhereToKotlin());
|
||||
wheres.add(((TypeParameter) t).getWhereToKotlin());
|
||||
return SPACE + "where" + SPACE + AstUtil.join(wheres, COMMA_WITH_SPACE) + SPACE;
|
||||
}
|
||||
return EMPTY;
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ClassType extends Type {
|
||||
private final Identifier myType;
|
||||
private List<Type> myParameters;
|
||||
private final List<Type> myParameters;
|
||||
|
||||
public ClassType(Identifier type, List<Type> parameters) {
|
||||
myType = type;
|
||||
|
||||
@@ -10,11 +10,10 @@ import java.util.List;
|
||||
*/
|
||||
public class ExpressionList extends Expression {
|
||||
private final List<Expression> myExpressions;
|
||||
private List<Type> myTypes; // TODO: add types to toKotlin
|
||||
|
||||
public ExpressionList(List<Expression> expressions, List<Type> types) {
|
||||
myExpressions = expressions;
|
||||
myTypes = types;
|
||||
List<Type> types1 = types;
|
||||
}
|
||||
|
||||
public ExpressionList(List<Expression> expressions) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
public class Function extends Node {
|
||||
private final Identifier myName;
|
||||
private final Type myType;
|
||||
private List<Element> myTypeParameters;
|
||||
private final List<Element> myTypeParameters;
|
||||
final Element myParams;
|
||||
private final Block myBlock;
|
||||
|
||||
@@ -30,17 +30,17 @@ public class Function extends Node {
|
||||
|
||||
private boolean hasWhere() {
|
||||
for (Element t : myTypeParameters)
|
||||
if (t instanceof TypeParameter && ((TypeParameter)t).hasWhere())
|
||||
if (t instanceof TypeParameter && ((TypeParameter) t).hasWhere())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
String typeParameterWhereToKotlin() {
|
||||
if (hasWhere()) {
|
||||
List<String> wheres = new LinkedList<String >();
|
||||
List<String> wheres = new LinkedList<String>();
|
||||
for (Element t : myTypeParameters)
|
||||
if (t instanceof TypeParameter)
|
||||
wheres.add(((TypeParameter)t).getWhereToKotlin());
|
||||
wheres.add(((TypeParameter) t).getWhereToKotlin());
|
||||
return SPACE + "where" + SPACE + AstUtil.join(wheres, COMMA_WITH_SPACE) + SPACE;
|
||||
}
|
||||
return EMPTY;
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.util.Set;
|
||||
* @author ignatov
|
||||
*/
|
||||
public abstract class Node implements INode {
|
||||
public static final String STAR = "*";
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
@@ -39,6 +37,7 @@ public abstract class Node implements INode {
|
||||
static final String IN = "in";
|
||||
static final String AT = "@";
|
||||
static final String BACKTICK = "`";
|
||||
static final String QUESTION = "?";
|
||||
static final String QUEST = "?";
|
||||
static final String COMMA_WITH_SPACE = "," + SPACE;
|
||||
static final String STAR = "*";
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author ignatov
|
||||
*/
|
||||
public abstract class Type extends Element {
|
||||
public static Type EMPTY_TYPE = new EmptyType();
|
||||
protected boolean myNullable = true;
|
||||
public static final Type EMPTY_TYPE = new EmptyType();
|
||||
private boolean myNullable = true;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -19,12 +19,12 @@ public abstract class Type extends Element {
|
||||
myNullable = nullable;
|
||||
}
|
||||
|
||||
public boolean isNullable() {
|
||||
boolean isNullable() {
|
||||
return myNullable;
|
||||
}
|
||||
|
||||
protected String isNullableStr() {
|
||||
return isNullable() ? QUESTION : EMPTY;
|
||||
String isNullableStr() {
|
||||
return isNullable() ? QUEST : EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jet.j2k.ast;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.j2k.util.AstUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,8 +8,8 @@ import java.util.List;
|
||||
* @author ignatov
|
||||
*/
|
||||
public class TypeParameter extends Element {
|
||||
private Identifier myName;
|
||||
private List<Type> myExtendsTypes;
|
||||
private final Identifier myName;
|
||||
private final List<Type> myExtendsTypes;
|
||||
|
||||
public TypeParameter(Identifier name, List<Type> extendsTypes) {
|
||||
myName = name;
|
||||
|
||||
@@ -6,17 +6,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author ignatov
|
||||
*/
|
||||
public class VarArg extends Type {
|
||||
private Type myType;
|
||||
private final Type myType;
|
||||
|
||||
public VarArg(Type type) {
|
||||
myType = type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Type getType() {
|
||||
return myType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
|
||||
Reference in New Issue
Block a user