public JetTypeJetSignatureReader( JavaSemanticServices javaSemanticServices, JetStandardLibrary jetStandardLibrary, TypeVariableResolver typeVariableResolver) { this.javaSemanticServices = javaSemanticServices; this.javaDescriptorResolver = javaSemanticServices.getDescriptorResolver(); this.jetStandardLibrary = jetStandardLibrary; this.typeVariableResolver = typeVariableResolver; }
@Override public void visitClassType(String name, boolean nullable, boolean forceReal) { FqName ourName = new FqName( name.replace('/', '.').replace('$', '.') // TODO: not sure ); this.classDescriptor = null; if (!forceReal) { classDescriptor = javaSemanticServices .getTypeTransformer() .getKotlinAnalog(ourName, JavaTypeTransformer.TypeUsage.MEMBER_SIGNATURE_INVARIANT); } if (classDescriptor == null) { // TODO: this is the worst code in Kotlin project Matcher matcher = Pattern.compile("jet\\.Function(\\d+)").matcher(ourName.getFqName()); if (matcher.matches()) { classDescriptor = JetStandardClasses.getFunction(Integer.parseInt(matcher.group(1))); } } if (classDescriptor == null) { Matcher matcher = Pattern.compile("jet\\.Tuple(\\d+)").matcher(ourName.getFqName()); if (matcher.matches()) { classDescriptor = JetStandardClasses.getTuple(Integer.parseInt(matcher.group(1))); } } if (this.classDescriptor == null) { this.classDescriptor = javaDescriptorResolver.resolveClass(ourName, DescriptorSearchRule.INCLUDE_KOTLIN); } if (this.classDescriptor == null) { // TODO: report in to trace this.errorType = ErrorUtils.createErrorType("class not found by name: " + ourName); } this.nullable = nullable; this.typeArguments = new ArrayList<TypeProjection>(); }