summaryrefslogtreecommitdiff
path: root/java/java-impl/src/com/intellij
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2014-01-17 14:04:48 -0800
committerTor Norbye <tnorbye@google.com>2014-01-17 14:04:53 -0800
commite2d6089d43d7ac1f62bafe06638d5ac2c21f5283 (patch)
tree82793a3124b69b74c3ced64e35aaa9e613ff0198 /java/java-impl/src/com/intellij
parentf2f7178ad6915927d918481b911e57a49785e4c4 (diff)
downloadidea-e2d6089d43d7ac1f62bafe06638d5ac2c21f5283.tar.gz
Snapshot b9931c55d2175b6552f90b2225eb09c13bd6dfed from idea/133.609 of git://git.jetbrains.org/idea/community.git
b9931c5: [git log] IDEA-119247 Use "--date-order" when requesting filtered results a425d83: [vcs-log] user-filter: treat empty user name as no filter. 54b87b7: [log] IDEA-116242 Allow multiple users selection in the log filter 75057c2: [^Evdokimov] IDEA-118027 Groovy: constructors with mixed privacy are flagged as errors f6f884e: [^Vishnyakov] IDEA-119085 Code style does not recognize Groovy spaceship operator <=> d1d61a1: [^Peter]IDEA-117982 correct classpath for groovy scripts 448557f: [^Peter]IDEA-118920 introduce local var intention should not start in write action 3e0ac06: IDEA-118521 Latest 13.0.1 keeps locking up. Editor becomes unresponsive. Various file types... using allScope() (cherry picked from commit a7d5dd0) d3978ef: IDEA-118521 Latest 13.0.1 keeps locking up. Editor becomes unresponsive. Various file types. Using XmlPropertiesIndex to avoid getting xml file content (cherry picked from commit 602db68) d0a2612: IDEA-119344 (Incorrect "Unnecessary call toString()" inspection when super is used) (cherry picked from commit ed03022)[CR-IC-4005] d719338: IDEA-118429 (IDEA incorrectly suggests to remove unboxing) (cherry picked from commit c450665)[CR-IC-3938] 0ae5316: IDEA-118743 (False positive "Number of placeholders does not match number of arguments in logging call") (cherry picked from commit 8f76e73)[CR-IC-3854] c641c52: IDEA-118181 (false positive "number of placeholders does not match number of arguments" for multi-catch) (cherry picked from commit bbc19f5)[CR-IC-3855] 4a5654f: IDEA-118588 (Concatenation with empty string fails to fix an expression) (cherry picked from commit 01753c7)[CR-IC-3801] 3bdf7c6: fix quickfix breaking code when non-static inner class was used from an other file (cherry picked from commit 5e9c2c3)[CR-IC-3659] 2ddc8f5: IDEA-118004 (Find's Regex Help Popup table header bad color with darcula) (cherry picked from commit 95399a1)[CR-IC-3634] 39b0f0c: IDEA-117863 (Package with disjoint dependency graph ignores interfaces) (cherry picked from commit 1257700)[CR-IC-3623] 8805c17: fix and clarify "Cyclic class dependency" inspection warning (cherry picked from commit 68b7ce4)[CR-IC-3800] 4a1b901: EA-52499 - NPE: BraceHighlightingHandler.highlightBraces 365533d: EA-53134 - IOE: DocumentImpl.doBeforeChangedUpdate 186cc36: unused code 81af309: extract DummyCachingFileSystem: put all the weirdness in one place 754c063: Merge branch '133' of git.labs.intellij.net:idea/community into 133 eee267b: Update Python plugin a3fbc3a: IDEA-118989 Code Formatting broken in 13.0.2 EAP [CR-IC-3927] (cherry picked from commit 4d2a597) 96c57db: IDEA-118616 Lens mode with tool windows on the right side (cherry picked from commit 56738b2) [reviewed by kb] 2b06e76: IDEA-117831 After deleting last live template in a group, I can't click OK. (cherry picked from commit 41f6f85) 187d6b1: get rid of psi/doc inconsistency before reparse by not relying on TextBlock information (cherry picked from commit c7a0408) 42f85ee: IDEA-113344 An easy way to exit from full screen mode using mouse (cherry picked from commit 458c964) [reviewed by kb] ace88bd: Merge branch '133' of git.labs.intellij.net:idea/community into 133 c9bad57: Update Python plugin 43cf538: IDEA-94950 Code Style | Arrangement: AIOOBE at ArrangementMatchingRulesModel.removeRow() on removing the last rule that is in edit mode (cherry picked from commit 9a60903) b06982f: introduce AbstractNavBarExtension with processChildren(..) API 15a665c: unwrap: allow to unwrap catch for try-with-resources statement 5b9a6c0: strip @SuppressWarning on delegating (IDEA-118528) 2d0486c: IDEA-111535 Edit Language Fragment: Synchronization is broken after tab drag ebfaf78: true -> false! 84434d5: avoid NPE for non-text editors 204395c: Merge remote-tracking branch 'origin/133' into 133 8a44e62: delete catch fix: introduce ARM 79b66a1: can be final: ensure non final for base of anonymous class (IDEA-118493) dc2a67b: IDEA-118496 disable boolean param inspection for library overriders 1469417: run manager: do not override shared status from default configuration when existing configuration is checked e.g. run from tests view c03e718: junit: reject to start when no tests were found in package 81b8ea2: refactoring listeners: missed after data (IDEA-119118) b9535cd: refactoringIDs: IDEA-119121;IDEA-119122 429cc6e: IDEA-118487 IDEA should suggest downloading missing plug-ins for unrecognised artifact configuration 1e49463: plugin advertiser: do not suggest to update from ultimate to ultimate when 'bundled' plugin is not yet available for current version 12185dd: ensure public inner inside interface (IDEA-118564) (cherry picked from commit 3d7a8fb) fbe5a3a: Fix maven tests. (cherry picked from commit 1e4e54d) fd30aa3: detect the plugin responsible for run configuration AbstractMethodError (IDEA-119173) (cherry picked from commit 70b8663) fe4dd2e: make show usages consistent with Find usages 28194cd: IDEA-97930 41ad9e0: Merge branch '133' of git.labs.intellij.net:idea/community into 133 d89f761: rename while we still can c484ee3: backported IDEA-118742 and IDEA-112104 e5ccd29: Fix blink maven test. a1e1aab: Add retina version for executeMavenGoal.png icon. (cherry picked from commit 1466df4) 785932d: IDEA-112104 "Find Usages Settings Dialog" button re-emerged in "Find in Path" results c5cdb6d: do not allow slash in the middle of the child name 88c56dd: correctly handle request for the not-canonically named child b52c02a: mac file chooser must respect FileChooserDescriptor.isFileSelectable +review b48ed4b: WEB-10360 Javascript debugger with non unique file names 32e35af: prevent cancellation upon removing data from indices, to avoid state data in e.g. stub index IDEA-117290 (cherry picked from commit 4ec42a6) [r=Peter.Gromov] dfb6509: IDEA-118675 - Errors in app server run configs not shown in UI (cherry picked from commit 3feff30) 72e247a: cleanup (commented code) (cherry picked from commit 0063990) e175aab: Merge remote-tracking branch 'origin/133' into 133 4c89b6f: allow external documentation over references with multiple resolve (cherry picked from commit 7b239df) [r=Roman.Shevchenko] fd46f79: remove unwanted registry.properties changes 54d3383: - fixed serialization for DOM indexes - DOM indices work without exception about stub mismatch (cherry picked from commit cff5c6c) 47af646: DOM index: @StubbedOccurrence (cherry picked from commit 3a22d6f) d7ada2a: IDEA-115702 DomAnchorImpl exception: element stubs indexed (cherry picked from commit d0b977b) ae79e45: [^romka] make IDEA-94683 fix controllable via registry (Completion popup loses focus when viewing documentation (sometimes, almost always)) 0681b33: fixwd a few IndexNotReadyExceptions b98216f: extract checkDisposed() with verbose reporting 751194e: Database navbar extension 0a4129c: EditorSplitters: update shortcuts on keymap change c23ada7: IDEA-118970 (external URL formatting for Javadoc 8) 72f30cb: IDEA-118970 (preparation, cleanup, minor optimization) 41dfb6c: [log] simplify loading details around selected commit ed79a3b: IDEA-118763 (handle project component initialization errors) 0e2378a: preselect exact prefix match in autopopup completion (RUBY-14617) (cherry picked from commit 6a771e7) d50fe83: IDEA-119047 (MidnightBSD test) 2f72a0b: Fixed tips of the day. 07ec483: New PyCharm tips of the day. 1d0f380: Cut out escapes from vagrant output in message dialogs. 58e844c: Make setters return this to encourage functional style. 73d7b88: [git] IDEA-116738 Don't eat newlines when amending ee2f349: [git] IDEA-115594 Don't join equal commit messages from different roots a9a0505: IDEA-118330 (kill unresponsive environment reader after timeout) b59cdcf: fix performance problem on 'new Object() {}' test code (cherry picked from commit 3d634e4)[CR-IC-3799] cca9a90: LOG.debug which file is currently checked when running inspections globally (IDEA-118567) (cherry picked from commit c78d7e4) 7e7469c: Make the constant final b2158f1: [git] Understand renames in the log ff04982: [log] IDEA-117680 IDEA-116207 Fix showing Changes for multi-selection 482ab9e: [log] Flush the Hash->Int persistent map more often 8ab87771: [git log] Don't display "index" and "stash" pseudo-commits in the log 5918341: [vcs] IDEA-118644 Fix apply patch for new file in new folder + test 8fc76f5: [log] IDEA-115423 Limit number of commits requested when filtering 0183fd2: [log] simplify 96ad748: [log] Take END_COMMIT_NODE as well as COMMIT_NODE 6ca69c0: [log] Fix identifying root of Node 532cf87: [log] Supply correct commit object to getCommitData in DetailsPanel 9f4eb47: [log] Correctly load details of commits around the selected commit edf55a4: take words from other files if there is no variants from current file at all (IDEA-117511) (cherry picked from commit 64575f6) [r=Peter.Gromov] 6a00485: IOBE fix IDEA-118696 (cherry picked from commit b1a787f) 5b2b564: performance fix IDEA-116803 (cherry picked from commit 5bd84de) 4f7e1f2: nonempty check (cherry picked from commit eead8f1) [r=Peter.Gromov] 13d7e20: project disposed check (cherry picked from commit ab602cb) [r=Peter.Gromov] 7437593: IDEA-118718 Occasionally seeing "Low disk space on a IntelliJ IDEA system directory partition" (cherry picked from commit 22c7a4f) [r=Peter.Gromov/Roman.Shevchenko] 2d1303f: IDEA-111684 Quick Documentation should resolve values for aggregated / indirect constants (cherry picked from commit 065fa6d) [r=Anna.Kozlova] 281a9fc: slightly better fix for IDEA-118691 (cherry picked from commit e87a766) [r=Anna.Kozlova] d55d31a: IDEA-118745 Show directory in editor tabs for non-unique filenames doesn't work for non-project files (cherry picked from commit e560ee2) [r=Peter.Gromov] c9d6d82: IDEA-118446 Installation and plugin update (patch) download ignores Settings / HTTP Proxy (cherry picked from commit 90f2e9c) [r=Anna.Kozlova] 0083f07: IDEA-118787 IAE: Argument 0 for @NotNull parameter of com/intellij/codeInspection/dataFlow/value/DfaPsiType.<init> must not be null (with testcase) (cherry picked from commit 2f26745) 1e2b2ce: Merge branch '133' of git.labs.intellij.net:idea/community into 133 2267ace: updated code compatibility inspection fd4da08: IDEA-116910 (Invalid "unnecessary explicit numeric cast" warning) (cherry picked from commit 7c80f38)[CR-IC-3747] cd2e961: IDEA-116758 ('equals()' between objects of inconvertible types - not working for ...= equals("differentClass")); (cherry picked from commit faa180a)[CR-IC-3355] e235284: new in 13, because these inspections were not actually integrated into 12.1 (cherry picked from commit 3b6f9bf) dd4e427: IDEA-92545 (Type maybe weakened does not always work) (cherry picked from commit 4d5bfb7)[CR-IC-3791] 565054e: IDEA-55970 (Erroneous "type may be weakened to 'null'" in generic method) (cherry picked from commit db52690)[CR-IC-3749] e2f6fea: IDEA-116682 ("Collection declared by class, not interface" suggests abstract classes) (cherry picked from commit 240a1ff)[CR-IC-3748] a2e586e: fixed PY-11673 Error on project creation 6dac33f: Prefer highlighting passes for the selected editor (IDEA-23831) f3ea46e: updated test data for python3.4 3eb3a59: Added error message for missing python-skeletons diagnostics (PY-10411) c134015: Made builtins cache valid only if it has a valid reference to the builtins file (PY-11665) d8d5d79: Switched back to char-based triple quotes detection for docstring element types (PY-11585) 60a4ea9: fixed PY-11654 Move Statement: IOE at com.intellij.openapi.editor.impl.DocumentImpl.d 1b780fe: fixed PY-11610 Django johnny-cache breaks django_test_manage.py fa9d315: fixed PY-11581 RST: Header is not highlighted if there is a space after separator 32c1775: fixed PY-11588 "Instance attribute %s defined outside __init__" in static method cfd8060: fixed PY-11617 Nosetest runner: simple function tests cannot jump to source 540f5a9: Switched to synchronized count of running Python skeleton generators 8f167a4: Don't add python-skeletons to Python paths during skeletons generation 41c891b: Don't show python-skeletons path in the Python interpreter paths tab (PY-11218) 42ee478: Don't report unresolved references and unused imports during skeletons generation 017accd: Return unknown return type for generator functions if the built-in generator type is not found 115af20: Don't report unresolved references and unused imports if the project interpreter is not selected (PY-11589) daf47ee: Call a static method via its defining class, not its subclass baf4d9e: Removed unused PythonSdkType.switchPathToInterpreter() 4257828: Nullity annotations for overridden methods ec6753c: Moved skeleton generation progress on adding a Python interpreter to background 9901a18: Switched from showing balloons to logging errors for serious skeleton generation exceptions 6d2c9c0: Added ellipses for skeleton processing progress messages 7ba1d4f: Merge branch '133' of git.labs.intellij.net:idea/community into 133 f0918d5: Fixed PIEAE in referencing obsolete cached PSI elements for built-in 'str | unicode' type 9bd03d9: Rearranged fields and constructors 85295da: Removed unused PyBuiltinCache.isValid() 8603b21: Removed stdlib type cache unused after the switch to python-skeletons 2e2a3ee: Call static methods via classes where they are actually defined d0deed6: fixed PY-11594 New Project: selected interpreter is not set as project interpreter when attaching project to already opened one dd98a8e: fixed PY-11595 Unable to move lines within Python doc strings Change-Id: I389125baa54f7a0f40ce6a7e7c059241e3a4ff0c
Diffstat (limited to 'java/java-impl/src/com/intellij')
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateInnerClassFromNewFix.java6
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteCatchFix.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java1
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/unwrap/JavaCatchRemover.java7
-rw-r--r--java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java17
-rw-r--r--java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java77
-rw-r--r--java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java40
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java38
-rw-r--r--java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java10
-rw-r--r--java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java2
10 files changed, 116 insertions, 84 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateInnerClassFromNewFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateInnerClassFromNewFix.java
index 2ccaa4b80f19..dfcb0eec2b3d 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateInnerClassFromNewFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateInnerClassFromNewFix.java
@@ -54,7 +54,11 @@ public class CreateInnerClassFromNewFix extends CreateClassFromNewFix {
PsiClass created = elementFactory.createClass(refName);
final PsiModifierList modifierList = created.getModifierList();
LOG.assertTrue(modifierList != null);
- modifierList.setModifierProperty(PsiModifier.PRIVATE, true);
+ if (targetClass.isInterface()) {
+ modifierList.setModifierProperty(PsiModifier.PACKAGE_LOCAL, true);
+ } else {
+ modifierList.setModifierProperty(PsiModifier.PRIVATE, true);
+ }
if (PsiUtil.getEnclosingStaticElement(newExpression, targetClass) != null || isInThisOrSuperCall(newExpression)) {
modifierList.setModifierProperty(PsiModifier.STATIC, true);
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteCatchFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteCatchFix.java
index ec6e0c3e23dd..0bd97a0e198f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteCatchFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/DeleteCatchFix.java
@@ -53,7 +53,7 @@ public class DeleteCatchFix implements IntentionAction {
if (!FileModificationService.getInstance().prepareFileForWrite(myCatchParameter.getContainingFile())) return;
final PsiTryStatement tryStatement = ((PsiCatchSection)myCatchParameter.getDeclarationScope()).getTryStatement();
- if (tryStatement.getCatchBlocks().length == 1 && tryStatement.getFinallyBlock() == null) {
+ if (tryStatement.getCatchBlocks().length == 1 && tryStatement.getFinallyBlock() == null && tryStatement.getResourceList() == null) {
// unwrap entire try statement
final PsiCodeBlock tryBlock = tryStatement.getTryBlock();
PsiElement lastAddedStatement = null;
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
index 0d3dd6dc8103..21511113ff0e 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/GenerateDelegateHandler.java
@@ -171,6 +171,7 @@ public class GenerateDelegateHandler implements LanguageCodeInsightActionHandler
method.getBody().add(stmt);
for (PsiAnnotation annotation : methodCandidate.getElement().getModifierList().getAnnotations()) {
+ if (SuppressWarnings.class.getName().equals(annotation.getQualifiedName())) continue;
method.getModifierList().add(annotation.copy());
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaCatchRemover.java b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaCatchRemover.java
index 204cfe71d527..97508d7a7c1f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaCatchRemover.java
+++ b/java/java-impl/src/com/intellij/codeInsight/unwrap/JavaCatchRemover.java
@@ -28,11 +28,12 @@ public class JavaCatchRemover extends JavaUnwrapper {
@Override
public boolean isApplicableTo(PsiElement e) {
- return e instanceof PsiCatchSection && tryHasSeveralCatches(e);
+ return e instanceof PsiCatchSection && tryHasSeveralCatchesOrResourcesDefined(e);
}
- private boolean tryHasSeveralCatches(PsiElement el) {
- return ((PsiTryStatement)el.getParent()).getCatchBlocks().length > 1;
+ private static boolean tryHasSeveralCatchesOrResourcesDefined(PsiElement el) {
+ PsiTryStatement tryStatement = (PsiTryStatement)el.getParent();
+ return tryStatement.getCatchBlocks().length > 1 || tryStatement.getResourceList() != null;
}
@Override
diff --git a/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java b/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
index 2fc52f481343..a9ad81bb9dc6 100644
--- a/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
+++ b/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
@@ -22,19 +22,15 @@ package com.intellij.ide.navigationToolbar;
import com.intellij.analysis.AnalysisScopeBundle;
import com.intellij.lang.StdLanguages;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.presentation.java.ClassPresentationUtil;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.*;
+import com.intellij.psi.presentation.java.ClassPresentationUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
-import java.util.Collection;
-import java.util.Collections;
-
-public class JavaNavBarExtension implements NavBarModelExtension{
+public class JavaNavBarExtension extends AbstractNavBarModelExtension {
public String getPresentableText(final Object object) {
if (object instanceof PsiClass) {
return ClassPresentationUtil.getNameForClass((PsiClass)object, false);
@@ -77,11 +73,6 @@ public class JavaNavBarExtension implements NavBarModelExtension{
}
return containingFile;
}
- return psiElement.isPhysical() ? psiElement : null;
- }
-
- @Override
- public Collection<VirtualFile> additionalRoots(Project project) {
- return Collections.emptyList();
+ return psiElement;
}
}
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
index 3cae4f5aaa94..1a93b8c234b2 100644
--- a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
+++ b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.lang.java;
import com.intellij.codeInsight.CodeInsightBundle;
-import com.intellij.codeInsight.documentation.DocumentationManager;
+import com.intellij.codeInsight.documentation.DocumentationManagerProtocol;
import com.intellij.codeInsight.documentation.PlatformDocumentationUtil;
import com.intellij.codeInsight.editorActions.CodeDocumentationUtil;
import com.intellij.codeInsight.javadoc.JavaDocExternalFilter;
@@ -31,10 +30,11 @@ import com.intellij.lang.documentation.CompositeDocumentationProvider;
import com.intellij.lang.documentation.ExternalDocumentationProvider;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.*;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
@@ -49,12 +49,13 @@ import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.javadoc.PsiDocTag;
import com.intellij.psi.util.PsiFormatUtil;
import com.intellij.psi.util.PsiFormatUtilBase;
+import com.intellij.psi.util.PsiUtil;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -114,7 +115,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
}
private static void generateInitializer(StringBuilder buffer, PsiVariable variable) {
- PsiExpression initializer = variable.getInitializer();
+ PsiExpression initializer = JavaDocInfoGenerator.calcInitializerExpression(variable);
if (initializer != null) {
String text = initializer.getText().trim();
int index1 = text.indexOf('\n');
@@ -157,7 +158,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
}
}
else {
- final Module module = ModuleUtil.findModuleForPsiElement(file);
+ final Module module = ModuleUtilCore.findModuleForPsiElement(file);
if (module != null) {
buffer.append('[').append(module.getName()).append("] ");
}
@@ -533,7 +534,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
return null;
}
- private String getMethodCandidateInfo(PsiMethodCallExpression expr) {
+ private static String getMethodCandidateInfo(PsiMethodCallExpression expr) {
final PsiResolveHelper rh = JavaPsiFacade.getInstance(expr.getProject()).getResolveHelper();
final CandidateInfo[] candidates = rh.getReferencedMethodCandidates(expr, true);
final String text = expr.getText();
@@ -562,7 +563,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
}
private static void createElementLink(@NonNls final StringBuilder sb, final PsiElement element, final String str) {
- sb.append("&nbsp;&nbsp;<a href=\"" + DocumentationManager.PSI_ELEMENT_PROTOCOL);
+ sb.append("&nbsp;&nbsp;<a href=\"" + DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL);
sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
sb.append("\">");
sb.append(str);
@@ -593,19 +594,20 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
PsiMethod method = (PsiMethod)element;
PsiClass aClass = method.getContainingClass();
if (aClass != null) {
- final List<String> classUrls = findUrlForClass(aClass);
-
+ List<String> classUrls = findUrlForClass(aClass);
if (classUrls != null) {
- urls = new ArrayList<String>();
- String signature = formatMethodSignature(method);
+ urls = ContainerUtil.newSmartList();
+
+ String rawSignature = formatMethodSignature(method, true);
for (String classUrl : classUrls) {
- urls.add(classUrl + "#" + signature);
+ urls.add(classUrl + "#" + rawSignature);
}
- signature = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY,
- PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS,
- PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES, 999);
- for (String classUrl : classUrls) {
- urls.add(classUrl + "#" + signature);
+
+ String signature = formatMethodSignature(method, false);
+ if (Comparing.compare(rawSignature, signature) != 0) {
+ for (String classUrl : classUrls) {
+ urls.add(classUrl + "#" + signature);
+ }
}
}
}
@@ -631,25 +633,35 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
}
}
- public static String formatMethodSignature(PsiMethod method) {
- return PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY,
- PsiFormatUtilBase.SHOW_NAME |
- PsiFormatUtilBase.SHOW_PARAMETERS |
- PsiFormatUtilBase.SHOW_RAW_NON_TOP_TYPE,
- PsiFormatUtilBase.SHOW_TYPE |
- PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES |
- PsiFormatUtilBase.SHOW_RAW_NON_TOP_TYPE,
- 999);
+ private static String formatMethodSignature(PsiMethod method, boolean raw) {
+ int options = PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS;
+ int parameterOptions = PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES;
+ if (raw) {
+ options |= PsiFormatUtilBase.SHOW_RAW_NON_TOP_TYPE;
+ parameterOptions |= PsiFormatUtilBase.SHOW_RAW_NON_TOP_TYPE;
+ }
+
+ String signature = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, options, parameterOptions, 999);
+
+ if (PsiUtil.isLanguageLevel8OrHigher(method)) {
+ signature = signature.replaceAll("\\(|\\)|, ", "-").replaceAll("\\[\\]", ":A");
+ }
+
+ return signature;
}
@Nullable
public static List<String> findUrlForClass(PsiClass aClass) {
String qName = aClass.getQualifiedName();
if (qName == null) return null;
+
PsiFile file = aClass.getContainingFile();
if (!(file instanceof PsiJavaFile)) return null;
- String packageName = ((PsiJavaFile)file).getPackageName();
+ VirtualFile virtualFile = file.getVirtualFile();
+ if (virtualFile == null) return null;
+
+ String packageName = ((PsiJavaFile)file).getPackageName();
String relPath;
if (packageName.length() > 0) {
relPath = packageName.replace('.', '/') + '/' + qName.substring(packageName.length() + 1) + HTML_EXTENSION;
@@ -658,12 +670,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
relPath = qName + HTML_EXTENSION;
}
- final PsiFile containingFile = aClass.getContainingFile();
- if (containingFile == null) return null;
- final VirtualFile virtualFile = containingFile.getVirtualFile();
- if (virtualFile == null) return null;
-
- return findUrlForVirtualFile(containingFile.getProject(), virtualFile, relPath);
+ return findUrlForVirtualFile(file.getProject(), virtualFile, relPath);
}
@Nullable
diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
index eed6d597e476..39a1a730aa02 100644
--- a/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
+++ b/java/java-impl/src/com/intellij/psi/formatter/java/JavaSpacePropertyProcessor.java
@@ -653,18 +653,25 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
}
if (myRole2 == ChildRole.TRY_BLOCK) {
- myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_TRY_LBRACE,
- mySettings.BRACE_STYLE, null, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, true);
+ TextRange dependantRange = getDependencyRangeForLBraceWhiteSpace(statement.getTryBlock());
+ myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_TRY_LBRACE, mySettings.BRACE_STYLE, dependantRange, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, false);
}
else if (myRole2 == ChildRole.FINALLY_BLOCK) {
- myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_FINALLY_LBRACE,
- mySettings.BRACE_STYLE, null, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, true);
+ TextRange dependantRange = getDependencyRangeForLBraceWhiteSpace(statement.getFinallyBlock());
+ myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_FINALLY_LBRACE, mySettings.BRACE_STYLE, dependantRange, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, false);
}
else if (myType2 == JavaElementType.RESOURCE_LIST) {
createSpaceInCode(mySettings.SPACE_BEFORE_TRY_PARENTHESES);
}
}
+ @Nullable
+ private TextRange getDependencyRangeForLBraceWhiteSpace(PsiElement element) {
+ return mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE && element != null
+ ? element.getTextRange()
+ : null;
+ }
+
@Override public void visitForeachStatement(PsiForeachStatement statement) {
if (myRole1 == ChildRole.FOR_KEYWORD && myRole2 == ChildRole.LPARENTH) {
createSpaceInCode(mySettings.SPACE_BEFORE_FOR_PARENTHESES);
@@ -840,14 +847,10 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
}
else {
if (myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT || myChild2.getElementType() == JavaElementType.CODE_BLOCK) {
- PsiElement branch = statement.getElseBranch();
- boolean shouldKeepInOneLine = mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE
- && branch != null
- && !branch.textContains('\n');
-
+ TextRange dependantRange = getDependencyRangeForLBraceWhiteSpace(statement.getElseBranch());
myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_ELSE_LBRACE,
mySettings.BRACE_STYLE,
- null, shouldKeepInOneLine, true);
+ dependantRange, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, false);
}
else {
createSpacingBeforeElementInsideControlStatement();
@@ -861,13 +864,13 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
PsiElement branch = myRole2 == ChildRole.ELSE_BRANCH ? statement.getElseBranch()
: statement.getThenBranch();
- boolean shouldKeepInOneLine = mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE
- && branch != null
- && !branch.textContains('\n');
+ TextRange dependantRange = mySettings.BRACE_STYLE == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED || branch == null
+ ? new TextRange(myParent.getTextRange().getStartOffset(), myChild1.getTextRange().getEndOffset())
+ : branch.getTextRange();
myResult = getSpaceBeforeLBrace(space, mySettings.BRACE_STYLE,
- new TextRange(myParent.getTextRange().getStartOffset(), myChild1.getTextRange().getEndOffset()),
- shouldKeepInOneLine, true);
+ dependantRange,
+ mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, false);
}
else if (myRole2 == ChildRole.LPARENTH) {
createSpaceInCode(mySettings.SPACE_BEFORE_IF_PARENTHESES);
@@ -924,10 +927,6 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
else if (braceStyle == CommonCodeStyleSettings.END_OF_LINE || braceStyle == CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED) {
return createNonLFSpace(space, null, false);
}
- else if (braceStyle == CommonCodeStyleSettings.NEXT_LINE) {
- space = (keepOneLine && spaceBeforeLbrace) ? 1 : 0;
- return Spacing.createSpacing(space, 0, keepOneLine ? 0 : 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
- }
else if (keepOneLine) {
TextRange dependencyRangeToUse = dependantRange == null || useParentBlockAsDependencyAllTheTime
? myParent.getTextRange() : dependantRange;
@@ -1290,7 +1289,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
@Override public void visitCatchSection(PsiCatchSection section) {
if (myRole2 == ChildRole.CATCH_BLOCK) {
- myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_CATCH_LBRACE, mySettings.BRACE_STYLE, null,
+ TextRange dependantRange = mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE ? section.getTextRange() : null;
+ myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_CATCH_LBRACE, mySettings.BRACE_STYLE, dependantRange,
mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, true);
}
else if (myRole2 == ChildRole.CATCH_BLOCK_PARAMETER_LPARENTH) {
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
index 3056eccd9291..e5e7741f3d72 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
@@ -209,6 +209,13 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
}
@Override
+ public SuggestedNameInfo suggestCompiledParameterName(@NotNull PsiType type) {
+ // avoid hang due to nice name evaluation that uses indices for resolve (IDEA-116803)
+ return new SuggestedNameInfo(suggestVariableNameByType(type, VariableKind.PARAMETER, true, true)) {
+ };
+ }
+
+ @Override
public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
@Nullable final String propertyName,
@Nullable final PsiExpression expr,
@@ -301,7 +308,11 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
}
private String[] suggestVariableNameByType(PsiType type, final VariableKind variableKind, boolean correctKeywords) {
- String longTypeName = getLongTypeName(type);
+ return suggestVariableNameByType(type, variableKind, correctKeywords, false);
+ }
+
+ private String[] suggestVariableNameByType(PsiType type, final VariableKind variableKind, boolean correctKeywords, boolean skipIndices) {
+ String longTypeName = skipIndices ? type.getCanonicalText():getLongTypeName(type);
CodeStyleSettings.TypeToNameMap map = getMapByVariableKind(variableKind);
if (map != null && longTypeName != null) {
if (type.equals(PsiType.NULL)) {
@@ -315,11 +326,15 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
Collection<String> suggestions = new LinkedHashSet<String>();
- suggestNamesForCollectionInheritors(type, variableKind, suggestions, correctKeywords);
- suggestNamesFromGenericParameters(type, variableKind, suggestions, correctKeywords);
+ if (!skipIndices) {
+ suggestNamesForCollectionInheritors(type, variableKind, suggestions, correctKeywords);
+ suggestNamesFromGenericParameters(type, variableKind, suggestions, correctKeywords);
+ }
+
+ String typeName = getTypeName(type, !skipIndices);
- String typeName = normalizeTypeName(getTypeName(type));
if (typeName != null) {
+ typeName = normalizeTypeName(typeName);
ContainerUtil.addAll(suggestions, getSuggestionsByName(typeName, variableKind, type instanceof PsiArrayType, correctKeywords));
}
@@ -376,11 +391,16 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
@Nullable
private static String getTypeName(PsiType type) {
+ return getTypeName(type, true);
+ }
+
+ @Nullable
+ private static String getTypeName(PsiType type, boolean withIndices) {
type = type.getDeepComponentType();
if (type instanceof PsiClassType) {
final PsiClassType classType = (PsiClassType)type;
final String className = classType.getClassName();
- if (className != null) return className;
+ if (className != null || !withIndices) return className;
final PsiClass aClass = classType.resolve();
return aClass instanceof PsiAnonymousClass ? ((PsiAnonymousClass)aClass).getBaseClassType().getClassName() : null;
}
@@ -388,16 +408,16 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
return type.getPresentableText();
}
else if (type instanceof PsiWildcardType) {
- return getTypeName(((PsiWildcardType)type).getExtendsBound());
+ return getTypeName(((PsiWildcardType)type).getExtendsBound(), withIndices);
}
else if (type instanceof PsiIntersectionType) {
- return getTypeName(((PsiIntersectionType)type).getRepresentative());
+ return getTypeName(((PsiIntersectionType)type).getRepresentative(), withIndices);
}
else if (type instanceof PsiCapturedWildcardType) {
- return getTypeName(((PsiCapturedWildcardType)type).getWildcard());
+ return getTypeName(((PsiCapturedWildcardType)type).getWildcard(), withIndices);
}
else if (type instanceof PsiDisjunctionType) {
- return getTypeName(((PsiDisjunctionType)type).getLeastUpperBound());
+ return getTypeName(((PsiDisjunctionType)type).getLeastUpperBound(), withIndices);
}
else {
return null;
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
index 5e6ac953d789..4531e391f838 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPullUp/PullUpProcessor.java
@@ -100,7 +100,7 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
@Nullable
@Override
protected String getRefactoringId() {
- return "refactoring.pullUp";
+ return "refactoring.pull.up";
}
@Nullable
@@ -117,6 +117,14 @@ public class PullUpProcessor extends BaseRefactoringProcessor implements PullUpD
return data;
}
+ @Nullable
+ @Override
+ protected RefactoringEventData getAfterData(UsageInfo[] usages) {
+ final RefactoringEventData data = new RefactoringEventData();
+ data.addElement(myTargetSuperClass);
+ return data;
+ }
+
protected void performRefactoring(UsageInfo[] usages) {
moveMembersToBase();
moveFieldInitializations();
diff --git a/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java b/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
index 31139257d5d0..532e0b9c207d 100644
--- a/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/memberPushDown/PushDownProcessor.java
@@ -83,7 +83,7 @@ public class PushDownProcessor extends BaseRefactoringProcessor {
@Nullable
@Override
protected String getRefactoringId() {
- return "refactoring.psuDown";
+ return "refactoring.push.down";
}
@Nullable