From ed3e632f2d321bf99c27776d39b6b52d0fef5447 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 5 Jun 2013 20:58:31 +0400 Subject: [PATCH] java: test-only method extracted --- .../psi/impl/source/PsiJavaFileImpl.java | 16 +++++----------- .../cache/impl/InnerClassesScannerTest.java | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileImpl.java index 902c49af63f8..e56f53cbfbdf 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileImpl.java @@ -16,8 +16,6 @@ package com.intellij.psi.impl.source; import com.intellij.ide.highlighter.JavaFileType; -import com.intellij.lang.java.JavaParserDefinition; -import com.intellij.lexer.Lexer; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.roots.FileIndexFacade; @@ -33,15 +31,6 @@ public class PsiJavaFileImpl extends PsiJavaFileBaseImpl { super(JavaStubElementTypes.JAVA_FILE, JavaStubElementTypes.JAVA_FILE, file); } - @Override - public String toString() { - return "PsiJavaFile:" + getName(); - } - - public Lexer createLexer() { - return JavaParserDefinition.createLexer(getLanguageLevel()); - } - @NotNull @Override public GlobalSearchScope getResolveScope() { @@ -60,4 +49,9 @@ public class PsiJavaFileImpl extends PsiJavaFileBaseImpl { public FileType getFileType() { return JavaFileType.INSTANCE; } + + @Override + public String toString() { + return "PsiJavaFile:" + getName(); + } } diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/InnerClassesScannerTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/InnerClassesScannerTest.java index 5b7295dfa14d..159d7c7bc9a7 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/InnerClassesScannerTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/cache/impl/InnerClassesScannerTest.java @@ -1,5 +1,21 @@ +/* + * Copyright 2000-2013 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.impl.cache.impl; +import com.intellij.lang.java.JavaParserDefinition; import com.intellij.openapi.application.ex.PathManagerEx; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; @@ -56,8 +72,7 @@ public class InnerClassesScannerTest extends PsiTestCase { boolean mayHaveClassesInside = false; if (psiFile instanceof PsiJavaFileImpl) { - PsiJavaFileImpl impl = (PsiJavaFileImpl)psiFile; - Lexer originalLexer = impl.createLexer(); + Lexer originalLexer = JavaParserDefinition.createLexer(((PsiJavaFileImpl)psiFile).getLanguageLevel()); FilterLexer lexer = new FilterLexer(originalLexer, new FilterLexer.SetFilter(StdTokenSets.WHITE_SPACE_OR_COMMENT_BIT_SET)); final TextRange range = psiElement.getTextRange(); lexer.start(fileBuffer, range.getStartOffset(), range.getEndOffset());