java: test-only method extracted

This commit is contained in:
Roman Shevchenko
2013-06-07 12:00:15 +04:00
parent a0f88a0987
commit ed3e632f2d
2 changed files with 22 additions and 13 deletions
@@ -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();
}
}
@@ -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());