Replace OBJECT$ usages in code and test data

This commit is contained in:
Pavel V. Talanov
2015-03-25 15:49:16 +03:00
parent ed218c473a
commit 9d618ca767
13 changed files with 31 additions and 31 deletions
@@ -1908,7 +1908,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (descriptor instanceof PropertyDescriptor) { if (descriptor instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor; PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
Collection<ExpressionCodegenExtension> codegenExtensions = ExpressionCodegenExtension.OBJECT$.getInstances(state.getProject()); Collection<ExpressionCodegenExtension> codegenExtensions = ExpressionCodegenExtension.Companion.getInstances(state.getProject());
if (!codegenExtensions.isEmpty() && resolvedCall != null) { if (!codegenExtensions.isEmpty() && resolvedCall != null) {
ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v); ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v);
JetType returnType = propertyDescriptor.getReturnType(); JetType returnType = propertyDescriptor.getReturnType();
@@ -2348,7 +2348,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
if (!(resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor)) { // otherwise already if (!(resolvedCall.getResultingDescriptor() instanceof ConstructorDescriptor)) { // otherwise already
receiver = StackValue.receiver(resolvedCall, receiver, this, callableMethod); receiver = StackValue.receiver(resolvedCall, receiver, this, callableMethod);
Collection<ExpressionCodegenExtension> codegenExtensions = ExpressionCodegenExtension.OBJECT$.getInstances(state.getProject()); Collection<ExpressionCodegenExtension> codegenExtensions = ExpressionCodegenExtension.Companion.getInstances(state.getProject());
if (!codegenExtensions.isEmpty()) { if (!codegenExtensions.isEmpty()) {
ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v); ExpressionCodegenExtension.Context context = new ExpressionCodegenExtension.Context(typeMapper, v);
for (ExpressionCodegenExtension extension : codegenExtensions) { for (ExpressionCodegenExtension extension : codegenExtensions) {
@@ -388,7 +388,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
genClosureFields(context.closure, v, typeMapper); genClosureFields(context.closure, v, typeMapper);
for (ExpressionCodegenExtension extension : ExpressionCodegenExtension.OBJECT$.getInstances(state.getProject())) { for (ExpressionCodegenExtension extension : ExpressionCodegenExtension.Companion.getInstances(state.getProject())) {
extension.generateClassSyntheticParts(v, state, myClass, descriptor); extension.generateClassSyntheticParts(v, state, myClass, descriptor);
} }
} }
@@ -138,7 +138,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
writeInnerClasses(); writeInnerClasses();
if (sourceMapper != null) { if (sourceMapper != null) {
SourceMapper.OBJECT$.flushToClassBuilder(sourceMapper, v); SourceMapper.Companion.flushToClassBuilder(sourceMapper, v);
} }
v.done(); v.done();
@@ -520,7 +520,7 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
@NotNull @NotNull
public SourceMapper getOrCreateSourceMapper() { public SourceMapper getOrCreateSourceMapper() {
if (sourceMapper == null) { if (sourceMapper == null) {
sourceMapper = new DefaultSourceMapper(SourceInfo.OBJECT$.createInfo(element, getClassName()), null); sourceMapper = new DefaultSourceMapper(SourceInfo.Companion.createInfo(element, getClassName()), null);
} }
return sourceMapper; return sourceMapper;
} }
@@ -161,7 +161,7 @@ public class AnonymousObjectTransformer {
if (!inliningContext.isInliningLambda) { if (!inliningContext.isInliningLambda) {
if (debugInfo != null && !debugInfo.isEmpty()) { if (debugInfo != null && !debugInfo.isEmpty()) {
sourceMapper = SourceMapper.OBJECT$.createFromSmap(SMAPParser.parse(debugInfo)); sourceMapper = SourceMapper.Companion.createFromSmap(SMAPParser.parse(debugInfo));
} }
else { else {
//seems we can't do any clever mapping cause we don't know any about original class name //seems we can't do any clever mapping cause we don't know any about original class name
@@ -195,7 +195,7 @@ public class AnonymousObjectTransformer {
result.addAllClassesToRemove(constructorResult); result.addAllClassesToRemove(constructorResult);
SourceMapper.OBJECT$.flushToClassBuilder(sourceMapper, classBuilder); SourceMapper.Companion.flushToClassBuilder(sourceMapper, classBuilder);
classBuilder.done(); classBuilder.done();
@@ -299,8 +299,8 @@ public class JetCoreEnvironment {
project.registerService(VirtualFileFinderFactory.class, new CliVirtualFileFinderFactory(classPath)); project.registerService(VirtualFileFinderFactory.class, new CliVirtualFileFinderFactory(classPath));
ExternalDeclarationsProvider.OBJECT$.registerExtensionPoint(project); ExternalDeclarationsProvider.Companion.registerExtensionPoint(project);
ExpressionCodegenExtension.OBJECT$.registerExtensionPoint(project); ExpressionCodegenExtension.Companion.registerExtensionPoint(project);
for (ComponentRegistrar registrar : configuration.getList(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS)) { for (ComponentRegistrar registrar : configuration.getList(ComponentRegistrar.PLUGIN_COMPONENT_REGISTRARS)) {
registrar.registerProjectComponents(project, configuration); registrar.registerProjectComponents(project, configuration);
@@ -2,13 +2,13 @@ package test;
class ClassObject { class ClassObject {
void accessToClassObject() { void accessToClassObject() {
WithClassObject.OBJECT$.foo(); WithClassObject.Companion.foo();
WithClassObject.OBJECT$.getValue(); WithClassObject.Companion.getValue();
WithClassObject.OBJECT$.getValueWithGetter(); WithClassObject.Companion.getValueWithGetter();
WithClassObject.OBJECT$.getVariable(); WithClassObject.Companion.getVariable();
WithClassObject.OBJECT$.setVariable(0); WithClassObject.Companion.setVariable(0);
WithClassObject.OBJECT$.getVariableWithAccessors(); WithClassObject.Companion.getVariableWithAccessors();
WithClassObject.OBJECT$.setVariableWithAccessors(0); WithClassObject.Companion.setVariableWithAccessors(0);
} }
void accessToPackageObject() { void accessToPackageObject() {
@@ -34,7 +34,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
PsiReference ref = expression.getReference(); PsiReference ref = expression.getReference();
if (ref == null) return; if (ref == null) return;
if (JetPsiChecker.OBJECT$.getNamesHighlightingEnabled()) { if (JetPsiChecker.Companion.getNamesHighlightingEnabled()) {
DeclarationDescriptor referenceTarget = bindingContext.get(BindingContext.REFERENCE_TARGET, expression); DeclarationDescriptor referenceTarget = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
if (referenceTarget instanceof ConstructorDescriptor) { if (referenceTarget instanceof ConstructorDescriptor) {
referenceTarget = referenceTarget.getContainingDeclaration(); referenceTarget = referenceTarget.getContainingDeclaration();
@@ -46,7 +46,7 @@ public class JetPsiCheckerAndHighlightingUpdater extends JetPsiChecker {
PsiElement grandParent = parameter.getParent().getParent(); PsiElement grandParent = parameter.getParent().getParent();
if (grandParent instanceof JetNamedFunction) { if (grandParent instanceof JetNamedFunction) {
JetNamedFunction function = (JetNamedFunction) grandParent; JetNamedFunction function = (JetNamedFunction) grandParent;
return UnusedSymbolInspection.OBJECT$.isEntryPoint(function); return UnusedSymbolInspection.Companion.isEntryPoint(function);
} }
return false; return false;
} }
@@ -129,7 +129,7 @@ public class QuickFixRegistrar {
QuickFixes.factories.put(NO_BACKING_FIELD_CUSTOM_ACCESSORS, changeToPropertyNameFactory); QuickFixes.factories.put(NO_BACKING_FIELD_CUSTOM_ACCESSORS, changeToPropertyNameFactory);
QuickFixes.factories.put(INACCESSIBLE_BACKING_FIELD, changeToPropertyNameFactory); QuickFixes.factories.put(INACCESSIBLE_BACKING_FIELD, changeToPropertyNameFactory);
JetSingleIntentionActionFactory unresolvedReferenceFactory = AutoImportFix.OBJECT$.createFactory(); JetSingleIntentionActionFactory unresolvedReferenceFactory = AutoImportFix.Companion.createFactory();
QuickFixes.factories.put(UNRESOLVED_REFERENCE, unresolvedReferenceFactory); QuickFixes.factories.put(UNRESOLVED_REFERENCE, unresolvedReferenceFactory);
QuickFixes.factories.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, unresolvedReferenceFactory); QuickFixes.factories.put(UNRESOLVED_REFERENCE_WRONG_RECEIVER, unresolvedReferenceFactory);
@@ -263,7 +263,7 @@ public class KotlinIntroduceVariableHandler extends KotlinIntroduceHandlerBase {
final JetExpression originalBody = originalDeclaration.getBodyExpression(); final JetExpression originalBody = originalDeclaration.getBodyExpression();
assert originalBody != null : "Original body is not found: " + originalDeclaration; assert originalBody != null : "Original body is not found: " + originalDeclaration;
JetDeclarationWithBody newDeclaration = ConvertToBlockBodyAction.OBJECT$.convert(originalDeclaration); JetDeclarationWithBody newDeclaration = ConvertToBlockBodyAction.Companion.convert(originalDeclaration);
JetBlockExpression newCommonContainer = (JetBlockExpression) newDeclaration.getBodyExpression(); JetBlockExpression newCommonContainer = (JetBlockExpression) newDeclaration.getBodyExpression();
assert newCommonContainer != null : "New body is not found: " + newDeclaration; assert newCommonContainer != null : "New body is not found: " + newDeclaration;
@@ -1,12 +1,12 @@
class ClassObject { class ClassObject {
void foo() { void foo() {
WithClassObject.OBJECT$.getValue(); WithClassObject.Companion.getValue();
WithClassObject.OBJECT$.getValue(); WithClassObject.Companion.getValue();
WithClassObject.OBJECT$.foo(); WithClassObject.Companion.foo();
WithClassObject.OBJECT$.getValueWithGetter(); WithClassObject.Companion.getValueWithGetter();
WithClassObject.OBJECT$.getVariable(); WithClassObject.Companion.getVariable();
WithClassObject.OBJECT$.setVariable(0); WithClassObject.Companion.setVariable(0);
WithClassObject.OBJECT$.getVariableWithAccessors(); WithClassObject.Companion.getVariableWithAccessors();
WithClassObject.OBJECT$.setVariableWithAccessors(0); WithClassObject.Companion.setVariableWithAccessors(0);
} }
} }
@@ -38,11 +38,11 @@ public abstract class AbstractJetPsiCheckerTest extends JetLightCodeInsightFixtu
//noinspection unchecked //noinspection unchecked
myFixture.enableInspections(SpellCheckingInspection.class); myFixture.enableInspections(SpellCheckingInspection.class);
JetPsiChecker.OBJECT$.setNamesHighlightingEnabled(false); JetPsiChecker.Companion.setNamesHighlightingEnabled(false);
checkHighlighting(true, true, false); checkHighlighting(true, true, false);
} }
finally { finally {
JetPsiChecker.OBJECT$.setNamesHighlightingEnabled(true); JetPsiChecker.Companion.setNamesHighlightingEnabled(true);
} }
} }
@@ -94,7 +94,7 @@ public final class AnnotationsUtils {
} }
for (DeclarationDescriptor descriptor : descriptors) { for (DeclarationDescriptor descriptor : descriptors) {
for (PredefinedAnnotation annotation : PredefinedAnnotation.OBJECT$.getWITH_CUSTOM_NAME()) { for (PredefinedAnnotation annotation : PredefinedAnnotation.Companion.getWITH_CUSTOM_NAME()) {
if (!hasAnnotationOrInsideAnnotatedClass(descriptor, annotation)) { if (!hasAnnotationOrInsideAnnotatedClass(descriptor, annotation)) {
continue; continue;
} }