summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java49
-rw-r--r--java/idea-ui/src/com/intellij/framework/FrameworkGroup.java34
-rw-r--r--java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java5
-rw-r--r--java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java125
-rw-r--r--java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkGroupNode.java34
-rw-r--r--java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java49
-rw-r--r--java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNodeBase.java59
-rw-r--r--java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java23
-rw-r--r--java/idea-ui/src/com/intellij/platform/templates/ArchivedTemplatesFactory.java1
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java16
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java58
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java39
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java5
-rw-r--r--java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java5
-rw-r--r--java/java-impl/src/com/intellij/refactoring/replaceConstructorWithFactory/ReplaceConstructorWithFactoryHandler.java2
-rw-r--r--java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java3
-rw-r--r--java/java-psi-api/src/com/intellij/psi/GenericsUtil.java12
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java11
-rw-r--r--java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java6
-rw-r--r--java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java5
-rw-r--r--java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java5
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java4
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java16
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java21
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java13
-rw-r--r--java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiArrayAccessExpressionImpl.java2
-rw-r--r--java/java-psi-impl/src/messages/JavaErrorMessages.properties1
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA60875.java16
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA67829.java4
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA71645.java20
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IgnoreImplicitThisReferenceBeforeSuperSinceJdk7.java4
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IllegalVoidType.java16
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Loop.java40
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA62056.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA63731.java6
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA70890.java10
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67841/pck/AmbiguousMethodCall.java21
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DisableCastingToNestedWildcards.java32
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/Enum56239.java34
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA18425.java15
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20244.java23
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20573.java26
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21597.java7
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602_7.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22005.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22079.java18
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27080.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27185.java13
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57265.java5
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57271.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57272.java8
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57285.java12
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57413.java7
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57482.java9
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57534.java15
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA65066.java19
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67571.java17
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67577.java7
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67998.java22
-rw-r--r--java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/WildcardCastConversion.java18
-rw-r--r--java/java-tests/testData/psi/cls/mirror/Booleans.txt13
-rw-r--r--java/java-tests/testData/psi/cls/mirror/ClassRefs.txt12
-rw-r--r--java/java-tests/testData/psi/cls/mirror/pkg/AnnWithTypeLocal.classbin0 -> 186 bytes
-rw-r--r--java/java-tests/testData/psi/cls/mirror/pkg/BooleanAnno.classbin0 -> 165 bytes
-rw-r--r--java/java-tests/testData/psi/cls/mirror/pkg/Booleans.classbin346 -> 449 bytes
-rw-r--r--java/java-tests/testData/psi/cls/mirror/pkg/ClassRefs.classbin0 -> 461 bytes
-rw-r--r--java/java-tests/testData/psi/cls/mirror/src/pkg/Booleans.java14
-rw-r--r--java/java-tests/testData/psi/cls/mirror/src/pkg/ClassRefs.java10
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy21
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java4
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java32
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java3
-rw-r--r--java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java265
-rw-r--r--java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java1
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java4
-rw-r--r--java/java-tests/testSrc/com/intellij/refactoring/MockIntroduceVariableHandler.java2
-rw-r--r--java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java4
-rw-r--r--java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java9
-rw-r--r--java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java6
82 files changed, 1157 insertions, 375 deletions
diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java
index 513be6c798f4..86c6803d6977 100644
--- a/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java
+++ b/java/compiler/impl/src/com/intellij/compiler/impl/generic/GenericCompilerPersistentData.java
@@ -16,6 +16,7 @@
package com.intellij.compiler.impl.generic;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.io.IOUtil;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NotNull;
@@ -46,32 +47,38 @@ public class GenericCompilerPersistentData {
return;
}
- DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(myFile)));
try {
- final int dataVersion = input.readInt();
- if (dataVersion != VERSION) {
- LOG.info("Version of compiler info file (" + myFile.getAbsolutePath() + ") changed: " + dataVersion + " -> " + VERSION);
- myVersionChanged = true;
- return;
- }
+ DataInputStream input = new DataInputStream(new BufferedInputStream(new FileInputStream(myFile)));
+ try {
+ final int dataVersion = input.readInt();
+ if (dataVersion != VERSION) {
+ LOG.info("Version of compiler info file (" + myFile.getAbsolutePath() + ") changed: " + dataVersion + " -> " + VERSION);
+ myVersionChanged = true;
+ return;
+ }
- final int savedCompilerVersion = input.readInt();
- if (savedCompilerVersion != compilerVersion) {
- LOG.info("Compiler caches version changed (" + myFile.getAbsolutePath() + "): " + savedCompilerVersion + " -> " + compilerVersion);
- myVersionChanged = true;
- return;
- }
+ final int savedCompilerVersion = input.readInt();
+ if (savedCompilerVersion != compilerVersion) {
+ LOG.info("Compiler caches version changed (" + myFile.getAbsolutePath() + "): " + savedCompilerVersion + " -> " + compilerVersion);
+ myVersionChanged = true;
+ return;
+ }
- int size = input.readInt();
- while (size-- > 0) {
- final String target = IOUtil.readString(input);
- final int id = input.readInt();
- myTarget2Id.put(target, id);
- myUsedIds.add(id);
+ int size = input.readInt();
+ while (size-- > 0) {
+ final String target = IOUtil.readString(input);
+ final int id = input.readInt();
+ myTarget2Id.put(target, id);
+ myUsedIds.add(id);
+ }
+ }
+ finally {
+ input.close();
}
}
- finally {
- input.close();
+ catch (IOException e) {
+ FileUtil.delete(myFile);
+ throw e;
}
}
diff --git a/java/idea-ui/src/com/intellij/framework/FrameworkGroup.java b/java/idea-ui/src/com/intellij/framework/FrameworkGroup.java
new file mode 100644
index 000000000000..bd626e59f209
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/framework/FrameworkGroup.java
@@ -0,0 +1,34 @@
+package com.intellij.framework;
+
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public abstract class FrameworkGroup {
+ private final String myId;
+
+ public FrameworkGroup(String id) {
+ myId = id;
+ }
+
+ @NotNull
+ public final String getId() {
+ return myId;
+ }
+
+ @NotNull
+ public abstract String getPresentableName();
+
+ @NotNull
+ public abstract Icon getIcon();
+
+ @NotNull
+ public List<String> getGroupVersions() {
+ return Collections.emptyList();
+ }
+}
diff --git a/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java b/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java
index ce58e530ec6b..4c8e59ea9e36 100644
--- a/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java
+++ b/java/idea-ui/src/com/intellij/framework/FrameworkTypeEx.java
@@ -30,6 +30,11 @@ public abstract class FrameworkTypeEx extends FrameworkType {
super(id);
}
+ @Nullable
+ public FrameworkGroup getParentGroup() {
+ return null;
+ }
+
@NotNull
public abstract FrameworkSupportInModuleProvider createProvider();
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
index 312d9d1aaba1..bb54043be3e8 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AddSupportForFrameworksPanel.java
@@ -19,6 +19,7 @@ package com.intellij.ide.util.newProjectWizard;
import com.intellij.facet.impl.ui.libraries.LibraryCompositionSettings;
import com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel;
import com.intellij.facet.ui.FacetBasedFrameworkSupportProvider;
+import com.intellij.framework.FrameworkGroup;
import com.intellij.framework.addSupport.FrameworkSupportInModuleConfigurable;
import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurable;
@@ -33,12 +34,14 @@ import com.intellij.openapi.roots.IdeaModifiableModelsProvider;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
+import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.Splitter;
+import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.Comparing;
-import com.intellij.openapi.util.MultiValuesMap;
import com.intellij.ui.CheckedTreeNode;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.ui.FormBuilder;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -59,14 +62,15 @@ public class AddSupportForFrameworksPanel implements Disposable {
@NonNls private static final String EMPTY_CARD = "empty";
private JPanel myMainPanel;
private JPanel myFrameworksPanel;
- private List<List<FrameworkSupportNode>> myGroups;
+ private List<FrameworkSupportNodeBase> myRoots;
private final LibrariesContainer myLibrariesContainer;
private final List<FrameworkSupportInModuleProvider> myProviders;
private final FrameworkSupportModelBase myModel;
private final JPanel myOptionsPanel;
private final FrameworksTree myFrameworksTree;
private final Map<FrameworkSupportNode, FrameworkSupportOptionsComponent> myInitializedOptionsComponents = new HashMap<FrameworkSupportNode, FrameworkSupportOptionsComponent>();
- private FrameworkSupportNode myLastSelectedNode;
+ private final Map<FrameworkGroup, JPanel> myInitializedGroupPanels = new HashMap<FrameworkGroup, JPanel>();
+ private FrameworkSupportNodeBase myLastSelectedNode;
public AddSupportForFrameworksPanel(final List<FrameworkSupportInModuleProvider> providers, final FrameworkSupportModelBase model) {
myModel = model;
@@ -75,7 +79,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
createNodes();
final Splitter splitter = new Splitter(false, 0.30f, 0.1f, 0.7f);
- myFrameworksTree = new FrameworksTree(myGroups) {
+ myFrameworksTree = new FrameworksTree(myRoots) {
@Override
protected void onNodeStateChanged(CheckedTreeNode node) {
if (!(node instanceof FrameworkSupportNode)) return;
@@ -113,7 +117,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
updateOptionsPanel();
}
- final FrameworkSupportNode selectedNode = getSelectedNode();
+ final FrameworkSupportNodeBase selectedNode = getSelectedNode();
if (!Comparing.equal(selectedNode, myLastSelectedNode)) {
applyLibraryOptionsForSelected();
@@ -126,8 +130,8 @@ public class AddSupportForFrameworksPanel implements Disposable {
}
private void applyLibraryOptionsForSelected() {
- if (myLastSelectedNode != null) {
- final FrameworkSupportOptionsComponent optionsComponent = myInitializedOptionsComponents.get(myLastSelectedNode);
+ if (myLastSelectedNode instanceof FrameworkSupportNode) {
+ final FrameworkSupportOptionsComponent optionsComponent = myInitializedOptionsComponents.get((FrameworkSupportNode)myLastSelectedNode);
if (optionsComponent != null) {
final LibraryOptionsPanel optionsPanel = optionsComponent.getLibraryOptionsPanel();
if (optionsPanel != null) {
@@ -138,34 +142,55 @@ public class AddSupportForFrameworksPanel implements Disposable {
}
private void updateOptionsPanel() {
- final FrameworkSupportNode node = getSelectedNode();
- if (node != null) {
- initializeOptionsPanel(node);
- showCard(node.getProvider().getFrameworkType().getId());
- UIUtil.setEnabled(myOptionsPanel, node.isChecked(), true);
- node.getConfigurable().onFrameworkSelectionChanged(node.isChecked());
+ final FrameworkSupportNodeBase node = getSelectedNode();
+ if (node instanceof FrameworkSupportNode) {
+ FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode)node;
+ initializeOptionsPanel(frameworkSupportNode);
+ showCard(frameworkSupportNode.getProvider().getFrameworkType().getId());
+ UIUtil.setEnabled(myOptionsPanel, frameworkSupportNode.isChecked(), true);
+ frameworkSupportNode.getConfigurable().onFrameworkSelectionChanged(node.isChecked());
+ }
+ else if (node instanceof FrameworkGroupNode) {
+ FrameworkGroup group = ((FrameworkGroupNode)node).getGroup();
+ initializeGroupPanel(group);
+ showCard(group.getId());
}
else {
showCard(EMPTY_CARD);
}
}
+ private void initializeGroupPanel(FrameworkGroup group) {
+ if (!myInitializedGroupPanels.containsKey(group)) {
+ JPanel panel = new JPanel(new VerticalFlowLayout());
+ List<String> versions = group.getGroupVersions();
+ if (!versions.isEmpty()) {
+ ComboBox versionsBox = new ComboBox();
+ for (String version : versions) {
+ versionsBox.addItem(version);
+ }
+ panel.add(FormBuilder.createFormBuilder().addLabeledComponent("Version:", versionsBox).getPanel());
+ }
+ myInitializedGroupPanels.put(group, panel);
+ myOptionsPanel.add(group.getId(), panel);
+ }
+ }
+
@Nullable
- private FrameworkSupportNode getSelectedNode() {
- final FrameworkSupportNode[] nodes = myFrameworksTree.getSelectedNodes(FrameworkSupportNode.class, null);
+ private FrameworkSupportNodeBase getSelectedNode() {
+ final FrameworkSupportNodeBase[] nodes = myFrameworksTree.getSelectedNodes(FrameworkSupportNodeBase.class, null);
return nodes.length == 1 ? nodes[0] : null;
}
private void initializeOptionsPanel(final FrameworkSupportNode node) {
if (!myInitializedOptionsComponents.containsKey(node)) {
- final FrameworkSupportNode parentNode = node.getParentNode();
- if (parentNode != null) {
- initializeOptionsPanel(parentNode);
+ final FrameworkSupportNodeBase parentNode = node.getParentNode();
+ if (parentNode instanceof FrameworkSupportNode) {
+ initializeOptionsPanel((FrameworkSupportNode)parentNode);
}
FrameworkSupportOptionsComponent optionsComponent = new FrameworkSupportOptionsComponent(myModel, myLibrariesContainer, this,
- node.getProvider(), node.getConfigurable()
- );
+ node.getProvider(), node.getConfigurable());
final String id = node.getProvider().getFrameworkType().getId();
myOptionsPanel.add(id, optionsComponent.getMainPanel());
myInitializedOptionsComponents.put(node, optionsComponent);
@@ -202,47 +227,47 @@ public class AddSupportForFrameworksPanel implements Disposable {
private void createNodes() {
Map<String, FrameworkSupportNode> nodes = new HashMap<String, FrameworkSupportNode>();
- MultiValuesMap<String, FrameworkSupportNode> groups = new MultiValuesMap<String, FrameworkSupportNode>(true);
+ Map<FrameworkGroup, FrameworkGroupNode> groups = new HashMap<FrameworkGroup, FrameworkGroupNode>();
+ List<FrameworkSupportNodeBase> roots = new ArrayList<FrameworkSupportNodeBase>();
for (FrameworkSupportInModuleProvider provider : myProviders) {
- createNode(provider, nodes, groups);
+ createNode(provider, nodes, groups, roots);
}
- myGroups = new ArrayList<List<FrameworkSupportNode>>();
- for (String groupId : groups.keySet()) {
- final Collection<FrameworkSupportNode> collection = groups.get(groupId);
- if (collection != null) {
- final List<FrameworkSupportNode> group = new ArrayList<FrameworkSupportNode>();
- for (FrameworkSupportNode node : collection) {
- if (node.getParentNode() == null) {
- group.add(node);
- }
- }
- FrameworkSupportNode.sortByName(group);
- myGroups.add(group);
- }
- }
+ FrameworkSupportNodeBase.sortByName(roots);
+ myRoots = roots;
}
@Nullable
private FrameworkSupportNode createNode(final FrameworkSupportInModuleProvider provider, final Map<String, FrameworkSupportNode> nodes,
- final MultiValuesMap<String, FrameworkSupportNode> groups) {
+ final Map<FrameworkGroup, FrameworkGroupNode> groupNodes,
+ List<FrameworkSupportNodeBase> roots) {
FrameworkSupportNode node = nodes.get(provider.getFrameworkType().getId());
if (node == null) {
String underlyingTypeId = provider.getFrameworkType().getUnderlyingFrameworkTypeId();
- FrameworkSupportNode parentNode = null;
+ FrameworkSupportNodeBase parentNode = null;
+ final FrameworkGroup group = provider.getFrameworkType().getParentGroup();
if (underlyingTypeId != null) {
FrameworkSupportInModuleProvider parentProvider = FrameworkSupportUtil.findProvider(underlyingTypeId, myProviders);
if (parentProvider == null) {
LOG.info("Cannot find id = " + underlyingTypeId);
return null;
}
- parentNode = createNode(parentProvider, nodes, groups);
+ parentNode = createNode(parentProvider, nodes, groupNodes, roots);
+ }
+ else if (group != null) {
+ parentNode = groupNodes.get(group);
+ if (parentNode == null) {
+ FrameworkGroupNode groupNode = new FrameworkGroupNode(group, null);
+ groupNodes.put(group, groupNode);
+ parentNode = groupNode;
+ roots.add(groupNode);
+ }
}
node = new FrameworkSupportNode(provider, parentNode, myModel, this);
nodes.put(provider.getFrameworkType().getId(), node);
- final String groupId = provider instanceof OldFrameworkSupportProviderWrapper
- ? ((OldFrameworkSupportProviderWrapper)provider).getProvider().getGroupId() : null;
- groups.put(groupId, node);
+ if (parentNode == null) {
+ roots.add(node);
+ }
}
return node;
}
@@ -260,20 +285,20 @@ public class AddSupportForFrameworksPanel implements Disposable {
}
private List<FrameworkSupportNode> getFrameworkNodes(final boolean selectedOnly) {
- ArrayList<FrameworkSupportNode> list = new ArrayList<FrameworkSupportNode>();
- if (myGroups != null) {
- for (List<FrameworkSupportNode> group : myGroups) {
- addChildFrameworks(group, list, selectedOnly);
- }
+ List<FrameworkSupportNode> list = new ArrayList<FrameworkSupportNode>();
+ if (myRoots != null) {
+ addChildFrameworks(myRoots, list, selectedOnly);
}
return list;
}
- private static void addChildFrameworks(final List<FrameworkSupportNode> list, final List<FrameworkSupportNode> result,
+ private static void addChildFrameworks(final List<FrameworkSupportNodeBase> list, final List<FrameworkSupportNode> result,
final boolean selectedOnly) {
- for (FrameworkSupportNode node : list) {
+ for (FrameworkSupportNodeBase node : list) {
if (!selectedOnly || node.isChecked()) {
- result.add(node);
+ if (node instanceof FrameworkSupportNode) {
+ result.add((FrameworkSupportNode)node);
+ }
addChildFrameworks(node.getChildren(), result, selectedOnly);
}
}
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkGroupNode.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkGroupNode.java
new file mode 100644
index 000000000000..2a513d310fcd
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkGroupNode.java
@@ -0,0 +1,34 @@
+package com.intellij.ide.util.newProjectWizard;
+
+import com.intellij.framework.FrameworkGroup;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+/**
+ * @author nik
+ */
+public class FrameworkGroupNode extends FrameworkSupportNodeBase {
+ private final FrameworkGroup myGroup;
+
+ public FrameworkGroupNode(@NotNull FrameworkGroup group, FrameworkSupportNodeBase parent) {
+ super(group, parent);
+ myGroup = group;
+ }
+
+ public FrameworkGroup getGroup() {
+ return myGroup;
+ }
+
+ @NotNull
+ @Override
+ protected String getTitle() {
+ return myGroup.getPresentableName();
+ }
+
+ @NotNull
+ @Override
+ public Icon getIcon() {
+ return myGroup.getIcon();
+ }
+}
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java
index 180e4e5745fe..84d7280f5b5a 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNode.java
@@ -20,51 +20,32 @@ import com.intellij.framework.addSupport.FrameworkSupportInModuleProvider;
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.util.Disposer;
-import com.intellij.ui.CheckedTreeNode;
+import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
+import javax.swing.*;
/**
* @author nik
*/
-public class FrameworkSupportNode extends CheckedTreeNode {
+public class FrameworkSupportNode extends FrameworkSupportNodeBase {
private final FrameworkSupportInModuleProvider myProvider;
- private final FrameworkSupportNode myParentNode;
private FrameworkSupportInModuleConfigurable myConfigurable;
- private final List<FrameworkSupportNode> myChildren = new ArrayList<FrameworkSupportNode>();
private final FrameworkSupportModelBase myModel;
private final Disposable myParentDisposable;
- public FrameworkSupportNode(final FrameworkSupportInModuleProvider provider, final FrameworkSupportNode parentNode, final FrameworkSupportModelBase model,
+ public FrameworkSupportNode(final FrameworkSupportInModuleProvider provider, final FrameworkSupportNodeBase parentNode, final FrameworkSupportModelBase model,
Disposable parentDisposable) {
- super(provider);
+ super(provider, parentNode);
myParentDisposable = parentDisposable;
- setChecked(false);
myProvider = provider;
- myParentNode = parentNode;
model.registerComponent(provider, this);
myModel = model;
- if (parentNode != null) {
- parentNode.add(this);
- parentNode.myChildren.add(this);
- }
- }
-
- public List<FrameworkSupportNode> getChildren() {
- return myChildren;
}
public FrameworkSupportInModuleProvider getProvider() {
return myProvider;
}
- public FrameworkSupportNode getParentNode() {
- return myParentNode;
- }
-
public synchronized FrameworkSupportInModuleConfigurable getConfigurable() {
if (myConfigurable == null) {
myConfigurable = myProvider.createConfigurable(myModel);
@@ -73,24 +54,14 @@ public class FrameworkSupportNode extends CheckedTreeNode {
return myConfigurable;
}
- public static void sortByName(List<FrameworkSupportNode> nodes) {
- if (nodes.isEmpty()) return;
-
- Collections.sort(nodes, new Comparator<FrameworkSupportNode>() {
- public int compare(final FrameworkSupportNode o1, final FrameworkSupportNode o2) {
- return o1.getTitle().compareToIgnoreCase(o2.getTitle());
- }
- });
- for (FrameworkSupportNode node : nodes) {
- node.sortChildren();
- }
- }
-
+ @NotNull
public String getTitle() {
return myProvider.getFrameworkType().getPresentableName();
}
- private void sortChildren() {
- sortByName(myChildren);
+ @NotNull
+ @Override
+ public Icon getIcon() {
+ return myProvider.getFrameworkType().getIcon();
}
}
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNodeBase.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNodeBase.java
new file mode 100644
index 000000000000..0e737f8cdf57
--- /dev/null
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworkSupportNodeBase.java
@@ -0,0 +1,59 @@
+package com.intellij.ide.util.newProjectWizard;
+
+import com.intellij.ui.CheckedTreeNode;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * @author nik
+ */
+public abstract class FrameworkSupportNodeBase extends CheckedTreeNode {
+ protected final FrameworkSupportNodeBase myParentNode;
+ protected final List<FrameworkSupportNodeBase> myChildren = new ArrayList<FrameworkSupportNodeBase>();
+
+ public FrameworkSupportNodeBase(Object userObject, final FrameworkSupportNodeBase parentNode) {
+ super(userObject);
+ setChecked(false);
+ myParentNode = parentNode;
+ if (parentNode != null) {
+ parentNode.add(this);
+ parentNode.myChildren.add(this);
+ }
+ }
+
+ public static void sortByName(List<FrameworkSupportNodeBase> nodes) {
+ if (nodes.isEmpty()) return;
+
+ Collections.sort(nodes, new Comparator<FrameworkSupportNodeBase>() {
+ public int compare(final FrameworkSupportNodeBase o1, final FrameworkSupportNodeBase o2) {
+ return o1.getTitle().compareToIgnoreCase(o2.getTitle());
+ }
+ });
+ for (FrameworkSupportNodeBase node : nodes) {
+ node.sortChildren();
+ }
+ }
+
+ @NotNull
+ protected abstract String getTitle();
+
+ @NotNull
+ public abstract Icon getIcon();
+
+ public List<FrameworkSupportNodeBase> getChildren() {
+ return myChildren;
+ }
+
+ public FrameworkSupportNodeBase getParentNode() {
+ return myParentNode;
+ }
+
+ private void sortChildren() {
+ sortByName(myChildren);
+ }
+}
diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
index 30a188a8a2cd..bed73f5b3e1a 100644
--- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
+++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/FrameworksTree.java
@@ -33,8 +33,8 @@ import java.util.List;
public class FrameworksTree extends CheckboxTree {
private boolean myProcessingMouseEventOnCheckbox;
- public FrameworksTree(List<List<FrameworkSupportNode>> groups) {
- super(new FrameworksTreeRenderer(), new FrameworksRootNode(groups), new CheckPolicy(false, true, true, false));
+ public FrameworksTree(List<FrameworkSupportNodeBase> roots) {
+ super(new FrameworksTreeRenderer(), new FrameworksRootNode(roots), new CheckPolicy(false, true, true, false));
setRootVisible(false);
setShowsRootHandles(false);
TreeUtil.expandAll(this);
@@ -71,8 +71,8 @@ public class FrameworksTree extends CheckboxTree {
@Override
public String convert(TreePath path) {
final Object node = path.getLastPathComponent();
- if (node instanceof FrameworkSupportNode) {
- return ((FrameworkSupportNode)node).getTitle();
+ if (node instanceof FrameworkSupportNodeBase) {
+ return ((FrameworkSupportNodeBase)node).getTitle();
}
return "";
}
@@ -90,21 +90,20 @@ public class FrameworksTree extends CheckboxTree {
@Override
public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
- if (value instanceof FrameworkSupportNode) {
- final FrameworkSupportNode node = (FrameworkSupportNode)value;
+ if (value instanceof FrameworkSupportNodeBase) {
+ final FrameworkSupportNodeBase node = (FrameworkSupportNodeBase)value;
getTextRenderer().append(node.getTitle());
- getTextRenderer().setIcon(node.getProvider().getFrameworkType().getIcon());
+ getTextRenderer().setIcon(node.getIcon());
+ getCheckbox().setVisible(value instanceof FrameworkSupportNode);
}
}
}
private static class FrameworksRootNode extends CheckedTreeNode {
- public FrameworksRootNode(List<List<FrameworkSupportNode>> groups) {
+ public FrameworksRootNode(List<FrameworkSupportNodeBase> roots) {
super(null);
- for (List<FrameworkSupportNode> group : groups) {
- for (FrameworkSupportNode node : group) {
- add(node);
- }
+ for (FrameworkSupportNodeBase node : roots) {
+ add(node);
}
}
}
diff --git a/java/idea-ui/src/com/intellij/platform/templates/ArchivedTemplatesFactory.java b/java/idea-ui/src/com/intellij/platform/templates/ArchivedTemplatesFactory.java
index 1695a82b75ff..919f95239803 100644
--- a/java/idea-ui/src/com/intellij/platform/templates/ArchivedTemplatesFactory.java
+++ b/java/idea-ui/src/com/intellij/platform/templates/ArchivedTemplatesFactory.java
@@ -51,6 +51,7 @@ public class ArchivedTemplatesFactory extends ProjectTemplatesFactory {
IdeaPluginDescriptor[] plugins = PluginManager.getPlugins();
Map<URL, ClassLoader> urls = new HashMap<URL, ClassLoader>();
for (IdeaPluginDescriptor plugin : plugins) {
+ if (!plugin.isEnabled()) continue;
try {
ClassLoader loader = plugin.getPluginClassLoader();
Enumeration<URL> resources = loader.getResources("resources/projectTemplates");
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index 1e5d68fb2eca..3f9bf87694f3 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -893,6 +893,7 @@ public class GenericsHighlightUtil {
return typeParameters[0];
}
+ //http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9.2
@Nullable
public static HighlightInfo checkAccessStaticFieldFromEnumConstructor(PsiReferenceExpression expr, JavaResolveResult result) {
final PsiElement resolved = result.getElement();
@@ -903,14 +904,17 @@ public class GenericsHighlightUtil {
if (constructorOrInitializer == null) return null;
if (constructorOrInitializer.hasModifierProperty(PsiModifier.STATIC)) return null;
final PsiClass aClass = constructorOrInitializer.getContainingClass();
- if (aClass == null) return null;
- if (!aClass.isEnum()) return null;
+ if (aClass == null || !(aClass.isEnum() || aClass instanceof PsiEnumConstantInitializer)) return null;
final PsiField field = (PsiField)resolved;
- if (field.getContainingClass() != aClass) return null;
- final PsiType type = field.getType();
+ if (aClass instanceof PsiEnumConstantInitializer) {
+ if (field.getContainingClass() != aClass.getSuperClass()) return null;
+ } else if (field.getContainingClass() != aClass) return null;
+
- //TODO is access to enum constant is allowed ?
- if (type instanceof PsiClassType && ((PsiClassType)type).resolve() == aClass) return null;
+ if (!JavaVersionService.getInstance().isAtLeast(field, JavaSdkVersion.JDK_1_6)) {
+ final PsiType type = field.getType();
+ if (type instanceof PsiClassType && ((PsiClassType)type).resolve() == aClass) return null;
+ }
if (PsiUtil.isCompileTimeConstant(field)) return null;
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
index 2487c3d680ab..58e2acceefbe 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
@@ -778,7 +778,7 @@ public class HighlightClassUtil {
if (!PsiUtil.isInnerClass(base)) return;
if (resolve == resolved && baseClass != null && (!PsiTreeUtil.isAncestor(baseClass, extendRef, true) || aClass.hasModifierProperty(PsiModifier.STATIC)) &&
- !hasEnclosingInstanceInScope(baseClass, extendRef, true, true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
+ !hasEnclosingInstanceInScope(baseClass, extendRef, !aClass.hasModifierProperty(PsiModifier.STATIC), true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
String description = JavaErrorMessages.message("no.enclosing.instance.in.scope", HighlightUtil.formatClass(baseClass));
infos[0] = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(extendRef).descriptionAndTooltip(description).create();
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
index 7a4ca788a22a..5a0f156c5bbd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightControlFlowUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * 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.
@@ -41,7 +41,7 @@ import java.util.*;
/**
* @author cdr
- * Date: Aug 8, 2002
+ * @since Aug 8, 2002
*/
public class HighlightControlFlowUtil {
private static final QuickFixFactory QUICK_FIX_FACTORY = QuickFixFactory.getInstance();
@@ -50,48 +50,42 @@ public class HighlightControlFlowUtil {
@Nullable
public static HighlightInfo checkMissingReturnStatement(PsiCodeBlock body, PsiType returnType) {
-
- if (body == null
- || returnType == null
- || PsiType.VOID.equals(returnType)) {
+ if (body == null || returnType == null || PsiType.VOID.equals(returnType.getDeepComponentType())) {
return null;
}
+
// do not compute constant expressions for if() statement condition
// see JLS 14.20 Unreachable Statements
try {
- final ControlFlow controlFlow = getControlFlowNoConstantEvaluate(body);
+ ControlFlow controlFlow = getControlFlowNoConstantEvaluate(body);
if (!ControlFlowUtil.returnPresent(controlFlow)) {
- final PsiJavaToken rBrace = body.getRBrace();
- final PsiElement context = rBrace == null
- ? body.getLastChild()
- : rBrace;
- String description = JavaErrorMessages.message("missing.return.statement");
- final HighlightInfo highlightInfo =
- HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(context).descriptionAndTooltip(description).create();
- final PsiElement parent = body.getParent();
+ PsiJavaToken rBrace = body.getRBrace();
+ PsiElement context = rBrace == null ? body.getLastChild() : rBrace;
+ String message = JavaErrorMessages.message("missing.return.statement");
+ HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(context).descriptionAndTooltip(message).create();
+ PsiElement parent = body.getParent();
if (parent instanceof PsiMethod) {
- final PsiMethod method = (PsiMethod)parent;
- QuickFixAction.registerQuickFixAction(highlightInfo, new AddReturnFix(method));
+ PsiMethod method = (PsiMethod)parent;
+ QuickFixAction.registerQuickFixAction(info, new AddReturnFix(method));
IntentionAction fix = QUICK_FIX_FACTORY.createMethodReturnFix(method, PsiType.VOID, true);
- QuickFixAction.registerQuickFixAction(highlightInfo, fix);
+ QuickFixAction.registerQuickFixAction(info, fix);
}
- return highlightInfo;
+ return info;
}
}
- catch (AnalysisCanceledException e) {
- // incomplete code
- }
- return null;
+ catch (AnalysisCanceledException ignored) { }
+ return null;
}
- public static ControlFlow getControlFlowNoConstantEvaluate(final PsiElement body) throws AnalysisCanceledException {
- return ControlFlowFactory.getInstance(body.getProject()).getControlFlow(body,
- LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance(),
- false);
+ public static ControlFlow getControlFlowNoConstantEvaluate(PsiElement body) throws AnalysisCanceledException {
+ LocalsOrMyInstanceFieldsControlFlowPolicy policy = LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance();
+ return ControlFlowFactory.getInstance(body.getProject()).getControlFlow(body, policy, false);
}
- private static ControlFlow getControlFlow(final PsiElement context) throws AnalysisCanceledException {
- return ControlFlowFactory.getInstance(context.getProject()).getControlFlow(context, LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance());
+
+ private static ControlFlow getControlFlow(PsiElement context) throws AnalysisCanceledException {
+ LocalsOrMyInstanceFieldsControlFlowPolicy policy = LocalsOrMyInstanceFieldsControlFlowPolicy.getInstance();
+ return ControlFlowFactory.getInstance(context.getProject()).getControlFlow(context, policy);
}
public static HighlightInfo checkUnreachableStatement(PsiCodeBlock codeBlock) {
@@ -683,12 +677,12 @@ public class HighlightControlFlowUtil {
if (innerClass != null) {
if (variable instanceof PsiParameter) {
final PsiElement parent = variable.getParent();
- if (parent instanceof PsiParameterList && parent.getParent() instanceof PsiLambdaExpression &&
+ if (parent instanceof PsiParameterList && parent.getParent() instanceof PsiLambdaExpression &&
notAccessedForWriting(variable, new LocalSearchScope(((PsiParameter)variable).getDeclarationScope()))) {
return null;
}
}
- if (PsiUtil.getLanguageLevel(variable).isAtLeast(LanguageLevel.JDK_1_8) &&
+ if (PsiUtil.getLanguageLevel(variable).isAtLeast(LanguageLevel.JDK_1_8) &&
isEffectivelyFinal(variable, innerClass, context)) {
return null;
}
@@ -738,7 +732,7 @@ public class HighlightControlFlowUtil {
}
return effectivelyFinal;
}
-
+
private static boolean notAccessedForWriting(PsiVariable variable, final LocalSearchScope searchScope) {
for (PsiReference reference : ReferencesSearch.search(variable, searchScope)) {
final PsiElement element = reference.getElement();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
index 2098dd6bacaf..8fc4b7391b3c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java
@@ -32,6 +32,8 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
@@ -52,7 +54,10 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.templateLanguages.OuterLanguageElement;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.*;
-import com.intellij.util.*;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.ArrayUtilRt;
+import com.intellij.util.Function;
+import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.xml.util.XmlStringUtil;
@@ -1806,10 +1811,10 @@ public class HighlightUtil extends HighlightUtilBase {
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(typeElement).descriptionAndTooltip(description).create();
}
}
+
return null;
}
-
@Nullable
public static HighlightInfo checkIllegalVoidType(@NotNull PsiKeyword type) {
if (!PsiKeyword.VOID.equals(type.getText())) return null;
@@ -1817,15 +1822,17 @@ public class HighlightUtil extends HighlightUtilBase {
PsiElement parent = type.getParent();
if (parent instanceof PsiTypeElement) {
PsiElement typeOwner = parent.getParent();
+ if (typeOwner != null) {
+ // do not highlight incomplete declarations
+ if (PsiUtilCore.hasErrorElementChild(typeOwner)) return null;
+ }
+
if (typeOwner instanceof PsiMethod) {
- if (((PsiMethod)typeOwner).getReturnTypeElement() == parent) return null;
+ PsiMethod method = (PsiMethod)typeOwner;
+ if (method.getReturnTypeElement() == parent && PsiType.VOID.equals(method.getReturnType())) return null;
}
- else if (// like in Class c = void.class;
- typeOwner instanceof PsiClassObjectAccessExpression &&
- TypeConversionUtil.isVoidType(((PsiClassObjectAccessExpression)typeOwner).getOperand().getType()) ||
- // do not highlight incomplete declarations
- typeOwner != null && PsiUtilCore.hasErrorElementChild(typeOwner)) {
- return null;
+ else if (typeOwner instanceof PsiClassObjectAccessExpression) {
+ if (TypeConversionUtil.isVoidType(((PsiClassObjectAccessExpression)typeOwner).getOperand().getType())) return null;
}
else if (typeOwner instanceof JavaCodeFragment) {
if (typeOwner.getUserData(PsiUtil.VALID_VOID_TYPE_IN_CODE_FRAGMENT) != null) return null;
@@ -2002,6 +2009,7 @@ public class HighlightUtil extends HighlightUtilBase {
@Nullable
public static HighlightInfo checkImplicitThisReferenceBeforeSuper(@NotNull PsiClass aClass) {
+ if (JavaVersionService.getInstance().isAtLeast(aClass, JavaSdkVersion.JDK_1_7)) return null;
if (aClass instanceof PsiAnonymousClass) return null;
PsiClass superClass = aClass.getSuperClass();
if (superClass == null || !PsiUtil.isInnerClass(superClass)) return null;
@@ -2636,6 +2644,19 @@ public class HighlightUtil extends HighlightUtilBase {
return null;
}
+ @Nullable
+ static HighlightInfo checkForStatement(@NotNull PsiForStatement statement) {
+ PsiStatement init = statement.getInitialization();
+ if (!(init == null || init instanceof PsiEmptyStatement ||
+ init instanceof PsiDeclarationStatement ||
+ init instanceof PsiExpressionStatement || init instanceof PsiExpressionListStatement)) {
+ String message = JavaErrorMessages.message("invalid.statement");
+ return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(init).descriptionAndTooltip(message).create();
+ }
+
+ return null;
+ }
+
private enum Feature {
GENERICS(LanguageLevel.JDK_1_5, "feature.generics"),
ANNOTATIONS(LanguageLevel.JDK_1_5, "feature.annotations"),
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
index 44b5431e8e08..f611668b576c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
@@ -469,6 +469,11 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
}
@Override
+ public void visitForStatement(PsiForStatement statement) {
+ myHolder.add(HighlightUtil.checkForStatement(statement));
+ }
+
+ @Override
public void visitForeachStatement(final PsiForeachStatement statement) {
myHolder.add(HighlightUtil.checkForEachFeature(statement));
}
diff --git a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java
index fdfb71688530..bc9195dc6ee7 100644
--- a/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/nullable/NullableStuffInspection.java
@@ -425,7 +425,10 @@ public class NullableStuffInspection extends BaseLocalInspectionTool {
private static LocalQuickFix createChangeDefaultNotNullFix(NullableNotNullManager nullableManager, PsiModifierListOwner modifierListOwner) {
final PsiAnnotation annotation = AnnotationUtil.findAnnotation(modifierListOwner, nullableManager.getNotNulls());
if (annotation != null) {
- return new ChangeNullableDefaultsFix(annotation.getQualifiedName(), null, nullableManager);
+ final PsiJavaCodeReferenceElement referenceElement = annotation.getNameReferenceElement();
+ if (referenceElement != null && referenceElement.resolve() != null) {
+ return new ChangeNullableDefaultsFix(annotation.getQualifiedName(), null, nullableManager);
+ }
}
return null;
}
diff --git a/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithFactory/ReplaceConstructorWithFactoryHandler.java b/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithFactory/ReplaceConstructorWithFactoryHandler.java
index c9480d3d40d6..470c5d68513a 100644
--- a/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithFactory/ReplaceConstructorWithFactoryHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/replaceConstructorWithFactory/ReplaceConstructorWithFactoryHandler.java
@@ -112,7 +112,7 @@ public class ReplaceConstructorWithFactoryHandler
final PsiMethod[] constructors = aClass.getConstructors();
if (constructors.length > 0) {
String message =
- RefactoringBundle.message("class.does.not.have.implicit.default.consructor", aClass.getQualifiedName()) ;
+ RefactoringBundle.message("class.does.not.have.implicit.default.constructor", aClass.getQualifiedName()) ;
CommonRefactoringUtil.showErrorHint(myProject, editor, message, REFACTORING_NAME, HelpID.REPLACE_CONSTRUCTOR_WITH_FACTORY);
return;
}
diff --git a/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java b/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java
index b053945ddf6c..db3e95b83938 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/InlineUtil.java
@@ -216,6 +216,9 @@ public class InlineUtil {
PsiElement lastInitializerSibling = initializers[initializers.length - 1];
while (lastInitializerSibling != null) {
final PsiElement nextSibling = lastInitializerSibling.getNextSibling();
+ if (nextSibling == null) {
+ break;
+ }
if (nextSibling.getNode().getElementType() == JavaTokenType.RBRACE) break;
lastInitializerSibling = nextSibling;
}
diff --git a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
index 8a6bb464e63d..06d40370d5b7 100644
--- a/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/GenericsUtil.java
@@ -234,8 +234,16 @@ public class GenericsUtil {
}
@Nullable
- public static PsiType getVariableTypeByExpressionType(@Nullable final PsiType type) {
+ public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type) {
+ return getVariableTypeByExpressionType(type, true);
+ }
+
+ @Nullable
+ public static PsiType getVariableTypeByExpressionType(@Nullable PsiType type, final boolean openCaptured) {
if (type == null) return null;
+ if (type instanceof PsiCapturedWildcardType) {
+ type = ((PsiCapturedWildcardType)type).getWildcard();
+ }
PsiType transformed = type.accept(new PsiTypeVisitor<PsiType>() {
@Override
public PsiType visitArrayType(PsiArrayType arrayType) {
@@ -271,7 +279,7 @@ public class GenericsUtil {
@Override
public PsiType visitCapturedWildcardType(PsiCapturedWildcardType capturedWildcardType) {
- return capturedWildcardType.getWildcard().accept(this);
+ return openCaptured ? capturedWildcardType.getWildcard().accept(this) : capturedWildcardType;
}
@Override
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
index 672a01334f47..9cce64d95310 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypeConversionUtil.java
@@ -325,7 +325,7 @@ public class TypeConversionUtil {
PsiClass[] supers = derived.getSupers();
if (manager.areElementsEquivalent(base, derived)) {
derivedSubstitutor = getSuperClassSubstitutor(derived, derived, derivedSubstitutor);
- return areSameArgumentTypes(derived, baseResult.getSubstitutor(), derivedSubstitutor);
+ return areSameArgumentTypes(derived, baseResult.getSubstitutor(), derivedSubstitutor, 1);
}
else if (base.isInheritor(derived, true)) {
derivedSubstitutor = getSuperClassSubstitutor(derived, derived, derivedSubstitutor);
@@ -355,11 +355,18 @@ public class TypeConversionUtil {
}
private static boolean areSameArgumentTypes(PsiClass aClass, PsiSubstitutor substitutor1, PsiSubstitutor substitutor2) {
+ return areSameArgumentTypes(aClass, substitutor1, substitutor2, 0);
+ }
+
+ private static boolean areSameArgumentTypes(PsiClass aClass,
+ PsiSubstitutor substitutor1,
+ PsiSubstitutor substitutor2,
+ int level) {
for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(aClass)) {
PsiType typeArg1 = substitutor1.substitute(typeParameter);
PsiType typeArg2 = substitutor2.substitute(typeParameter);
if (typeArg1 == null || typeArg2 == null) return true;
- if (TypesDistinctProver.provablyDistinct(typeArg1, typeArg2)) return false;
+ if (TypesDistinctProver.provablyDistinct(typeArg1, typeArg2, level)) return false;
final PsiClass class1 = PsiUtil.resolveClassInType(typeArg1);
if (class1 instanceof PsiTypeParameter) {
diff --git a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
index 5d2c6aab7467..df1be5851ec1 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/TypesDistinctProver.java
@@ -35,7 +35,7 @@ public class TypesDistinctProver {
return provablyDistinct(type1, type2, 0);
}
- private static boolean provablyDistinct(PsiType type1, PsiType type2, int level) {
+ protected static boolean provablyDistinct(PsiType type1, PsiType type2, int level) {
if (type1 instanceof PsiClassType && ((PsiClassType)type1).resolve() instanceof PsiTypeParameter) return false;
if (type2 instanceof PsiClassType && ((PsiClassType)type2).resolve() instanceof PsiTypeParameter) return false;
if (type1 instanceof PsiWildcardType) {
@@ -43,9 +43,9 @@ public class TypesDistinctProver {
return provablyDistinct((PsiWildcardType)type1, (PsiWildcardType)type2);
}
+ if (level > 1) return true;
if (type2 instanceof PsiCapturedWildcardType) {
- return ((PsiWildcardType)type1).isExtends() && level > 0 ||
- provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard());
+ return provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard());
}
if (type2 instanceof PsiClassType) {
diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
index 914a30024aef..c61659752eec 100644
--- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
+++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java
@@ -657,6 +657,11 @@ public class JavaDocInfoGenerator {
}
buffer.append("&nbsp;");
}
+ } else {
+ buffer.append("<font color=red>");
+ buffer.append(annotation.getText());
+ buffer.append("</font>");
+ buffer.append("&nbsp;");
}
}
}
diff --git a/java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java b/java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java
index 05132a8b7734..cc9ff3bd7a6c 100644
--- a/java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java
+++ b/java/java-psi-impl/src/com/intellij/externalSystem/JavaProjectDataService.java
@@ -48,11 +48,14 @@ public class JavaProjectDataService implements ProjectDataService<JavaProjectDat
@Override
public void importData(@NotNull Collection<DataNode<JavaProjectData>> toImport, @NotNull Project project, boolean synchronous) {
+ if (!ExternalSystemApiUtil.isNewProjectConstruction()) {
+ return;
+ }
if (toImport.size() != 1) {
throw new IllegalArgumentException(String.format("Expected to get a single project but got %d: %s", toImport.size(), toImport));
}
JavaProjectData projectData = toImport.iterator().next().getData();
-
+
// JDK.
JavaSdkVersion version = projectData.getJdkVersion();
JavaSdk javaSdk = JavaSdk.getInstance();
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
index 0e1e3439418d..d0f05480613f 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java
@@ -491,6 +491,10 @@ public class PsiImplUtil {
toplevel = (PsiExpression)toplevel.getParent();
}
+ if (toplevel instanceof PsiArrayAccessExpression && !PsiUtil.isAccessedForWriting(toplevel)) {
+ return PsiUtil.captureToplevelWildcards(type, expression);
+ }
+
final PsiType normalized = doNormalizeWildcardByPosition(type, expression, toplevel);
LOG.assertTrue(normalized.isValid(), type);
if (normalized instanceof PsiClassType && !PsiUtil.isAccessedForWriting(toplevel)) {
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
index f17fb5b54557..8f0e58d9619e 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -406,9 +406,17 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
setMirror(getExtendsList(), mirror.getExtendsList());
setMirror(getImplementsList(), mirror.getImplementsList());
- setMirrors(getOwnFields(), mirror.getFields());
- setMirrors(getOwnMethods(), mirror.getMethods());
- setMirrors(getOwnInnerClasses(), mirror.getInnerClasses());
+ if (mirror instanceof PsiExtensibleClass) {
+ PsiExtensibleClass extMirror = (PsiExtensibleClass)mirror;
+ setMirrors(getOwnFields(), extMirror.getOwnFields());
+ setMirrors(getOwnMethods(), extMirror.getOwnMethods());
+ setMirrors(getOwnInnerClasses(), extMirror.getOwnInnerClasses());
+ }
+ else {
+ setMirrors(getOwnFields(), mirror.getFields());
+ setMirrors(getOwnMethods(), mirror.getMethods());
+ setMirrors(getOwnInnerClasses(), mirror.getInnerClasses());
+ }
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
index c435f97766a4..060ed38ba278 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsElementImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -310,20 +310,19 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
}
protected static <T extends PsiElement> void setMirrors(@NotNull T[] stubs, @NotNull T[] mirrors) throws InvalidMirrorException {
- if (stubs.length != mirrors.length) {
- throw new InvalidMirrorException(stubs, mirrors);
- }
- for (int i = 0; i < stubs.length; i++) {
- setMirror(stubs[i], mirrors[i]);
- }
+ setMirrors(Arrays.asList(stubs), Arrays.asList(mirrors));
}
protected static <T extends PsiElement> void setMirrors(@NotNull List<T> stubs, @NotNull T[] mirrors) throws InvalidMirrorException {
- if (stubs.size() != mirrors.length) {
+ setMirrors(stubs, Arrays.asList(mirrors));
+ }
+
+ protected static <T extends PsiElement> void setMirrors(@NotNull List<T> stubs, @NotNull List<T> mirrors) throws InvalidMirrorException {
+ if (stubs.size() != mirrors.size()) {
throw new InvalidMirrorException(stubs, mirrors);
}
for (int i = 0; i < stubs.size(); i++) {
- setMirror(stubs.get(i), mirrors[i]);
+ setMirror(stubs.get(i), mirrors.get(i));
}
}
@@ -340,8 +339,8 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
this("stub:" + Arrays.toString(stubElements) + "; mirror:" + Arrays.toString(mirrorElements));
}
- public InvalidMirrorException(@NotNull List<? extends PsiElement> stubElements, @NotNull PsiElement[] mirrorElements) {
- this("stub:" + stubElements + "; mirror:" + Arrays.toString(mirrorElements));
+ public InvalidMirrorException(@NotNull List<? extends PsiElement> stubElements, @NotNull List<? extends PsiElement> mirrorElements) {
+ this("stub:" + stubElements + "; mirror:" + mirrorElements);
}
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
index 95daf337ebc7..8e79478dd2d6 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/StubBuildingVisitor.java
@@ -340,7 +340,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
byte flags = PsiFieldStubImpl.packFlags((access & Opcodes.ACC_ENUM) != 0, (access & Opcodes.ACC_DEPRECATED) != 0, false);
TypeInfo type = fieldType(desc, signature);
- String initializer = constToString(value, "boolean".equals(type.text.getString()));
+ String initializer = constToString(value, "boolean".equals(type.text.getString()), false);
PsiFieldStub stub = new PsiFieldStubImpl(myResult, name, type, initializer, flags);
PsiModifierListStub modList = new PsiModifierListStubImpl(stub, packFieldFlags(access));
return new AnnotationCollectingVisitor(modList);
@@ -371,7 +371,8 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
return new TypeInfo(getTypeText(type), (byte)dim, false, Collections.<PsiAnnotationStub>emptyList()); //todo read annos from .class file
}
- private static final String[] parameterNames = {"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9",};
+ private static final String[] parameterNames = {"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"};
+
@Override
@Nullable
public MethodVisitor visitMethod(final int access,
@@ -536,7 +537,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
@Override
public void visit(final String name, final Object value) {
valuePairPrefix(name);
- myBuilder.append(constToString(value, false));
+ myBuilder.append(constToString(value, false, true));
}
@Override
@@ -696,7 +697,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
}
@Nullable
- private static String constToString(@Nullable Object value, boolean isBoolean) {
+ private static String constToString(@Nullable Object value, boolean isBoolean, boolean anno) {
if (value == null) return null;
if (value instanceof String) return "\"" + StringUtil.escapeStringCharacters((String)value) + "\"";
@@ -747,6 +748,10 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
return buffer.toString();
}
+ if (anno && value instanceof Type) {
+ return getTypeText((Type)value) + ".class";
+ }
+
return null;
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiArrayAccessExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiArrayAccessExpressionImpl.java
index cead445cb9b4..f9b2a939fa4b 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiArrayAccessExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiArrayAccessExpressionImpl.java
@@ -46,7 +46,7 @@ public class PsiArrayAccessExpressionImpl extends ExpressionPsiElement implement
public PsiType getType() {
PsiType arrayType = getArrayExpression().getType();
if (!(arrayType instanceof PsiArrayType)) return null;
- return GenericsUtil.getVariableTypeByExpressionType(((PsiArrayType)arrayType).getComponentType());
+ return GenericsUtil.getVariableTypeByExpressionType(((PsiArrayType)arrayType).getComponentType(), false);
}
@Override
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index a20e3c24e1e5..e108e585a02f 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -217,6 +217,7 @@ modifier.not.allowed=Modifier ''{0}'' not allowed here
exception.never.thrown.try=Exception ''{0}'' is never thrown in the corresponding try block
exception.already.caught.warn=Unreachable section: {1, choice, 0#exception|2#exceptions} ''{0}'' {1, choice, 0#has|2#have} already been caught
not.a.statement=Not a statement
+invalid.statement=Invalid statement
incompatible.types=Incompatible types. Found: ''{1}'', required: ''{0}''
valid.switch.selector.types=byte, char, short or int
dot.expected.after.super.or.this='.' expected
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA60875.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA60875.java
new file mode 100644
index 000000000000..8c2d86ed2578
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA60875.java
@@ -0,0 +1,16 @@
+class A {
+
+ class B {
+
+ private void foo() {}
+ }
+ class C extends B {
+
+ class D {
+
+ void bar() {
+ C.this.<error descr="'foo()' has private access in 'A.B'">foo</error>();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA67829.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA67829.java
new file mode 100644
index 000000000000..ba40610e98ad
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA67829.java
@@ -0,0 +1,4 @@
+class A{
+ void foo(String s){}
+ static void foo(Object s){<error descr="Non-static method 'foo(java.lang.String)' cannot be referenced from a static context">foo</error>("");}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA71645.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA71645.java
new file mode 100644
index 000000000000..6c23dcd5e141
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IDEA71645.java
@@ -0,0 +1,20 @@
+class Component {
+ void addChild( Component b ) {
+ }
+}
+
+class Panel extends Component {
+ public Panel( Component pNode ) {
+ }
+
+ Panel() {
+ }
+}
+
+class VerticalPanel extends Panel {
+ public VerticalPanel() {
+ super( new Component() {{
+ addChild( new Panel() );
+ }} );
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IgnoreImplicitThisReferenceBeforeSuperSinceJdk7.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IgnoreImplicitThisReferenceBeforeSuperSinceJdk7.java
new file mode 100644
index 000000000000..2dc8d2cbf1ea
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IgnoreImplicitThisReferenceBeforeSuperSinceJdk7.java
@@ -0,0 +1,4 @@
+class Test {
+ class Test1 extends Test {}
+ class Test2 extends Test1 {}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IllegalVoidType.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IllegalVoidType.java
index 206be9026ba0..6852b0fa9ed2 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IllegalVoidType.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/IllegalVoidType.java
@@ -1,18 +1,18 @@
-class s {
- void f() {
- // illegal type
+class C {
+ <error descr="Illegal type: 'void'">void</error>[] m1() { }
+ <error descr="Illegal type: 'void'">void</error> m2()[] { }
+ void m3(<error descr="Illegal type: 'void'">void</error> p) {}
+
+ {
<error descr="Illegal type: 'void'">void</error>[] va;
<error descr="Illegal type: 'void'">void</error> vv;
- class loc {
- void f(<error descr="Illegal type: 'void'">void</error> i) {}
- }
- Object o = new <error descr="Illegal type: 'void'">void</error>[1];
+ Object oo = new <error descr="Illegal type: 'void'">void</error>[1];
// this is the only valid void usage
Class voidClass = void.class;
}
- {
+ void f() {
<error descr="Incompatible types. Found: 'void', required: 'java.lang.Object'">Object o = f();</error>
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Loop.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Loop.java
index 600bae3ca7db..5dd2c92da54b 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Loop.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Loop.java
@@ -1,54 +1,54 @@
-// continue outside of.../loop label
-public class a {
+class a {
+ class ff { }
void f() {
<error descr="Continue outside of loop">continue;</error>
+
while (true) {
continue;
}
do { continue; } while (true);
+
switch (1) {
case 1: <error descr="Continue outside of loop">continue;</error>
}
+
for (;;) {
continue;
}
for (;;) {
new ff() {
- void f() {
+ void f() {
<error descr="Continue outside of loop">continue;</error>
}
};
continue;
}
-
while (true) {
class s {
- {
- <error descr="Continue outside of loop">continue;</error>
- }
+ {
+ <error descr="Continue outside of loop">continue;</error>
+ }
}
continue;
}
do {
class s {
- {
- <error descr="Continue outside of loop">continue;</error>
- }
+ {
+ <error descr="Continue outside of loop">continue;</error>
+ }
}
continue;
} while (true);
-
-
a:
if (2==4) {
- for (;;) {
- <error descr="Not a loop label: 'a'">continue a;</error>
- }
+ for (;;) {
+ <error descr="Not a loop label: 'a'">continue a;</error>
+ }
}
a:
@@ -56,12 +56,10 @@ public class a {
for (;;) {
<error descr="Not a loop label: 'a'">continue a;</error>
}
-
-
+ int i = 0;
+ for (<error descr="Not a statement">i==0?7:8;</error> ; ) ;
+ for (<error descr="Invalid statement">if (i<0) i++;</error> ; ) ;
+ for (new ff(), new ff(); ; ) ;
}
}
-
-class ff {
-
-}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass.java
new file mode 100644
index 000000000000..3c38d3c19096
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass.java
@@ -0,0 +1,8 @@
+class Test {
+ class Test1 extends Test {}
+ static class Test2 extends <error descr="No enclosing instance of type 'Test' is in scope">Test1</error> {}
+
+
+ static class Test11 extends Test {}
+ static class Test21 extends Test11 {}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA62056.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA62056.java
new file mode 100644
index 000000000000..13d4aa9b3b54
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA62056.java
@@ -0,0 +1,10 @@
+class Test {
+ public static void rotate(S<?> s) {
+ Object[] o = new Object[0];
+ s.call(o);
+ }
+}
+
+interface S<T>{
+ void call(T... elements);
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA63731.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA63731.java
new file mode 100644
index 000000000000..a204a57e3b83
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA63731.java
@@ -0,0 +1,6 @@
+class Test {
+ {
+ Integer i = 9;
+ byte b = (byte) (i >> 2);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA70890.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA70890.java
new file mode 100644
index 000000000000..c5283294ce0b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/IDEA70890.java
@@ -0,0 +1,10 @@
+import java.util.*;
+
+public class Test {
+ static <E extends Exception, T> void foo(List<T> l, Class<E> ec) throws E {
+ }
+
+ public static void main(String[] s) {
+ foo(new ArrayList(), RuntimeException.class); //IDEA says we have an unhandled exception here
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67841/pck/AmbiguousMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67841/pck/AmbiguousMethodCall.java
new file mode 100644
index 000000000000..c79d7c8b875b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ambiguousIDEA67841/pck/AmbiguousMethodCall.java
@@ -0,0 +1,21 @@
+package pck;
+
+import java.util.Collection;
+import java.util.List;
+
+import static pck.D.foo;
+import static pck.C.foo;
+
+public class C {
+ static <T extends Collection<S>, S> void foo(T x) { }
+}
+
+class D {
+ static <T extends List<S>, S> String foo(T x) { return null; }
+}
+
+class B{
+ public static void bar(){
+ foo(null).toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DisableCastingToNestedWildcards.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DisableCastingToNestedWildcards.java
new file mode 100644
index 000000000000..9c076abce2ac
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/DisableCastingToNestedWildcards.java
@@ -0,0 +1,32 @@
+import java.util.List;
+
+public class Test {
+
+ interface P {
+
+ }
+
+ public abstract class AP implements P {
+
+ }
+
+ public class AP1 extends AP {
+
+ }
+
+ public class AP2 extends AP {
+
+ }
+
+ private static final List<Class<AP1>> AP_LIST = listOf(AP1.class);
+
+
+ private static <T> List<T> listOf(T... ts) {
+ return null;
+ }
+
+ public static void test() {
+ List<Class<? extends AP>> apList1 = <error descr="Inconvertible types; cannot cast 'java.util.List<java.lang.Class<Test.AP1>>' to 'java.util.List<java.lang.Class<? extends Test.AP>>'">(List<Class<? extends AP>>) AP_LIST</error>;
+ List<Class<? super AP1>> apList2 = <error descr="Inconvertible types; cannot cast 'java.util.List<java.lang.Class<Test.AP1>>' to 'java.util.List<java.lang.Class<? super Test.AP1>>'">(List<Class<? super AP1>>) AP_LIST</error>;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/Enum56239.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/Enum56239.java
new file mode 100644
index 000000000000..9f7d0b8f195e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/Enum56239.java
@@ -0,0 +1,34 @@
+enum IDEA56239 {
+ A, B() {
+ {
+ System.out.println(<error descr="It is illegal to access static member 'A' from enum constructor or instance initializer">A</error>);
+ System.out.println(<error descr="It is illegal to access static member 'FOO' from enum constructor or instance initializer">FOO</error>);
+ System.out.println(FOO1);
+ System.out.println(<error descr="It is illegal to access static member 'C' from enum constructor or instance initializer">C</error>);
+ }
+ }, C(<error descr="Illegal forward reference">D</error>), D;
+
+ public static String FOO = "";
+ public static final String FOO1 = "";
+
+ IDEA56239() {
+ }
+
+ IDEA56239(IDEA56239 t) {
+ System.out.println(<error descr="It is illegal to access static member 'A' from enum constructor or instance initializer">A</error>);
+ System.out.println(<error descr="It is illegal to access static member 'FOO' from enum constructor or instance initializer">FOO</error>);
+ System.out.println(FOO1);
+ }
+
+ {
+ System.out.println(<error descr="It is illegal to access static member 'A' from enum constructor or instance initializer">A</error>);
+ System.out.println(<error descr="It is illegal to access static member 'FOO' from enum constructor or instance initializer">FOO</error>);
+ System.out.println(FOO1);
+ }
+
+ void foo() {
+ System.out.println(A);
+ System.out.println(FOO);
+ System.out.println(FOO1);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA18425.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA18425.java
new file mode 100644
index 000000000000..4308a92cc67c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA18425.java
@@ -0,0 +1,15 @@
+public abstract class BiFunction<A,B> {
+ public abstract B apply(A a);
+ public abstract A unapply(B b);
+ public BiFunction<B,A> flip() {
+ return new BiFunction<B, A>() {
+ public A apply(B b) {
+ return BiFunction.this.unapply(b);
+ }
+
+ public B unapply(A a) {
+ return BiFunction.this.apply(a);
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20244.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20244.java
new file mode 100644
index 000000000000..ee5235ad87fe
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20244.java
@@ -0,0 +1,23 @@
+import java.util.Collection;
+class Test {
+ public static final UnaryFunction<Object, Object, RuntimeException> unaryFunction = new UnaryFunction<Object, Object, RuntimeException>() {
+ public Object execute(Object o) throws RuntimeException {
+ return null;
+ }
+ };
+
+ public static <A, B, X extends Throwable> void someMethod() {
+ transformCollection(null, unaryFunction, null);
+ }
+
+ public static <A, B, X extends Throwable> void transformCollection(Collection<? extends A> input, UnaryFunction<A, B, X> transform, Collection<? super B> output) throws X {
+ for (A a : input) {
+ B b = transform.execute(a);
+ output.add(b);
+ }
+ }
+}
+
+interface UnaryFunction<A, B, X extends Throwable> {
+ public B execute(A a) throws X;
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20573.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20573.java
new file mode 100644
index 000000000000..22bd7a39c8a9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA20573.java
@@ -0,0 +1,26 @@
+public class GoodCodeIsRed {
+
+ public void test() {
+ FileIF file = new FileImpl();
+ file.getInputStream();
+ }
+}
+
+class FileImpl implements FileIF {
+
+ public void getInputStream() {
+ }
+
+}
+
+interface FileIF extends BasicFileIF, DataSource {
+}
+
+interface BasicFileIF {
+ void getInputStream();
+}
+
+
+interface DataSource {
+ void getInputStream() throws java.io.IOException;
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21597.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21597.java
new file mode 100644
index 000000000000..b26f4917e6e0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21597.java
@@ -0,0 +1,7 @@
+interface Foo<A> {}
+interface Bar extends Foo<Boolean> {}
+class FooFactory {
+ public <A> Foo<A> getFoo() {
+ return (Foo<A>) new Bar() {};
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602.java
new file mode 100644
index 000000000000..c02ceaa8c651
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602.java
@@ -0,0 +1,17 @@
+import java.util.Collection;
+import java.util.Collections;
+
+public class IDEABug {
+
+ static class ClassA {
+ static <T> void sayHello(Collection<? extends T> msg) {}
+ }
+
+ static class ClassB extends ClassA {
+ static <T extends String> void sayHello(Collection<? extends T> msg) {}
+ }
+
+ public static void main(String[] args) {
+ ClassB.sayHello(Collections.<String>emptyList());
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602_7.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602_7.java
new file mode 100644
index 000000000000..0496f3a40b13
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA21602_7.java
@@ -0,0 +1,17 @@
+import java.util.Collection;
+import java.util.Collections;
+
+public class IDEABug {
+
+ static class ClassA {
+ static <T> void sayHello(Collection<? extends T> msg) {}
+ }
+
+ static class ClassB extends ClassA {
+ <error descr="'sayHello(Collection<? extends T>)' in 'IDEABug.ClassB' clashes with 'sayHello(Collection<? extends T>)' in 'IDEABug.ClassA'; both methods have same erasure, yet neither hides the other">static <T extends String> void sayHello(Collection<? extends T> msg)</error> {}
+ }
+
+ public static void main(String[] args) {
+ ClassB.sayHello(Collections.<String>emptyList());
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22005.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22005.java
new file mode 100644
index 000000000000..78aad3c656f0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22005.java
@@ -0,0 +1,13 @@
+class Test {
+ interface Foo<T> {
+ void boo(T t);
+ }
+
+ private static void f(Foo<?>... fs) {
+ fs[0].boo<error descr="'boo(capture<?>)' in 'Test.Foo' cannot be applied to '(java.lang.String)'">("hey!")</error>;
+ }
+
+ private static void f1(Foo<? extends String>... fs) {
+ fs[0].boo<error descr="'boo(capture<? extends java.lang.String>)' in 'Test.Foo' cannot be applied to '(java.lang.String)'">("hey!")</error>;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22079.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22079.java
new file mode 100644
index 000000000000..f3b25c959fd5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA22079.java
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class SubClass extends BaseClass<String> {
+ public static void main(String[] args) {
+ new SubClass().method(null);
+ }
+
+ @Override
+ public void method(List list) {}
+}
+
+class BaseClass<E> implements EntityListListener<E> {
+ public void method(List list) {}
+}
+
+interface EntityListListener<E> {
+ public void method(List<E> list);
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27080.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27080.java
new file mode 100644
index 000000000000..7e9168d33a61
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27080.java
@@ -0,0 +1,9 @@
+abstract class TypeToken<T> {
+ private <T> TypeToken<T> tt(Class<T> t) { return null; }
+ private <T> void checkedTestInexactSupertype(TypeToken<T> expectedSuperclass, TypeToken<? extends T> type) {}
+ TypeToken<? super Integer> ft = null;
+
+ {
+ checkedTestInexactSupertype(ft, tt(Integer.class));
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27185.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27185.java
new file mode 100644
index 000000000000..3afbc3c6fd83
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA27185.java
@@ -0,0 +1,13 @@
+import java.io.Serializable;
+interface A<T extends Serializable>
+{
+ <S extends T> S foo(S s);
+}
+class B implements A<Number>
+{
+ @Override
+ public <S extends Number> S foo(S s)
+ {
+ return s;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57265.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57265.java
new file mode 100644
index 000000000000..9a74ac7c44c6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57265.java
@@ -0,0 +1,5 @@
+class A<T> {
+ class B<S> {
+ <error descr="Improper formed type; some type parameters are missing">A<T>.B</error> x;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57271.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57271.java
new file mode 100644
index 000000000000..3dc042f9ee99
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57271.java
@@ -0,0 +1,9 @@
+abstract class A<S> {
+ abstract <T> T foo(T x, T y);
+
+ {
+ A<? extends A<? extends Throwable>> a = null;
+ A<? extends A<?>> b = null;
+ foo(a, b);
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57272.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57272.java
new file mode 100644
index 000000000000..c91867c7da69
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57272.java
@@ -0,0 +1,8 @@
+abstract class A<S> {
+ abstract <T extends A<? extends Throwable>> T foo(T y);
+
+ {
+ A<?> a = null;
+ <error descr="Inferred type 'A<capture<?>>' for type parameter 'T' is not within its bound; should extend 'A<? extends java.lang.Throwable>'">foo(a)</error>;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57285.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57285.java
new file mode 100644
index 000000000000..5498f79e4650
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57285.java
@@ -0,0 +1,12 @@
+package pck;
+
+abstract class A<S> {
+ S y;
+ void bar(A<? extends int[]> x){
+ Object obj = <error descr="Array type expected; found: 'capture<? extends int[]>'">x.y</error>[0];
+ }
+
+ void baz(A<? super int[]> x){
+ Object obj = <error descr="Array type expected; found: 'capture<? super int[]>'">x.y</error>[0];
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57413.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57413.java
new file mode 100644
index 000000000000..99b34aa67b05
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57413.java
@@ -0,0 +1,7 @@
+class A<T> {
+ <T extends A<T>> void foo(T x){}
+
+ void bar(A<?> x){
+ <error descr="Inferred type 'A<capture<?>>' for type parameter 'T' is not within its bound; should extend 'A<A<capture<?>>>'">foo(x)</error>;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57482.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57482.java
new file mode 100644
index 000000000000..8b1471b27c24
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57482.java
@@ -0,0 +1,9 @@
+class C<T>{
+ static class D{
+ class E{
+ <error descr="'C.this' cannot be referenced from a static context">T</error> x;
+ }
+ }
+}
+
+class T{} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57534.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57534.java
new file mode 100644
index 000000000000..ea3e242fa54c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA57534.java
@@ -0,0 +1,15 @@
+abstract class C{
+ abstract <T extends Cloneable> void foo(T x);
+ abstract <T extends Object & Cloneable> void foo(T x);
+ void bar(Cloneable x){
+ foo<error descr="Ambiguous method call: both 'C.foo(Cloneable)' and 'C.foo(Cloneable)' match">(x)</error>;
+ }
+}
+
+abstract class D {
+ abstract <T extends Iterable<? extends Exception>> void foo(T x);
+ abstract <T extends Object & Iterable<? super Exception>> void foo(T x);
+ void bar(Iterable<Exception> x){
+ foo<error descr="Ambiguous method call: both 'D.foo(Iterable<Exception>)' and 'D.foo(Iterable<Exception>)' match">(x)</error>;
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA65066.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA65066.java
new file mode 100644
index 000000000000..3078f601d777
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA65066.java
@@ -0,0 +1,19 @@
+import java.util.List;
+
+class Generics {
+ public static void main( String[] args ) {
+ Outer<? extends List<? extends Nested<?>>, ?> var = OuterImpl.create(); //marked red
+ }
+
+ private static interface Outer<I, O> {
+ }
+
+ private static class OuterImpl<T> implements Outer<T, T> {
+ public static <T> OuterImpl<T> create() {
+ return new OuterImpl<T>();
+ }
+ }
+
+ private static class Nested<T> {
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67571.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67571.java
new file mode 100644
index 000000000000..14d2d29ef114
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67571.java
@@ -0,0 +1,17 @@
+interface A
+{
+ abstract <T> void foo();
+}
+
+interface B
+{
+ abstract <T,S> void foo();
+}
+
+class C<<error descr="'foo()' in 'B' clashes with 'foo()' in 'A'; both methods have same erasure, yet neither overrides the other"></error>T extends A & B>
+{
+ void bar(T x)
+ {
+ x.foo<error descr="Ambiguous method call: both 'A.foo()' and 'B.foo()' match">()</error>;
+ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67577.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67577.java
new file mode 100644
index 000000000000..3c34161bd481
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67577.java
@@ -0,0 +1,7 @@
+class X<T>{}
+
+class A<T,S extends X<T>> {}
+
+class C {
+ void foo(A<?, <error descr="Type parameter 'X' is not within its bound; should extend 'X<?>'">X</error>> a){ }
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67998.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67998.java
new file mode 100644
index 000000000000..3fede9cc7909
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/IDEA67998.java
@@ -0,0 +1,22 @@
+class TestClass {
+ public final class TestMapper<X> {
+
+ public <U, T extends Mapping<X, U>> T mapType() {
+ SimpleMapping<X, U> mapping = new SimpleMapping<X, U>();
+ return (T) mapping; //This is reports "Inconvertible types; cannot cast TestClass.SimpleMapping<X,U> to 'T'"
+ }
+ }
+ private final class SimpleMapping<X, U> implements Mapping<X, U> {}
+ public interface Mapping<F, U> {}
+}
+class TestClass1 {
+ public final class TestMapper<X> {
+
+ public <U, T extends Mapping<X, U>> T mapType() {
+ Mapping<X, U> mapping = new SimpleMapping<X, U>(); //Changed type to interface
+ return (T) mapping;
+ }
+ }
+ private final class SimpleMapping<X, U> implements Mapping<X, U> {}
+ public interface Mapping<F, U> {}
+} \ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/WildcardCastConversion.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/WildcardCastConversion.java
index ac8d53bdb38a..f610bacd5314 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/WildcardCastConversion.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/WildcardCastConversion.java
@@ -529,4 +529,20 @@ class IndexedElementInvocationHandler extends DomInvocationHandler<FixedChildDes
}
class FixedChildDescriptionImpl extends AbstractDomChildDescriptionImpl {
-} \ No newline at end of file
+}
+
+class CaptureSymmetry {
+ interface Collection<A> {}
+ interface List<A> extends Collection<A>{}
+ class ArrayList<A> implements List<A> {}
+
+ public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) {
+ return null;
+ }
+
+ public <B extends List<?>> Collection<? extends B> getBreakpoints (List<B> b) {
+ Collection<? extends ArrayList<?>> breakpoints = null;
+ Collection<? extends B> regular = breakpoints != null ? unmodifiableCollection((Collection<? extends B>)breakpoints) : b;
+ return null;
+ }
+}
diff --git a/java/java-tests/testData/psi/cls/mirror/Booleans.txt b/java/java-tests/testData/psi/cls/mirror/Booleans.txt
index 24d533feaa29..8def7d921ba3 100644
--- a/java/java-tests/testData/psi/cls/mirror/Booleans.txt
+++ b/java/java-tests/testData/psi/cls/mirror/Booleans.txt
@@ -5,11 +5,14 @@
package pkg;
class Booleans {
- public static final boolean RELEASE = true;
- public static final boolean DEBUG = false;
- public static final boolean PROFILE = false;
- public static final boolean LOGV = false;
- public static final boolean LOGD = true;
+ public static final boolean TRUE = true;
+ public static final boolean FALSE = false;
Booleans() { /* compiled code */ }
+
+ @pkg.BooleanAnno(true)
+ public static boolean TRUE() { /* compiled code */ }
+
+ @pkg.BooleanAnno(false)
+ public static boolean FALSE() { /* compiled code */ }
} \ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/ClassRefs.txt b/java/java-tests/testData/psi/cls/mirror/ClassRefs.txt
new file mode 100644
index 000000000000..ce11e0e0b329
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/ClassRefs.txt
@@ -0,0 +1,12 @@
+
+ // IntelliJ API Decompiler stub source generated from a class file
+ // Implementation of methods is not available
+
+package pkg;
+
+class ClassRefs {
+ @pkg.AnnWithTypeLocal(type = java.lang.String.class)
+ public static final java.lang.Class<?> cls;
+
+ ClassRefs() { /* compiled code */ }
+}
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/AnnWithTypeLocal.class b/java/java-tests/testData/psi/cls/mirror/pkg/AnnWithTypeLocal.class
new file mode 100644
index 000000000000..9252a8ec4faf
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/AnnWithTypeLocal.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/BooleanAnno.class b/java/java-tests/testData/psi/cls/mirror/pkg/BooleanAnno.class
new file mode 100644
index 000000000000..64ba86fc5932
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/BooleanAnno.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/Booleans.class b/java/java-tests/testData/psi/cls/mirror/pkg/Booleans.class
index d2a2fc0f5a78..1a71ca06f3c4 100644
--- a/java/java-tests/testData/psi/cls/mirror/pkg/Booleans.class
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/Booleans.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/pkg/ClassRefs.class b/java/java-tests/testData/psi/cls/mirror/pkg/ClassRefs.class
new file mode 100644
index 000000000000..ca03e1bc4c98
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/pkg/ClassRefs.class
Binary files differ
diff --git a/java/java-tests/testData/psi/cls/mirror/src/pkg/Booleans.java b/java/java-tests/testData/psi/cls/mirror/src/pkg/Booleans.java
index dac1d2c11d49..495e1ace68a3 100644
--- a/java/java-tests/testData/psi/cls/mirror/src/pkg/Booleans.java
+++ b/java/java-tests/testData/psi/cls/mirror/src/pkg/Booleans.java
@@ -1,9 +1,13 @@
package pkg;
class Booleans {
- public static final boolean RELEASE = true;
- public static final boolean DEBUG = false;
- public static final boolean PROFILE = false;
- public static final boolean LOGV = false;
- public static final boolean LOGD = true;
+ public static final boolean TRUE = true;
+ public static final boolean FALSE = false;
+
+ @BooleanAnno(true) public static boolean TRUE() { return TRUE; }
+ @BooleanAnno(false) public static boolean FALSE() { return FALSE; }
}
+
+@interface BooleanAnno {
+ boolean value();
+} \ No newline at end of file
diff --git a/java/java-tests/testData/psi/cls/mirror/src/pkg/ClassRefs.java b/java/java-tests/testData/psi/cls/mirror/src/pkg/ClassRefs.java
new file mode 100644
index 000000000000..af3784c3562f
--- /dev/null
+++ b/java/java-tests/testData/psi/cls/mirror/src/pkg/ClassRefs.java
@@ -0,0 +1,10 @@
+package pkg;
+
+class ClassRefs {
+ @AnnWithTypeLocal(type = String.class)
+ public static final Class<?> cls = String.class; // class refs are set from class initaializer
+}
+
+@interface AnnWithTypeLocal {
+ Class type();
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
index 507f3d508899..11cfb312bd50 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/JavaAutoPopupTest.groovy
@@ -1253,6 +1253,8 @@ class Foo {
protected void tearDown() {
CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false
CodeInsightSettings.instance.COMPLETION_CASE_SENSITIVE = CodeInsightSettings.FIRST_LETTER
+ UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = false
+
super.tearDown()
}
@@ -1384,4 +1386,23 @@ class ListConfigKey {
}
+ public void testPreselectMostRelevantInTheMiddleAlpha() {
+ UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = true;
+ CodeInsightSettings.instance.SELECT_AUTOPOPUP_SUGGESTIONS_BY_CHARS = false
+
+ myFixture.configureByText 'a.java', '''
+class Foo {
+ void setText() {}
+ void setHorizontalText() {}
+ void foo() {
+ <caret>
+ }
+
+}
+'''
+ type 'sette'
+ myFixture.assertPreferredCompletionItems 1, 'setHorizontalText', 'setText'
+ }
+
+
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
index 25bb907dbddd..352048dea4b7 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/AdvHighlightingJdk7Test.java
@@ -152,6 +152,10 @@ public class AdvHighlightingJdk7Test extends DaemonAnalyzerTestCase {
doTestAmbiguous();
}
+ public void testAmbiguousIDEA67841() throws Exception {
+ doTestAmbiguous();
+ }
+
public void testAmbiguousIDEA57535() throws Exception {
doTestAmbiguous();
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
index 03ff60bbdf29..37163f203e22 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/GenericsHighlightingTest.java
@@ -73,7 +73,10 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testAutoboxingMethods() { doTest5(false); }
public void testAutoboxingConstructors() { doTest5(false); }
public void testEnumWithAbstractMethods() { doTest5(false); }
- public void testEnum() { doTest5(false); }
+ public void testEnum() {
+ doTest(LanguageLevel.JDK_1_5, JavaSdkVersion.JDK_1_5, false);
+ }
+ public void testEnum56239() { doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }
public void testSameErasure() { doTest5(false); }
public void testMethods() { doTest5(false); }
public void testFields() { doTest5(false); }
@@ -211,12 +214,39 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA57446(){ doTest5(false); }
public void testIDEA67677(){ doTest5(false); }
public void testIDEA67798(){ doTest5(false); }
+ public void testIDEA57534(){ doTest5(false); }
+ public void testIDEA57482(){ doTest5(false); }
+ public void testIDEA67577(){ doTest5(false); }
+ public void testIDEA57413(){ doTest5(false); }
+ public void testIDEA57265(){ doTest5(false); }
+ public void testIDEA57271(){ doTest5(false); }
+ public void testIDEA57272(){ doTest5(false); }
+ public void testIDEA57285(){ doTest5(false); }
+ public void testIDEA65066(){ doTest5(false); }
+ public void testIDEA67998(){ doTest5(false); }
+ public void testIDEA18425(){ doTest5(false); }
+ public void testIDEA27080(){ doTest5(false); }
+ public void testIDEA22079(){ doTest5(false); }
+ public void testIDEA21602(){ doTest5(false); }
+ public void testIDEA21602_7(){ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
+
+ public void testIDEA21597() throws Exception { doTest5(false);}
+ public void testIDEA20573() throws Exception { doTest5(false);}
+ public void testIDEA20244() throws Exception { doTest5(false);}
+ public void testIDEA22005() throws Exception { doTest5(false);}
+
+ public void testIDEA27185(){ doTest(LanguageLevel.JDK_1_6, JavaSdkVersion.JDK_1_6, false); }
+ public void testIDEA67571(){ doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false); }
public void testWildcardsOnRawTypes() { doTest5(false); }
public void testDisableWithinBoundsCheckForSuperWildcards() {
doTest(LanguageLevel.JDK_1_7, JavaSdkVersion.JDK_1_7, false);
}
+ public void testDisableCastingToNestedWildcards() throws Exception {
+ doTest5(false);
+ }
+
public void testBooleanInferenceFromIfCondition() throws Exception {
doTest5(false);
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
index 0bc2fd4049a5..fb4fedebb121 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingJdk7Test.java
@@ -176,4 +176,7 @@ public class LightAdvHighlightingJdk7Test extends LightDaemonAnalyzerTestCase {
public void testInstanceMemberNotAccessibleInStaticContext() { doTest(false, false); }
public void testRejectedTypeParamsForConstructor() { doTest(false, false); }
public void testAnnotationArgs() throws Exception { doTest(false, false);}
+ public void testIDEA70890() { doTest(false, false); }
+ public void testIDEA63731() { doTest(false, false); }
+ public void testIDEA62056() { doTest(false, false); }
}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java
index ed66f5f4676b..b57321456d94 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/LightAdvHighlightingTest.java
@@ -38,6 +38,9 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.JavaVersionService;
+import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -63,7 +66,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
private UnusedSymbolLocalInspection myUnusedSymbolLocalInspection;
- private void doTest(boolean checkWarnings, boolean checkInfos) throws Exception {
+ private void doTest(boolean checkWarnings, boolean checkInfos) {
doTest(BASE_PATH + "/" + getTestName(false) + ".java", checkWarnings, checkInfos);
}
@@ -87,125 +90,134 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
};
}
- public void testCanHaveBody() throws Exception { doTest(false, false); }
- public void testInheritFinal() throws Exception { doTest(false, false); }
- public void testBreakOutside() throws Exception { doTest(false, false); }
- public void testLoop() throws Exception { doTest(false, false); }
- public void testIllegalModifiersCombination() throws Exception { doTest(false, false); }
- public void testModifierAllowed() throws Exception { doTest(false, false); }
- public void testAbstractMethods() throws Exception { doTest(false, false); }
- public void testInstantiateAbstract() throws Exception { doTest(false, false); }
- public void testDuplicateClassMethod() throws Exception { doTest(false, false); }
- public void testStringLiterals() throws Exception { doTest(false, false); }
- public void testStaticInInner() throws Exception { doTest(false, false); }
- public void testInvalidExpressions() throws Exception { doTest(false, false); }
- public void testIllegalVoidType() throws Exception { doTest(false, false); }
- public void testIllegalType() throws Exception { doTest(false, false); }
- public void testOperatorApplicability() throws Exception { doTest(false, false); }
- public void testIncompatibleTypes() throws Exception { doTest(false, false); }
- public void testCtrCallIsFirst() throws Exception { doTest(false, false); }
- public void testAccessLevelClash() throws Exception { doTest(false, false); }
- public void testCasts() throws Exception { doTest(false, false); }
- public void testOverrideConflicts() throws Exception { doTest(false, false); }
- public void testOverriddenMethodIsFinal() throws Exception { doTest(false, false); }
- public void testMissingReturn() throws Exception { doTest(false, false); }
- public void testUnreachable() throws Exception { doTest(false, false); }
- public void testFinalFieldInit() throws Exception { doTest(false, false); }
- public void testLocalVariableInitialization() throws Exception { doTest(false, false); }
- public void testVarDoubleInitialization() throws Exception { doTest(false, false); }
- public void testFieldDoubleInitialization() throws Exception { doTest(false, false); }
- public void testAssignToFinal() throws Exception { doTest(false, false); }
- public void testUnhandledExceptionsInSuperclass() throws Exception { doTest(false, false); }
- public void testAssignmentCompatible () throws Exception { doTest(false, false); }
- public void testMustBeBoolean() throws Exception { doTest(false, false); }
-
- public void testNumericLiterals() throws Exception { doTest(false, false); }
- public void testInitializerCompletion() throws Exception { doTest(false, false); }
-
- public void testUndefinedLabel() throws Exception { doTest(false, false); }
- public void testDuplicateSwitchLabels() throws Exception { doTest(false, false); }
- public void testStringSwitchLabels() throws Exception { doTest(false, false); }
- public void testIllegalForwardReference() throws Exception { doTest(false, false); }
- public void testStaticOverride() throws Exception { doTest(false, false); }
- public void testCyclicInheritance() throws Exception { doTest(false, false); }
- public void testReferenceMemberBeforeCtrCalled() throws Exception { doTest(false, false); }
- public void testLabels() throws Exception { doTest(false, false); }
- public void testUnclosedBlockComment() throws Exception { doTest(false, false); }
- public void testUnclosedComment() throws Exception { doTest(false, false); }
- public void testUnclosedDecl() throws Exception { doTest(false, false); }
- public void testSillyAssignment() throws Exception { doTest(true, false); }
- public void testTernary() throws Exception { doTest(false, false); }
- public void testDuplicateClass() throws Exception { doTest(false, false); }
- public void testCatchType() throws Exception { doTest(false, false); }
- public void testMustBeThrowable() throws Exception { doTest(false, false); }
- public void testUnhandledMessingWithFinally() throws Exception { doTest(false, false); }
- public void testSerializableStuff() throws Exception { doTest(true, false); }
- public void testDeprecated() throws Exception { doTest(true, false); }
- public void testJavadoc() throws Exception { enableInspectionTool(new JavaDocLocalInspection()); doTest(true, false); }
- public void testExpressionsInSwitch () throws Exception { doTest(false, false); }
- public void testAccessInner () throws Exception { doTest(false, false); }
-
- public void testExceptionNeverThrown() throws Exception { doTest(true, false); }
- public void testExceptionNeverThrownInTry() throws Exception { doTest(false, false); }
-
- public void testSwitchStatement() throws Exception { doTest(false, false); }
- public void testAssertExpression() throws Exception { doTest(false, false); }
-
- public void testSynchronizedExpression() throws Exception { doTest(false, false); }
- public void testExtendMultipleClasses() throws Exception { doTest(false, false); }
- public void testRecursiveConstructorInvocation() throws Exception { doTest(false, false); }
- public void testMethodCalls() throws Exception { doTest(false, false); }
- public void testSingleTypeImportConflicts() throws Exception { doTest(false, false); }
- public void testMultipleSingleTypeImports() throws Exception { doTest(true, false); } //duplicate imports
- public void testNotAllowedInInterface() throws Exception { doTest(false, false); }
- public void testQualifiedNew() throws Exception { doTest(false, false); }
- public void testEnclosingInstance() throws Exception { doTest(false, false); }
-
- public void testStaticViaInstance() throws Exception { doTest(true, false); } // static via instance
- public void testQualifiedThisSuper() throws Exception { doTest(true, false); } //illegal qualified this or super
-
- public void testAmbiguousMethodCall() throws Exception { doTest(false, false); }
-
- public void testImplicitConstructor() throws Exception { doTest(false, false); }
- public void testDotBeforeDecl() throws Exception { doTest(false, false); }
- public void testComputeConstant() throws Exception { doTest(false, false); }
-
- public void testAnonInAnon() throws Exception { doTest(false, false); }
- public void testAnonBaseRef() throws Exception { doTest(false, false); }
- public void testReturn() throws Exception { doTest(false, false); }
- public void testInterface() throws Exception { doTest(false, false); }
- public void testExtendsClause() throws Exception { doTest(false, false); }
- public void testMustBeFinal() throws Exception { doTest(false, false); }
-
- public void testXXX() throws Exception { doTest(false, false); }
- public void testUnused() throws Exception { doTest(true, false); }
- public void testQualifierBeforeClassName() throws Exception { doTest(false, false); }
- public void testQualifiedSuper() throws Exception { doTest(false, false); }
- public void testCastFromVoid() throws Exception { doTest(false, false); }
- public void testCatchUnknownMethod() throws Exception { doTest(false, false); }
- public void testIDEADEV8822() throws Exception { doTest(false, false); }
- public void testIDEADEV9201() throws Exception { doTest(false, false); }
- public void testIDEADEV25784() throws Exception { doTest(false, false); }
- public void testIDEADEV13249() throws Exception { doTest(false, false); }
- public void testIDEADEV11919() throws Exception { doTest(false, false); }
- public void testMethodCannotBeApplied() throws Exception { doTest(false, false); }
- public void testDefaultPackageClassInStaticImport() throws Exception { doTest(false, false); }
-
- public void testUnusedParamsOfPublicMethod() throws Exception { doTest(true, false); }
- public void testInnerClassesShadowing() throws Exception { doTest(false, false); }
-
- public void testUnusedParamsOfPublicMethodDisabled() throws Exception {
+ public void testCanHaveBody() { doTest(false, false); }
+ public void testInheritFinal() { doTest(false, false); }
+ public void testBreakOutside() { doTest(false, false); }
+ public void testLoop() { doTest(false, false); }
+ public void testIllegalModifiersCombination() { doTest(false, false); }
+ public void testModifierAllowed() { doTest(false, false); }
+ public void testAbstractMethods() { doTest(false, false); }
+ public void testInstantiateAbstract() { doTest(false, false); }
+ public void testDuplicateClassMethod() { doTest(false, false); }
+ public void testStringLiterals() { doTest(false, false); }
+ public void testStaticInInner() { doTest(false, false); }
+ public void testInvalidExpressions() { doTest(false, false); }
+ public void testIllegalVoidType() { doTest(false, false); }
+ public void testIllegalType() { doTest(false, false); }
+ public void testOperatorApplicability() { doTest(false, false); }
+ public void testIncompatibleTypes() { doTest(false, false); }
+ public void testCtrCallIsFirst() { doTest(false, false); }
+ public void testAccessLevelClash() { doTest(false, false); }
+ public void testCasts() { doTest(false, false); }
+ public void testOverrideConflicts() { doTest(false, false); }
+ public void testOverriddenMethodIsFinal() { doTest(false, false); }
+ public void testMissingReturn() { doTest(false, false); }
+ public void testUnreachable() { doTest(false, false); }
+ public void testFinalFieldInit() { doTest(false, false); }
+ public void testLocalVariableInitialization() { doTest(false, false); }
+ public void testVarDoubleInitialization() { doTest(false, false); }
+ public void testFieldDoubleInitialization() { doTest(false, false); }
+ public void testAssignToFinal() { doTest(false, false); }
+ public void testUnhandledExceptionsInSuperclass() { doTest(false, false); }
+ public void testAssignmentCompatible () { doTest(false, false); }
+ public void testMustBeBoolean() { doTest(false, false); }
+
+ public void testNumericLiterals() { doTest(false, false); }
+ public void testInitializerCompletion() { doTest(false, false); }
+
+ public void testUndefinedLabel() { doTest(false, false); }
+ public void testDuplicateSwitchLabels() { doTest(false, false); }
+ public void testStringSwitchLabels() { doTest(false, false); }
+ public void testIllegalForwardReference() { doTest(false, false); }
+ public void testStaticOverride() { doTest(false, false); }
+ public void testCyclicInheritance() { doTest(false, false); }
+ public void testReferenceMemberBeforeCtrCalled() { doTest(false, false); }
+ public void testLabels() { doTest(false, false); }
+ public void testUnclosedBlockComment() { doTest(false, false); }
+ public void testUnclosedComment() { doTest(false, false); }
+ public void testUnclosedDecl() { doTest(false, false); }
+ public void testSillyAssignment() { doTest(true, false); }
+ public void testTernary() { doTest(false, false); }
+ public void testDuplicateClass() { doTest(false, false); }
+ public void testCatchType() { doTest(false, false); }
+ public void testMustBeThrowable() { doTest(false, false); }
+ public void testUnhandledMessingWithFinally() { doTest(false, false); }
+ public void testSerializableStuff() { doTest(true, false); }
+ public void testDeprecated() { doTest(true, false); }
+ public void testJavadoc() { enableInspectionTool(new JavaDocLocalInspection()); doTest(true, false); }
+ public void testExpressionsInSwitch () { doTest(false, false); }
+ public void testAccessInner () { doTest(false, false); }
+
+ public void testExceptionNeverThrown() { doTest(true, false); }
+ public void testExceptionNeverThrownInTry() { doTest(false, false); }
+
+ public void testSwitchStatement() { doTest(false, false); }
+ public void testAssertExpression() { doTest(false, false); }
+
+ public void testSynchronizedExpression() { doTest(false, false); }
+ public void testExtendMultipleClasses() { doTest(false, false); }
+ public void testRecursiveConstructorInvocation() { doTest(false, false); }
+ public void testMethodCalls() { doTest(false, false); }
+ public void testSingleTypeImportConflicts() { doTest(false, false); }
+ public void testMultipleSingleTypeImports() { doTest(true, false); } //duplicate imports
+ public void testNotAllowedInInterface() { doTest(false, false); }
+ public void testQualifiedNew() { doTest(false, false); }
+ public void testEnclosingInstance() { doTest(false, false); }
+
+ public void testStaticViaInstance() { doTest(true, false); } // static via instance
+ public void testQualifiedThisSuper() { doTest(true, false); } //illegal qualified this or super
+
+ public void testAmbiguousMethodCall() { doTest(false, false); }
+
+ public void testImplicitConstructor() { doTest(false, false); }
+ public void testDotBeforeDecl() { doTest(false, false); }
+ public void testComputeConstant() { doTest(false, false); }
+
+ public void testAnonInAnon() { doTest(false, false); }
+ public void testAnonBaseRef() { doTest(false, false); }
+ public void testReturn() { doTest(false, false); }
+ public void testInterface() { doTest(false, false); }
+ public void testExtendsClause() { doTest(false, false); }
+ public void testMustBeFinal() { doTest(false, false); }
+
+ public void testXXX() { doTest(false, false); }
+ public void testUnused() { doTest(true, false); }
+ public void testQualifierBeforeClassName() { doTest(false, false); }
+ public void testQualifiedSuper() {
+ ((JavaVersionServiceImpl)JavaVersionService.getInstance()).setTestVersion(JavaSdkVersion.JDK_1_6, myTestRootDisposable);
+ doTest(false, false);
+ }
+
+ public void testIgnoreImplicitThisReferenceBeforeSuperSinceJdk7() throws Exception {
+ doTest(false, false);
+ }
+
+ public void testCastFromVoid() { doTest(false, false); }
+ public void testCatchUnknownMethod() { doTest(false, false); }
+ public void testIDEADEV8822() { doTest(false, false); }
+ public void testIDEADEV9201() { doTest(false, false); }
+ public void testIDEADEV25784() { doTest(false, false); }
+ public void testIDEADEV13249() { doTest(false, false); }
+ public void testIDEADEV11919() { doTest(false, false); }
+ public void testIDEA67829() { doTest(false, false); }
+ public void testMethodCannotBeApplied() { doTest(false, false); }
+ public void testDefaultPackageClassInStaticImport() { doTest(false, false); }
+
+ public void testUnusedParamsOfPublicMethod() { doTest(true, false); }
+ public void testInnerClassesShadowing() { doTest(false, false); }
+
+ public void testUnusedParamsOfPublicMethodDisabled() {
myUnusedSymbolLocalInspection.REPORT_PARAMETER_FOR_PUBLIC_METHODS = false;
doTest(true, false);
}
- public void testUnusedNonPrivateMembers() throws Exception {
+ public void testUnusedNonPrivateMembers() {
UnusedDeclarationInspection deadCodeInspection = new UnusedDeclarationInspection();
enableInspectionTool(deadCodeInspection);
doTest(true, false);
}
- public void testUnusedNonPrivateMembers2() throws Exception {
+ public void testUnusedNonPrivateMembers2() {
ExtensionPoint<EntryPoint> point = Extensions.getRootArea().getExtensionPoint(ExtensionPoints.DEAD_CODE_TOOL);
EntryPoint extension = new EntryPoint() {
@NotNull
@@ -251,7 +263,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
point.unregisterExtension(extension);
}
}
- public void testUnusedNonPrivateMembersReferencedFromText() throws Exception {
+ public void testUnusedNonPrivateMembersReferencedFromText() {
UnusedDeclarationInspection deadCodeInspection = new UnusedDeclarationInspection();
enableInspectionTool(deadCodeInspection);
@@ -277,12 +289,12 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
assertEmpty(infos);
}
- public void testNamesHighlighting() throws Exception {
+ public void testNamesHighlighting() {
LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test();
}
- public void testMultiFieldDeclNames() throws Exception {
+ public void testMultiFieldDeclNames() {
doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test();
}
@@ -306,7 +318,7 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
}
}
- public void testInjectedAnnotator() throws Exception {
+ public void testInjectedAnnotator() {
Annotator annotator = new MyAnnotator();
Language xml = StdFileTypes.XML.getLanguage();
LanguageAnnotators.INSTANCE.addExplicitExtension(xml, annotator);
@@ -354,14 +366,21 @@ public class LightAdvHighlightingTest extends LightDaemonAnalyzerTestCase {
doHighlighting();
}
- public void testClassicRethrow() throws Exception { doTest(false, false); }
- public void testRegexp() throws Exception { doTest(false, false); }
- public void testUnsupportedFeatures() throws Exception { doTest(false, false); }
- public void testThisBeforeSuper() throws Exception { doTest(false, false); }
- public void testExplicitConstructorInvocation() throws Exception { doTest(false, false); }
- public void testThisInInterface() throws Exception { doTest(false, false); }
- public void testInnerClassConstantReference() throws Exception { doTest(false, false); }
- public void testStaticMethodCalls() throws Exception {
+ public void testClassicRethrow() { doTest(false, false); }
+ public void testRegexp() { doTest(false, false); }
+ public void testUnsupportedFeatures() { doTest(false, false); }
+ public void testThisBeforeSuper() { doTest(false, false); }
+ public void testExplicitConstructorInvocation() { doTest(false, false); }
+ public void testThisInInterface() { doTest(false, false); }
+ public void testInnerClassConstantReference() { doTest(false, false); }
+ public void testIDEA60875() { doTest(false, false); }
+ public void testIDEA71645() { doTest(false, false); }
+
+ public void testNoEnclosingInstanceWhenStaticNestedInheritsFromContainingClass() throws Exception {
+ doTest(false, false);
+ }
+
+ public void testStaticMethodCalls() {
doTestFile(BASE_PATH + "/" + getTestName(false) + ".java").checkSymbolNames().test();
}
}
diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
index f15637ea703c..14c2e2927c9b 100644
--- a/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
+++ b/java/java-tests/testSrc/com/intellij/psi/ClsMirrorBuildingTest.java
@@ -41,6 +41,7 @@ public class ClsMirrorBuildingTest extends LightIdeaTestCase {
public void testPackageInfo() { doTest("package-info"); }
public void testEA40568() { doTest(); }
public void testBooleans() { doTest(); }
+ public void testClassRefs() { doTest(); }
private void doTest() {
doTest(getTestName(false));
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
index 4d9e581ad94b..a447fa117790 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/IntroduceVariableTest.java
@@ -177,7 +177,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
}
public void testSCR40281() throws Exception {
- doTest(new MockIntroduceVariableHandler("temp", false, false, false, "Set<? extends Map<?,String>.Entry<?,String>>"));
+ doTest(new MockIntroduceVariableHandler("temp", false, false, false, "Set<? extends Map<?,java.lang.String>.Entry<?,java.lang.String>>"));
}
public void testWithIfBranches() throws Exception {
@@ -189,7 +189,7 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
}
public void testDuplicateGenericExpressions() throws Exception {
- doTest(new MockIntroduceVariableHandler("temp", true, false, false, "Foo2<? extends Runnable>"));
+ doTest(new MockIntroduceVariableHandler("temp", true, false, false, "Foo2<? extends java.lang.Runnable>"));
}
public void testStaticImport() throws Exception {
diff --git a/java/java-tests/testSrc/com/intellij/refactoring/MockIntroduceVariableHandler.java b/java/java-tests/testSrc/com/intellij/refactoring/MockIntroduceVariableHandler.java
index f3558499036d..008f3f93a53f 100644
--- a/java/java-tests/testSrc/com/intellij/refactoring/MockIntroduceVariableHandler.java
+++ b/java/java-tests/testSrc/com/intellij/refactoring/MockIntroduceVariableHandler.java
@@ -52,7 +52,7 @@ class MockIntroduceVariableHandler extends IntroduceVariableBase {
PsiElement anchor, final OccurrencesChooser.ReplaceChoice replaceChoice) {
final PsiType type = myLookForType ? findType(typeSelectorManager.getTypesForAll(), typeSelectorManager.getDefaultType())
: typeSelectorManager.getDefaultType();
- Assert.assertTrue(type.getCanonicalText(), type.equalsToText(myExpectedTypeCanonicalName));
+ Assert.assertTrue(type.getInternalCanonicalText(), type.getInternalCanonicalText().equals(myExpectedTypeCanonicalName));
IntroduceVariableSettings introduceVariableSettings = new IntroduceVariableSettings() {
@Override
public String getEnteredName() {
diff --git a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java
index 240e7e54ef11..71e2bb73950d 100644
--- a/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java
+++ b/java/testFramework/src/com/intellij/codeInsight/CodeInsightTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
@@ -108,6 +108,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
protected void configureByFile(@NonNls String filePath) throws Exception {
configureByFile(filePath, null);
}
+
protected VirtualFile configureByFiles(@Nullable String projectRoot,String... files) throws Exception {
final VirtualFile[] vFiles = new VirtualFile[files.length];
for (int i = 0; i < files.length; i++) {
@@ -122,6 +123,7 @@ public abstract class CodeInsightTestCase extends PsiTestCase {
return configureByFiles(projectFile, vFiles);
}
+
protected VirtualFile configureByFile(@NonNls String filePath, String projectRoot) throws Exception {
String fullPath = getTestDataPath() + filePath;
diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java
index ae80acc3caf4..6d40070c1d1d 100644
--- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java
+++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -255,10 +255,11 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
@NotNull
@SuppressWarnings("TestMethodWithIncorrectSignature")
protected HighlightTestInfo testFile(@NonNls @NotNull String... filePath) {
- return new HighlightTestInfo(getTestRootDisposable(), filePath){
+ return new HighlightTestInfo(getTestRootDisposable(), filePath) {
@Override
- public HighlightTestInfo doTest() throws Exception {
- configureByFiles(projectRoot, filePaths);
+ public HighlightTestInfo doTest() {
+ try { configureByFiles(projectRoot, filePaths); }
+ catch (Exception e) { throw new RuntimeException(e); }
ExpectedHighlightingData data = new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, myFile);
if (checkSymbolNames) data.checkSymbolNames();
checkHighlighting(data);
diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java
index 548e7af0d387..1416e81ec9e4 100644
--- a/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java
+++ b/java/testFramework/src/com/intellij/codeInsight/daemon/LightDaemonAnalyzerTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * 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.
@@ -117,9 +117,9 @@ public abstract class LightDaemonAnalyzerTestCase extends LightCodeInsightTestCa
}
protected HighlightTestInfo doTestFile(@NonNls @NotNull String filePath) {
- return new HighlightTestInfo(getTestRootDisposable(), filePath){
+ return new HighlightTestInfo(getTestRootDisposable(), filePath) {
@Override
- public HighlightTestInfo doTest() throws Exception {
+ public HighlightTestInfo doTest() {
String path = assertOneElement(filePaths);
configureByFile(path);
ExpectedHighlightingData data = new ExpectedHighlightingData(myEditor.getDocument(), checkWarnings, checkWeakWarnings, checkInfos, myFile);