Merge with branch "AnalyzerJS"

This commit is contained in:
Pavel V. Talanov
2012-04-09 17:08:57 +04:00
parent a030576052
commit 7dd0e50bcd
10 changed files with 70 additions and 44 deletions
@@ -35,6 +35,7 @@ import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetObjectDeclaration; import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
import org.jetbrains.jet.lang.psi.JetObjectLiteralExpression; import org.jetbrains.jet.lang.psi.JetObjectLiteralExpression;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import org.jetbrains.jet.utils.Progress; import org.jetbrains.jet.utils.Progress;
import java.util.List; import java.util.List;
@@ -51,15 +52,18 @@ public class GenerationState {
public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) { public GenerationState(Project project, ClassBuilderFactory builderFactory, AnalyzeExhaust analyzeExhaust, List<JetFile> files) {
this(project, builderFactory, Progress.DEAF, analyzeExhaust, files); this(project, builderFactory, Progress.DEAF, analyzeExhaust, files, CompilerSpecialMode.REGULAR);
} }
public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress, @NotNull AnalyzeExhaust exhaust, @NotNull List<JetFile> files) { public GenerationState(Project project, ClassBuilderFactory builderFactory, Progress progress,
@NotNull AnalyzeExhaust exhaust, @NotNull List<JetFile> files, @NotNull CompilerSpecialMode compilerSpecialMode) {
this.project = project; this.project = project;
this.progress = progress; this.progress = progress;
this.analyzeExhaust = exhaust; this.analyzeExhaust = exhaust;
this.files = files; this.files = files;
this.injector = new InjectorForJvmCodegen(analyzeExhaust.getStandardLibrary(), analyzeExhaust.getBindingContext(), this.files, project, this, builderFactory); this.injector = new InjectorForJvmCodegen(
analyzeExhaust.getStandardLibrary(), analyzeExhaust.getBindingContext(),
this.files, project, compilerSpecialMode, this, builderFactory);
} }
@NotNull @NotNull
@@ -84,11 +88,11 @@ public class GenerationState {
} }
public ClassBuilder forClassImplementation(ClassDescriptor aClass) { public ClassBuilder forClassImplementation(ClassDescriptor aClass) {
return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.IMPLEMENTATION).getInternalName() + ".class"); return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), MapTypeMode.IMPL).getInternalName() + ".class");
} }
public ClassBuilder forTraitImplementation(ClassDescriptor aClass) { public ClassBuilder forTraitImplementation(ClassDescriptor aClass) {
return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), OwnerKind.TRAIT_IMPL).getInternalName() + ".class"); return getFactory().newVisitor(getInjector().getJetTypeMapper().mapType(aClass.getDefaultType(), MapTypeMode.TRAIT_IMPL).getInternalName() + ".class");
} }
public Pair<String, ClassBuilder> forAnonymousSubclass(JetExpression expression) { public Pair<String, ClassBuilder> forAnonymousSubclass(JetExpression expression) {
@@ -71,11 +71,8 @@ public class CompileSession {
private final CompilerDependencies compilerDependencies; private final CompilerDependencies compilerDependencies;
private AnalyzeExhaust bindingContext; private AnalyzeExhaust bindingContext;
public CompileSession(JetCoreEnvironment environment, public CompileSession(JetCoreEnvironment environment, MessageRenderer messageRenderer, PrintStream errorStream, boolean verbose,
MessageRenderer messageRenderer, @NotNull CompilerDependencies compilerDependencies) {
PrintStream errorStream,
boolean verbose,
CompilerSpecialMode mode) {
this.environment = environment; this.environment = environment;
this.messageRenderer = messageRenderer; this.messageRenderer = messageRenderer;
this.errorStream = errorStream; this.errorStream = errorStream;
@@ -180,7 +177,8 @@ public class CompileSession {
Predicate<PsiFile> filesToAnalyzeCompletely = Predicate<PsiFile> filesToAnalyzeCompletely =
stubs ? Predicates.<PsiFile>alwaysFalse() : Predicates.<PsiFile>alwaysTrue(); stubs ? Predicates.<PsiFile>alwaysFalse() : Predicates.<PsiFile>alwaysTrue();
bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration( bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
environment.getProject(), sourceFiles, filesToAnalyzeCompletely, JetControlFlowDataTraceFactory.EMPTY, compilerSpecialMode); environment.getProject(), sourceFiles, filesToAnalyzeCompletely, JetControlFlowDataTraceFactory.EMPTY,
compilerDependencies);
for (Diagnostic diagnostic : bindingContext.getBindingContext().getDiagnostics()) { for (Diagnostic diagnostic : bindingContext.getBindingContext().getDiagnostics()) {
reportDiagnostic(messageCollector, diagnostic); reportDiagnostic(messageCollector, diagnostic);
@@ -36,6 +36,8 @@ import org.jetbrains.jet.lang.types.lang.JetStandardLibrary;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import static org.jetbrains.jet.lang.resolve.java.CompilerDependencies.compilerDependenciesForProduction;
/** /**
* @author abreslav * @author abreslav
*/ */
@@ -49,56 +51,61 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
@Override @Override
@NotNull @NotNull
public AnalyzeExhaust analyzeFiles(@NotNull Project project, public AnalyzeExhaust analyzeFiles(@NotNull Project project,
@NotNull Collection<JetFile> files, @NotNull Collection<JetFile> files,
@NotNull Predicate<PsiFile> filesToAnalyzeCompletely, @NotNull Predicate<PsiFile> filesToAnalyzeCompletely,
@NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) { @NotNull JetControlFlowDataTraceFactory flowDataTraceFactory) {
return analyzeFilesWithJavaIntegration(project, files, filesToAnalyzeCompletely, flowDataTraceFactory, CompilerSpecialMode.REGULAR); return analyzeFilesWithJavaIntegration(project, files, filesToAnalyzeCompletely, flowDataTraceFactory,
compilerDependenciesForProduction(CompilerSpecialMode.REGULAR));
} }
public static AnalyzeExhaust analyzeOneFileWithJavaIntegrationAndCheckForErrors( public static AnalyzeExhaust analyzeOneFileWithJavaIntegrationAndCheckForErrors(
JetFile file, JetControlFlowDataTraceFactory flowDataTraceFactory) { JetFile file, JetControlFlowDataTraceFactory flowDataTraceFactory,
@NotNull CompilerSpecialMode compilerSpecialMode, @NotNull CompilerDependencies compilerDependencies) {
AnalyzingUtils.checkForSyntacticErrors(file); AnalyzingUtils.checkForSyntacticErrors(file);
AnalyzeExhaust analyzeExhaust = analyzeOneFileWithJavaIntegration(file, flowDataTraceFactory); AnalyzeExhaust analyzeExhaust = analyzeOneFileWithJavaIntegration(file, flowDataTraceFactory, compilerDependencies);
AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext()); AnalyzingUtils.throwExceptionOnErrors(analyzeExhaust.getBindingContext());
return analyzeExhaust; return analyzeExhaust;
} }
public static AnalyzeExhaust analyzeOneFileWithJavaIntegration(JetFile file, JetControlFlowDataTraceFactory flowDataTraceFactory) { public static AnalyzeExhaust analyzeOneFileWithJavaIntegration(
JetFile file, JetControlFlowDataTraceFactory flowDataTraceFactory,
@NotNull CompilerDependencies compilerDependencies) {
return analyzeFilesWithJavaIntegration(file.getProject(), Collections.singleton(file), return analyzeFilesWithJavaIntegration(file.getProject(), Collections.singleton(file),
Predicates.<PsiFile>alwaysTrue(), flowDataTraceFactory, CompilerSpecialMode.REGULAR); Predicates.<PsiFile>alwaysTrue(), flowDataTraceFactory, compilerDependencies);
} }
public static AnalyzeExhaust analyzeFilesWithJavaIntegration( public static AnalyzeExhaust analyzeFilesWithJavaIntegration(
Project project, Collection<JetFile> files, Predicate<PsiFile> filesToAnalyzeCompletely, Project project, Collection<JetFile> files, Predicate<PsiFile> filesToAnalyzeCompletely,
JetControlFlowDataTraceFactory flowDataTraceFactory, JetControlFlowDataTraceFactory flowDataTraceFactory,
CompilerSpecialMode compilerSpecialMode) { @NotNull CompilerDependencies compilerDependencies) {
BindingTraceContext bindingTraceContext = new BindingTraceContext(); BindingTraceContext bindingTraceContext = new BindingTraceContext();
final ModuleDescriptor owner = new ModuleDescriptor("<module>"); final ModuleDescriptor owner = new ModuleDescriptor("<module>");
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters( TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
filesToAnalyzeCompletely, false, false); filesToAnalyzeCompletely, false, false);
InjectorForTopDownAnalyzerForJvm injector = new InjectorForTopDownAnalyzerForJvm( InjectorForTopDownAnalyzerForJvm injector = new InjectorForTopDownAnalyzerForJvm(
project, topDownAnalysisParameters, project, topDownAnalysisParameters,
new ObservableBindingTrace(bindingTraceContext), owner, flowDataTraceFactory, new ObservableBindingTrace(bindingTraceContext), owner, flowDataTraceFactory,
compilerSpecialMode); compilerDependencies);
injector.getTopDownAnalyzer().analyzeFiles(files); injector.getTopDownAnalyzer().analyzeFiles(files);
return new AnalyzeExhaust(bindingTraceContext.getBindingContext(), JetStandardLibrary.getInstance()); return new AnalyzeExhaust(bindingTraceContext.getBindingContext(), JetStandardLibrary.getInstance());
} }
public static AnalyzeExhaust shallowAnalyzeFiles(Collection<JetFile> files) { public static AnalyzeExhaust shallowAnalyzeFiles(Collection<JetFile> files,
@NotNull CompilerSpecialMode compilerSpecialMode, @NotNull CompilerDependencies compilerDependencies) {
assert files.size() > 0; assert files.size() > 0;
Project project = files.iterator().next().getProject(); Project project = files.iterator().next().getProject();
return analyzeFilesWithJavaIntegration(project, files, Predicates.<PsiFile>alwaysFalse(), return analyzeFilesWithJavaIntegration(project, files, Predicates.<PsiFile>alwaysFalse(),
JetControlFlowDataTraceFactory.EMPTY, CompilerSpecialMode.REGULAR); JetControlFlowDataTraceFactory.EMPTY, compilerDependencies);
} }
} }
@@ -17,6 +17,7 @@
package org.jetbrains.jet.codegen; package org.jetbrains.jet.codegen;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.analyzer.AnalyzeExhaust; import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory; import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
@@ -22,13 +22,13 @@ import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.JetLiteFixture; import org.jetbrains.jet.JetLiteFixture;
import org.jetbrains.jet.JetTestCaseBuilder; import org.jetbrains.jet.JetTestCaseBuilder;
import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory; import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetVisitorVoid; import org.jetbrains.jet.lang.psi.JetVisitorVoid;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.java.AnalyzeExhaust;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode; import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.analyzer.AnalyzeExhaust; import org.jetbrains.jet.analyzer.AnalyzeExhaust;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory; import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
@@ -245,6 +246,9 @@ public abstract class ExpectedResolveData {
assert expected != null : "No declaration for " + name; assert expected != null : "No declaration for " + name;
PsiElement actual = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, reference); PsiElement actual = BindingContextUtils.resolveToDeclarationPsiElement(bindingContext, reference);
if (actual instanceof JetSimpleNameExpression) {
actual = ((JetSimpleNameExpression)actual).getIdentifier();
}
String actualName = null; String actualName = null;
if (actual != null) { if (actual != null) {
@@ -16,6 +16,7 @@
package org.jetbrains.jet.types; package org.jetbrains.jet.types;
import org.jetbrains.jet.CompileCompilerDependenciesTest;
import org.jetbrains.jet.JetLiteFixture; import org.jetbrains.jet.JetLiteFixture;
import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.JetTestUtils;
import org.jetbrains.jet.analyzer.AnalyzeExhaust; import org.jetbrains.jet.analyzer.AnalyzeExhaust;
@@ -26,6 +27,7 @@ import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorResolver; import org.jetbrains.jet.lang.resolve.DescriptorResolver;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler; import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
@@ -63,9 +65,10 @@ public class JetDefaultModalityModifiersTest extends JetLiteFixture {
List<JetDeclaration> declarations = file.getDeclarations(); List<JetDeclaration> declarations = file.getDeclarations();
JetDeclaration aClass = declarations.get(0); JetDeclaration aClass = declarations.get(0);
assert aClass instanceof JetClass; assert aClass instanceof JetClass;
AnalyzeExhaust bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file, JetControlFlowDataTraceFactory.EMPTY); AnalyzeExhaust bindingContext = AnalyzerFacadeForJVM.analyzeOneFileWithJavaIntegration(file,
DeclarationDescriptor classDescriptor = JetControlFlowDataTraceFactory.EMPTY,
bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass); CompileCompilerDependenciesTest.compilerDependenciesForTests(CompilerSpecialMode.REGULAR));
DeclarationDescriptor classDescriptor = bindingContext.getBindingContext().get(BindingContext.DECLARATION_TO_DESCRIPTOR, aClass);
WritableScopeImpl scope = new WritableScopeImpl(libraryScope, root, RedeclarationHandler.DO_NOTHING); WritableScopeImpl scope = new WritableScopeImpl(libraryScope, root, RedeclarationHandler.DO_NOTHING);
assert classDescriptor instanceof ClassifierDescriptor; assert classDescriptor instanceof ClassifierDescriptor;
scope.addClassifierDescriptor((ClassifierDescriptor) classDescriptor); scope.addClassifierDescriptor((ClassifierDescriptor) classDescriptor);
@@ -16,6 +16,7 @@
package org.jetbrains.jet.plugin.libraries; package org.jetbrains.jet.plugin.libraries;
import com.google.common.base.Predicates;
import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.OrderEntry; import com.intellij.openapi.roots.OrderEntry;
@@ -32,17 +33,22 @@ import com.intellij.psi.util.PsiTreeUtil;
import jet.Tuple2; import jet.Tuple2;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.FqName; import org.jetbrains.jet.lang.resolve.FqName;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM; import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.CompilerDependencies;
import org.jetbrains.jet.lang.resolve.java.CompilerSpecialMode;
import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor; import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.plugin.project.AnalyzeSingleFileUtil; import org.jetbrains.jet.plugin.project.AnalyzeSingleFileUtil;
import org.jetbrains.jet.plugin.project.AnalyzerFacadeProvider;
import org.jetbrains.jet.plugin.project.WholeProjectAnalyzerFacade;
import org.jetbrains.jet.resolve.DescriptorRenderer; import org.jetbrains.jet.resolve.DescriptorRenderer;
import org.jetbrains.jet.util.slicedmap.WritableSlice; import org.jetbrains.jet.util.slicedmap.ReadOnlySlice;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@@ -59,19 +65,22 @@ public class JetSourceNavigationHelper {
@Nullable @Nullable
private static<D extends ClassOrNamespaceDescriptor> Tuple2<BindingContext, D> private static<D extends ClassOrNamespaceDescriptor> Tuple2<BindingContext, D>
getBindingContextAndClassOrNamespaceDescriptor(@NotNull WritableSlice<FqName, D> slice, getBindingContextAndClassOrNamespaceDescriptor(@NotNull ReadOnlySlice<FqName, D> slice,
@NotNull JetDeclaration declaration, @NotNull JetDeclaration declaration,
@Nullable FqName fqName) { @Nullable FqName fqName) {
if (fqName == null || DumbService.isDumb(declaration.getProject())) { if (fqName == null || DumbService.isDumb(declaration.getProject())) {
return null; return null;
} }
final Project project = declaration.getProject();
final List<JetFile> libraryFiles = findAllSourceFilesWhichContainIdentifier(declaration); final List<JetFile> libraryFiles = findAllSourceFilesWhichContainIdentifier(declaration);
for (JetFile libraryFile : libraryFiles) { BindingContext bindingContext = AnalyzerFacadeProvider.getAnalyzerFacadeForProject(project).analyzeFiles(
BindingContext bindingContext = AnalyzeSingleFileUtil.getContextForSingleFile(libraryFile); project,
D descriptor = bindingContext.get(slice, fqName); libraryFiles,
if (descriptor != null) { Predicates.<PsiFile>alwaysTrue(),
return new Tuple2<BindingContext, D>(bindingContext, descriptor); JetControlFlowDataTraceFactory.EMPTY).getBindingContext();
} D descriptor = bindingContext.get(slice, fqName);
if (descriptor != null) {
return new Tuple2<BindingContext, D>(bindingContext, descriptor);
} }
return null; return null;
} }
@@ -37,6 +37,7 @@ import org.jetbrains.jet.lexer.JetKeywordToken;
import org.jetbrains.jet.lexer.JetToken; import org.jetbrains.jet.lexer.JetToken;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
import org.jetbrains.jet.plugin.JetBundle; import org.jetbrains.jet.plugin.JetBundle;
import org.jetbrains.jet.plugin.project.AnalyzeSingleFileUtil;
/** /**
* @author svtk * @author svtk
@@ -73,8 +74,7 @@ public class ChangeVisibilityModifierFix extends JetIntentionAction<JetModifierL
} }
private JetKeywordToken findVisibilityChangeTo(JetFile file) { private JetKeywordToken findVisibilityChangeTo(JetFile file) {
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFileWithCache(file, AnalyzerFacadeForJVM.SINGLE_DECLARATION_PROVIDER, BindingContext bindingContext = AnalyzeSingleFileUtil.getContextForSingleFile(file);
CompilerSpecialMode.REGULAR, CompilerDependencies.compilerDependenciesForProduction(CompilerSpecialMode.REGULAR)).getBindingContext();
DeclarationDescriptor descriptor; DeclarationDescriptor descriptor;
if (element instanceof JetParameter) { if (element instanceof JetParameter) {
descriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, element); descriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, element);
@@ -153,8 +153,8 @@ public class JetNameSuggester {
private static void addCamelNames(ArrayList<String> result, String name, JetNameValidator validator) { private static void addCamelNames(ArrayList<String> result, String name, JetNameValidator validator) {
if (name == "") return; if (name == "") return;
String s = deleteNonLetterFromString(name); String s = deleteNonLetterFromString(name);
if (s.startsWith("get") || s.startsWith("set")) s = s.substring(0, 3); if (s.startsWith("get") || s.startsWith("set")) s = s.substring(3);
else if (s.startsWith("is")) s = s.substring(0, 2); else if (s.startsWith("is")) s = s.substring(2);
for (int i = 0; i < s.length(); ++i) { for (int i = 0; i < s.length(); ++i) {
if (i == 0) { if (i == 0) {
addName(result, StringUtil.decapitalize(s), validator); addName(result, StringUtil.decapitalize(s), validator);