From 3b77d337e819ad7477b8f0236fbf53198ae59484 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Wed, 19 Nov 2014 18:50:59 +0300 Subject: [PATCH] Renames "possibly nothing" to "probably nothing" --- .../jet/lang/psi/stubs/KotlinFunctionStub.java | 2 +- .../jet/lang/psi/stubs/KotlinPropertyStub.java | 2 +- .../psi/stubs/elements/JetFunctionElementType.java | 9 ++++----- .../psi/stubs/elements/JetPropertyElementType.java | 8 ++++---- .../jetbrains/jet/lang/psi/stubs/elements/Util.kt | 2 +- .../psi/stubs/impl/KotlinFunctionStubImpl.java | 10 +++++----- .../psi/stubs/impl/KotlinPropertyStubImpl.java | 10 +++++----- .../jet/lang/resolve/lazy/ElementResolver.java | 4 ++-- .../lang/resolve/lazy/PartialBodyResolveFilter.kt | 10 +++++----- ...e.kt => ProbablyNothingCallableNamesService.kt} | 4 ++-- .../jet/plugin/project/ResolveElementCache.java | 14 +++++++------- ... JetProbablyNothingFunctionShortNameIndex.java} | 10 +++++----- ... JetProbablyNothingPropertyShortNameIndex.java} | 10 +++++----- .../jet/plugin/stubindex/StubIndexServiceImpl.java | 8 ++++---- idea/src/META-INF/plugin.xml | 4 ++-- 15 files changed, 53 insertions(+), 54 deletions(-) rename idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/{PossiblyNothingCallableNamesService.kt => ProbablyNothingCallableNamesService.kt} (88%) rename idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/{JetPossiblyNothingFunctionShortNameIndex.java => JetProbablyNothingFunctionShortNameIndex.java} (80%) rename idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/{JetPossiblyNothingPropertyShortNameIndex.java => JetProbablyNothingPropertyShortNameIndex.java} (79%) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/KotlinFunctionStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/KotlinFunctionStub.java index e4dc1eb2054..1bbe37b68ee 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/KotlinFunctionStub.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/KotlinFunctionStub.java @@ -29,5 +29,5 @@ public interface KotlinFunctionStub extends KotlinStubWithFqName { boolean hasReceiverTypeRef(); boolean hasReturnTypeRef(); - boolean isPossiblyNothingType(); + boolean isProbablyNothingType(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java index 4378d6479bf..c7f3e7afc7a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java @@ -44,10 +44,9 @@ public class JetFunctionElementType extends JetStubElementType private final boolean hasBlockBody; private final boolean hasBody; private final boolean hasTypeParameterListBeforeFunctionName; - private final boolean possiblyNothingType; + private final boolean probablyNothingType; public KotlinFunctionStubImpl( @NotNull StubElement parent, @@ -45,7 +45,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl boolean hasBlockBody, boolean hasBody, boolean hasTypeParameterListBeforeFunctionName, - boolean possiblyNothingType + boolean probablyNothingType ) { super(parent, JetStubElementTypes.FUNCTION); @@ -60,7 +60,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl this.hasBlockBody = hasBlockBody; this.hasBody = hasBody; this.hasTypeParameterListBeforeFunctionName = hasTypeParameterListBeforeFunctionName; - this.possiblyNothingType = possiblyNothingType; + this.probablyNothingType = probablyNothingType; } @Override @@ -100,7 +100,7 @@ public class KotlinFunctionStubImpl extends KotlinStubBaseImpl } @Override - public boolean isPossiblyNothingType() { - return possiblyNothingType; + public boolean isProbablyNothingType() { + return probablyNothingType; } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/KotlinPropertyStubImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/KotlinPropertyStubImpl.java index 43a42895b9b..f56fe0cfc26 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/KotlinPropertyStubImpl.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/impl/KotlinPropertyStubImpl.java @@ -33,7 +33,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl impl private final boolean hasInitializer; private final boolean hasReceiverTypeRef; private final boolean hasReturnTypeRef; - private final boolean possiblyNothingType; + private final boolean probablyNothingType; private final FqName fqName; public KotlinPropertyStubImpl( @@ -46,7 +46,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl impl boolean hasInitializer, boolean hasReceiverTypeRef, boolean hasReturnTypeRef, - boolean possiblyNothingType, + boolean probablyNothingType, @Nullable FqName fqName ) { super(parent, JetStubElementTypes.PROPERTY); @@ -66,7 +66,7 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl impl this.hasInitializer = hasInitializer; this.hasReceiverTypeRef = hasReceiverTypeRef; this.hasReturnTypeRef = hasReturnTypeRef; - this.possiblyNothingType = possiblyNothingType; + this.probablyNothingType = probablyNothingType; this.fqName = fqName; } @@ -106,8 +106,8 @@ public class KotlinPropertyStubImpl extends KotlinStubBaseImpl impl } @Override - public boolean isPossiblyNothingType() { - return possiblyNothingType; + public boolean isProbablyNothingType() { + return probablyNothingType; } @Nullable diff --git a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ElementResolver.java b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ElementResolver.java index e4d508c9d69..319f5ac8e98 100644 --- a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ElementResolver.java +++ b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ElementResolver.java @@ -70,7 +70,7 @@ public abstract class ElementResolver { } @NotNull - protected PossiblyNothingCallableNamesService possiblyNothingCallableNamesService() { + protected ProbablyNothingCallableNamesService probablyNothingCallableNamesService() { return DefaultNothingCallableNamesService.INSTANCE$; } @@ -101,7 +101,7 @@ public abstract class ElementResolver { boolean inBody = body != null && PsiTreeUtil.isAncestor(body, jetElement, false); Function1 filter; if (inBody) { - filter = new PartialBodyResolveFilter(jetElement, body, possiblyNothingCallableNamesService()); + filter = new PartialBodyResolveFilter(jetElement, body, probablyNothingCallableNamesService()); } else { // do as less as possible body-resolve filter = new Function1() { diff --git a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt index 16c4bb03cc6..4b5c98f3f5d 100644 --- a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt +++ b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PartialBodyResolveFilter.kt @@ -30,13 +30,13 @@ import org.jetbrains.jet.lang.psi.psiUtil.isAncestor class PartialBodyResolveFilter( elementToResolve: JetElement, private val body: JetExpression, - possiblyNothingCallableNamesService: PossiblyNothingCallableNamesService + probablyNothingCallableNamesService: ProbablyNothingCallableNamesService ) : (JetElement) -> Boolean { private val statementsToResolve = HashSet() private val processedBlocks = HashSet() - private val possiblyNothingFunctionNames = possiblyNothingCallableNamesService.functionNames() - private val possiblyNothingPropertyNames = possiblyNothingCallableNamesService.propertyNames() + private val nothingFunctionNames = probablyNothingCallableNamesService.functionNames() + private val nothingPropertyNames = probablyNothingCallableNamesService.propertyNames() ;{ assert(body.isAncestor(elementToResolve, strict = false)) @@ -286,7 +286,7 @@ class PartialBodyResolveFilter( override fun visitCallExpression(expression: JetCallExpression) { val name = (expression.getCalleeExpression() as? JetSimpleNameExpression)?.getReferencedName() - if (name != null && name in possiblyNothingFunctionNames) { + if (name != null && name in nothingFunctionNames) { result.add(expression) } super.visitCallExpression(expression) @@ -294,7 +294,7 @@ class PartialBodyResolveFilter( override fun visitSimpleNameExpression(expression: JetSimpleNameExpression) { val name = expression.getReferencedName() - if (name in possiblyNothingPropertyNames) { + if (name in nothingPropertyNames) { result.add(expression) } } diff --git a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PossiblyNothingCallableNamesService.kt b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ProbablyNothingCallableNamesService.kt similarity index 88% rename from idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PossiblyNothingCallableNamesService.kt rename to idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ProbablyNothingCallableNamesService.kt index 7a4b5fb239d..564cd82dd6d 100644 --- a/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/PossiblyNothingCallableNamesService.kt +++ b/idea/ide-common/src/org/jetbrains/jet/lang/resolve/lazy/ProbablyNothingCallableNamesService.kt @@ -16,12 +16,12 @@ package org.jetbrains.jet.lang.resolve.lazy -public trait PossiblyNothingCallableNamesService { +public trait ProbablyNothingCallableNamesService { public fun functionNames(): Set public fun propertyNames(): Set } -public object DefaultNothingCallableNamesService : PossiblyNothingCallableNamesService { +public object DefaultNothingCallableNamesService : ProbablyNothingCallableNamesService { private val hardcodedNames = setOf("error") override fun functionNames() = hardcodedNames diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/project/ResolveElementCache.java b/idea/idea-analysis/src/org/jetbrains/jet/plugin/project/ResolveElementCache.java index 4bad7245351..a7d534083cf 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/project/ResolveElementCache.java +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/project/ResolveElementCache.java @@ -30,10 +30,10 @@ import org.jetbrains.jet.lang.resolve.AdditionalCheckerProvider; import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.lazy.DefaultNothingCallableNamesService; import org.jetbrains.jet.lang.resolve.lazy.ElementResolver; -import org.jetbrains.jet.lang.resolve.lazy.PossiblyNothingCallableNamesService; +import org.jetbrains.jet.lang.resolve.lazy.ProbablyNothingCallableNamesService; import org.jetbrains.jet.lang.resolve.lazy.ResolveSession; -import org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingFunctionShortNameIndex; -import org.jetbrains.jet.plugin.stubindex.JetPossiblyNothingPropertyShortNameIndex; +import org.jetbrains.jet.plugin.stubindex.JetProbablyNothingFunctionShortNameIndex; +import org.jetbrains.jet.plugin.stubindex.JetProbablyNothingPropertyShortNameIndex; import org.jetbrains.jet.storage.LazyResolveStorageManager; import org.jetbrains.jet.storage.MemoizedFunctionToNotNull; @@ -87,14 +87,14 @@ public class ResolveElementCache extends ElementResolver { @NotNull @Override - protected PossiblyNothingCallableNamesService possiblyNothingCallableNamesService() { - return new PossiblyNothingCallableNamesService() { + protected ProbablyNothingCallableNamesService probablyNothingCallableNamesService() { + return new ProbablyNothingCallableNamesService() { @NotNull @Override public Set functionNames() { // we have to add hardcoded-names until we have Kotlin compiled classes in caches Set hardcodedNames = DefaultNothingCallableNamesService.INSTANCE$.functionNames(); - Collection indexedNames = JetPossiblyNothingFunctionShortNameIndex.getInstance().getAllKeys(project); + Collection indexedNames = JetProbablyNothingFunctionShortNameIndex.getInstance().getAllKeys(project); Set set = new HashSet(hardcodedNames.size() + indexedNames.size()); set.addAll(hardcodedNames); set.addAll(indexedNames); @@ -105,7 +105,7 @@ public class ResolveElementCache extends ElementResolver { @NotNull @Override public Set propertyNames() { - return new HashSet(JetPossiblyNothingPropertyShortNameIndex.getInstance().getAllKeys(project)); + return new HashSet(JetProbablyNothingPropertyShortNameIndex.getInstance().getAllKeys(project)); } }; } diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingFunctionShortNameIndex.java b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingFunctionShortNameIndex.java similarity index 80% rename from idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingFunctionShortNameIndex.java rename to idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingFunctionShortNameIndex.java index 20e18532a5f..9933567385a 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingFunctionShortNameIndex.java +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingFunctionShortNameIndex.java @@ -25,16 +25,16 @@ import org.jetbrains.jet.lang.psi.JetNamedFunction; import java.util.Collection; -public class JetPossiblyNothingFunctionShortNameIndex extends StringStubIndexExtension { - private static final StubIndexKey KEY = KotlinIndexUtil.createIndexKey(JetPossiblyNothingFunctionShortNameIndex.class); +public class JetProbablyNothingFunctionShortNameIndex extends StringStubIndexExtension { + private static final StubIndexKey KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingFunctionShortNameIndex.class); - private static final JetPossiblyNothingFunctionShortNameIndex ourInstance = new JetPossiblyNothingFunctionShortNameIndex(); + private static final JetProbablyNothingFunctionShortNameIndex ourInstance = new JetProbablyNothingFunctionShortNameIndex(); - public static JetPossiblyNothingFunctionShortNameIndex getInstance() { + public static JetProbablyNothingFunctionShortNameIndex getInstance() { return ourInstance; } - private JetPossiblyNothingFunctionShortNameIndex() {} + private JetProbablyNothingFunctionShortNameIndex() {} @NotNull @Override diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingPropertyShortNameIndex.java b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingPropertyShortNameIndex.java similarity index 79% rename from idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingPropertyShortNameIndex.java rename to idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingPropertyShortNameIndex.java index d51bb4639d4..e23836017d1 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetPossiblyNothingPropertyShortNameIndex.java +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/JetProbablyNothingPropertyShortNameIndex.java @@ -25,16 +25,16 @@ import org.jetbrains.jet.lang.psi.JetProperty; import java.util.Collection; -public class JetPossiblyNothingPropertyShortNameIndex extends StringStubIndexExtension { - private static final StubIndexKey KEY = KotlinIndexUtil.createIndexKey(JetPossiblyNothingPropertyShortNameIndex.class); +public class JetProbablyNothingPropertyShortNameIndex extends StringStubIndexExtension { + private static final StubIndexKey KEY = KotlinIndexUtil.createIndexKey(JetProbablyNothingPropertyShortNameIndex.class); - private static final JetPossiblyNothingPropertyShortNameIndex ourInstance = new JetPossiblyNothingPropertyShortNameIndex(); + private static final JetProbablyNothingPropertyShortNameIndex ourInstance = new JetProbablyNothingPropertyShortNameIndex(); - public static JetPossiblyNothingPropertyShortNameIndex getInstance() { + public static JetProbablyNothingPropertyShortNameIndex getInstance() { return ourInstance; } - private JetPossiblyNothingPropertyShortNameIndex() {} + private JetProbablyNothingPropertyShortNameIndex() {} @NotNull @Override diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java index 549538e967c..98c51575f56 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/stubindex/StubIndexServiceImpl.java @@ -114,8 +114,8 @@ public class StubIndexServiceImpl implements StubIndexService { } sink.occurrence(JetFunctionShortNameIndex.getInstance().getKey(), name); - if (stub.isPossiblyNothingType()) { - sink.occurrence(JetPossiblyNothingFunctionShortNameIndex.getInstance().getKey(), name); + if (stub.isProbablyNothingType()) { + sink.occurrence(JetProbablyNothingFunctionShortNameIndex.getInstance().getKey(), name); } } // can have special fq name in case of syntactically incorrect function with no name @@ -141,8 +141,8 @@ public class StubIndexServiceImpl implements StubIndexService { sink.occurrence(JetPropertyShortNameIndex.getInstance().getKey(), name); - if (stub.isPossiblyNothingType()) { - sink.occurrence(JetPossiblyNothingPropertyShortNameIndex.getInstance().getKey(), name); + if (stub.isProbablyNothingType()) { + sink.occurrence(JetProbablyNothingPropertyShortNameIndex.getInstance().getKey(), name); } } // can have special fq name in case of syntactically incorrect function with no name diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index cabfe4506f5..c86ddf539a9 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -395,8 +395,8 @@ - - + +