mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid loading JavaPsiFacade for default project while decompiling class files
This commit is contained in:
+1
-1
@@ -1005,7 +1005,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
}
|
||||
|
||||
private boolean isIdentifier(String name) {
|
||||
return JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(name, LanguageLevel.HIGHEST);
|
||||
return PsiNameHelper.getInstance(myProject).isIdentifier(name, LanguageLevel.HIGHEST);
|
||||
}
|
||||
|
||||
private CodeStyleSettings getSettings() {
|
||||
|
||||
@@ -101,6 +101,7 @@ public abstract class JavaPsiFacade {
|
||||
* Returns the name helper for the project, which can be used to validate
|
||||
* and parse Java identifiers.
|
||||
*
|
||||
* @deprecated use {@link com.intellij.psi.PsiNameHelper#getInstance(com.intellij.openapi.project.Project)}
|
||||
* @return the name helper instance.
|
||||
*/
|
||||
@NotNull
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -31,6 +33,11 @@ import static com.intellij.util.ObjectUtils.notNull;
|
||||
* @see com.intellij.psi.JavaPsiFacade#getNameHelper()
|
||||
*/
|
||||
public abstract class PsiNameHelper {
|
||||
|
||||
public static PsiNameHelper getInstance(Project project) {
|
||||
return ServiceManager.getService(project, PsiNameHelper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the specified text is a Java identifier, using the language level of the project
|
||||
* with which the name helper is associated to filter out keywords.
|
||||
|
||||
@@ -58,7 +58,6 @@ import java.util.concurrent.ConcurrentMap;
|
||||
*/
|
||||
public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
|
||||
private volatile PsiElementFinder[] myElementFinders;
|
||||
private final PsiNameHelper myNameHelper;
|
||||
private final PsiConstantEvaluationHelper myConstantEvaluationHelper;
|
||||
private volatile SoftReference<ConcurrentMap<String, PsiPackage>> myPackageCache;
|
||||
private final Project myProject;
|
||||
@@ -70,7 +69,6 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
|
||||
MessageBus bus) {
|
||||
myProject = project;
|
||||
myFileManager = javaFileManager;
|
||||
myNameHelper = new PsiNameHelperImpl(this);
|
||||
myConstantEvaluationHelper = new PsiConstantEvaluationHelperImpl();
|
||||
|
||||
final PsiModificationTracker modificationTracker = psiManager.getModificationTracker();
|
||||
@@ -223,7 +221,7 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx {
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiNameHelper getNameHelper() {
|
||||
return myNameHelper;
|
||||
return PsiNameHelper.getInstance(myProject);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
package com.intellij.psi.impl;
|
||||
|
||||
import com.intellij.lang.java.lexer.JavaLexer;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiNameHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -27,8 +27,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PsiNameHelperImpl extends PsiNameHelper {
|
||||
private final LanguageLevelProjectExtension myLanguageLevelExtension;
|
||||
|
||||
public PsiNameHelperImpl(JavaPsiFacade manager) {
|
||||
myLanguageLevelExtension = LanguageLevelProjectExtension.getInstance(manager.getProject());
|
||||
public PsiNameHelperImpl(Project project) {
|
||||
myLanguageLevelExtension = LanguageLevelProjectExtension.getInstance(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.NullableLazyValue;
|
||||
import com.intellij.openapi.util.VolatileNullableLazyValue;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.impl.PsiJavaParserFacadeImpl;
|
||||
import com.intellij.psi.impl.cache.TypeInfo;
|
||||
import com.intellij.psi.impl.source.PsiClassReferenceType;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
@@ -136,7 +137,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
|
||||
}
|
||||
|
||||
private ClsElementImpl calculateChild() {
|
||||
if (JavaPsiFacade.getInstance(getProject()).getElementFactory().createPrimitiveType(myTypeText) != null) {
|
||||
if (PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText) != null) {
|
||||
return null;
|
||||
}
|
||||
else if (isArray()) {
|
||||
@@ -153,7 +154,7 @@ public class ClsTypeElementImpl extends ClsElementImpl implements PsiTypeElement
|
||||
}
|
||||
|
||||
private PsiType calculateType() {
|
||||
PsiType result = JavaPsiFacade.getInstance(getProject()).getElementFactory().createPrimitiveType(myTypeText);
|
||||
PsiType result = PsiJavaParserFacadeImpl.getPrimitiveType(myTypeText);
|
||||
if (result != null) return result;
|
||||
|
||||
ClsElementImpl childElement = myChild.getValue();
|
||||
|
||||
@@ -357,6 +357,8 @@
|
||||
serviceImplementation="com.intellij.ide.util.TreeClassChooserFactoryImpl"/>
|
||||
<projectService serviceInterface="com.intellij.psi.JavaPsiFacade"
|
||||
serviceImplementation="com.intellij.psi.impl.JavaPsiFacadeImpl"/>
|
||||
<projectService serviceInterface="com.intellij.psi.PsiNameHelper"
|
||||
serviceImplementation="com.intellij.psi.impl.PsiNameHelperImpl"/>
|
||||
<projectService serviceInterface="com.intellij.psi.impl.file.impl.JavaFileManager"
|
||||
serviceImplementation="com.intellij.psi.impl.file.impl.JavaFileManagerImpl"/>
|
||||
<projectService serviceInterface="com.intellij.codeInsight.guess.GuessManager"
|
||||
|
||||
Reference in New Issue
Block a user