mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -475,7 +475,8 @@ public class JVMNameUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getClassVMName(PsiClass containingClass) {
|
||||
public static String getClassVMName(@Nullable PsiClass containingClass) {
|
||||
if (containingClass == null) return null;
|
||||
if (containingClass instanceof PsiAnonymousClass) {
|
||||
return getClassVMName(PsiTreeUtil.getParentOfType(containingClass, PsiClass.class)) +
|
||||
JavaAnonymousClassesHelper.getName((PsiAnonymousClass)containingClass);
|
||||
|
||||
+5
-2
@@ -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,6 +34,7 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* User: lex
|
||||
@@ -147,8 +148,10 @@ public class DebuggerTreeNodeExpression {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static PsiExpression substituteThis(PsiExpression expressionWithThis, PsiExpression howToEvaluateThis, Value howToEvaluateThisValue)
|
||||
@Nullable
|
||||
public static PsiExpression substituteThis(@Nullable PsiExpression expressionWithThis, PsiExpression howToEvaluateThis, Value howToEvaluateThisValue)
|
||||
throws EvaluateException {
|
||||
if (expressionWithThis == null) return null;
|
||||
PsiExpression result = (PsiExpression)expressionWithThis.copy();
|
||||
|
||||
PsiClass thisClass = PsiTreeUtil.getContextOfType(result, PsiClass.class, true);
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.ide.wizard.AbstractWizard;
|
||||
import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.StorageScheme;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -50,12 +51,12 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
|
||||
public AbstractProjectWizard(String title, Project project, String defaultPath) {
|
||||
super(title, project);
|
||||
myWizardContext = initContext(project, defaultPath);
|
||||
myWizardContext = initContext(project, defaultPath, getDisposable());
|
||||
}
|
||||
|
||||
public AbstractProjectWizard(String title, Project project, Component dialogParent) {
|
||||
super(title, dialogParent);
|
||||
myWizardContext = initContext(project, null);
|
||||
myWizardContext = initContext(project, null, getDisposable());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,8 +69,8 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
|
||||
public abstract StepSequence getSequence();
|
||||
|
||||
private static WizardContext initContext(@Nullable Project project, @Nullable String defaultPath) {
|
||||
WizardContext context = new WizardContext(project);
|
||||
private static WizardContext initContext(@Nullable Project project, @Nullable String defaultPath, Disposable parentDisposable) {
|
||||
WizardContext context = new WizardContext(project, parentDisposable);
|
||||
if (defaultPath != null) {
|
||||
context.setProjectFileDirectory(defaultPath);
|
||||
context.setProjectName(defaultPath.substring(FileUtil.toSystemIndependentName(defaultPath).lastIndexOf("/") + 1));
|
||||
|
||||
@@ -53,7 +53,7 @@ class ManageProjectTemplatesDialog extends DialogWrapper {
|
||||
super(false);
|
||||
setTitle("Manage Project Templates");
|
||||
final ProjectTemplate[] templates =
|
||||
new ArchivedTemplatesFactory().createTemplates(ProjectTemplatesFactory.CUSTOM_GROUP, new WizardContext(null));
|
||||
new ArchivedTemplatesFactory().createTemplates(ProjectTemplatesFactory.CUSTOM_GROUP, new WizardContext(null, getDisposable()));
|
||||
myTemplatesList = new JBList(new CollectionListModel<ProjectTemplate>(Arrays.asList(templates)) {
|
||||
@Override
|
||||
public void remove(int index) {
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -912,18 +912,15 @@ public class GenericsHighlightUtil {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static HighlightInfo checkOverrideAnnotation(PsiMethod method, final LanguageLevel languageLevel) {
|
||||
PsiModifierList list = method.getModifierList();
|
||||
final PsiAnnotation overrideAnnotation = list.findAnnotation("java.lang.Override");
|
||||
if (overrideAnnotation == null) {
|
||||
return null;
|
||||
}
|
||||
static HighlightInfo checkOverrideAnnotation(@NotNull PsiMethod method,
|
||||
@NotNull PsiAnnotation overrideAnnotation,
|
||||
@NotNull LanguageLevel languageLevel) {
|
||||
try {
|
||||
MethodSignatureBackedByPsiMethod superMethod = SuperMethodsSearch.search(method, null, true, false).findFirst();
|
||||
if (superMethod != null && method.getContainingClass().isInterface()) {
|
||||
final PsiMethod psiMethod = superMethod.getMethod();
|
||||
final PsiClass containingClass = psiMethod.getContainingClass();
|
||||
if (containingClass != null &&
|
||||
if (containingClass != null &&
|
||||
CommonClassNames.JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName()) &&
|
||||
psiMethod.hasModifierProperty(PsiModifier.PROTECTED)) {
|
||||
superMethod = null;
|
||||
|
||||
+7
-1
@@ -237,6 +237,13 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkForeignInnerClassesUsed(annotation));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkFunctionalInterface(annotation, myLanguageLevel));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(AnnotationsHighlightUtil.checkRepeatableAnnotation(annotation));
|
||||
if (CommonClassNames.JAVA_LANG_OVERRIDE.equals(annotation.getQualifiedName())) {
|
||||
PsiAnnotationOwner owner = annotation.getOwner();
|
||||
PsiElement parent = owner instanceof PsiModifierList ? ((PsiModifierList)owner).getParent() : null;
|
||||
if (parent instanceof PsiMethod) {
|
||||
myHolder.add(GenericsHighlightUtil.checkOverrideAnnotation((PsiMethod)parent, annotation, myLanguageLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -773,7 +780,6 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightControlFlowUtil.checkUnreachableStatement(method.getBody()));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkConstructorHandleSuperClassExceptions(method));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkRecursiveConstructorInvocation(method));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkOverrideAnnotation(method, myLanguageLevel));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkSafeVarargsAnnotation(method, myLanguageLevel));
|
||||
|
||||
PsiClass aClass = method.getContainingClass();
|
||||
|
||||
@@ -215,6 +215,7 @@ public class ExtractMethodDialog extends DialogWrapper implements AbstractExtrac
|
||||
});
|
||||
|
||||
myVisibilityPanel = createVisibilityPanel();
|
||||
myVisibilityPanel.registerUpDownActionsFor(myNameField);
|
||||
final JPanel visibilityAndReturnType = new JPanel(new BorderLayout(2, 0));
|
||||
if (!myTargetClass.isInterface()) {
|
||||
visibilityAndReturnType.add(myVisibilityPanel, BorderLayout.WEST);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.codeStyle.autodetect;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.psi.autodetect.AbstractIndentAutoDetectionTest;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
public class JavaAutoDetectIndentPerformanceTest extends AbstractIndentAutoDetectionTest {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/psi/autodetect/";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String getFileNameWithExtension() {
|
||||
return getTestName(true) + ".java";
|
||||
}
|
||||
|
||||
public void testBigFile() {
|
||||
final CommonCodeStyleSettings.IndentOptions[] options = new CommonCodeStyleSettings.IndentOptions[1];
|
||||
|
||||
PlatformTestUtil
|
||||
.startPerformanceTest("Detecting indent on newly opened file", 250, () -> options[0] = detectIndentOptions())
|
||||
.setup(() -> configureByFile(getFileNameWithExtension()))
|
||||
.cpuBound()
|
||||
.assertTiming();
|
||||
|
||||
//to ensure if worked as expected
|
||||
Assert.assertEquals("Detect indent mistmatch", 2, options[0].INDENT_SIZE);
|
||||
|
||||
PlatformTestUtil
|
||||
.startPerformanceTest("Detecting indent on hot file", 30, AbstractIndentAutoDetectionTest::detectIndentOptions)
|
||||
.cpuBound()
|
||||
.assertTiming();
|
||||
}
|
||||
}
|
||||
@@ -214,9 +214,10 @@ public class OutputChecker {
|
||||
result = result.replaceAll("file.*AppletPage.*\\.html", "file:/!APPLET_HTML!");
|
||||
result = result.replaceAll("\"(!JDK_HOME!.*?)\"", "$1");
|
||||
result = result.replaceAll("\"(!APP_PATH!.*?)\"", "$1");
|
||||
result = result.replaceAll("\"(" + TEST_JDK_HOME_STR + ".*?)\"", "$1");
|
||||
|
||||
// unquote extra params
|
||||
result = result.replaceAll("\"(-D.*)\"", "$1");
|
||||
//result = result.replaceAll("\"(-D.*)\"", "$1");
|
||||
|
||||
result = result.replaceAll("-Didea.launcher.port=\\d*", "-Didea.launcher.port=!IDEA_LAUNCHER_PORT!");
|
||||
result = result.replaceAll("-Dfile.encoding=[\\w\\d-]*", "-Dfile.encoding=!FILE_ENCODING!");
|
||||
|
||||
Reference in New Issue
Block a user