From 0229e725ab3eeb39997555fff88611e36a625bf8 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Wed, 18 Jan 2012 12:03:23 +0400 Subject: [PATCH] read class data: resolve Function* types --- .../java/JetTypeJetSignatureReader.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java index d45e3db6c8f..c25d29a9360 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/JetTypeJetSignatureReader.java @@ -17,6 +17,8 @@ import org.jetbrains.jet.rt.signature.JetSignatureVisitor; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * @author Stepan Koltsov @@ -74,11 +76,27 @@ public abstract class JetTypeJetSignatureReader extends JetSignatureExceptionsAd String ourName = name.replace('/', '.'); this.classDescriptor = this.javaSemanticServices.getTypeTransformer().getPrimitiveWrappersClassDescriptorMap().get(ourName); - + if (this.classDescriptor == null && ourName.equals("java.lang.Object")) { this.classDescriptor = JetStandardClasses.getAny(); } + if (classDescriptor == null) { + // TODO: this is the worst code in Kotlin project + Matcher matcher = Pattern.compile("jet\\.Function(\\d+)").matcher(ourName); + if (matcher.matches()) { + classDescriptor = JetStandardClasses.getFunction(Integer.parseInt(matcher.group(1))); + } + } + + if (classDescriptor == null) { + Matcher matcher = Pattern.compile("jet\\.Tuple(\\d+)").matcher(ourName); + if (matcher.matches()) { + classDescriptor = JetStandardClasses.getTuple(Integer.parseInt(matcher.group(1))); + } + } + + if (this.classDescriptor == null) { this.classDescriptor = javaDescriptorResolver.resolveClass(ourName); }