From fef21c60cba4a5bee6382922c25cc759bb39f4e8 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 19 Feb 2015 14:21:11 +0300 Subject: [PATCH] EA-64708 - IAE: InjectedSelfElementInfo. --- .../smartPointers/ImplicitVariableElementInfoFactory.java | 4 ++-- .../impl/smartPointers/ImportListElementInfoFactory.java | 4 ++-- .../psi/impl/smartPointers/SmartPsiElementPointerImpl.java | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImplicitVariableElementInfoFactory.java b/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImplicitVariableElementInfoFactory.java index 4239f03a9359..29da83455ee1 100644 --- a/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImplicitVariableElementInfoFactory.java +++ b/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImplicitVariableElementInfoFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,7 +34,7 @@ public class ImplicitVariableElementInfoFactory implements SmartPointerElementIn } private static class ImplicitVariableInfo extends HardElementInfo { - public ImplicitVariableInfo(@NotNull ImplicitVariable var, @NotNull Project project) { + private ImplicitVariableInfo(@NotNull ImplicitVariable var, @NotNull Project project) { super(project, var); } diff --git a/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImportListElementInfoFactory.java b/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImportListElementInfoFactory.java index d621de473d93..b2c76903ae03 100644 --- a/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImportListElementInfoFactory.java +++ b/java/java-impl/src/com/intellij/psi/impl/smartPointers/ImportListElementInfoFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ public class ImportListElementInfoFactory implements SmartPointerElementInfoFact } private static class ImportListInfo extends FileElementInfo { - public ImportListInfo(@NotNull PsiJavaFile file) { + private ImportListInfo(@NotNull PsiJavaFile file) { super(file); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java index 326d6b050250..3f4880c98a71 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/smartPointers/SmartPsiElementPointerImpl.java @@ -146,11 +146,12 @@ class SmartPsiElementPointerImpl implements SmartPointerEx } FileViewProvider viewProvider = containingFile.getViewProvider(); - if (viewProvider instanceof FreeThreadedFileViewProvider) { + TextRange elementRange = element.getTextRange(); + if (viewProvider instanceof FreeThreadedFileViewProvider && elementRange != null) { PsiLanguageInjectionHost hostContext = InjectedLanguageManager.getInstance(containingFile.getProject()).getInjectionHost(containingFile); if (hostContext != null) { SmartPsiElementPointer hostPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(hostContext); - return new InjectedSelfElementInfo(project, element, element.getTextRange(), containingFile, hostPointer); + return new InjectedSelfElementInfo(project, element, elementRange, containingFile, hostPointer); } } @@ -163,7 +164,6 @@ class SmartPsiElementPointerImpl implements SmartPointerEx return new FileElementInfo((PsiFile)element); } - TextRange elementRange = element.getTextRange(); if (elementRange == null) { return new HardElementInfo(project, element); }