diff --git a/.idea/libraries/Guava.xml b/.idea/libraries/Guava.xml
index 555ca8377a3c..649397a32e38 100644
--- a/.idea/libraries/Guava.xml
+++ b/.idea/libraries/Guava.xml
@@ -1,11 +1,11 @@
-
+
-
+
\ No newline at end of file
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 60bece10bfc9..923a39ebf639 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -505,7 +505,7 @@ def layout_core(String home, String target) {
}
fileset(dir: "$home/lib") {
- include(name: "guava-11.0.1.jar")
+ include(name: "guava-12.0.jar")
include(name: "picocontainer.jar")
include(name: "trove4j.jar")
include(name: "asm.jar")
@@ -537,7 +537,7 @@ def layout_core_upsource(String home, String target) {
}
fileset(dir: "$home/lib") {
- include(name: "guava-11.0.1.jar")
+ include(name: "guava-12.0.jar")
include(name: "picocontainer.jar")
include(name: "trove4j.jar")
include(name: "asm.jar")
diff --git a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java
index e3c299a55d79..004209e3930c 100644
--- a/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java
+++ b/java/compiler/forms-compiler/src/com/intellij/uiDesigner/compiler/AsmCodeGenerator.java
@@ -858,7 +858,7 @@ public class AsmCodeGenerator {
pushBorderProperties(container, generator, borderTitle, componentLocal);
if (Boolean.valueOf(System.getProperty("idea.is.internal")).booleanValue()) {
- container.getDelegeeClientProperties().put(ourBorderFactoryClientProperty, "com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent");
+ container.getDelegeeClientProperties().put(ourBorderFactoryClientProperty, StringDescriptor.create("com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"));
}
Type borderFactoryType = ourBorderFactoryType;
diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
index 5a0ba7439fb2..5b88d0b428ea 100644
--- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
+++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java
@@ -19,12 +19,12 @@ import com.intellij.ProjectTopics;
import com.intellij.application.options.PathMacrosImpl;
import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.compiler.server.impl.CompileServerClasspathManager;
+import com.intellij.execution.ExecutionAdapter;
import com.intellij.execution.ExecutionException;
+import com.intellij.execution.ExecutionManager;
import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.process.OSProcessHandler;
-import com.intellij.execution.process.ProcessAdapter;
-import com.intellij.execution.process.ProcessEvent;
-import com.intellij.execution.process.ProcessOutputTypes;
+import com.intellij.execution.configurations.RunProfile;
+import com.intellij.execution.process.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathMacros;
import com.intellij.openapi.application.PathManager;
@@ -114,9 +114,11 @@ public class BuildManager implements ApplicationComponent{
}
};
private final SequentialTaskExecutor myEventsProcessor = new SequentialTaskExecutor(myPooledThreadExecutor);
-
private final Map myProjectDataMap = Collections.synchronizedMap(new HashMap());
+ private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
+ private final AtomicBoolean myAutoMakeInProgress = new AtomicBoolean(false);
+
private final ChannelGroup myAllOpenChannels = new DefaultChannelGroup("build-manager");
private final BuildMessageDispatcher myMessageDispatcher = new BuildMessageDispatcher();
private int myListenPort = -1;
@@ -137,8 +139,6 @@ public class BuildManager implements ApplicationComponent{
projectManager.addProjectManagerListener(new ProjectWatcher());
final MessageBusConnection conn = ApplicationManager.getApplication().getMessageBus().connect();
conn.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
- private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD);
- private final AtomicBoolean myAutoMakeInProgress = new AtomicBoolean(false);
@Override
public void before(@NotNull List extends VFileEvent> events) {
}
@@ -146,44 +146,11 @@ public class BuildManager implements ApplicationComponent{
@Override
public void after(@NotNull List extends VFileEvent> events) {
if (shouldTriggerMake(events)) {
- scheduleMake(new Runnable() {
- @Override
- public void run() {
- if (!myAutoMakeInProgress.getAndSet(true)) {
- try {
- ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
- @Override
- public void run() {
- try {
- runAutoMake();
- }
- finally {
- myAutoMakeInProgress.set(false);
- }
- }
- });
- }
- catch (RejectedExecutionException ignored) {
- // we were shut down
- }
- }
- else {
- scheduleMake(this);
- }
- }
- });
+ scheduleAutoMake();
}
}
- private void scheduleMake(Runnable runnable) {
- myAlarm.cancelAllRequests();
- myAlarm.addRequest(runnable, MAKE_TRIGGER_DELAY);
- }
-
private boolean shouldTriggerMake(List extends VFileEvent> events) {
- if (!CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild()) {
- return false;
- }
for (VFileEvent event : events) {
if (event.isFromRefresh() || event.getRequestor() instanceof SavingRequestor) {
return true;
@@ -265,10 +232,46 @@ public class BuildManager implements ApplicationComponent{
return vFile != null ? vFile.getPath() : null;
}
- private void runAutoMake() {
+ private void scheduleAutoMake() {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return;
}
+ if (CompilerWorkspaceConfiguration.useServerlessOutOfProcessBuild()) {
+ addMakeRequest(new Runnable() {
+ @Override
+ public void run() {
+ if (!myAutoMakeInProgress.getAndSet(true)) {
+ try {
+ ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ runAutoMake();
+ }
+ finally {
+ myAutoMakeInProgress.set(false);
+ }
+ }
+ });
+ }
+ catch (RejectedExecutionException ignored) {
+ // we were shut down
+ }
+ }
+ else {
+ addMakeRequest(this);
+ }
+ }
+ });
+ }
+ }
+
+ private void addMakeRequest(Runnable runnable) {
+ myAlarm.cancelAllRequests();
+ myAlarm.addRequest(runnable, MAKE_TRIGGER_DELAY);
+ }
+
+ private void runAutoMake() {
final Project[] openProjects = myProjectManager.getOpenProjects();
if (openProjects.length > 0) {
final List futures = new ArrayList();
@@ -412,7 +415,7 @@ public class BuildManager implements ApplicationComponent{
public void onTextAvailable(ProcessEvent event, Key outputType) {
// re-translate builder's output to idea.log
final String text = event.getText();
- if (!StringUtil.isEmpty(text)) {
+ if (!StringUtil.isEmptyOrSpaces(text)) {
LOG.info("BUILDER_PROCESS [" + outputType.toString() + "]: " + text.trim());
if (stdErrOutput.length() < 1024 && ProcessOutputTypes.STDERR.equals(outputType)) {
stdErrOutput.append(text);
@@ -819,6 +822,12 @@ public class BuildManager implements ApplicationComponent{
}
}
});
+ conn.subscribe(ExecutionManager.EXECUTION_TOPIC, new ExecutionAdapter() {
+ @Override
+ public void processTerminated(@NotNull RunProfile runProfile, @NotNull ProcessHandler handler) {
+ scheduleAutoMake();
+ }
+ });
}
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java
index 1278f72e8c35..0a450e5454b8 100644
--- a/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java
+++ b/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java
@@ -32,8 +32,10 @@ import com.intellij.openapi.ui.popup.LightweightWindowEvent;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.util.ui.UIUtil;
import com.intellij.xdebugger.impl.actions.EditBreakpointActionHandler;
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
+import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsMasterDetailPopupFactory;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.NotNull;
@@ -49,7 +51,7 @@ import java.awt.*;
*/
public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler {
@Override
- protected void doShowPopup(Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
+ protected void doShowPopup(final Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
if (!(breakpoint instanceof BreakpointWithHighlighter)) return;
final BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)breakpoint;
@@ -88,13 +90,16 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
final Runnable showMoreOptions = new Runnable() {
@Override
public void run() {
- propertiesPanel.setMoreOptionsVisible(true);
- final Balloon newBalloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, null);
- newBalloon.addListener(saveOnClose);
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ @Override
+ public void run() {
+ BreakpointsMasterDetailPopupFactory.
+ getInstance(project).createPopup(javaBreakpoint).showCenteredInCurrentWindow(project);
+ }
+ });
}
};
- final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent,
- propertiesPanel.isMoreOptionsVisible() ? null : showMoreOptions);
+ final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
balloon.addListener(saveOnClose);
propertiesPanel.setDelegate(new BreakpointPropertiesPanel.Delegate() {
@@ -103,7 +108,7 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
propertiesPanel.setActionsPanelVisible(true);
balloon.hide();
final Balloon newBalloon =
- DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
+ DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
newBalloon.addListener(saveOnClose);
}
});
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
index d920f3993df3..a596e30b5565 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2012 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.
@@ -21,6 +21,7 @@
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
+import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.SourcePosition;
@@ -160,7 +161,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
final PsiType unboxedLType = PsiPrimitiveType.getUnboxedType(lType);
if (unboxedLType != null) {
- if (rType instanceof PsiPrimitiveType && !PsiPrimitiveType.NULL.equals(rType)) {
+ if (rType instanceof PsiPrimitiveType && !PsiType.NULL.equals(rType)) {
if (!rType.equals(unboxedLType)) {
rEvaluator = new TypeCastEvaluator(rEvaluator, unboxedLType.getCanonicalText(), true);
}
@@ -175,7 +176,7 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
}
final PsiPrimitiveType unboxedRType = PsiPrimitiveType.getUnboxedType(rType);
final PsiType _rType = unboxedRType != null? unboxedRType : rType;
- if (_rType instanceof PsiPrimitiveType && !PsiPrimitiveType.NULL.equals(_rType)) {
+ if (_rType instanceof PsiPrimitiveType && !PsiType.NULL.equals(_rType)) {
if (!lType.equals(_rType)) {
rEvaluator = new TypeCastEvaluator(rEvaluator, lType.getCanonicalText(), true);
}
@@ -988,9 +989,9 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
@Override
public void visitLiteralExpression(PsiLiteralExpression expression) {
- final String parsingError = HighlightUtil.getLiteralExpressionParsingError(expression);
+ final HighlightInfo parsingError = HighlightUtil.checkLiteralExpressionParsingError(expression);
if (parsingError != null) {
- throwEvaluateException(parsingError);
+ throwEvaluateException(parsingError.description);
return;
}
@@ -1219,9 +1220,9 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
myResult = new ArrayInitializerEvaluator(evaluators);
}
+ @Nullable
private static PsiClass getOuterClass(PsiClass aClass) {
- if(aClass == null) return null;
- return PsiTreeUtil.getContextOfType(aClass, PsiClass.class, true);
+ return aClass == null ? null : PsiTreeUtil.getContextOfType(aClass, PsiClass.class, true);
}
private PsiClass getContainingClass(PsiVariable variable) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
index 675ba7211a7a..2dda3d70feb4 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java
@@ -214,8 +214,10 @@ public class JavaDebuggerSupport extends DebuggerSupport {
}
@Override
- public void provideBreakpointsGroupingRules(Collection rules) {
+ public void createBreakpointsGroupingRules(Collection rules) {
rules.add(new XBreakpointGroupingByCategoryRule());
+ rules.add(new XBreakpointGroupingByPackageRule());
+ rules.add(new XBreakpointGroupingByClassRule());
}
@Override
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointClassGroup.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointClassGroup.java
new file mode 100644
index 000000000000..5a81258caaa4
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointClassGroup.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.ui;
+
+import com.intellij.debugger.DebuggerBundle;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.PlatformIcons;
+import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+
+public class XBreakpointClassGroup extends XBreakpointGroup {
+ private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
+
+ private String myPackageName;
+ private String myClassName;
+
+ public XBreakpointClassGroup(@Nullable String packageName, String className) {
+ myPackageName = packageName != null ? packageName : DEFAULT_PACKAGE_NAME;
+ myClassName = className;
+ }
+
+ @Override
+ public Icon getIcon(boolean isOpen) {
+ return PlatformIcons.CLASS_ICON;
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return getClassName();
+ }
+
+ @NotNull
+ public String getPackageName() {
+ return myPackageName;
+ }
+
+ @NotNull
+ public String getClassName() {
+ return myClassName;
+ }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByCategoryRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByCategoryRule.java
index 477417f54ee7..7b8fe5d4b767 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByCategoryRule.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByCategoryRule.java
@@ -22,18 +22,16 @@ import org.jetbrains.annotations.NotNull;
import java.util.Collection;
-/**
-* Created with IntelliJ IDEA.
-* User: zajac
-* Date: 23.05.12
-* Time: 16:24
-* To change this template use File | Settings | File Templates.
-*/
class XBreakpointGroupingByCategoryRule extends XBreakpointGroupingRule {
XBreakpointGroupingByCategoryRule() {
super("XBreakpointGroupingByCategoryRule", "Type");
}
+ @Override
+ public boolean isAlwaysEnabled() {
+ return true;
+ }
+
@Override
public XBreakpointCategoryGroup getGroup(@NotNull B b, @NotNull Collection groups) {
if (b instanceof Breakpoint) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
new file mode 100644
index 000000000000..aa28158221ae
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByClassRule.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.ui;
+
+import com.intellij.debugger.ui.breakpoints.Breakpoint;
+import com.intellij.debugger.ui.breakpoints.BreakpointFactory;
+import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+class XBreakpointGroupingByClassRule extends XBreakpointGroupingRule {
+ XBreakpointGroupingByClassRule() {
+ super("XBreakpointGroupingByClassRule", "Group by Class");
+ }
+
+ @Override
+ public boolean isAlwaysEnabled() {
+ return false;
+ }
+
+ @Override
+ public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection groups) {
+ if (b instanceof Breakpoint) {
+ final Breakpoint breakpoint = (Breakpoint)b;
+ String className = breakpoint.getShortClassName();
+ String packageName = breakpoint.getPackageName();
+ if (className == null) {
+ return null;
+ }
+ for (XBreakpointClassGroup group : groups) {
+ if (group.getClassName().equals(className) && group.getPackageName().equals(packageName)) {
+ return group;
+ }
+ }
+ return new XBreakpointClassGroup(packageName, className);
+ }
+ return null;
+ }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java
new file mode 100644
index 000000000000..a9f43cc444ee
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointGroupingByPackageRule.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.ui;
+
+import com.intellij.debugger.ui.breakpoints.BreakpointWithHighlighter;
+import com.intellij.debugger.ui.breakpoints.ExceptionBreakpoint;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
+import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class XBreakpointGroupingByPackageRule extends XBreakpointGroupingRule {
+
+ protected XBreakpointGroupingByPackageRule() {
+ super("XBreakpointGroupingByPackageRule", "Group by package");
+ }
+
+ @Override
+ public XBreakpointPackageGroup getGroup(@NotNull B breakpoint, @NotNull Collection groups) {
+ String packageName = null;
+ if (breakpoint instanceof BreakpointWithHighlighter) {
+ packageName = ((BreakpointWithHighlighter)breakpoint).getPackageName();
+ }
+ else if (breakpoint instanceof ExceptionBreakpoint) {
+ packageName = ((ExceptionBreakpoint)breakpoint).getPackageName();
+ }
+ if (packageName == null) {
+ return null;
+ }
+ for (XBreakpointPackageGroup group : groups) {
+ if (StringUtil.equals(group.getPackageName(), packageName)) {
+ return group;
+ }
+ }
+ return new XBreakpointPackageGroup(packageName);
+ }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointPackageGroup.java b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointPackageGroup.java
new file mode 100644
index 000000000000..0d193a20255b
--- /dev/null
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/XBreakpointPackageGroup.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.debugger.ui;
+
+import com.intellij.debugger.DebuggerBundle;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.PlatformIcons;
+import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
+import org.jetbrains.annotations.NotNull;
+
+import javax.swing.*;
+
+public class XBreakpointPackageGroup extends XBreakpointGroup {
+ private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
+
+ private String myPackageName;
+
+ public XBreakpointPackageGroup(String packageName) {
+ myPackageName = packageName;
+ }
+
+ @Override
+ public Icon getIcon(boolean isOpen) {
+ return PlatformIcons.PACKAGE_ICON;
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ String packageName = getPackageName();
+ return StringUtil.isEmpty(packageName) ? DEFAULT_PACKAGE_NAME : packageName;
+ }
+
+ @NotNull
+ public String getPackageName() {
+ return myPackageName;
+ }
+}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointTree.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointTree.java
index d99efc55bbb2..2d39fe03ead5 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointTree.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointTree.java
@@ -679,7 +679,7 @@ public class BreakpointTree extends CheckboxTree {
if (!(descriptor instanceof BreakpointDescriptor)) {
return node;
}
-
+
final Breakpoint breakpoint = ((BreakpointDescriptor)descriptor).getBreakpoint();
final String packageName;
if (breakpoint instanceof ExceptionBreakpoint) {
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
index 2e52109b5ae4..7ef5417ca915 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/breakpoints/BreakpointWithHighlighter.java
@@ -522,6 +522,7 @@ public abstract class BreakpointWithHighlighter extends Breakpoint {
if (!highlighter.isValid()) {
return null;
}
+ highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE);
highlighter.setErrorStripeTooltip(DebuggerBundle.message("breakpoint.tooltip.text", lineIndex + 1));
return highlighter;
}
diff --git a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
index 382bcff89b41..96d684a289d3 100644
--- a/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
+++ b/java/debugger/openapi/src/com/intellij/debugger/engine/DebuggerUtils.java
@@ -334,19 +334,36 @@ public abstract class DebuggerUtils {
return getSuperType(subType, superType) != null;
}
- public static PsiClass findClass(String className, Project project, final GlobalSearchScope scope) {
+ @Nullable
+ public static PsiClass findClass(final String className, Project project, final GlobalSearchScope scope) {
ApplicationManager.getApplication().assertReadAccessAllowed();
final PsiManager psiManager = PsiManager.getInstance(project);
+ final JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(psiManager.getProject());
if (getArrayClass(className) != null) {
- return JavaPsiFacade.getInstance(psiManager.getProject()).getElementFactory().getArrayClass(LanguageLevelProjectExtension.getInstance(psiManager.getProject()).getLanguageLevel());
+ return javaPsiFacade.getElementFactory().getArrayClass(LanguageLevelProjectExtension.getInstance(psiManager.getProject()).getLanguageLevel());
}
if(project.isDefault()) {
return null;
}
final String _className = className.replace('$', '.');
- final PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(_className, scope);
- if (aClass == null && scope != GlobalSearchScope.allScope(project)) {
- return JavaPsiFacade.getInstance(psiManager.getProject()).findClass(_className, GlobalSearchScope.allScope(project));
+ PsiClass aClass = javaPsiFacade.findClass(_className, scope);
+ if (aClass == null) {
+ if (!_className.equals(className)) {
+ // try original name if it differs from the normalized name
+ aClass = javaPsiFacade.findClass(className, scope);
+ }
+ }
+ if (aClass == null) {
+ final GlobalSearchScope globalScope = GlobalSearchScope.allScope(project);
+ if (!globalScope.equals(scope)) {
+ aClass = javaPsiFacade.findClass(_className, globalScope);
+ if (aClass == null) {
+ if (!_className.equals(className)) {
+ // try original name with global scope if the original differs from the normalized name
+ aClass = javaPsiFacade.findClass(className, globalScope);
+ }
+ }
+ }
}
return aClass;
}
diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/DownloadingOptionsDialog.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/DownloadingOptionsDialog.java
index c5d6bde48e4c..f3b5ca2b3d2d 100644
--- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/DownloadingOptionsDialog.java
+++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/DownloadingOptionsDialog.java
@@ -15,7 +15,7 @@
*/
package com.intellij.facet.impl.ui.libraries;
-import com.intellij.util.download.DownloadableFileDescription;
+import com.intellij.framework.library.DownloadableLibraryFileDescription;
import com.intellij.framework.library.DownloadableLibraryType;
import com.intellij.framework.library.FrameworkLibraryVersion;
import com.intellij.ide.ui.ListCellRendererWrapper;
@@ -29,6 +29,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.ui.CheckBoxList;
+import com.intellij.ui.CheckBoxListListener;
import com.intellij.ui.CollectionListModel;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
@@ -47,6 +48,7 @@ import java.util.List;
* @author Dmitry Avdeev
*/
public class DownloadingOptionsDialog extends DialogWrapper {
+ private static enum AdditionalDownloadType {SOURCES, DOCUMENTATION}
private static final Logger LOG = Logger.getInstance("#com.intellij.facet.impl.ui.libraries.DownloadingOptionsDialog");
private JPanel myPanel;
private CheckBoxList myFilesList;
@@ -110,32 +112,79 @@ public class DownloadingOptionsDialog extends DialogWrapper {
myCopyDownloadedFilesToLabel.setLabelFor(myDirectoryField);
myDirectoryField.setText(FileUtil.toSystemDependentName(settings.getDirectoryForDownloadedLibrariesPath()));
- //todo[nik] show when downloading sources/javadocs will be supported
- myDownloadSourcesCheckBox.setVisible(false);
- myDownloadJavadocsCheckBox.setVisible(false);
+ boolean sourcesCheckboxVisible = false;
+ boolean javadocCheckboxVisible = false;
+ for (FrameworkLibraryVersion version : versions) {
+ sourcesCheckboxVisible |= haveAdditionalDownloads(version.getFiles(), AdditionalDownloadType.SOURCES);
+ javadocCheckboxVisible |= haveAdditionalDownloads(version.getFiles(), AdditionalDownloadType.DOCUMENTATION);
+ }
+ myDownloadSourcesCheckBox.setVisible(sourcesCheckboxVisible);
+ myDownloadJavadocsCheckBox.setVisible(javadocCheckboxVisible);
+ myFilesList.setCheckBoxListListener(new CheckBoxListListener() {
+ @Override
+ public void checkBoxSelectionChanged(int index, boolean value) {
+ updateSourcesAndJavadocCheckboxes();
+ }
+ });
+ updateSourcesAndJavadocCheckboxes();
myDownloadSourcesCheckBox.setSelected(settings.isDownloadSources());
myDownloadJavadocsCheckBox.setSelected(settings.isDownloadJavaDocs());
init();
}
- private void onVersionChanged(final @Nullable List extends DownloadableFileDescription> selected) {
+ private void updateSourcesAndJavadocCheckboxes() {
+ final FrameworkLibraryVersion version = getSelectedVersion();
+ boolean sourcesCheckboxEnabled;
+ boolean javadocCheckboxEnabled;
+ if (version == null) {
+ sourcesCheckboxEnabled = javadocCheckboxEnabled = false;
+ }
+ else {
+ final List descriptions = getSelectedDownloads(version);
+ sourcesCheckboxEnabled = haveAdditionalDownloads(descriptions, AdditionalDownloadType.SOURCES);
+ javadocCheckboxEnabled = haveAdditionalDownloads(descriptions, AdditionalDownloadType.DOCUMENTATION);
+ }
+ setEnabled(myDownloadSourcesCheckBox, sourcesCheckboxEnabled);
+ setEnabled(myDownloadJavadocsCheckBox, javadocCheckboxEnabled);
+ }
+
+ private static void setEnabled(final JCheckBox checkBox, final boolean enabled) {
+ if (!enabled) {
+ checkBox.setSelected(false);
+ }
+ checkBox.setEnabled(enabled);
+ }
+
+ private static boolean haveAdditionalDownloads(final List extends DownloadableLibraryFileDescription> descriptions, AdditionalDownloadType type) {
+ for (DownloadableLibraryFileDescription description : descriptions) {
+ if (type == AdditionalDownloadType.SOURCES && description.getSourcesDescription() != null
+ || type == AdditionalDownloadType.DOCUMENTATION && description.getDocumentationDescription() != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void onVersionChanged(final @Nullable List extends DownloadableLibraryFileDescription> selectedFiles) {
final FrameworkLibraryVersion version = getSelectedVersion();
if (Comparing.equal(myLastSelectedVersion, version)) return;
if (version != null) {
- final List extends DownloadableFileDescription> downloads = version.getFiles();
- myFilesList.setModel(new CollectionListModel(
- ContainerUtil.map2Array(downloads, JCheckBox.class, new Function() {
+ final List extends DownloadableLibraryFileDescription> downloads = version.getFiles();
+ myFilesList.setModel(new CollectionListModel(
+ ContainerUtil.map2Array(downloads, JCheckBox.class, new Function() {
@Override
- public JCheckBox fun(DownloadableFileDescription description) {
- return new JCheckBox(description.getPresentableFileName(), selected == null || selected.contains(description));
+ public JCheckBox fun(DownloadableLibraryFileDescription description) {
+ final boolean selected = selectedFiles != null ? selectedFiles.contains(description) : !description.isOptional();
+ return new JCheckBox(description.getPresentableFileName(), selected);
}
})));
if (myNameAndLevelPanel != null) {
myNameAndLevelPanel.setDefaultName(version.getDefaultLibraryName());
}
}
+ updateSourcesAndJavadocCheckboxes();
myLastSelectedVersion = version;
}
@@ -168,9 +217,9 @@ public class DownloadingOptionsDialog extends DialogWrapper {
return dialog.createSettings();
}
- private List getSelectedDownloads(FrameworkLibraryVersion version) {
- List selected = new ArrayList();
- List extends DownloadableFileDescription> downloads = version.getFiles();
+ private List getSelectedDownloads(FrameworkLibraryVersion version) {
+ List selected = new ArrayList();
+ List extends DownloadableLibraryFileDescription> downloads = version.getFiles();
for (int i = 0; i < downloads.size(); i++) {
if (myFilesList.isItemSelected(i)) {
selected.add(downloads.get(i));
@@ -194,7 +243,7 @@ public class DownloadingOptionsDialog extends DialogWrapper {
}
final String path = FileUtil.toSystemIndependentName(myDirectoryField.getText());
- List selected = getSelectedDownloads(version);
+ List selected = getSelectedDownloads(version);
return new LibraryDownloadSettings(version, myLibraryType, path, libraryName, libraryLevel, selected,
myDownloadSourcesCheckBox.isSelected(), myDownloadJavadocsCheckBox.isSelected());
diff --git a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryDownloadSettings.java b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryDownloadSettings.java
index 2e12030dc85c..b3584169acfc 100644
--- a/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryDownloadSettings.java
+++ b/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryDownloadSettings.java
@@ -15,20 +15,28 @@
*/
package com.intellij.facet.impl.ui.libraries;
+import com.intellij.framework.library.DownloadableLibraryFileDescription;
import com.intellij.framework.library.DownloadableLibraryType;
import com.intellij.framework.library.FrameworkLibraryVersion;
import com.intellij.framework.library.LibraryVersionProperties;
+import com.intellij.openapi.roots.JavadocOrderRootType;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.download.DownloadableFileDescription;
import com.intellij.util.download.DownloadableFileService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author nik
@@ -41,19 +49,19 @@ public class LibraryDownloadSettings {
private final boolean myDownloadSources;
private final boolean myDownloadJavaDocs;
private final LibrariesContainer.LibraryLevel myLibraryLevel;
- private final List extends DownloadableFileDescription> mySelectedDownloads;
+ private final List extends DownloadableLibraryFileDescription> mySelectedDownloads;
public LibraryDownloadSettings(@NotNull FrameworkLibraryVersion libraryVersion,
@Nullable DownloadableLibraryType libraryType,
final LibrariesContainer.LibraryLevel libraryLevel, final String downloadedLibrariesPath) {
this(libraryVersion, libraryType, downloadedLibrariesPath, libraryVersion.getDefaultLibraryName(), libraryLevel,
- libraryVersion.getFiles(), true, true);
+ getRequiredFiles(libraryVersion.getFiles()), true, true);
}
public LibraryDownloadSettings(@NotNull FrameworkLibraryVersion libraryVersion, @Nullable DownloadableLibraryType libraryType,
@NotNull String directoryForDownloadedLibrariesPath, @NotNull String libraryName,
@NotNull LibrariesContainer.LibraryLevel libraryLevel,
- @NotNull List extends DownloadableFileDescription> selectedDownloads,
+ @NotNull List extends DownloadableLibraryFileDescription> selectedDownloads,
boolean downloadSources, boolean downloadJavaDocs) {
myVersion = libraryVersion;
myLibraryType = libraryType;
@@ -65,6 +73,15 @@ public class LibraryDownloadSettings {
mySelectedDownloads = selectedDownloads;
}
+ private static List extends DownloadableLibraryFileDescription> getRequiredFiles(List extends DownloadableLibraryFileDescription> files) {
+ return ContainerUtil.filter(files, new Condition() {
+ @Override
+ public boolean value(DownloadableLibraryFileDescription description) {
+ return !description.isOptional();
+ }
+ });
+ }
+
@NotNull
public FrameworkLibraryVersion getVersion() {
return myVersion;
@@ -86,7 +103,7 @@ public class LibraryDownloadSettings {
return myDirectoryForDownloadedLibrariesPath;
}
- public List extends DownloadableFileDescription> getSelectedDownloads() {
+ public List extends DownloadableLibraryFileDescription> getSelectedDownloads() {
return mySelectedDownloads;
}
@@ -109,10 +126,26 @@ public class LibraryDownloadSettings {
@Nullable
public NewLibraryEditor download(JComponent parent) {
- VirtualFile[] files = DownloadableFileService.getInstance().createDownloader(mySelectedDownloads, null, parent, myLibraryName + " Library")
+ final List toDownload = new ArrayList(mySelectedDownloads);
+ Map rootTypes = new HashMap();
+ for (DownloadableLibraryFileDescription description : mySelectedDownloads) {
+ final DownloadableFileDescription sources = description.getSourcesDescription();
+ if (myDownloadSources && sources != null) {
+ toDownload.add(sources);
+ rootTypes.put(sources, OrderRootType.SOURCES);
+ }
+ final DownloadableFileDescription docs = description.getDocumentationDescription();
+ if (myDownloadJavaDocs && docs != null) {
+ toDownload.add(docs);
+ rootTypes.put(docs, JavadocOrderRootType.getInstance());
+ }
+ }
+
+ List> downloaded =
+ DownloadableFileService.getInstance().createDownloader(toDownload, null, parent, myLibraryName + " Library")
.toDirectory(myDirectoryForDownloadedLibrariesPath)
- .download();
- if (files == null) {
+ .downloadAndReturnWithDescriptions();
+ if (downloaded == null) {
return null;
}
@@ -124,8 +157,9 @@ public class LibraryDownloadSettings {
libraryEditor = new NewLibraryEditor();
}
libraryEditor.setName(myLibraryName);
- for (VirtualFile file : files) {
- libraryEditor.addRoot(file, OrderRootType.CLASSES);
+ for (Pair pair : downloaded) {
+ final OrderRootType rootType = rootTypes.containsKey(pair.getSecond()) ? rootTypes.get(pair.getSecond()) : OrderRootType.CLASSES;
+ libraryEditor.addRoot(pair.getFirst(), rootType);
}
return libraryEditor;
}
diff --git a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/OldCustomLibraryDescription.java b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/OldCustomLibraryDescription.java
index bc2ab2fd62eb..7e53c09383d8 100644
--- a/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/OldCustomLibraryDescription.java
+++ b/java/idea-ui/src/com/intellij/ide/util/frameworkSupport/OldCustomLibraryDescription.java
@@ -19,16 +19,16 @@ import com.intellij.facet.impl.ui.libraries.RequiredLibrariesInfo;
import com.intellij.facet.ui.libraries.LibraryDownloadInfo;
import com.intellij.facet.ui.libraries.LibraryInfo;
import com.intellij.framework.library.DownloadableLibraryDescription;
+import com.intellij.framework.library.DownloadableLibraryFileDescription;
import com.intellij.framework.library.FrameworkLibraryVersion;
import com.intellij.framework.library.impl.DownloadableLibraryDescriptionImpl;
+import com.intellij.framework.library.impl.DownloadableLibraryFileDescriptionImpl;
import com.intellij.framework.library.impl.FrameworkLibraryVersionImpl;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
-import com.intellij.util.download.DownloadableFileDescription;
-import com.intellij.util.download.impl.DownloadableFileDescriptionImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -53,13 +53,12 @@ public class OldCustomLibraryDescription extends CustomLibraryDescriptionBase {
myVersions = versions;
final List libraryVersions = new ArrayList();
for (FrameworkVersion version : versions) {
- List downloads = new ArrayList();
+ List downloads = new ArrayList();
for (LibraryInfo info : version.getLibraries()) {
final LibraryDownloadInfo downloadingInfo = info.getDownloadingInfo();
if (downloadingInfo != null) {
- final DownloadableFileDescription
- element = new DownloadableFileDescriptionImpl(downloadingInfo.getDownloadUrl(), downloadingInfo.getFileNamePrefix(), downloadingInfo.getFileNameSuffix());
- downloads.add(element);
+ downloads.add(new DownloadableLibraryFileDescriptionImpl(downloadingInfo.getDownloadUrl(), downloadingInfo.getFileNamePrefix(),
+ downloadingInfo.getFileNameSuffix(), null, null, false));
}
}
libraryVersions.add(new FrameworkLibraryVersionImpl(version.getVersionName(), downloads, version.getLibraryName()));
diff --git a/java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileImpl.java b/java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileImpl.java
index 2e37a5d60f1a..36d2ba4e529b 100644
--- a/java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileImpl.java
+++ b/java/idea-ui/src/com/intellij/util/descriptors/impl/ConfigFileImpl.java
@@ -1,7 +1,6 @@
package com.intellij.util.descriptors.impl;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
import com.intellij.openapi.vfs.pointers.VirtualFilePointerListener;
@@ -43,7 +42,6 @@ public class ConfigFileImpl implements ConfigFile {
}
});
onChange();
- Disposer.register(container, this);
myProject = myContainer.getProject();
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/Java18CompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/Java18CompletionData.java
new file mode 100644
index 000000000000..d627fc535b0b
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/Java18CompletionData.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.completion;
+
+import com.intellij.psi.PsiKeyword;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiParameterList;
+import com.intellij.psi.filters.AndFilter;
+import com.intellij.psi.filters.ClassFilter;
+import com.intellij.psi.filters.ElementFilter;
+import com.intellij.psi.filters.TextFilter;
+import com.intellij.psi.filters.classes.InterfaceFilter;
+import com.intellij.psi.filters.position.LeftNeighbour;
+import com.intellij.psi.filters.position.ParentElementFilter;
+
+public class Java18CompletionData extends Java15CompletionData {
+ @Override
+ protected void initVariantsInMethodScope() {
+ super.initVariantsInMethodScope();
+
+ {
+ // in extension method
+ ElementFilter position = new AndFilter(
+ new LeftNeighbour(new AndFilter(
+ new TextFilter(")"),
+ new ParentElementFilter(new ClassFilter(PsiParameterList.class)))),
+ new ParentElementFilter(new InterfaceFilter(), 3));
+ CompletionVariant variant = new CompletionVariant(PsiMethod.class, position);
+ variant.addCompletion(PsiKeyword.DEFAULT);
+ registerVariant(variant);
+ }
+ }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
index 2e787a533784..a1e9fb3ce9f6 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2012 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.
@@ -36,6 +36,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.patterns.ElementPattern;
import com.intellij.patterns.PatternCondition;
import com.intellij.patterns.PsiNameValuePairPattern;
+import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.filters.*;
import com.intellij.psi.filters.classes.AssignableFromContextFilter;
@@ -66,8 +67,22 @@ import static com.intellij.patterns.PsiJavaPatterns.*;
public class JavaCompletionContributor extends CompletionContributor {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.completion.JavaCompletionContributor");
- private static final Java15CompletionData ourJava15CompletionData = new Java15CompletionData();
- private static final JavaCompletionData ourJavaCompletionData = new JavaCompletionData();
+ private static final Map ourCompletionData;
+
+ static {
+ ourCompletionData = new LinkedHashMap();
+ ourCompletionData.put(LanguageLevel.JDK_1_8, new Java18CompletionData());
+ ourCompletionData.put(LanguageLevel.JDK_1_3, new Java15CompletionData());
+ ourCompletionData.put(LanguageLevel.JDK_1_3, new JavaCompletionData());
+ }
+
+ private static JavaCompletionData getCompletionData(LanguageLevel level) {
+ final Set> entries = ourCompletionData.entrySet();
+ for (Map.Entry entry : entries) {
+ if (entry.getKey().isAtLeast(level)) return entry.getValue();
+ }
+ return ourCompletionData.get(LanguageLevel.JDK_1_3);
+ }
private static final PsiNameValuePairPattern NAME_VALUE_PAIR =
psiNameValuePair().withSuperParent(2, psiElement(PsiAnnotation.class));
@@ -338,7 +353,7 @@ public class JavaCompletionContributor extends CompletionContributor {
PsiElement position = parameters.getPosition();
final Set lookupSet = new LinkedHashSet();
final Set keywordVariants = new HashSet();
- final JavaCompletionData completionData = PsiUtil.isLanguageLevel5OrHigher(position) ? ourJava15CompletionData : ourJavaCompletionData;
+ final JavaCompletionData completionData = getCompletionData(PsiUtil.getLanguageLevel(position));
completionData.addKeywordVariants(keywordVariants, position, parameters.getOriginalFile());
completionData.completeKeywordsBySet(lookupSet, keywordVariants, position, result.getPrefixMatcher(), parameters.getOriginalFile());
completionData.fillCompletions(parameters, result);
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
index 618d7196e467..bb12266e5564 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2012 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.
@@ -311,7 +311,7 @@ public class JavaCompletionData extends JavaAwareCompletionData{
}
}
- private void initVariantsInMethodScope() {
+ protected void initVariantsInMethodScope() {
// Completion for classes in method throws section
// position
{
@@ -363,7 +363,7 @@ public class JavaCompletionData extends JavaAwareCompletionData{
registerVariant(variant);
}
-// Catch/Finnaly completion
+// Catch/Finally completion
{
final ElementFilter position = new LeftNeighbour(new AndFilter(
new TextFilter("}"),
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 535aee6ea37b..a28be95d2166 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
@@ -678,6 +678,7 @@ public class HighlightClassUtil {
* @param extendRef points to the class in the extends list
* @param resolved extendRef resolved
*/
+ @Nullable
public static HighlightInfo checkClassExtendsForeignInnerClass(final PsiJavaCodeReferenceElement extendRef, final PsiElement resolved) {
PsiElement parent = extendRef.getParent();
if (!(parent instanceof PsiReferenceList)) {
@@ -723,11 +724,10 @@ public class HighlightClassUtil {
// must be inner class
if (!PsiUtil.isInnerClass(base)) return;
- if (resolve == resolved) {
- if (!hasEnclosingInstanceInScope(baseClass, extendRef, true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
- String description = JavaErrorMessages.message("no.enclosing.instance.in.scope", HighlightUtil.formatClass(baseClass));
- infos[0] = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, extendRef, description);
- }
+ if (resolve == resolved && baseClass != null &&
+ !hasEnclosingInstanceInScope(baseClass, extendRef, true) && !qualifiedNewCalledInConstructors(aClass, baseClass)) {
+ String description = JavaErrorMessages.message("no.enclosing.instance.in.scope", HighlightUtil.formatClass(baseClass));
+ infos[0] = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, extendRef, description);
}
}
}
@@ -796,6 +796,7 @@ public class HighlightClassUtil {
return checkCreateInnerClassFromStaticContext(expression, qualifier, aClass);
}
+ @Nullable
public static HighlightInfo checkCreateInnerClassFromStaticContext(PsiElement element, @Nullable PsiExpression qualifier, PsiClass aClass) {
if (!PsiUtil.isInnerClass(aClass)) return null;
PsiClass outerClass = aClass.getContainingClass();
@@ -803,15 +804,14 @@ public class HighlightClassUtil {
PsiElement placeToSearchEnclosingFrom;
if (qualifier != null) {
- PsiType qtype = qualifier.getType();
- placeToSearchEnclosingFrom = PsiUtil.resolveClassInType(qtype);
+ PsiType qType = qualifier.getType();
+ placeToSearchEnclosingFrom = PsiUtil.resolveClassInType(qType);
}
else {
placeToSearchEnclosingFrom = element;
}
- if (outerClass instanceof JspClass
- || hasEnclosingInstanceInScope(outerClass, placeToSearchEnclosingFrom, true)) return null;
+ if (outerClass instanceof JspClass || hasEnclosingInstanceInScope(outerClass, placeToSearchEnclosingFrom, true)) return null;
return reportIllegalEnclosingUsage(placeToSearchEnclosingFrom, aClass, outerClass, element);
}
@@ -837,7 +837,8 @@ public class HighlightClassUtil {
@Nullable
public static HighlightInfo reportIllegalEnclosingUsage(PsiElement place,
- PsiClass aClass, PsiClass outerClass,
+ @Nullable PsiClass aClass,
+ PsiClass outerClass,
PsiElement elementToHighlight) {
if (outerClass != null && !PsiTreeUtil.isContextAncestor(outerClass, place, false)) {
String description = JavaErrorMessages.message("is.not.an.enclosing.class", HighlightUtil.formatClass(outerClass));
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 ac3a5df3c7ad..618e5e8701ac 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
@@ -67,7 +67,7 @@ import static com.intellij.codeInsight.daemon.JavaHighlightingFilter.suppressed;
/**
* @author cdr
- * Date: Jul 30, 2002
+ * @since Jul 30, 2002
*/
public class HighlightUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil");
@@ -534,14 +534,14 @@ public class HighlightUtil {
IntentionAction fix = QUICK_FIX_FACTORY.createMethodReturnFix(method, valueType, true);
QuickFixAction.registerQuickFixAction(errorResult, fix);
}
- }
+ }
else {
errorResult = checkAssignability(returnType, valueType, returnValue, statement);
if (errorResult != null && valueType != null) {
IntentionAction fix = QUICK_FIX_FACTORY.createMethodReturnFix(method, valueType, true);
QuickFixAction.registerQuickFixAction(errorResult, fix);
if (returnType instanceof PsiArrayType && TypeConversionUtil.isAssignable(((PsiArrayType)returnType).getComponentType(), valueType)) {
- QuickFixAction.registerQuickFixAction(errorResult, new SurroundWithArrayFix(null){
+ QuickFixAction.registerQuickFixAction(errorResult, new SurroundWithArrayFix(null) {
@Override
protected PsiExpression getExpression(final PsiElement element) {
return returnValue.isValid() ? returnValue : null;
@@ -580,7 +580,10 @@ public class HighlightUtil {
private static String formatTypes(Collection unhandled) {
return StringUtil.join(unhandled, new Function() {
- @Override public String fun(PsiClassType type) { return formatType(type); }
+ @Override
+ public String fun(PsiClassType type) {
+ return formatType(type);
+ }
}, ", ");
}
@@ -825,7 +828,8 @@ public class HighlightUtil {
}
else {
if (PsiModifier.PUBLIC.equals(modifier)) {
- isAllowed = modifierOwnerParent instanceof PsiJavaFile || (modifierOwnerParent instanceof PsiClass && (modifierOwnerParent instanceof JspClass || ((PsiClass)modifierOwnerParent).getQualifiedName() != null));
+ isAllowed = modifierOwnerParent instanceof PsiJavaFile ||
+ (modifierOwnerParent instanceof PsiClass && (modifierOwnerParent instanceof JspClass || ((PsiClass)modifierOwnerParent).getQualifiedName() != null));
}
else if (PsiModifier.STATIC.equals(modifier) || PsiModifier.PRIVATE.equals(modifier) || PsiModifier.PROTECTED.equals(modifier) ||
PsiModifier.PACKAGE_LOCAL.equals(modifier)) {
@@ -879,41 +883,30 @@ public class HighlightUtil {
return null;
}
-
@Nullable
- static HighlightInfo checkLiteralExpressionParsingError(final PsiLiteralExpression expression) {
- final String error = getLiteralExpressionParsingError(expression);
- if (error != null) {
- final HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, error);
- QuickFixAction.registerQuickFixActions(info, getLiteralExpressionQuickFixes(expression));
- return info;
- }
- return null;
- }
-
- private static final Key TOO_BIG_CHAR_LITERAL_KEY = Key.create("too.big.char.literal");
-
- public static String getLiteralExpressionParsingError(final PsiLiteralExpression expression) {
+ public static HighlightInfo checkLiteralExpressionParsingError(final PsiLiteralExpression expression) {
final Object value = expression.getValue();
final PsiElement literal = expression.getFirstChild();
assert literal instanceof PsiJavaToken : literal;
final IElementType type = ((PsiJavaToken)literal).getTokenType();
String text = PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type) ? literal.getText().toLowerCase() : literal.getText();
- final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(expression);
if (PsiLiteralExpressionImpl.REAL_LITERALS.contains(type)) {
- if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX) && !languageLevel.isAtLeast(LanguageLevel.JDK_1_5)) {
- return JavaErrorMessages.message("hex.FP.literals.not.supported");
+ if (text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
+ final HighlightInfo info = checkFeature(expression, Feature.HEX_FP_LITERALS);
+ if (info != null) return info;
}
}
if (PsiLiteralExpressionImpl.INTEGER_LITERALS.contains(type)) {
- if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX) && !languageLevel.isAtLeast(LanguageLevel.JDK_1_7)) {
- return JavaErrorMessages.message("binary.literals.not.supported");
+ if (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX)) {
+ final HighlightInfo info = checkFeature(expression, Feature.BIN_LITERALS);
+ if (info != null) return info;
}
}
if (PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type)) {
- if (text.contains("_") && !languageLevel.isAtLeast(LanguageLevel.JDK_1_7)) {
- return JavaErrorMessages.message("underscores.in.literals.not.supported");
+ if (text.contains("_")) {
+ final HighlightInfo info = checkFeature(expression, Feature.UNDERSCORES);
+ if (info != null) return info;
}
}
@@ -924,13 +917,16 @@ public class HighlightUtil {
parent instanceof PsiPrefixExpression &&
((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
if (text.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
- return JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+ final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
if (text.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
- return JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+ final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
if (value == null || text.equals(PsiLiteralExpressionImpl._2_IN_31)) {
- return JavaErrorMessages.message("integer.number.too.large");
+ final String message = JavaErrorMessages.message("integer.number.too.large");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
}
@@ -941,19 +937,23 @@ public class HighlightUtil {
parent instanceof PsiPrefixExpression &&
((PsiPrefixExpression)parent).getOperationTokenType() == JavaTokenType.MINUS)) {
if (mText.equals(PsiLiteralExpressionImpl.HEX_PREFIX)) {
- return JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+ final String message = JavaErrorMessages.message("hexadecimal.numbers.must.contain.at.least.one.hexadecimal.digit");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
if (mText.equals(PsiLiteralExpressionImpl.BIN_PREFIX)) {
- return JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+ final String message = JavaErrorMessages.message("binary.numbers.must.contain.at.least.one.hexadecimal.digit");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
if (value == null || mText.equals(PsiLiteralExpressionImpl._2_IN_63)) {
- return JavaErrorMessages.message("long.number.too.large");
+ final String message = JavaErrorMessages.message("long.number.too.large");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
}
else if (type == JavaTokenType.FLOAT_LITERAL || type == JavaTokenType.DOUBLE_LITERAL) {
if (value == null) {
- return JavaErrorMessages.message("malformed.floating.point.literal");
+ final String message = JavaErrorMessages.message("malformed.floating.point.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
else if (type == JavaTokenType.TRUE_KEYWORD || type == JavaTokenType.FALSE_KEYWORD || type == JavaTokenType.NULL_KEYWORD) {
@@ -962,28 +962,41 @@ public class HighlightUtil {
else if (type == JavaTokenType.CHARACTER_LITERAL) {
// todo[r.sh] clean this mess up
if (value != null) {
- if (!StringUtil.endsWithChar(text, '\'')) return JavaErrorMessages.message("unclosed.char.literal");
+ if (!StringUtil.endsWithChar(text, '\'')) {
+ final String message = JavaErrorMessages.message("unclosed.char.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
}
else {
if (!StringUtil.startsWithChar(text, '\'')) return null;
if (StringUtil.endsWithChar(text, '\'')) {
- if (text.length() == 1) return JavaErrorMessages.message("illegal.line.end.in.character.literal");
+ if (text.length() == 1) {
+ final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
text = text.substring(1, text.length() - 1);
}
else {
- return JavaErrorMessages.message("illegal.line.end.in.character.literal");
+ final String message = JavaErrorMessages.message("illegal.line.end.in.character.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
final StringBuilder chars = StringBuilderSpinAllocator.alloc();
final boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
- if (!success) return JavaErrorMessages.message("illegal.escape.character.in.character.literal");
+ if (!success) {
+ final String message = JavaErrorMessages.message("illegal.escape.character.in.character.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
final int length = chars.length();
StringBuilderSpinAllocator.dispose(chars);
if (length > 1) {
- literal.putUserData(TOO_BIG_CHAR_LITERAL_KEY, Boolean.TRUE);
- return JavaErrorMessages.message("too.many.characters.in.character.literal");
+ final String message = JavaErrorMessages.message("too.many.characters.in.character.literal");
+ final HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ QuickFixAction.registerQuickFixAction(info, new ConvertToStringLiteralAction());
+ return info;
}
else if (length == 0) {
- return JavaErrorMessages.message("empty.character.literal");
+ final String message = JavaErrorMessages.message("empty.character.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
}
}
@@ -997,27 +1010,46 @@ public class HighlightUtil {
if (!StringUtil.startsWithChar(text, '\"')) return null;
if (StringUtil.endsWithChar(text, '\"')) {
- if (text.length() == 1) return JavaErrorMessages.message("illegal.line.end.in.string.literal");
+ if (text.length() == 1) {
+ final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
text = text.substring(1, text.length() - 1);
}
else {
- return JavaErrorMessages.message("illegal.line.end.in.string.literal");
+ final String message = JavaErrorMessages.message("illegal.line.end.in.string.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
StringBuilder chars = new StringBuilder();
boolean success = PsiLiteralExpressionImpl.parseStringCharacters(text, chars, null);
- if (!success) return JavaErrorMessages.message("illegal.escape.character.in.string.literal");
+ if (!success) {
+ final String message = JavaErrorMessages.message("illegal.escape.character.in.string.literal");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
}
}
if (value instanceof Float) {
final Float number = (Float)value;
- if (number.isInfinite()) return JavaErrorMessages.message("floating.point.number.too.large");
- if (number.floatValue() == 0 && !isFPZero(text)) return JavaErrorMessages.message("floating.point.number.too.small");
+ if (number.isInfinite()) {
+ final String message = JavaErrorMessages.message("floating.point.number.too.large");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
+ if (number.floatValue() == 0 && !isFPZero(text)) {
+ final String message = JavaErrorMessages.message("floating.point.number.too.small");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
}
else if (value instanceof Double) {
final Double number = (Double)value;
- if (number.isInfinite()) return JavaErrorMessages.message("floating.point.number.too.large");
- if (number.doubleValue() == 0 && !isFPZero(text)) return JavaErrorMessages.message("floating.point.number.too.small");
+ if (number.isInfinite()) {
+ final String message = JavaErrorMessages.message("floating.point.number.too.large");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
+ if (number.doubleValue() == 0 && !isFPZero(text)) {
+ final String message = JavaErrorMessages.message("floating.point.number.too.small");
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
+ }
}
return null;
@@ -1033,33 +1065,6 @@ public class HighlightUtil {
return true;
}
- private static Collection extends IntentionAction> getLiteralExpressionQuickFixes(final PsiLiteralExpression expression) {
- final PsiElement literal = expression.getFirstChild();
- assert literal instanceof PsiJavaToken : literal;
- final String text = literal.getText().toLowerCase();
- final IElementType type = ((PsiJavaToken)literal).getTokenType();
- final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(expression);
-
- if (PsiLiteralExpressionImpl.REAL_LITERALS.contains(type)) {
- if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_5) && text.startsWith(PsiLiteralExpressionImpl.HEX_PREFIX)) {
- return Collections.singletonList(new IncreaseLanguageLevelFix(LanguageLevel.JDK_1_5));
- }
- }
- if (PsiLiteralExpressionImpl.NUMERIC_LITERALS.contains(type)) {
- if (!languageLevel.isAtLeast(LanguageLevel.JDK_1_7) && (text.startsWith(PsiLiteralExpressionImpl.BIN_PREFIX) || text.contains("_"))) {
- return Collections.singletonList(new IncreaseLanguageLevelFix(LanguageLevel.JDK_1_7));
- }
- }
- if (type == JavaTokenType.CHARACTER_LITERAL) {
- if (Boolean.TRUE.equals(literal.getUserData(TOO_BIG_CHAR_LITERAL_KEY))) {
- return Collections.singletonList(new ConvertToStringLiteralAction());
- }
- }
-
- return Collections.emptyList();
- }
-
-
@Nullable
static HighlightInfo checkMustBeBoolean(@NotNull PsiExpression expr, PsiType type) {
PsiElement parent = expr.getParent();
@@ -1071,7 +1076,7 @@ public class HighlightUtil {
if (!TypeConversionUtil.isBooleanType(type)) {
final HighlightInfo info = createIncompatibleTypeHighlightInfo(PsiType.BOOLEAN, type, expr.getTextRange());
if (expr instanceof PsiMethodCallExpression) {
- final PsiMethodCallExpression methodCall = (PsiMethodCallExpression) expr;
+ final PsiMethodCallExpression methodCall = (PsiMethodCallExpression)expr;
final PsiMethod method = methodCall.resolveMethod();
if (method != null && PsiType.VOID.equals(method.getReturnType())) {
IntentionAction fix = QUICK_FIX_FACTORY.createMethodReturnFix(method, PsiType.BOOLEAN, true);
@@ -1140,8 +1145,7 @@ public class HighlightUtil {
final List typeElements = PsiUtil.getParameterTypeElements(parameter);
final Collection highlights = Lists.newArrayListWithCapacity(typeElements.size());
- for (int i = 0, size = typeElements.size(); i < size; i++) {
- final PsiTypeElement typeElement = typeElements.get(i);
+ for (final PsiTypeElement typeElement : typeElements) {
final PsiType catchType = typeElement.getType();
if (catchType instanceof PsiClassType && ExceptionUtil.isUncheckedExceptionOrSuperclass((PsiClassType)catchType)) continue;
@@ -1188,7 +1192,10 @@ public class HighlightUtil {
// collect exceptions which are caught by this type
Collection caught = ContainerUtil.findAll(thrownTypes, new Condition() {
- @Override public boolean value(PsiClassType type) { return catchType.isAssignableFrom(type); }
+ @Override
+ public boolean value(PsiClassType type) {
+ return catchType.isAssignableFrom(type);
+ }
});
if (caught.isEmpty()) continue;
final Collection caughtCopy = Sets.newHashSet(caught);
@@ -1247,7 +1254,8 @@ public class HighlightUtil {
if (PsiType.LONG.equals(type) || PsiType.FLOAT.equals(type) || PsiType.DOUBLE.equals(type)) {
QuickFixAction.registerQuickFixAction(errorResult, new AddTypeCastFix(PsiType.INT, expression));
}
- } else {
+ }
+ else {
final PsiClass member = PsiUtil.resolveClassInClassTypeOnly(type);
if (member != null && !PsiUtil.isAccessible(member, expression, null)) {
String message = PsiFormatUtil.formatClass(member, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME) + " is inaccessible here";
@@ -1285,8 +1293,8 @@ public class HighlightUtil {
if (!TypeConversionUtil.isBinaryOperatorApplicable(operationSign, lType, rType, false)) {
PsiJavaToken token = expression.getTokenBeforeOperand(operand);
String message = JavaErrorMessages.message("binary.operator.not.applicable", token.getText(),
- formatType(lType),
- formatType(rType));
+ formatType(lType),
+ formatType(rType));
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
}
lType = TypeConversionUtil.calcTypeForBinaryExpression(lType, rType, operationSign, true);
@@ -1314,29 +1322,56 @@ public class HighlightUtil {
}
@Nullable
- public static HighlightInfo checkThisOrSuperExpressionInIllegalContext(PsiExpression expr, @Nullable PsiJavaCodeReferenceElement qualifier) {
- if (expr instanceof PsiSuperExpression && !(expr.getParent() instanceof PsiReferenceExpression)) {
- // like in 'Object o = super;'
- return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expr.getTextRange().getEndOffset(),
- expr.getTextRange().getEndOffset() + 1,
- JavaErrorMessages.message("dot.expected.after.super.or.this"));
+ public static HighlightInfo checkThisOrSuperExpressionInIllegalContext(PsiExpression expr,
+ @Nullable PsiJavaCodeReferenceElement qualifier) {
+ if (expr instanceof PsiSuperExpression) {
+ final PsiElement parent = expr.getParent();
+ if (!(parent instanceof PsiReferenceExpression)) {
+ // like in 'Object o = super;'
+ final int o = expr.getTextRange().getEndOffset();
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, o, o + 1, JavaErrorMessages.message("dot.expected.after.super.or.this"));
+ }
+
+ if (PsiUtil.isLanguageLevel8OrHigher(expr)) {
+ final PsiMethod method = PsiTreeUtil.getParentOfType(expr, PsiMethod.class);
+ if (PsiUtil.isExtensionMethod(method) && qualifier == null) {
+ //todo[r.sh] "Add qualifier" quick fix
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, parent, JavaErrorMessages.message("unqualified.super.disallowed"));
+ }
+ }
}
- PsiElement resolved = null;
- PsiClass aClass = qualifier == null ? PsiTreeUtil.getParentOfType(expr, PsiClass.class) : (resolved = qualifier.resolve()) instanceof PsiClass ? (PsiClass)resolved : null;
- if (resolved != null && !(resolved instanceof PsiClass)) {
- return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, qualifier, JavaErrorMessages.message("class.expected"));
+
+ final PsiClass aClass;
+ if (qualifier != null) {
+ final PsiElement resolved = qualifier.resolve();
+ if (resolved != null && !(resolved instanceof PsiClass)) {
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, qualifier, JavaErrorMessages.message("class.expected"));
+ }
+ aClass = (PsiClass)resolved;
+ }
+ else {
+ aClass = PsiTreeUtil.getParentOfType(expr, PsiClass.class);
}
if (aClass == null) return null;
- if (qualifier != null && aClass.isInterface()) {
- return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, qualifier, JavaErrorMessages.message("no.interface.expected"));
- }
- if (!HighlightClassUtil.hasEnclosingInstanceInScope(aClass, expr, false)) {
+
+ if (!HighlightClassUtil.hasEnclosingInstanceInScope(aClass, expr, false) &&
+ !resolvesToImmediateSuperInterface(expr, qualifier, aClass)) {
return HighlightClassUtil.reportIllegalEnclosingUsage(expr, null, aClass, expr);
}
return null;
}
+ private static boolean resolvesToImmediateSuperInterface(PsiExpression expr,
+ @Nullable PsiJavaCodeReferenceElement qualifier,
+ PsiClass aClass) {
+ if (!(expr instanceof PsiSuperExpression) || qualifier == null || !PsiUtil.isLanguageLevel8OrHigher(expr)) return false;
+ final PsiType superType = expr.getType();
+ if (!(superType instanceof PsiClassType)) return false;
+ final PsiClass superClass = ((PsiClassType)superType).resolve();
+ return superClass != null && aClass.equals(superClass);
+ }
+
static String buildProblemWithStaticDescription(PsiElement refElement) {
String type = LanguageFindUsages.INSTANCE.forLanguage(JavaLanguage.INSTANCE).getType(refElement);
String name = HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY);
@@ -1406,13 +1441,19 @@ public class HighlightUtil {
}
@Nullable
- static HighlightInfo checkValidArrayAccessExpression(@Nullable PsiExpression arrayExpression, PsiExpression indexExpression, PsiType type) {
- PsiType arrayExpressionType = arrayExpression == null ? null : arrayExpression.getType();
+ static HighlightInfo checkValidArrayAccessExpression(@NotNull PsiArrayAccessExpression arrayAccessExpression) {
+ final PsiExpression arrayExpression = arrayAccessExpression.getArrayExpression();
+ final PsiType arrayExpressionType = arrayExpression.getType();
+
if (arrayExpressionType != null && !(arrayExpressionType instanceof PsiArrayType)) {
- String description = JavaErrorMessages.message("array.type.expected", formatType(arrayExpressionType));
- return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, arrayExpression, description);
+ final String description = JavaErrorMessages.message("array.type.expected", formatType(arrayExpressionType));
+ final HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, arrayExpression, description);
+ QuickFixAction.registerQuickFixAction(info, new ReplaceWithListAccessFix(arrayAccessExpression));
+ return info;
}
- return checkAssignability(PsiType.INT, indexExpression.getType(), indexExpression, indexExpression);
+
+ final PsiExpression indexExpression = arrayAccessExpression.getIndexExpression();
+ return indexExpression != null ? checkAssignability(PsiType.INT, indexExpression.getType(), indexExpression, indexExpression) : null;
}
@@ -1440,8 +1481,8 @@ public class HighlightUtil {
if (!(initializer instanceof PsiArrayInitializerExpression)) return null;
if (!(type instanceof PsiArrayType)) return null;
- final PsiType componentType = ((PsiArrayType) type).getComponentType();
- final PsiArrayInitializerExpression arrayInitializer = (PsiArrayInitializerExpression) initializer;
+ final PsiType componentType = ((PsiArrayType)type).getComponentType();
+ final PsiArrayInitializerExpression arrayInitializer = (PsiArrayInitializerExpression)initializer;
boolean arrayTypeFixChecked = false;
VariableArrayTypeFix fix = null;
@@ -1535,7 +1576,8 @@ public class HighlightUtil {
return null;
}
- HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, JavaErrorMessages.message("array.initializer.not.allowed"));
+ HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression,
+ JavaErrorMessages.message("array.initializer.not.allowed"));
QuickFixAction.registerQuickFixAction(info, new AddNewArrayExpressionFix(expression));
return info;
}
@@ -1617,7 +1659,7 @@ public class HighlightUtil {
String description = JavaErrorMessages.message("switch.colon.expected.after.case.label");
CharSequence chars = statement.getContainingFile().getViewProvider().getContents();
boolean isAfterEndOfLine = end >= chars.length() || chars.charAt(start) == '\n' || chars.charAt(start) == '\r';
- return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, null,start, end, description, description,isAfterEndOfLine, null);
+ return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, null, start, end, description, description, isAfterEndOfLine, null);
}
return null;
}
@@ -1709,10 +1751,10 @@ public class HighlightUtil {
if (((PsiMethod)typeOwner).getReturnTypeElement() == parent) 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)) {
+ 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 JavaCodeFragment) {
@@ -1733,7 +1775,9 @@ public class HighlightUtil {
// redirected ctr
if (PsiKeyword.THIS.equals(((PsiJavaCodeReferenceElement)expression).getReferenceName())
&& resolved instanceof PsiMethod
- && ((PsiMethod)resolved).isConstructor()) return null;
+ && ((PsiMethod)resolved).isConstructor()) {
+ return null;
+ }
PsiElement qualifier = ((PsiJavaCodeReferenceElement)expression).getQualifier();
type = qualifier instanceof PsiExpression ? ((PsiExpression)qualifier).getType() : null;
referencedClass = PsiUtil.resolveClassInType(type);
@@ -1785,7 +1829,7 @@ public class HighlightUtil {
resolvedName = qualifier.getText();
}
}
- else if (PsiKeyword.THIS.equals(name)) {
+ else if (PsiKeyword.THIS.equals(name)) {
resolvedName = PsiKeyword.THIS;
}
else {
@@ -1891,11 +1935,11 @@ public class HighlightUtil {
PsiMethod[] constructors = aClass.getConstructors();
if (constructors.length == 0) {
TextRange range = HighlightNamesUtil.getClassDeclarationTextRange(aClass);
- return createMemberReferencedError(aClass.getName()+".this", range);
+ return createMemberReferencedError(aClass.getName() + ".this", range);
}
for (PsiMethod constructor : constructors) {
if (!isSuperCalledInConstructor(constructor)) {
- return createMemberReferencedError(aClass.getName()+".this", HighlightNamesUtil.getMethodDeclarationTextRange(constructor));
+ return createMemberReferencedError(aClass.getName() + ".this", HighlightNamesUtil.getMethodDeclarationTextRange(constructor));
}
}
return null;
@@ -1908,12 +1952,12 @@ public class HighlightUtil {
if (statements.length == 0) return false;
final PsiStatement statement = statements[0];
final PsiElement element = new PsiMatcherImpl(statement)
- .dot(PsiMatchers.hasClass(PsiExpressionStatement.class))
- .firstChild(PsiMatchers.hasClass(PsiMethodCallExpression.class))
- .firstChild(PsiMatchers.hasClass(PsiReferenceExpression.class))
- .firstChild(PsiMatchers.hasClass(PsiKeyword.class))
- .dot(PsiMatchers.hasText(PsiKeyword.SUPER))
- .getElement();
+ .dot(PsiMatchers.hasClass(PsiExpressionStatement.class))
+ .firstChild(PsiMatchers.hasClass(PsiMethodCallExpression.class))
+ .firstChild(PsiMatchers.hasClass(PsiReferenceExpression.class))
+ .firstChild(PsiMatchers.hasClass(PsiKeyword.class))
+ .dot(PsiMatchers.hasText(PsiKeyword.SUPER))
+ .getElement();
return element != null;
}
@@ -1923,10 +1967,12 @@ public class HighlightUtil {
PsiReferenceExpression methodExpression = ((PsiMethodCallExpression)element).getMethodExpression();
return methodExpression.getReferenceName();
}
+
public static boolean isSuperOrThisMethodCall(PsiElement element) {
String name = getMethodExpressionName(element);
return PsiKeyword.SUPER.equals(name) || PsiKeyword.THIS.equals(name);
}
+
public static boolean isSuperMethodCall(PsiElement element) {
String name = getMethodExpressionName(element);
return PsiKeyword.SUPER.equals(name);
@@ -2362,7 +2408,8 @@ public class HighlightUtil {
}
if ((resolved instanceof PsiLocalVariable || resolved instanceof PsiParameter) && !(resolved instanceof ImplicitVariable)) {
highlightInfo = HighlightControlFlowUtil.checkVariableMustBeFinal((PsiVariable)resolved, ref);
- } else if (resolved instanceof PsiClass) {
+ }
+ else if (resolved instanceof PsiClass) {
if (Comparing.strEqual(((PsiClass)resolved).getQualifiedName(), ((PsiClass)resolved).getName())) {
final PsiElement parent = ref.getParent();
if (parent instanceof PsiImportStaticReferenceElement || parent instanceof PsiImportStatementBase) {
@@ -2391,8 +2438,8 @@ public class HighlightUtil {
@Nullable
public static HighlightInfo checkElementInReferenceList(PsiJavaCodeReferenceElement ref,
- PsiReferenceList referenceList,
- JavaResolveResult resolveResult) {
+ PsiReferenceList referenceList,
+ JavaResolveResult resolveResult) {
PsiElement resolved = resolveResult.getElement();
HighlightInfo highlightInfo = null;
PsiElement refGrandParent = referenceList.getParent();
@@ -2478,9 +2525,12 @@ public class HighlightUtil {
STATIC_IMPORTS(LanguageLevel.JDK_1_5, "feature.static.imports"),
FOR_EACH(LanguageLevel.JDK_1_5, "feature.for.each"),
VARARGS(LanguageLevel.JDK_1_5, "feature.varargs"),
+ HEX_FP_LITERALS(LanguageLevel.JDK_1_5, "feature.hex.fp.literals"),
DIAMOND_TYPES(LanguageLevel.JDK_1_7, "feature.diamond.types"),
MULTI_CATCH(LanguageLevel.JDK_1_7, "feature.multi.catch"),
TRY_WITH_RESOURCES(LanguageLevel.JDK_1_7, "feature.try.with.resources"),
+ BIN_LITERALS(LanguageLevel.JDK_1_7, "feature.binary.literals"),
+ UNDERSCORES(LanguageLevel.JDK_1_7, "feature.underscores.in.literals"),
EXTENSION_METHODS(LanguageLevel.JDK_1_8, "feature.extension.methods");
private final LanguageLevel level;
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 4de3dad216db..23d6ccbfc79b 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
@@ -79,7 +79,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
}
}
};
-
+
public HighlightVisitorImpl(@NotNull PsiResolveHelper resolveHelper) {
myResolveHelper = resolveHelper;
}
@@ -93,7 +93,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
@Override
public int order() {
return 0;
- }
+ }
@Override
public boolean suitableForFile(@NotNull PsiFile file) {
@@ -324,22 +324,20 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
@Override public void visitExpression(PsiExpression expression) {
ProgressManager.checkCanceled(); // visitLiteralExpression is invoked very often in array initializers
-
+
super.visitExpression(expression);
PsiType type = expression.getType();
if (myHolder.add(HighlightUtil.checkMustBeBoolean(expression, type))) return;
- PsiExpression indexExpression;
- if (expression instanceof PsiArrayAccessExpression
- && (indexExpression = ((PsiArrayAccessExpression)expression).getIndexExpression()) != null) {
- PsiExpression arrayExpression = ((PsiArrayAccessExpression)expression).getArrayExpression();
- myHolder.add(HighlightUtil.checkValidArrayAccessExpression(arrayExpression, indexExpression, indexExpression.getType()));
+ if(expression instanceof PsiArrayAccessExpression) {
+ myHolder.add(HighlightUtil.checkValidArrayAccessExpression((PsiArrayAccessExpression)expression));
}
+
if (expression.getParent() instanceof PsiNewExpression
&& ((PsiNewExpression)expression.getParent()).getQualifier() != expression
&& ((PsiNewExpression)expression.getParent()).getArrayInitializer() != expression) {
// like in 'new String["s"]'
- myHolder.add(HighlightUtil.checkValidArrayAccessExpression(null, expression, type));
+ myHolder.add(HighlightUtil.checkAssignability(PsiType.INT, expression.getType(), expression, expression));
}
if (!myHolder.hasErrorResults()) myHolder.add(HighlightControlFlowUtil.checkCannotWriteToFinal(expression));
if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkVariableExpected(expression));
@@ -900,7 +898,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
if (!(parent instanceof PsiTypeParameter)) {
myHolder.add(AnnotationsHighlightUtil.checkAnnotationDeclaration(parent, list));
if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkExtendsAllowed(list));
- if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkImplementsAllowed(list));
+ if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkImplementsAllowed(list));
if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkClassExtendsOnlyOneClass(list));
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkGenericCannotExtendException(list));
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithListAccessFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithListAccessFix.java
new file mode 100644
index 000000000000..4a73cb1daf69
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithListAccessFix.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.daemon.impl.quickfix;
+
+import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.codeInsight.daemon.QuickFixBundle;
+import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.util.TypeConversionUtil;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author Danila Ponomarenko
+ */
+public class ReplaceWithListAccessFix implements IntentionAction {
+ private PsiArrayAccessExpression myArrayAccessExpression;
+
+ public ReplaceWithListAccessFix(PsiArrayAccessExpression arrayAccessExpression) {
+ myArrayAccessExpression = arrayAccessExpression;
+ }
+
+ @NotNull
+ @Override
+ public String getText() {
+ return QuickFixBundle.message("replace.with.list.access.text");
+ }
+
+ @NotNull
+ @Override
+ public String getFamilyName() {
+ return getText();
+ }
+
+ @Override
+ public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
+ if (!myArrayAccessExpression.isValid()) return false;
+ if (!TypeConversionUtil.areTypesAssignmentCompatible(PsiType.INT, myArrayAccessExpression.getIndexExpression())) {
+ return false;
+ }
+ final PsiElement parent = myArrayAccessExpression.getParent();
+ if (parent instanceof PsiAssignmentExpression) {
+ final PsiExpression lExpression = ((PsiAssignmentExpression)parent).getLExpression();
+ if (lExpression.equals(myArrayAccessExpression) && !(parent.getParent() instanceof PsiExpressionStatement)) {
+ return false;
+ }
+ }
+
+ final PsiExpression arrayExpression = myArrayAccessExpression.getArrayExpression();
+ final PsiType type = arrayExpression.getType();
+ final PsiType listType = createUtilListType(project);
+
+ if (type == null || listType == null) return false;
+
+
+ return listType.isAssignableFrom(type);
+ }
+
+ @Nullable
+ private PsiType createUtilListType(@NotNull Project project) {
+ final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
+ final PsiClass listClass = JavaPsiFacade.getInstance(project).findClass(CommonClassNames.JAVA_UTIL_LIST, myArrayAccessExpression.getResolveScope());
+
+ if (listClass == null) return null;
+
+ final PsiElementFactory factory = facade.getElementFactory();
+ return factory.createType(listClass);
+ }
+
+ @Override
+ public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
+ if (!CodeInsightUtilBase.prepareFileForWrite(file)) return;
+ final PsiExpression arrayExpression = myArrayAccessExpression.getArrayExpression();
+ final PsiExpression indexExpression = myArrayAccessExpression.getIndexExpression();
+
+ if (indexExpression == null) return;
+
+ final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
+ final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);
+
+ final PsiElement parent = myArrayAccessExpression.getParent();
+ if (parent instanceof PsiAssignmentExpression) {
+ final PsiAssignmentExpression assignmentExpression = (PsiAssignmentExpression)parent;
+
+ final PsiExpression lExpression = assignmentExpression.getLExpression();
+ final PsiExpression rExpression = assignmentExpression.getRExpression();
+ if (lExpression.equals(myArrayAccessExpression) && parent.getParent() instanceof PsiExpressionStatement && rExpression != null) {
+ replaceWithSet(factory, codeStyleManager, arrayExpression, indexExpression, rExpression, assignmentExpression);
+ return;
+ }
+ }
+ replaceWithGet(factory, codeStyleManager, arrayExpression, indexExpression, myArrayAccessExpression);
+ }
+
+ @NotNull
+ private static PsiElement replaceWithGet(@NotNull PsiElementFactory factory,
+ @NotNull CodeStyleManager codeStyleManager,
+ @NotNull PsiExpression arrayExpression,
+ @NotNull PsiExpression indexExpression,
+ @NotNull PsiElement anchor) {
+
+ final PsiElement listAccess = factory.createExpressionFromText(
+ arrayExpression.getText() + ".get(" + indexExpression.getText() + ")",
+ anchor);
+ return anchor.replace(codeStyleManager.reformat(listAccess));
+ }
+
+ private static PsiElement replaceWithSet(@NotNull PsiElementFactory factory,
+ @NotNull CodeStyleManager codeStyleManager,
+ @NotNull PsiExpression arrayExpression,
+ @NotNull PsiExpression indexExpression,
+ @NotNull PsiExpression expression,
+ @NotNull PsiElement anchor) {
+ final PsiElement listAccess = factory.createExpressionFromText(
+ arrayExpression.getText() + ".set(" + indexExpression.getText() + "," + expression.getText() + ")",
+ anchor
+ );
+ return anchor.replace(codeStyleManager.reformat(listAccess));
+ }
+
+ @Override
+ public boolean startInWriteAction() {
+ return true;
+ }
+}
diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
index e183c5d8e9da..38c51a4acc66 100644
--- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
+++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java
@@ -267,7 +267,7 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar
PsiCodeBlock body = method.getBody();
if (body == null) return false;
PsiStatement[] statements = body.getStatements();
- if (statements.length != 1) return false;
+ if (statements.length == 0) return false;
PsiStatement statement = statements[0];
if (PropertyUtil.isSimplePropertyGetter(method)) {
if (statement instanceof PsiReturnStatement) {
@@ -275,6 +275,7 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar
}
}
else if (PropertyUtil.isSimplePropertySetter(method)) {
+ if (statements.length > 1 && !(statements[1] instanceof PsiReturnStatement)) return false;
if (statement instanceof PsiExpressionStatement) {
PsiExpression expr = ((PsiExpressionStatement)statement).getExpression();
if (expr instanceof PsiAssignmentExpression) {
@@ -651,7 +652,7 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar
return psiParameter.getName();
}
}, ", ");
- @NonNls final String lambdas = "{" + params + " =>";
+ @NonNls final String lambdas = "#{" + params + " ->";
final int closureStart = expression.getTextRange().getStartOffset();
final int closureEnd = expression.getTextRange().getEndOffset();
diff --git a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
index 6a52ec171673..3a4b690af4e5 100644
--- a/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java
@@ -263,7 +263,7 @@ public class OverrideImplementUtil {
}
if (results.isEmpty()) {
PsiMethod method1 = GenerateMembersUtil.substituteGenericMethod(method, substitutor, aClass);
-
+
PsiElementFactory factory = JavaPsiFacade.getInstance(method.getProject()).getElementFactory();
PsiMethod result = (PsiMethod)factory.createClass("Dummy").add(method1);
if (result instanceof PsiAnnotationMethod) {
@@ -304,6 +304,20 @@ public class OverrideImplementUtil {
}
}
+ //method type params are not allowed when overriding from raw type
+ final PsiTypeParameterList list = result.getTypeParameterList();
+ if (list != null) {
+ final PsiClass containingClass = method.getContainingClass();
+ if (containingClass != null) {
+ for (PsiClassType classType : aClass.getSuperTypes()) {
+ if (InheritanceUtil.isInheritorOrSelf(PsiUtil.resolveClassInType(classType), containingClass, true) && classType.isRaw()) {
+ list.replace(JavaPsiFacade.getElementFactory(aClass.getProject()).createTypeParameterList());
+ break;
+ }
+ }
+ }
+ }
+
annotateOnOverrideImplement(result, aClass, method, insertOverrideIfPossible);
if (CodeStyleSettingsManager.getSettings(aClass.getProject()).REPEAT_SYNCHRONIZED && method.hasModifierProperty(PsiModifier.SYNCHRONIZED)) {
@@ -523,6 +537,7 @@ public class OverrideImplementUtil {
final List selectedElements = chooser.getSelectedElements();
if (selectedElements == null || selectedElements.isEmpty()) return;
+ LOG.assertTrue(aClass.isValid());
new WriteCommandAction(project, aClass.getContainingFile()) {
protected void run(final Result result) throws Throwable {
overrideOrImplementMethodsInRightPlace(editor, aClass, selectedElements, chooser.isCopyJavadoc(), chooser.isInsertOverrideAnnotation());
diff --git a/java/java-impl/src/com/intellij/codeInspection/MoveToPackageFix.java b/java/java-impl/src/com/intellij/codeInspection/MoveToPackageFix.java
index ae00ea8e45e3..6fd29c5cacb5 100644
--- a/java/java-impl/src/com/intellij/codeInspection/MoveToPackageFix.java
+++ b/java/java-impl/src/com/intellij/codeInspection/MoveToPackageFix.java
@@ -86,7 +86,7 @@ public class MoveToPackageFix implements LocalQuickFix {
}
new MoveClassesOrPackagesProcessor(
project,
- new PsiElement[]{((PsiJavaFile) myFile).getClasses()[0]},
+ ((PsiJavaFile) myFile).getClasses(),
new SingleSourceRootMoveDestination(PackageWrapper.create(JavaDirectoryService.getInstance().getPackage(directory)), directory), false,
false,
null).run();
diff --git a/java/java-impl/src/com/intellij/codeInspection/ReplaceWithTernaryOperatorFix.java b/java/java-impl/src/com/intellij/codeInspection/ReplaceWithTernaryOperatorFix.java
new file mode 100644
index 000000000000..d08ba72cc81f
--- /dev/null
+++ b/java/java-impl/src/com/intellij/codeInspection/ReplaceWithTernaryOperatorFix.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.codeInsight.CodeInsightUtilBase;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.ScrollType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.psi.util.PsiTypesUtil;
+import com.intellij.psi.util.PsiUtilBase;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Danila Ponomarenko
+ */
+public class ReplaceWithTernaryOperatorFix implements LocalQuickFix {
+ private final String myText;
+
+ @NotNull
+ public String getName() {
+ return InspectionsBundle.message("inspection.replace.ternary.quickfix", myText);
+ }
+
+ public ReplaceWithTernaryOperatorFix(@NotNull PsiExpression expressionToAssert) {
+ myText = expressionToAssert.getText();
+ }
+
+ @NotNull
+ @Override
+ public String getFamilyName() {
+ return InspectionsBundle.message("inspection.surround.if.family");
+ }
+
+ @Override
+ public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
+ final PsiElement element = descriptor.getPsiElement();
+ if (!(element instanceof PsiExpression)) {
+ return;
+ }
+ final PsiExpression expression = (PsiExpression)element;
+
+ final PsiFile file = expression.getContainingFile();
+ if (!CodeInsightUtilBase.prepareFileForWrite(file)) return;
+ final PsiConditionalExpression conditionalExpression = replaceWthConditionalExpression(project, myText + "!=null", expression, suggestDefaultValue(expression));
+
+ final PsiExpression elseExpression = conditionalExpression.getElseExpression();
+ if (elseExpression != null) {
+ selectInEditor(elseExpression);
+ }
+ }
+
+ private static void selectInEditor(@NotNull PsiElement element) {
+ final Editor editor = PsiUtilBase.findEditor(element);
+ if (editor == null) return;
+
+ final TextRange expressionRange = element.getTextRange();
+ editor.getCaretModel().moveToOffset(expressionRange.getStartOffset());
+ editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
+ editor.getSelectionModel().setSelection(expressionRange.getStartOffset(), expressionRange.getEndOffset());
+ }
+
+ @NotNull
+ private static PsiConditionalExpression replaceWthConditionalExpression(@NotNull Project project,
+ @NotNull String condition,
+ @NotNull PsiExpression expression,
+ @NotNull String defaultValue) {
+ final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
+
+ final PsiElement parent = expression.getParent();
+ final PsiConditionalExpression conditionalExpression = (PsiConditionalExpression)factory.createExpressionFromText(
+ condition + " ? " + expression.getText() + " : " + defaultValue,
+ parent
+ );
+
+ final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);
+ return (PsiConditionalExpression)expression.replace( codeStyleManager.reformat(conditionalExpression));
+ }
+
+ public static boolean isAvailable(@NotNull PsiExpression qualifier, @NotNull PsiExpression expression) {
+ if (!qualifier.isValid() || qualifier.getText() == null) {
+ return false;
+ }
+
+ return !(expression.getParent() instanceof PsiExpressionStatement);
+ }
+
+ private static String suggestDefaultValue(@NotNull PsiExpression expression) {
+ PsiType type = expression.getType();
+ return PsiTypesUtil.getDefaultValueOfType(type);
+ }
+}
diff --git a/java/java-impl/src/com/intellij/codeInspection/SurroundWithIfFix.java b/java/java-impl/src/com/intellij/codeInspection/SurroundWithIfFix.java
index a6fb64d92833..3b651f71ee9a 100644
--- a/java/java-impl/src/com/intellij/codeInspection/SurroundWithIfFix.java
+++ b/java/java-impl/src/com/intellij/codeInspection/SurroundWithIfFix.java
@@ -81,8 +81,8 @@ public class SurroundWithIfFix implements LocalQuickFix {
return InspectionsBundle.message("inspection.surround.if.family");
}
- public boolean isAvailable(PsiExpression qualifier) {
- if (!qualifier.isValid() || myText == null) {
+ public static boolean isAvailable(PsiExpression qualifier) {
+ if (!qualifier.isValid() || qualifier.getText() == null) {
return false;
}
PsiStatement statement = PsiTreeUtil.getParentOfType(qualifier, PsiStatement.class);
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
index 94e67278a58f..c6c6095a2a1b 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/DataFlowInspection.java
@@ -68,20 +68,28 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
return new OptionsPanel();
}
+ void test(@NotNull List l) {
+ final List list = null;
+ test(list);
+ }
+
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new JavaElementVisitor() {
- @Override public void visitField(PsiField field) {
+ @Override
+ public void visitField(PsiField field) {
if (isNullLiteralExpression(field.getInitializer()) && NullableNotNullManager.isNotNull(field)) {
holder.registerProblem(field.getInitializer(), InspectionsBundle.message("dataflow.message.initializing.field.with.null"));
}
}
- @Override public void visitMethod(PsiMethod method) {
+ @Override
+ public void visitMethod(PsiMethod method) {
analyzeCodeBlock(method.getBody(), holder);
}
- @Override public void visitClassInitializer(PsiClassInitializer initializer) {
+ @Override
+ public void visitClassInitializer(PsiClassInitializer initializer) {
analyzeCodeBlock(initializer.getBody(), holder);
}
};
@@ -109,35 +117,38 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
}
@Nullable
- private static LocalQuickFix[] createNPEFixes(PsiExpression qualifier) {
- if (qualifier != null &&
- !(qualifier instanceof PsiMethodCallExpression) &&
- !(qualifier instanceof PsiLiteralExpression && ((PsiLiteralExpression)qualifier).getValue() == null)) {
- try {
- PsiBinaryExpression binary = (PsiBinaryExpression)JavaPsiFacade.getInstance(qualifier.getProject()).getElementFactory()
- .createExpressionFromText("a != null", null);
- binary.getLOperand().replace(qualifier);
- List fixes = new SmartList();
+ private static LocalQuickFix[] createNPEFixes(PsiExpression qualifier, PsiExpression expression) {
+ if (qualifier == null || expression == null) return null;
+ if (qualifier instanceof PsiMethodCallExpression) return null;
+ if (qualifier instanceof PsiLiteralExpression && ((PsiLiteralExpression)qualifier).getValue() == null) return null;
- if (PsiUtil.getLanguageLevel(qualifier).isAtLeast(LanguageLevel.JDK_1_4)) {
- fixes.add(new AddAssertStatementFix(binary));
- }
- SurroundWithIfFix ifFix = new SurroundWithIfFix(qualifier);
- if (ifFix.isAvailable(qualifier)) {
- fixes.add(ifFix);
- }
- return fixes.toArray(new LocalQuickFix[fixes.size()]);
+ try {
+ final List fixes = new SmartList();
+
+ if (PsiUtil.getLanguageLevel(qualifier).isAtLeast(LanguageLevel.JDK_1_4)) {
+ final Project project = qualifier.getProject();
+ final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
+ final PsiBinaryExpression binary = (PsiBinaryExpression)elementFactory.createExpressionFromText("a != null", null);
+ binary.getLOperand().replace(qualifier);
+ fixes.add(new AddAssertStatementFix(binary));
}
- catch (IncorrectOperationException e) {
- LOG.error(e);
- return null;
+
+ if (SurroundWithIfFix.isAvailable(qualifier)) {
+ fixes.add(new SurroundWithIfFix(qualifier));
}
+ if (ReplaceWithTernaryOperatorFix.isAvailable(qualifier, expression)) {
+ fixes.add(new ReplaceWithTernaryOperatorFix(qualifier));
+ }
+ return fixes.toArray(new LocalQuickFix[fixes.size()]);
+ }
+ catch (IncorrectOperationException e) {
+ LOG.error(e);
+ return null;
}
- return null;
}
private void createDescription(StandardDataFlowRunner runner, ProblemsHolder holder, StandardInstructionVisitor visitor) {
- Pair,Set> constConditions = runner.getConstConditionalExpressions();
+ Pair, Set> constConditions = runner.getConstConditionalExpressions();
Set trueSet = constConditions.getFirst();
Set falseSet = constConditions.getSecond();
Set npeSet = runner.getNPEInstructions();
@@ -164,7 +175,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
MethodCallInstruction mcInstruction = (MethodCallInstruction)instruction;
if (mcInstruction.getCallExpression() instanceof PsiMethodCallExpression) {
PsiMethodCallExpression callExpression = (PsiMethodCallExpression)mcInstruction.getCallExpression();
- LocalQuickFix[] fix = createNPEFixes(callExpression.getMethodExpression().getQualifierExpression());
+ LocalQuickFix[] fix = createNPEFixes(callExpression.getMethodExpression().getQualifierExpression(), callExpression);
holder.registerProblem(callExpression,
InspectionsBundle.message("dataflow.message.npe.method.invocation"),
@@ -176,13 +187,13 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
PsiElement elementToAssert = frInstruction.getElementToAssert();
PsiExpression expression = frInstruction.getExpression();
if (expression instanceof PsiArrayAccessExpression) {
- LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert);
+ LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert, expression);
holder.registerProblem(expression,
InspectionsBundle.message("dataflow.message.npe.array.access"),
fix);
}
else {
- LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert);
+ LocalQuickFix[] fix = createNPEFixes((PsiExpression)elementToAssert, expression);
holder.registerProblem(elementToAssert,
InspectionsBundle.message("dataflow.message.npe.field.access"),
fix);
@@ -207,7 +218,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, true);
holder.registerProblem(psiAnchor,
InspectionsBundle.message(underBinary ? "dataflow.message.constant.condition.whenriched" : "dataflow.message.constant.condition", Boolean.toString(true)),
- localQuickFix==null?null:new LocalQuickFix[]{localQuickFix});
+ localQuickFix == null ? null : new LocalQuickFix[]{localQuickFix});
}
}
else if (psiAnchor instanceof PsiSwitchLabelStatement) {
@@ -228,7 +239,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue);
holder.registerProblem(psiAnchor, InspectionsBundle.message(underBinary ? "dataflow.message.constant.condition.whenriched" : "dataflow.message.constant.condition",
Boolean.toString(evaluatesToTrue)),
- localQuickFix == null ? null : new LocalQuickFix[]{localQuickFix});
+ localQuickFix == null ? null : new LocalQuickFix[]{localQuickFix});
}
}
reportedAnchors.add(psiAnchor);
@@ -241,15 +252,15 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
final String text = isNullLiteralExpression(expr)
? InspectionsBundle.message("dataflow.message.passing.null.argument")
: InspectionsBundle.message("dataflow.message.passing.nullable.argument");
- LocalQuickFix[] fixes = createNPEFixes(expr);
+ LocalQuickFix[] fixes = createNPEFixes(expr, expr);
holder.registerProblem(expr, text, fixes);
}
exprs = runner.getNullableAssignments();
for (PsiExpression expr : exprs) {
final String text = isNullLiteralExpression(expr)
- ? InspectionsBundle.message("dataflow.message.assigning.null")
- : InspectionsBundle.message("dataflow.message.assigning.nullable");
+ ? InspectionsBundle.message("dataflow.message.assigning.null")
+ : InspectionsBundle.message("dataflow.message.assigning.nullable");
holder.registerProblem(expr, text);
}
@@ -263,17 +274,16 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
final PsiExpression expr = statement.getReturnValue();
if (runner.isInNotNullMethod()) {
final String text = isNullLiteralExpression(expr)
- ? InspectionsBundle.message("dataflow.message.return.null.from.notnull")
- : InspectionsBundle.message("dataflow.message.return.nullable.from.notnull");
+ ? InspectionsBundle.message("dataflow.message.return.null.from.notnull")
+ : InspectionsBundle.message("dataflow.message.return.nullable.from.notnull");
holder.registerProblem(expr, text);
}
else if (AnnotationUtil.isAnnotatingApplicable(statement)) {
final String text = isNullLiteralExpression(expr)
- ? InspectionsBundle.message("dataflow.message.return.null.from.notnullable")
- : InspectionsBundle.message("dataflow.message.return.nullable.from.notnullable");
+ ? InspectionsBundle.message("dataflow.message.return.null.from.notnullable")
+ : InspectionsBundle.message("dataflow.message.return.nullable.from.notnullable");
final NullableNotNullManager manager = NullableNotNullManager.getInstance(expr.getProject());
- holder.registerProblem(expr, text, new AnnotateMethodFix(manager.getDefaultNullable(), ArrayUtil.toStringArray(manager.getNotNulls())));
-
+ holder.registerProblem(expr, text, new AnnotateMethodFix(manager.getDefaultNullable(), ArrayUtil.toStringArray(manager.getNotNulls())));
}
}
}
@@ -343,7 +353,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
final PsiElement psiElement = descriptor.getPsiElement();
if (psiElement == null) return;
final SimplifyBooleanExpressionFix fix = createIntention(psiElement, value);
- if (fix==null) return;
+ if (fix == null) return;
try {
LOG.assertTrue(psiElement.isValid());
fix.invoke(project, null, psiElement.getContainingFile());
@@ -480,8 +490,8 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
private static class DataFlowInstructionVisitor extends StandardInstructionVisitor {
protected void onAssigningToNotNullableVariable(AssignInstruction instruction, DataFlowRunner runner) {
- ((StandardDataFlowRunner)runner).onAssigningToNotNullableVariable(instruction.getRExpression());
- }
+ ((StandardDataFlowRunner)runner).onAssigningToNotNullableVariable(instruction.getRExpression());
+ }
protected void onNullableReturn(CheckReturnValueInstruction instruction, DataFlowRunner runner) {
((StandardDataFlowRunner)runner).onNullableReturn(instruction.getReturn());
@@ -496,15 +506,15 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
}
protected void onInstructionProducesNPE(MethodCallInstruction instruction, DataFlowRunner runner) {
- ((StandardDataFlowRunner) runner).onInstructionProducesNPE(instruction);
+ ((StandardDataFlowRunner)runner).onInstructionProducesNPE(instruction);
}
protected void onUnboxingNullable(MethodCallInstruction instruction, DataFlowRunner runner) {
- ((StandardDataFlowRunner) runner).onUnboxingNullable(instruction.getContext());
+ ((StandardDataFlowRunner)runner).onUnboxingNullable(instruction.getContext());
}
protected void onPassingNullParameter(DataFlowRunner runner, PsiExpression arg) {
- ((StandardDataFlowRunner) runner).onPassingNullParameter(arg); // Parameters on stack are reverted.
- }
+ ((StandardDataFlowRunner)runner).onPassingNullParameter(arg); // Parameters on stack are reverted.
+ }
}
}
diff --git a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java
index d16b8e0b0bdf..f780b9d10f62 100644
--- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/SuspiciousCollectionsMethodCallsInspection.java
@@ -44,10 +44,10 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
}
private static void setupPatternMethods(PsiManager manager,
- GlobalSearchScope searchScope,
- List patternMethods,
- IntArrayList indices) {
- final PsiClass collectionClass = JavaPsiFacade.getInstance(manager.getProject()).findClass("java.util.Collection", searchScope);
+ GlobalSearchScope searchScope,
+ List patternMethods,
+ IntArrayList indices) {
+ final PsiClass collectionClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(CommonClassNames.JAVA_UTIL_COLLECTION, searchScope);
PsiType[] javaLangObject = {PsiType.getJavaLangObject(manager, searchScope)};
MethodSignature removeSignature = MethodSignatureUtil.createMethodSignature("remove", javaLangObject, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
if (collectionClass != null) {
@@ -58,7 +58,7 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
addMethod(contains, 0, patternMethods, indices);
}
- final PsiClass listClass = JavaPsiFacade.getInstance(manager.getProject()).findClass("java.util.List", searchScope);
+ final PsiClass listClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(CommonClassNames.JAVA_UTIL_LIST, searchScope);
if (listClass != null) {
MethodSignature indexofSignature = MethodSignatureUtil.createMethodSignature("indexOf", javaLangObject, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
PsiMethod indexof = MethodSignatureUtil.findMethodBySignature(listClass, indexofSignature, false);
@@ -68,7 +68,7 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
addMethod(lastindexof, 0, patternMethods, indices);
}
- final PsiClass mapClass = JavaPsiFacade.getInstance(manager.getProject()).findClass("java.util.Map", searchScope);
+ final PsiClass mapClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(CommonClassNames.JAVA_UTIL_MAP, searchScope);
if (mapClass != null) {
PsiMethod remove = MethodSignatureUtil.findMethodBySignature(mapClass, removeSignature, false);
addMethod(remove, 0, patternMethods, indices);
@@ -96,11 +96,13 @@ public class SuspiciousCollectionsMethodCallsInspection extends BaseLocalInspect
final List patternMethods = new ArrayList();
final IntArrayList indices = new IntArrayList();
return new JavaElementVisitor() {
- @Override public void visitReferenceExpression(final PsiReferenceExpression expression) {
+ @Override
+ public void visitReferenceExpression(final PsiReferenceExpression expression) {
visitExpression(expression);
}
- @Override public void visitMethodCallExpression(PsiMethodCallExpression methodCall) {
+ @Override
+ public void visitMethodCallExpression(PsiMethodCallExpression methodCall) {
super.visitMethodCallExpression(methodCall);
final String message = getSuspiciousMethodCallMessage(methodCall, REPORT_CONVERTIBLE_METHOD_CALLS, patternMethods, indices
);
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
index 5529ed6c5332..ede0a8514603 100644
--- a/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
+++ b/java/java-impl/src/com/intellij/lang/java/JavaDocumentationProvider.java
@@ -72,25 +72,26 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
@Override
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
+ String navigateInfo = null;
if (element instanceof PsiClass) {
- return generateClassInfo((PsiClass)element);
+ navigateInfo = generateClassInfo((PsiClass)element);
}
else if (element instanceof PsiMethod) {
- return generateMethodInfo((PsiMethod)element, calcSubstitutor(originalElement));
+ navigateInfo = generateMethodInfo((PsiMethod)element, calcSubstitutor(originalElement));
}
else if (element instanceof PsiField) {
- return generateFieldInfo((PsiField)element, calcSubstitutor(originalElement));
+ navigateInfo = generateFieldInfo((PsiField)element, calcSubstitutor(originalElement));
}
else if (element instanceof PsiVariable) {
- return generateVariableInfo((PsiVariable)element);
+ navigateInfo = generateVariableInfo((PsiVariable)element);
}
else if (element instanceof PsiPackage) {
- return generatePackageInfo((PsiPackage)element);
+ navigateInfo = generatePackageInfo((PsiPackage)element);
}
else if (element instanceof BeanPropertyElement) {
- return generateMethodInfo(((BeanPropertyElement) element).getMethod(), PsiSubstitutor.EMPTY);
+ navigateInfo = generateMethodInfo(((BeanPropertyElement) element).getMethod(), PsiSubstitutor.EMPTY);
}
- return null;
+ return StringUtil.escapeXml(StringUtil.unescapeXml(navigateInfo));
}
private static PsiSubstitutor calcSubstitutor(PsiElement originalElement) {
diff --git a/java/java-impl/src/com/intellij/psi/filters/AnnotationParameterFilter.java b/java/java-impl/src/com/intellij/psi/filters/AnnotationParameterFilter.java
deleted file mode 100644
index b7a6eab9f908..000000000000
--- a/java/java-impl/src/com/intellij/psi/filters/AnnotationParameterFilter.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.psi.filters;
-
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiAnnotationParameterList;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiNameValuePair;
-import com.intellij.util.ReflectionCache;
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @author peter
- */
-public class AnnotationParameterFilter implements ElementFilter{
- private final Class extends PsiElement> myClass;
- @NonNls private final String myParameterName;
- private final String myAnnotationQualifiedName;
-
-
- public AnnotationParameterFilter(final Class extends PsiElement> elementClass,
- final String annotationQualifiedName,
- @NonNls final String parameterName) {
- myAnnotationQualifiedName = annotationQualifiedName;
- myClass = elementClass;
- myParameterName = parameterName;
- }
-
- @Override
- public boolean isAcceptable(Object element, PsiElement context) {
- final PsiElement parent = ((PsiElement)element).getParent();
- if (parent instanceof PsiNameValuePair) {
- final PsiNameValuePair pair = (PsiNameValuePair)parent;
- final String name = pair.getName();
- if (myParameterName.equals(name) || name == null && "value".equals(myParameterName)) {
- final PsiElement psiElement = pair.getParent();
- if (psiElement instanceof PsiAnnotationParameterList) {
- final PsiElement grandParent = psiElement.getParent();
- if (grandParent instanceof PsiAnnotation) {
- if (myAnnotationQualifiedName.equals(((PsiAnnotation)grandParent).getQualifiedName())) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- @Override
- public boolean isClassAcceptable(Class hintClass) {
- return ReflectionCache.isAssignable(myClass, hintClass);
- }
-}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionCompletionConfidence.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionCompletionConfidence.java
index 6b77a6dcb752..35cbc362a0cb 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionCompletionConfidence.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionCompletionConfidence.java
@@ -21,7 +21,6 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.util.ThreeState;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
/**
* @author Konstantin Bulenkov
@@ -35,12 +34,10 @@ public class JavaReflectionCompletionConfidence extends CompletionConfidence {
@NotNull
@Override
- public ThreeState shouldSkipAutopopup(@Nullable PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
- if (contextElement != null) {
- final PsiElement literal = contextElement.getParent();
- if (literal != null && JavaReflectionReferenceContributor.PATTERN.accepts(literal)) {
- return ThreeState.NO;
- }
+ public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
+ final PsiElement literal = contextElement.getParent();
+ if (literal != null && JavaReflectionReferenceContributor.PATTERN.accepts(literal)) {
+ return ThreeState.NO;
}
return super.shouldSkipAutopopup(contextElement, psiFile, offset);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java b/java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
index 7f2f57965d61..d0212624665f 100644
--- a/java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/copy/CopyClassesHandler.java
@@ -318,10 +318,10 @@ public class CopyClassesHandler extends CopyHandlerDelegateBase {
List files = new ArrayList();
for (final Map.Entry entry : fileToClasses.entrySet()) {
final PsiFile psiFile = entry.getKey();
- if (psiFile instanceof PsiClassOwner) {
+ final PsiClass[] sources = entry.getValue();
+ if (psiFile instanceof PsiClassOwner && sources != null) {
final PsiFile createdFile = copy(psiFile, targetDirectory, copyClassName, map == null ? null : map.get(psiFile), choice);
if (createdFile == null) return null;
- final PsiClass[] sources = entry.getValue();
for (final PsiClass destination : ((PsiClassOwner)createdFile).getClasses()) {
if (destination instanceof SyntheticElement) {
continue;
diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java
index 3856c20bb935..c98e6b8da9d4 100644
--- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/InlineSuperClassRefactoringProcessor.java
@@ -40,11 +40,11 @@ import com.intellij.refactoring.util.classMembers.MemberInfoStorage;
import com.intellij.usageView.UsageInfo;
import com.intellij.usageView.UsageViewDescriptor;
import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.Processor;import com.intellij.util.containers.HashMap;
+import com.intellij.util.Processor;
+import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.MultiMap;
import org.jetbrains.annotations.NotNull;
-import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -63,39 +63,16 @@ public class InlineSuperClassRefactoringProcessor extends FixableUsagesRefactori
myTargetClasses = targetClasses;
MemberInfoStorage memberInfoStorage = new MemberInfoStorage(mySuperClass, new MemberInfo.Filter() {
public boolean includeMember(PsiMember element) {
- return true;
+ return !(element instanceof PsiClass) || PsiTreeUtil.isAncestor(mySuperClass, element, true);
}
});
List members = memberInfoStorage.getClassMemberInfos(mySuperClass);
for (MemberInfo member : members) {
member.setChecked(true);
}
- members = appendSuperRefs(members);
myMemberInfos = members.toArray(new MemberInfo[members.size()]);
}
- private List appendSuperRefs(List members) {
- if (!mySuperClass.isInterface()) {
- PsiReferenceList extendsList = mySuperClass.getExtendsList();
- if (extendsList != null && extendsList.getReferenceElements().length > 0) {
- PsiElement resolve = extendsList.getReferenceElements()[0].resolve();
- if (resolve instanceof PsiClass) {
- members = new ArrayList(members);
-
- MemberInfo memberInfo = new MemberInfo((PsiMember)resolve, true, extendsList) {
- {
- overrides = false;
- }
- };
-
- memberInfo.setChecked(true);
- members.add(memberInfo);
- }
- }
- }
- return members;
- }
-
@NotNull
protected UsageViewDescriptor createUsageViewDescriptor(final UsageInfo[] usages) {
return new InlineSuperClassUsageViewDescriptor(mySuperClass);
diff --git a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceExtendsListUsageInfo.java b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceExtendsListUsageInfo.java
index 686950aaba32..f9d28ac491b7 100644
--- a/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceExtendsListUsageInfo.java
+++ b/java/java-impl/src/com/intellij/refactoring/inlineSuperClass/usageInfo/ReplaceExtendsListUsageInfo.java
@@ -21,22 +21,22 @@
package com.intellij.refactoring.inlineSuperClass.usageInfo;
import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiJavaCodeReferenceElement;
+import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteExtendsClassUsageInfo;
import com.intellij.refactoring.util.FixableUsageInfo;
import com.intellij.util.IncorrectOperationException;
public class ReplaceExtendsListUsageInfo extends FixableUsageInfo {
+ private final SafeDeleteExtendsClassUsageInfo mySafeDeleteUsageInfo;
public ReplaceExtendsListUsageInfo(PsiJavaCodeReferenceElement element, final PsiClass superClass, final PsiClass targetClass) {
super(element);
-
+ mySafeDeleteUsageInfo = new SafeDeleteExtendsClassUsageInfo(element, superClass, targetClass);
}
public void fixUsage() throws IncorrectOperationException {
- final PsiElement element = getElement();
- if (element != null) {
- element.delete();
+ if (mySafeDeleteUsageInfo.isSafeDelete()) {
+ mySafeDeleteUsageInfo.deleteElement();
}
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
index ffd8645757fc..102b021103e3 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/InplaceIntroduceFieldPopup.java
@@ -111,7 +111,7 @@ public class InplaceIntroduceFieldPopup extends AbstractInplaceIntroduceFieldPop
final boolean forStatic,
@NotNull final PsiClass parentClass) {
return IntroduceFieldDialog.
- createGenerator(forStatic, localVariable, initializer, localVariable != null, null, parentClass).
+ createGenerator(forStatic, localVariable, initializer, localVariable != null, null, parentClass, parentClass.getProject()).
getSuggestedNameInfo(defaultType);
}
diff --git a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldDialog.java b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldDialog.java
index 7d3ee870175c..0aaad5f3608f 100644
--- a/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/introduceField/IntroduceFieldDialog.java
@@ -180,7 +180,7 @@ class IntroduceFieldDialog extends DialogWrapper {
myNameSuggestionsManager = new NameSuggestionsManager(myTypeSelector, myNameField,
createGenerator(myWillBeDeclaredStatic, myLocalVariable, myInitializerExpression, myIsInvokedOnDeclaration, myEnteredName,
- myParentClass));
+ myParentClass, myProject));
myNameSuggestionsManager.setLabelsFor(type, namePrompt);
return panel;
@@ -203,10 +203,12 @@ class IntroduceFieldDialog extends DialogWrapper {
static NameSuggestionsGenerator createGenerator(final boolean willBeDeclaredStatic,
final PsiLocalVariable localVariable,
final PsiExpression initializerExpression,
- final boolean isInvokedOnDeclaration, @Nullable final String enteredName, final PsiClass parentClass) {
+ final boolean isInvokedOnDeclaration,
+ @Nullable final String enteredName,
+ final PsiClass parentClass,
+ final Project project) {
return new NameSuggestionsGenerator() {
- private final JavaCodeStyleManager myCodeStyleManager = JavaCodeStyleManager.getInstance(localVariable != null ? localVariable.getProject()
- : initializerExpression.getProject());
+ private final JavaCodeStyleManager myCodeStyleManager = JavaCodeStyleManager.getInstance(project);
public SuggestedNameInfo getSuggestedNameInfo(PsiType type) {
VariableKind variableKind = willBeDeclaredStatic ? VariableKind.STATIC_FIELD : VariableKind.FIELD;
diff --git a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java
index cadb5c34b01a..38f3fe4e2e08 100644
--- a/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java
+++ b/java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassesOrPackagesUtil.java
@@ -231,7 +231,7 @@ public class MoveClassesOrPackagesUtil {
if (!moveDestination.equals(file.getContainingDirectory())) {
LOG.assertTrue(file.getVirtualFile() != null, aClass);
MoveFilesOrDirectoriesUtil.doMoveFile(file, moveDestination);
- if (file instanceof PsiClassOwner && newPackage != null) {
+ if (file instanceof PsiClassOwner && newPackage != null && !JspPsiUtil.isInJspFile(file)) {
((PsiClassOwner)file).setPackageName(newPackage.getQualifiedName());
}
}
diff --git a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java
index b4700ee9a8d2..4b440d6a26dc 100644
--- a/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/typeMigration/TypeMigrationStatementProcessor.java
@@ -59,9 +59,13 @@ class TypeMigrationStatementProcessor extends JavaRecursiveElementVisitor {
final TypeView right = new TypeView(rExpression);
final IElementType sign = expression.getOperationTokenType();
+ final PsiType ltype = left.getType();
+ final PsiType rtype = right.getType();
+ if (ltype == null || rtype == null) return;
+
if (sign != JavaTokenType.EQ) {
final IElementType binaryOperator = TypeConversionUtil.convertEQtoOperation(sign);
- if (!TypeConversionUtil.isBinaryOperatorApplicable(binaryOperator, left.getType(), right.getType(), false)) {
+ if (!TypeConversionUtil.isBinaryOperatorApplicable(binaryOperator, ltype, rtype, false)) {
if (left.isChanged()) {
findConversionOrFail(expression, lExpression, left.getTypePair());
}
@@ -77,11 +81,11 @@ class TypeMigrationStatementProcessor extends JavaRecursiveElementVisitor {
break;
case TypeInfection.LEFT_INFECTED:
- myLabeler.migrateExpressionType(rExpression, left.getType(), myStatement, TypeConversionUtil.isAssignable(left.getType(), right.getType()), true);
+ myLabeler.migrateExpressionType(rExpression, ltype, myStatement, TypeConversionUtil.isAssignable(ltype, rtype), true);
break;
case TypeInfection.RIGHT_INFECTED:
- myLabeler.migrateExpressionType(lExpression, right.getType(), myStatement, TypeConversionUtil.isAssignable(left.getType(), right.getType()), false);
+ myLabeler.migrateExpressionType(lExpression, rtype, myStatement, TypeConversionUtil.isAssignable(ltype, rtype), false);
break;
case TypeInfection.BOTH_INFECTED:
diff --git a/java/java-impl/src/com/intellij/usages/impl/rules/JavaUsageTypeProvider.java b/java/java-impl/src/com/intellij/usages/impl/rules/JavaUsageTypeProvider.java
index addc8c2bc96c..cce007268945 100644
--- a/java/java-impl/src/com/intellij/usages/impl/rules/JavaUsageTypeProvider.java
+++ b/java/java-impl/src/com/intellij/usages/impl/rules/JavaUsageTypeProvider.java
@@ -36,11 +36,11 @@ import java.util.Set;
*/
public class JavaUsageTypeProvider implements UsageTypeProviderEx {
public UsageType getUsageType(final PsiElement element) {
- return getUsageType(element, null);
+ return getUsageType(element, UsageTarget.EMPTY_ARRAY);
}
@Override
- public UsageType getUsageType(PsiElement element, @Nullable UsageTarget[] targets) {
+ public UsageType getUsageType(PsiElement element, @NotNull UsageTarget[] targets) {
UsageType classUsageType = getClassUsageType(element, targets);
if (classUsageType != null) return classUsageType;
@@ -108,8 +108,10 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
}
private static boolean haveCommonSuperMethod(@NotNull PsiMethod m1, @NotNull PsiMethod m2) {
- final Queue supers1Q = new ArrayDeque(); supers1Q.add(m1);
- final Queue supers2Q = new ArrayDeque(); supers2Q.add(m2);
+ final Queue supers1Q = new ArrayDeque();
+ supers1Q.add(m1);
+ final Queue supers2Q = new ArrayDeque();
+ supers2Q.add(m2);
Set supers1 = new THashSet();
Set supers2 = new THashSet();
while (true) {
@@ -138,7 +140,7 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
}
});
}
- if (me1 == null && me2==null) break;
+ if (me1 == null && me2 == null) break;
}
return false;
/*
@@ -154,9 +156,11 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
}
@Nullable
- private static UsageType getClassUsageType(PsiElement element, @Nullable UsageTarget[] targets) {
+ private static UsageType getClassUsageType(@NotNull PsiElement element, @NotNull UsageTarget[] targets) {
if (element.getParent() instanceof PsiAnnotation &&
- element == ((PsiAnnotation)element.getParent()).getNameReferenceElement()) return UsageType.ANNOTATION;
+ element == ((PsiAnnotation)element.getParent()).getNameReferenceElement()) {
+ return UsageType.ANNOTATION;
+ }
if (PsiTreeUtil.getParentOfType(element, PsiImportStatement.class, false) != null) return UsageType.CLASS_IMPORT;
PsiReferenceList referenceList = PsiTreeUtil.getParentOfType(element, PsiReferenceList.class);
@@ -215,12 +219,15 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
final PsiNewExpression psiNewExpression = PsiTreeUtil.getParentOfType(element, PsiNewExpression.class);
if (psiNewExpression != null) {
- final PsiJavaCodeReferenceElement classReference = psiNewExpression.getClassReference();
+ final PsiJavaCodeReferenceElement classReference = psiNewExpression.getClassOrAnonymousClassReference();
if (classReference != null && PsiTreeUtil.isAncestor(classReference, element, false)) {
+ if (isAnonymousClassOf(psiNewExpression.getAnonymousClass(), targets)) {
+ return UsageType.CLASS_ANONYMOUS_NEW_OPERATOR;
+ }
if (isInnerClassOf(classReference, targets)) {
return UsageType.CLASS_INNER_NEW_OPERATOR;
}
- if (psiNewExpression.getArrayDimensions().length > 0) {
+ if (isNewArrayCreation(psiNewExpression)) {
return UsageType.CLASS_NEW_ARRAY;
}
return UsageType.CLASS_NEW_OPERATOR;
@@ -230,20 +237,33 @@ public class JavaUsageTypeProvider implements UsageTypeProviderEx {
return null;
}
- private static boolean isInnerClassOf(PsiJavaCodeReferenceElement classReference, @Nullable UsageTarget[] targets) {
- if (targets == null) {
+ private static boolean isNewArrayCreation(@NotNull PsiNewExpression expression){
+ return expression.getArrayDimensions().length > 0 || expression.getArrayInitializer() != null;
+ }
+
+ private static boolean isAnonymousClassOf(@Nullable PsiAnonymousClass anonymousClass, @NotNull UsageTarget[] targets) {
+ if (anonymousClass == null) {
return false;
}
- PsiElement qualifier = classReference.getQualifier();
+
+ return qualifiesToTargetClasses(anonymousClass.getBaseClassReference(), targets);
+ }
+
+ private static boolean isInnerClassOf(PsiJavaCodeReferenceElement classReference, @NotNull UsageTarget[] targets) {
+ final PsiElement qualifier = classReference.getQualifier();
if (qualifier instanceof PsiJavaCodeReferenceElement) {
- for (UsageTarget target : targets) {
- if (target instanceof PsiElementUsageTarget) {
- PsiElement element = ((PsiElementUsageTarget)target).getElement();
- if (element instanceof PsiClass) {
- String name = target.getName();
- if (Comparing.equal(((PsiJavaCodeReferenceElement)qualifier).getReferenceName(), name)) {
- return true;
- }
+ return qualifiesToTargetClasses((PsiJavaCodeReferenceElement)qualifier, targets);
+ }
+ return false;
+ }
+
+ private static boolean qualifiesToTargetClasses(@NotNull PsiJavaCodeReferenceElement qualifier, @NotNull UsageTarget[] targets) {
+ for (UsageTarget target : targets) {
+ if (target instanceof PsiElementUsageTarget) {
+ PsiElement element = ((PsiElementUsageTarget)target).getElement();
+ if (element instanceof PsiClass) {
+ if (Comparing.equal(qualifier.getReferenceName(), target.getName())) {
+ return true;
}
}
}
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiSuperExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiSuperExpressionImpl.java
index e6637553395f..d50bfcb1a21d 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiSuperExpressionImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiSuperExpressionImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2012 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.
@@ -22,7 +22,10 @@ import com.intellij.psi.impl.source.Constants;
import com.intellij.psi.impl.source.tree.ChildRole;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.ChildRoleBase;
+import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
public class PsiSuperExpressionImpl extends ExpressionPsiElement implements PsiSuperExpression, Constants {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiSuperExpressionImpl");
@@ -38,17 +41,20 @@ public class PsiSuperExpressionImpl extends ExpressionPsiElement implements PsiS
@Override
public PsiType getType() {
- PsiJavaCodeReferenceElement qualifier = getQualifier();
- if (qualifier != null){
+ final PsiJavaCodeReferenceElement qualifier = getQualifier();
+ if (qualifier != null) {
final PsiElement aClass = qualifier.resolve();
- return aClass instanceof PsiClass ? getSuperType((PsiClass)aClass) : null;
+ if (!(aClass instanceof PsiClass)) return null;
+ return getSuperType((PsiClass)aClass, PsiUtil.isLanguageLevel8OrHigher(this));
}
- for(PsiElement scope = getContext(); scope != null; scope = scope.getContext()){
- if (scope instanceof PsiClass){
- PsiClass aClass = (PsiClass)scope;
- return getSuperType(aClass);
+
+ for (PsiElement scope = getContext(); scope != null; scope = scope.getContext()) {
+ if (scope instanceof PsiClass) {
+ final PsiClass aClass = (PsiClass)scope;
+ return getSuperType(aClass, false);
}
- if (scope instanceof PsiExpressionList && scope.getParent() instanceof PsiAnonymousClass){
+ if (scope instanceof PsiExpressionList && scope.getParent() instanceof PsiAnonymousClass) {
+ //noinspection AssignmentToForLoopParameter
scope = scope.getParent();
}
else if (scope instanceof JavaCodeFragment) {
@@ -56,55 +62,56 @@ public class PsiSuperExpressionImpl extends ExpressionPsiElement implements PsiS
if (fragmentSuperType != null) return fragmentSuperType;
}
}
+
return null;
}
- private PsiType getSuperType(PsiClass aClass) {
+ @Nullable
+ private PsiType getSuperType(PsiClass aClass, boolean checkImmediateSuperInterfaces) {
+ if (CommonClassNames.JAVA_LANG_OBJECT.equals(aClass.getQualifiedName())) return null;
+
+ final PsiClass containingClass = checkImmediateSuperInterfaces ? PsiTreeUtil.getParentOfType(this, PsiClass.class) : null;
+ if (containingClass != null) {
+ final PsiClassType[] superTypes;
+ if (containingClass.isInterface()) {
+ superTypes = containingClass.getExtendsListTypes();
+ }
+ else if (containingClass instanceof PsiAnonymousClass) {
+ superTypes = new PsiClassType[]{((PsiAnonymousClass)containingClass).getBaseClassType()};
+ }
+ else {
+ superTypes = containingClass.getImplementsListTypes();
+ }
+
+ for (PsiClassType superType : superTypes) {
+ final PsiClass superClass = superType.resolve();
+ if (superClass != null && superClass.isInterface() && aClass.equals(superClass)) return superType;
+ }
+ }
+
if (aClass.isInterface()) {
- JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
- return facade.getElementFactory().createType(facade.findClass("java.lang.Object", getResolveScope()));
+ return PsiType.getJavaLangObject(getManager(), getResolveScope());
}
if (aClass instanceof PsiAnonymousClass) {
final PsiClassType baseClassType = ((PsiAnonymousClass)aClass).getBaseClassType();
final PsiClass psiClass = baseClassType.resolve();
- if(psiClass != null && !psiClass.isInterface()){
- return baseClassType;
- }
-
- return PsiType.getJavaLangObject(getManager(), getResolveScope());
+ return psiClass != null && !psiClass.isInterface() ? baseClassType : PsiType.getJavaLangObject(getManager(), getResolveScope());
}
- if ("java.lang.Object".equals(aClass.getQualifiedName())) return null;
- PsiClassType[] superTypes = aClass.getExtendsListTypes();
- if (superTypes.length == 0) {
- JavaPsiFacade facade = JavaPsiFacade.getInstance(getProject());
- final PsiClass javaLangObject = facade.findClass("java.lang.Object", getResolveScope());
- if (javaLangObject != null) {
- return facade.getElementFactory().createType(javaLangObject);
- }
- else {
- return null;
- }
- }
-
- return superTypes[0];
+ final PsiClassType[] superTypes = aClass.getExtendsListTypes();
+ return superTypes.length == 0 ? PsiType.getJavaLangObject(getManager(), getResolveScope()) : superTypes[0];
}
@Override
public ASTNode findChildByRole(int role) {
LOG.assertTrue(ChildRole.isUnique(role));
- switch(role){
+ switch (role) {
default:
return null;
case ChildRole.QUALIFIER:
- if (getFirstChildNode().getElementType() == JAVA_CODE_REFERENCE){
- return getFirstChildNode();
- }
- else{
- return null;
- }
+ return getFirstChildNode().getElementType() == JAVA_CODE_REFERENCE ? getFirstChildNode() : null;
case ChildRole.DOT:
return findChildByType(DOT);
diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
index 3aae6ea3712b..51d626aaedbe 100644
--- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties
+++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties
@@ -198,6 +198,7 @@ not.a.statement=Not a 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
+unqualified.super.disallowed=Unqualified super reference is not allowed in extension method
non.static.symbol.referenced.from.static.context=Non-static {0} ''{1}'' cannot be referenced from a static context
private.symbol=''{0}'' has private access in ''{1}''
@@ -272,9 +273,6 @@ unclosed.char.literal=Unclosed character literal
illegal.escape.character.in.string.literal=Illegal escape character in string literal
floating.point.number.too.large=Floating point number too large
floating.point.number.too.small=Floating point number too small
-hex.FP.literals.not.supported=Hexadecimal floating point literals are only supported in JDK 5 or higher
-binary.literals.not.supported=Binary literals are only supported in JDK 7 or higher
-underscores.in.literals.not.supported=Underscores in literals are only supported in JDK 7 or higher
import.statement.identifier.or.asterisk.expected.=Identifier or '*' expected
@@ -348,8 +346,11 @@ feature.annotations=Annotations
feature.static.imports=Static imports
feature.for.each=For-each loops
feature.varargs=Variable arity methods
+feature.hex.fp.literals=Hexadecimal floating point literals
feature.diamond.types=Diamond types
feature.multi.catch=Multi-catches
feature.try.with.resources=Try-with-resources
+feature.binary.literals=Binary literals
+feature.underscores.in.literals=Underscores in literals
feature.extension.methods=Extension methods
insufficient.language.level={0} are not supported at this language level
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters-out.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters-out.java
deleted file mode 100644
index 789404f0e818..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters-out.java
+++ /dev/null
@@ -1,7 +0,0 @@
-
-public class Main {
-
- public static void main() {
- x = (ProceedingJoinPoint extends >
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters.java
deleted file mode 100644
index 8f5880237eb2..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInCastTypeParameters.java
+++ /dev/null
@@ -1,7 +0,0 @@
-
-public class Main {
-
- public static void main() {
- x = (ProceedingJoinPoint ext>
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters-out.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters-out.java
deleted file mode 100644
index 0fae50dd0fcc..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters-out.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class Xxx {
-
-
-
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters.java
deleted file mode 100644
index 3feb13009ce7..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsInMethodParameters.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class Xxx {
-
-
-
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters-out.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters-out.java
deleted file mode 100644
index 26c81ac928a3..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters-out.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class Foo A> {
-
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters.java
deleted file mode 100644
index c90ad3278973..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtendsWithRightContextInClassTypeParameters.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class Foo A> {
-
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally-out.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally-out.java
deleted file mode 100644
index 674fc428c5d9..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally-out.java
+++ /dev/null
@@ -1,12 +0,0 @@
-
-public class Main {
-
- public static void main() {
- try {
-
- } finally {
-
- }
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally.java
deleted file mode 100644
index 81df57df6185..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally.java
+++ /dev/null
@@ -1,12 +0,0 @@
-
-public class Main {
-
- public static void main() {
- try {
-
- } final {
-
- }
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1-out.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1-out.java
deleted file mode 100644
index edb1b9a8e4f9..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1-out.java
+++ /dev/null
@@ -1,12 +0,0 @@
-
-public class Main {
-
- public static void main() {
- try {
-
- } finally {
-
- }
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1.java b/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1.java
deleted file mode 100644
index 1cd4a6d72590..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/ExtraBracketAfterFinally1.java
+++ /dev/null
@@ -1,10 +0,0 @@
-
-public class Main {
-
- public static void main() {
- try {
-
- } final
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInIf-out.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInIf-out.java
deleted file mode 100644
index 9fd613410a95..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInIf-out.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static void main() {
- if (null)
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInIf.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInIf.java
deleted file mode 100644
index 421cf16e078d..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInIf.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static void main() {
- if (nu)
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall.java
deleted file mode 100644
index be803489e216..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class Null {
- public static void main(String[] argv) {
- StringBuffer buf = new StringBuffer();
-
- buf.append(nu);
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2.java
deleted file mode 100644
index 2233039cc872..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class Null {
- public static void main(String[] argv) {
- StringBuffer buf = new StringBuffer();
-
- buf.append(Null.nu);
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2_After.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2_After.java
deleted file mode 100644
index 2233039cc872..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall2_After.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class Null {
- public static void main(String[] argv) {
- StringBuffer buf = new StringBuffer();
-
- buf.append(Null.nu);
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall_After.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall_After.java
deleted file mode 100644
index 46fa66446e35..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInMethodCall_After.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class Null {
- public static void main(String[] argv) {
- StringBuffer buf = new StringBuffer();
-
- buf.append(null);
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn-out.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn-out.java
deleted file mode 100644
index 69f514804340..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn-out.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static Object main() {
- return null
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn.java b/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn.java
deleted file mode 100644
index 503614beb68a..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/NullInReturn.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static Object main() {
- return nu
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration-out.java b/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration-out.java
deleted file mode 100644
index c2f393fad7f6..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration-out.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static void main() {
- boolean b = true
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration.java b/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration.java
deleted file mode 100644
index 13ee5ed52f3b..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/TrueInVariableDeclaration.java
+++ /dev/null
@@ -1,8 +0,0 @@
-
-public class Main {
-
- public static void main() {
- boolean b = tr
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/catch-1.java b/java/java-tests/testData/codeInsight/completion/keywords/catch-1.java
deleted file mode 100644
index ba5ce5703432..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/catch-1.java
+++ /dev/null
@@ -1,8 +0,0 @@
-public class A{
- public void method(){
- try{
- String str = "";
- }
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/catchFinally.java b/java/java-tests/testData/codeInsight/completion/keywords/catchFinally.java
new file mode 100644
index 000000000000..f724d93396b2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/catchFinally.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ try{
+ String str = "";
+ }
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/classScope-4.java b/java/java-tests/testData/codeInsight/completion/keywords/classScope-4.java
deleted file mode 100644
index 0f6c3fdac00e..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/classScope-4.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class A{
-
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/classScope-1.java b/java/java-tests/testData/codeInsight/completion/keywords/classScope1.java
similarity index 100%
rename from java/java-tests/testData/codeInsight/completion/keywords/classScope-1.java
rename to java/java-tests/testData/codeInsight/completion/keywords/classScope1.java
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/classScope-2.java b/java/java-tests/testData/codeInsight/completion/keywords/classScope2.java
similarity index 100%
rename from java/java-tests/testData/codeInsight/completion/keywords/classScope-2.java
rename to java/java-tests/testData/codeInsight/completion/keywords/classScope2.java
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/classScope-3.java b/java/java-tests/testData/codeInsight/completion/keywords/classScope3.java
similarity index 100%
rename from java/java-tests/testData/codeInsight/completion/keywords/classScope-3.java
rename to java/java-tests/testData/codeInsight/completion/keywords/classScope3.java
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/classScope4.java b/java/java-tests/testData/codeInsight/completion/keywords/classScope4.java
new file mode 100644
index 000000000000..24e7bfbbaea6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/classScope4.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod.java b/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod.java
new file mode 100644
index 000000000000..04b2a8a7035f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface Foo {
+ String foo() def
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod_after.java b/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod_after.java
new file mode 100644
index 000000000000..22031018f7bc
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/defaultInExtMethod_after.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface Foo {
+ String foo() default
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-1.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-1.java
deleted file mode 100644
index a928948d81c7..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-1.java
+++ /dev/null
@@ -1 +0,0 @@
-class x3
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-10-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-10-result.java
deleted file mode 100644
index 9a954ae8b337..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-10-result.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class A{
- void >foo(){}
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-10.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-10.java
deleted file mode 100644
index 68da0e944b46..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-10.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class A{
- void >foo(){}
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-11-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-11-result.java
deleted file mode 100644
index 87e818a076c7..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-11-result.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class A{
- void >foo(){}
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-11.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-11.java
deleted file mode 100644
index a8e5fc0e9df5..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-11.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class A{
- void >foo(){}
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-12-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-12-result.java
deleted file mode 100644
index 7127a5250e35..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-12-result.java
+++ /dev/null
@@ -1,5 +0,0 @@
-class A{
- {
- Collection extends >
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-12.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-12.java
deleted file mode 100644
index 2cc23359731c..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-12.java
+++ /dev/null
@@ -1,5 +0,0 @@
-class A{
- {
- Collection ex>
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-2.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-2.java
deleted file mode 100644
index 41399187fe37..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class AAA{}
-
-class BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-3.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-3.java
deleted file mode 100644
index ce7fb1225cdc..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-class AAA{}
-
-interface CCC{}
-
-class BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-4.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-4.java
deleted file mode 100644
index ac0b51bfe351..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-class AAA{}
-
-interface CCC{}
-
-class BBB implements
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-5.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-5.java
deleted file mode 100644
index ca5ec8e7c471..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-5.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class AAA{}
-
-interface BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-6.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-6.java
deleted file mode 100644
index 4308b6710ec4..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-6.java
+++ /dev/null
@@ -1,3 +0,0 @@
-interface AAA{}
-
-interface BBB extends Runnable,
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-7-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-7-result.java
deleted file mode 100644
index e768367d0430..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-7-result.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class AAA{}
-
-class BBB extends AAA implements
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-7.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-7.java
deleted file mode 100644
index 20b561ac6ce6..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-7.java
+++ /dev/null
@@ -1,3 +0,0 @@
-class AAA{}
-
-class BBB extends AAA i
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-8-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-8-result.java
deleted file mode 100644
index 46fe4caea6dc..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-8-result.java
+++ /dev/null
@@ -1,4 +0,0 @@
-class AAA{}
-
-class BBB extends AAA implements {
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-8.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-8.java
deleted file mode 100644
index 80dbed368970..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-8.java
+++ /dev/null
@@ -1,4 +0,0 @@
-class AAA{}
-
-class BBB extends AAA i {
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-9-result.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-9-result.java
deleted file mode 100644
index 0a95953cba7d..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-9-result.java
+++ /dev/null
@@ -1 +0,0 @@
-interface AAAA extends
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends-9.java b/java/java-tests/testData/codeInsight/completion/keywords/extends-9.java
deleted file mode 100644
index bd85a41f7537..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/extends-9.java
+++ /dev/null
@@ -1 +0,0 @@
-interface AAAA e
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends1.java b/java/java-tests/testData/codeInsight/completion/keywords/extends1.java
new file mode 100644
index 000000000000..f3a5b845b5e5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends1.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class x3
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends10.java b/java/java-tests/testData/codeInsight/completion/keywords/extends10.java
new file mode 100644
index 000000000000..3e32612445b9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends10.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ void >foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends10_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends10_after.java
new file mode 100644
index 000000000000..ad63c3ba7526
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends10_after.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ void >foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends11.java b/java/java-tests/testData/codeInsight/completion/keywords/extends11.java
new file mode 100644
index 000000000000..a7cd5d64107c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends11.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ void >foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends11_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends11_after.java
new file mode 100644
index 000000000000..201aa5f1bd61
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends11_after.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ void >foo(){}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends12.java b/java/java-tests/testData/codeInsight/completion/keywords/extends12.java
new file mode 100644
index 000000000000..880b0ebb132a
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends12.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ {
+ Collection ex>
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends12_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends12_after.java
new file mode 100644
index 000000000000..7cf4bae3bd8c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends12_after.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ {
+ Collection extends >
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends2.java b/java/java-tests/testData/codeInsight/completion/keywords/extends2.java
new file mode 100644
index 000000000000..e00ac4c968aa
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends2.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+class BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends3.java b/java/java-tests/testData/codeInsight/completion/keywords/extends3.java
new file mode 100644
index 000000000000..00e012ba9122
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends3.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+interface CCC{}
+
+class BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends4.java b/java/java-tests/testData/codeInsight/completion/keywords/extends4.java
new file mode 100644
index 000000000000..0e7697bab3d7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends4.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+interface CCC{}
+
+class BBB implements
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends5.java b/java/java-tests/testData/codeInsight/completion/keywords/extends5.java
new file mode 100644
index 000000000000..cfec9d75e436
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends5.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+interface BBB extends
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends6.java b/java/java-tests/testData/codeInsight/completion/keywords/extends6.java
new file mode 100644
index 000000000000..cfffdb15a989
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends6.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface AAA{}
+
+interface BBB extends Runnable,
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends7.java b/java/java-tests/testData/codeInsight/completion/keywords/extends7.java
new file mode 100644
index 000000000000..3fb696c697b6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends7.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+class BBB extends AAA i
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends7_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends7_after.java
new file mode 100644
index 000000000000..3788648411f3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends7_after.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+class BBB extends AAA implements
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends8.java b/java/java-tests/testData/codeInsight/completion/keywords/extends8.java
new file mode 100644
index 000000000000..867fef89c73e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends8.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+class BBB extends AAA i {
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends8_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends8_after.java
new file mode 100644
index 000000000000..ea7a94e5fbd8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends8_after.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class AAA{}
+
+class BBB extends AAA implements {
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends9.java b/java/java-tests/testData/codeInsight/completion/keywords/extends9.java
new file mode 100644
index 000000000000..37cf1f210eb9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends9.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface AAAA e
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extends9_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extends9_after.java
new file mode 100644
index 000000000000..71f1777543af
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extends9_after.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface AAAA extends
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters.java
new file mode 100644
index 000000000000..78fb3e9f244f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters.java
@@ -0,0 +1,22 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ x = (ProceedingJoinPoint ext>
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters_after.java
new file mode 100644
index 000000000000..4a001127b4c4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsInCastTypeParameters_after.java
@@ -0,0 +1,22 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ x = (ProceedingJoinPoint extends >
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters.java
new file mode 100644
index 000000000000..6c467e38d4b4
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Xxx {
+
+
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters_after.java
new file mode 100644
index 000000000000..694dba7dfe6d
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsInMethodParameters_after.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Xxx {
+
+
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters.java
new file mode 100644
index 000000000000..30922b7a97ee
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Foo A> {
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters_after.java
new file mode 100644
index 000000000000..ef03219243ba
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extendsWithRightContextInClassTypeParameters_after.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Foo A> {
+
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1.java b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1.java
new file mode 100644
index 000000000000..6a9f7502fbf0
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1.java
@@ -0,0 +1,27 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ try {
+
+ } final {
+
+ }
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1_after.java
new file mode 100644
index 000000000000..43512dd5bbd9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally1_after.java
@@ -0,0 +1,27 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ try {
+
+ } finally {
+
+ }
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2.java b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2.java
new file mode 100644
index 000000000000..f1e428987e7c
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2.java
@@ -0,0 +1,25 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ try {
+
+ } final
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2_after.java b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2_after.java
new file mode 100644
index 000000000000..b99df3c0b2bb
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/extraBracketAfterFinally2_after.java
@@ -0,0 +1,27 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ try {
+
+ } finally {
+
+ }
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/fileScope-2.java b/java/java-tests/testData/codeInsight/completion/keywords/fileScope-2.java
deleted file mode 100644
index faee6dcb6f1d..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/fileScope-2.java
+++ /dev/null
@@ -1,3 +0,0 @@
-package myPackage;
-
-
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/fileScope-1.java b/java/java-tests/testData/codeInsight/completion/keywords/fileScope1.java
similarity index 100%
rename from java/java-tests/testData/codeInsight/completion/keywords/fileScope-1.java
rename to java/java-tests/testData/codeInsight/completion/keywords/fileScope1.java
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/fileScope2.java b/java/java-tests/testData/codeInsight/completion/keywords/fileScope2.java
new file mode 100644
index 000000000000..e70c35c71309
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/fileScope2.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package myPackage;
+
+
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1.java
new file mode 100644
index 000000000000..c4ef6c7c1fc8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ boolean x = this i
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1_after.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1_after.java
new file mode 100644
index 000000000000..344f74e8f6ed
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf1_after.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ boolean x = this instanceof
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2.java
new file mode 100644
index 000000000000..a60c70ad806e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ boolean x = super
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2_after.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2_after.java
new file mode 100644
index 000000000000..a60c70ad806e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf2_after.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ boolean x = super
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3.java
new file mode 100644
index 000000000000..fd6e661eb147
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ String str = "";
+ boolean x = str i
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3_after.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3_after.java
new file mode 100644
index 000000000000..a2bac477b6b5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/instanceOf3_after.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ String str = "";
+ boolean x = str instanceof
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1-result.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1-result.java
deleted file mode 100644
index b86936886d2b..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1-result.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
- boolean x = this instanceof
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1.java
deleted file mode 100644
index 0204407f2cb8..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-1.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
- boolean x = this i
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2-result.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2-result.java
deleted file mode 100644
index b42010d5d531..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2-result.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
- boolean x = super
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2.java
deleted file mode 100644
index b42010d5d531..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
- boolean x = super
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3-result.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3-result.java
deleted file mode 100644
index 9bc7e1cd03ba..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3-result.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class A{
- public void method(){
- String str = "";
- boolean x = str instanceof
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3.java b/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3.java
deleted file mode 100644
index 4cb057454774..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/instanceof-3.java
+++ /dev/null
@@ -1,6 +0,0 @@
-public class A{
- public void method(){
- String str = "";
- boolean x = str i
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-1.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-1.java
deleted file mode 100644
index 640faaa19d11..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-1.java
+++ /dev/null
@@ -1,3 +0,0 @@
-public class A{
- public void method() {}
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-2.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-2.java
deleted file mode 100644
index 965cfb800962..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-2.java
+++ /dev/null
@@ -1,4 +0,0 @@
-public class A{
- public void method(){
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-3.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-3.java
deleted file mode 100644
index dd99cb703a23..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-3.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-4.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-4.java
deleted file mode 100644
index dd99cb703a23..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-4.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(){
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5-out.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5-out.java
deleted file mode 100644
index 5ee694dc44d2..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5-out.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(final String){
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5.java
deleted file mode 100644
index 93adde13ad59..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/methodScope-5.java
+++ /dev/null
@@ -1,5 +0,0 @@
-public class A{
- public void method(fi String){
-
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope1.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope1.java
new file mode 100644
index 000000000000..1afc320d3736
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope1.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method() {}
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope2.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope2.java
new file mode 100644
index 000000000000..e6492ad07981
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope2.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope3.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope3.java
new file mode 100644
index 000000000000..b7dc464e92a8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope3.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope4.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope4.java
new file mode 100644
index 000000000000..b7dc464e92a8
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope4.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(){
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope5.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope5.java
new file mode 100644
index 000000000000..685c9f478ad6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope5.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(fi String){
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/methodScope5_after.java b/java/java-tests/testData/codeInsight/completion/keywords/methodScope5_after.java
new file mode 100644
index 000000000000..a270c75c12f5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/methodScope5_after.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class A{
+ public void method(final String){
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInIf.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInIf.java
new file mode 100644
index 000000000000..92a0dfedc82b
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInIf.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ if (nu)
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInIf_after.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInIf_after.java
new file mode 100644
index 000000000000..b538755def32
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInIf_after.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ if (null)
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall.java
new file mode 100644
index 000000000000..665f58fd6db3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(nu);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2.java
new file mode 100644
index 000000000000..bd1e40d515d5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(Null.nu);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2_after.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2_after.java
new file mode 100644
index 000000000000..bd1e40d515d5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall2_after.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(Null.nu);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall_after.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall_after.java
new file mode 100644
index 000000000000..53129988b57e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInMethodCall_after.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Null {
+ public static void main(String[] argv) {
+ StringBuffer buf = new StringBuffer();
+
+ buf.append(null);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn.java
new file mode 100644
index 000000000000..79fdea866365
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static Object main() {
+ return nu
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn_after.java b/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn_after.java
new file mode 100644
index 000000000000..465b5e7a0067
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/nullInReturn_after.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static Object main() {
+ return null
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/super-1.java b/java/java-tests/testData/codeInsight/completion/keywords/super-1.java
deleted file mode 100644
index 4450560b5f94..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/super-1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class B{
- class A{
- {
- B.
- }
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/super-2.java b/java/java-tests/testData/codeInsight/completion/keywords/super-2.java
deleted file mode 100644
index 390b24a570d5..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/super-2.java
+++ /dev/null
@@ -1,5 +0,0 @@
-class A{
- {
- String.
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/super1.java b/java/java-tests/testData/codeInsight/completion/keywords/super1.java
new file mode 100644
index 000000000000..43c488caa888
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/super1.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class B{
+ class A{
+ {
+ B.
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/super2.java b/java/java-tests/testData/codeInsight/completion/keywords/super2.java
new file mode 100644
index 000000000000..1780ecb2ef57
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/super2.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A{
+ {
+ String.
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1-result.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1-result.java
deleted file mode 100644
index f9fb47045945..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1-result.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class A {
- void foo () {
- new Runnable () {
- public synchronized
- };
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1.java
deleted file mode 100644
index 692b71b7b8d1..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-1.java
+++ /dev/null
@@ -1,7 +0,0 @@
-class A {
- void foo () {
- new Runnable () {
- public synch
- };
- }
-}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2-result.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2-result.java
deleted file mode 100644
index 859333d08a32..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2-result.java
+++ /dev/null
@@ -1,6 +0,0 @@
-class Test {
- void foo() {
- if (true) {
- } else synchronized()
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2.java
deleted file mode 100644
index e2e5fe775cfb..000000000000
--- a/java/java-tests/testData/codeInsight/completion/keywords/synchronized-2.java
+++ /dev/null
@@ -1,6 +0,0 @@
-class Test {
- void foo() {
- if (true) {
- } else syn
- }
-}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized1.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized1.java
new file mode 100644
index 000000000000..e00064cce802
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/synchronized1.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A {
+ void foo () {
+ new Runnable () {
+ public synch
+ };
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized1_after.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized1_after.java
new file mode 100644
index 000000000000..519a52c66ec7
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/synchronized1_after.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class A {
+ void foo () {
+ new Runnable () {
+ public synchronized
+ };
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized2.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized2.java
new file mode 100644
index 000000000000..d3ae6e142650
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/synchronized2.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Test {
+ void foo() {
+ if (true) {
+ } else syn
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/synchronized2_after.java b/java/java-tests/testData/codeInsight/completion/keywords/synchronized2_after.java
new file mode 100644
index 000000000000..ef913dbd183e
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/synchronized2_after.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+class Test {
+ void foo() {
+ if (true) {
+ } else synchronized()
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration.java b/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration.java
new file mode 100644
index 000000000000..2a64ecfaf2c2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ boolean b = tr
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration_after.java b/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration_after.java
new file mode 100644
index 000000000000..f202474e1e6f
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/completion/keywords/trueInVariableDeclaration_after.java
@@ -0,0 +1,23 @@
+
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+public class Main {
+
+ public static void main() {
+ boolean b = true
+
+ }
+}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Interface.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Interface.java
index 1dc6b8c535c7..2d3c98953e1a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Interface.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/Interface.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
interface i implements Runnable {}
interface ii {}
@@ -9,12 +24,12 @@ interface is3 extends cs {}
abstract class Exercis {
public static void main() {
- Object o = java.lang.this;
-
- new Runnable() {
- public void run() {
- Runnable.this.run(); ///
- }
- };
- }
+ Object o = java.lang.this;
+
+ new Runnable() {
+ public void run() {
+ Runnable.this.run();
+ }
+ };
+ }
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
index d05587836cac..becdda581a2a 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting/NumericLiterals.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/// assignment compatible types
import java.io.*;
import java.net.*;
@@ -23,9 +39,9 @@ public class a {
int i14 = 020000000000;
int i15 = 0xf044332211;
int octale = 017777777777; // negative
- int bi1 = 0b0010;
- int bi2 = 0B0010;
- int bi3 = 1_2;
+ int bi1 = 0b0010;
+ int bi2 = 0B0010;
+ int bi3 = 1_2;
long l1 = -9223372036854775809L;
long l2 = 9223372036854775808L;
@@ -39,20 +55,20 @@ public class a {
long l10 = 0x8000000000000000L;
long octalValue = 01777777777777777777600L;
long octalValua = 01777777777777777777777L;
- long bl1 = 0b0010l;
- long bl2 = 0B0010L;
- long bl3 = 10_24L;
+ long bl1 = 0b0010l;
+ long bl2 = 0B0010L;
+ long bl3 = 10_24L;
float f1= 1e-46f;
float f2 = 1e39f;
float f3 = 0E1F;
- float f4 = 0xabc.defP2f;
- float bf1 = 3.141_592f;
+ float f4 = 0xabc.defP2f;
+ float bf1 = 3.141_592f;
double dd1 = 1e-324;
double dd2 = 1e309;
double dd3 = 0E1;
- double dd4 = 0x1.fffffffffffffP1023;
+ double dd4 = 0x1.fffffffffffffP1023;
double d1 = 1.E;
double d2 = 1.e;
double d3 = 1.E+;
@@ -64,6 +80,6 @@ public class a {
double d9 = 1e-d;
double d10 = 1e-F;
double d11 = 1e-f;
- double d12 = 3.141_592_653_589_793d;
+ double d12 = 3.141_592_653_589_793d;
}
}
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ExtensionMethods.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ExtensionMethods.java
index 909d08a364b9..2bb985bef33e 100644
--- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ExtensionMethods.java
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting7/ExtensionMethods.java
@@ -16,10 +16,31 @@
class C {
interface I {
+ int i = 42;
void m() default { }
}
+ interface II extends I {
+ void m() default {
+ I.super.m();
+ super.m();
+
+ System.out.println(I.super.i);
+ System.out.println(super.i);
+ }
+
+ void ma();
+ }
+
void test() {
new I(){}.m();
+
+ new II() {
+ public void ma() {
+ I.super.m();
+ II.super.m();
+ II.super.ma();
+ }
+ }.m();
}
}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterExpression.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterExpression.java
new file mode 100644
index 000000000000..a3c59d28b3da
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterExpression.java
@@ -0,0 +1,10 @@
+// "Replace with list access" "true"
+
+import java.lang.Math;
+import java.util.List;
+
+class A {
+ void test(List lists) {
+ System.out.println(lists.get(Math.max(Math.abs(-2), 3)));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterIdexIsBoxedInteger.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterIdexIsBoxedInteger.java
new file mode 100644
index 000000000000..e51dad27bce2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterIdexIsBoxedInteger.java
@@ -0,0 +1,10 @@
+// "Replace with list access" "true"
+
+import java.lang.Integer;
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ System.out.println(list.get(new Integer(0)));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterListOfLists.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterListOfLists.java
new file mode 100644
index 000000000000..88de14ce85d6
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterListOfLists.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.List;
+
+class A {
+ void test(List lists) {
+ System.out.println(lists.get(0).get(0));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSetStatement.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSetStatement.java
new file mode 100644
index 000000000000..4996ab43fd67
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSetStatement.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ list.set(0, 5);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSimple.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSimple.java
new file mode 100644
index 000000000000..b724741bac86
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/afterSimple.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ System.out.println(list.get(0));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeAssignmentInIfCondition.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeAssignmentInIfCondition.java
new file mode 100644
index 000000000000..0ddfbf37d796
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeAssignmentInIfCondition.java
@@ -0,0 +1,11 @@
+// "Replace with list access" "false"
+
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ if (list[0] = 5 == 5){
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeExpression.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeExpression.java
new file mode 100644
index 000000000000..c24770fc7a26
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeExpression.java
@@ -0,0 +1,10 @@
+// "Replace with list access" "true"
+
+import java.lang.Math;
+import java.util.List;
+
+class A {
+ void test(List lists) {
+ System.out.println(lists[Math.max(Math.abs(-2),3)]);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIdexIsBoxedInteger.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIdexIsBoxedInteger.java
new file mode 100644
index 000000000000..5aa0912933b9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIdexIsBoxedInteger.java
@@ -0,0 +1,10 @@
+// "Replace with list access" "true"
+
+import java.lang.Integer;
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ System.out.println(list[new Integer(0)]);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIndexNotInteger.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIndexNotInteger.java
new file mode 100644
index 000000000000..3e357134a984
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeIndexNotInteger.java
@@ -0,0 +1,10 @@
+// "Replace with list access" "false"
+
+import java.lang.Object;
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ System.out.println(list[new Object(3)]);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeListOfLists.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeListOfLists.java
new file mode 100644
index 000000000000..c657db61bce9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeListOfLists.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.List;
+
+class A {
+ void test(List lists) {
+ System.out.println(lists[0].get(0));
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeNotLIst.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeNotLIst.java
new file mode 100644
index 000000000000..9b30417e9e57
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeNotLIst.java
@@ -0,0 +1,6 @@
+// "Replace with list access" "false"
+class A {
+ void test(Collection list) {
+ System.out.println(list[0]);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSetStatement.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSetStatement.java
new file mode 100644
index 000000000000..fd502663b7f2
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSetStatement.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ list[0] = 5;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSimple.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSimple.java
new file mode 100644
index 000000000000..4e96417cd6aa
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess/beforeSimple.java
@@ -0,0 +1,9 @@
+// "Replace with list access" "true"
+
+import java.util.ArrayList;
+
+class A {
+ void test(ArrayList list) {
+ System.out.println(list[0]);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterMethodCall.java
new file mode 100644
index 000000000000..76fbe9754ab3
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterMethodCall.java
@@ -0,0 +1,10 @@
+// "Replace with 'list != null ?:'" "true"
+
+import org.jetbrains.annotations.NotNull;
+
+class A{
+ void test(@NotNull List l) {
+ final List list = null;
+ test(list != null ? list : null);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterPrimitive.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterPrimitive.java
new file mode 100644
index 000000000000..8547e4597503
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterPrimitive.java
@@ -0,0 +1,10 @@
+// "Replace with 'integer != null ?:'" "true"
+
+import java.lang.Integer;
+
+class A{
+ void test(){
+ Integer integer = null;
+ int i = integer != null ? integer.intValue() : 0;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterSimple.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterSimple.java
new file mode 100644
index 000000000000..aff3f94edb95
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/afterSimple.java
@@ -0,0 +1,8 @@
+// "Replace with 'list != null ?:'" "true"
+
+class A{
+ void test(){
+ List list = null;
+ Object o = list != null ? list.get(0) : null;
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeExpressionStatement.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeExpressionStatement.java
new file mode 100644
index 000000000000..b072c84b5674
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeExpressionStatement.java
@@ -0,0 +1,7 @@
+// "Replace with 'list != null ?:'" "false"
+class A{
+ void test(){
+ List list = null;
+ list.get(0);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeMethodCall.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeMethodCall.java
new file mode 100644
index 000000000000..9b5ec3919db9
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeMethodCall.java
@@ -0,0 +1,10 @@
+// "Replace with 'list != null ?:'" "true"
+
+import org.jetbrains.annotations.NotNull;
+
+class A{
+ void test(@NotNull List l) {
+ final List list = null;
+ test(list);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforePrimitive.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforePrimitive.java
new file mode 100644
index 000000000000..3af5be0ac1f5
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforePrimitive.java
@@ -0,0 +1,10 @@
+// "Replace with 'integer != null ?:'" "true"
+
+import java.lang.Integer;
+
+class A{
+ void test(){
+ Integer integer = null;
+ int i = integer.intValue();
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeSimple.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeSimple.java
new file mode 100644
index 000000000000..87652493e474
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator/beforeSimple.java
@@ -0,0 +1,8 @@
+// "Replace with 'list != null ?:'" "true"
+
+class A{
+ void test(){
+ List list = null;
+ Object o = list.get(0);
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/codeInsight/overrideImplement/afterRawSuper.java b/java/java-tests/testData/codeInsight/overrideImplement/afterRawSuper.java
new file mode 100644
index 000000000000..95912a1bd1da
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/overrideImplement/afterRawSuper.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface A {
+ void foo();
+ }
+
+ class B implements A
+ {
+ public void foo() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ }
diff --git a/java/java-tests/testData/codeInsight/overrideImplement/afterSubstituteBoundInMethodTypeParam.java b/java/java-tests/testData/codeInsight/overrideImplement/afterSubstituteBoundInMethodTypeParam.java
new file mode 100644
index 000000000000..47816c480dca
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/overrideImplement/afterSubstituteBoundInMethodTypeParam.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+abstract class A {
+ abstract void foo(S s);
+ }
+
+ class B extends A{ // Implement methods
+
+ @Override
+ void foo(S s) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+ }
diff --git a/java/java-tests/testData/codeInsight/overrideImplement/beforeRawSuper.java b/java/java-tests/testData/codeInsight/overrideImplement/beforeRawSuper.java
new file mode 100644
index 000000000000..aefe95c86643
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/overrideImplement/beforeRawSuper.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+interface A {
+ void foo();
+ }
+
+ class B implements A
+ {
+
+
+ }
diff --git a/java/java-tests/testData/codeInsight/overrideImplement/beforeSubstituteBoundInMethodTypeParam.java b/java/java-tests/testData/codeInsight/overrideImplement/beforeSubstituteBoundInMethodTypeParam.java
new file mode 100644
index 000000000000..0cccda1cebde
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/overrideImplement/beforeSubstituteBoundInMethodTypeParam.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+abstract class A {
+ abstract void foo(S s);
+ }
+
+ class B extends A{ // Implement methods
+
+ }
diff --git a/java/java-tests/testData/inspection/globalContext/Foo.java b/java/java-tests/testData/inspection/globalContext/Foo.java
new file mode 100644
index 000000000000..4a2b44daf653
--- /dev/null
+++ b/java/java-tests/testData/inspection/globalContext/Foo.java
@@ -0,0 +1 @@
+public class Foo {}
diff --git a/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Super.java b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Super.java
new file mode 100644
index 000000000000..f0c2064481b6
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Super.java
@@ -0,0 +1,2 @@
+interface Int {
+}
diff --git a/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Test.java b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Test.java
new file mode 100644
index 000000000000..32dd1902afa5
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/after/Test.java
@@ -0,0 +1,2 @@
+interface Test extends Int {
+}
diff --git a/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Super.java b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Super.java
new file mode 100644
index 000000000000..35f223875043
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Super.java
@@ -0,0 +1,4 @@
+interface Super extends Int {
+}
+interface Int {
+}
diff --git a/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Test.java b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Test.java
new file mode 100644
index 000000000000..2eeeb5d5fe8a
--- /dev/null
+++ b/java/java-tests/testData/refactoring/inlineSuperClass/interfaceHierarchyWithSubstitution/before/Test.java
@@ -0,0 +1,2 @@
+interface Test extends Super{
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.java
index 3d0a160e8094..5a4b795126df 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/OverrideImplementTest.java
@@ -37,6 +37,8 @@ public class OverrideImplementTest extends LightCodeInsightTestCase {
public void testWildcard() throws Exception { doTest(false); }
public void testTypeParam() throws Exception { doTest(false); }
public void testInterfaceAndAbstractClass() throws Exception { doTest(false); }
+ public void testRawSuper() throws Exception { doTest(false); }
+ public void testSubstituteBoundInMethodTypeParam() throws Exception { doTest(false); }
public void testLongFinalParameterList() throws Exception {
CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject()).clone();
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
index 5885f56d7787..a8d77fc098e2 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/completion/KeywordCompletionTest.java
@@ -1,244 +1,110 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.intellij.codeInsight.completion;
import com.intellij.JavaTestUtil;
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
+import org.jetbrains.annotations.NonNls;
/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 20.02.2003
- * Time: 15:49:56
- * To change this template use Options | File Templates.
+ * @author ik
+ * @since 20.02.2003
*/
public class KeywordCompletionTest extends LightCompletionTestCase {
private static final String BASE_PATH = "/codeInsight/completion/keywords";
+ private static final String[] FILE_SCOPE_KEYWORDS = new String[]{
+ "package", "public", "private", "import", "final", "class", "interface", "abstract", "enum", null};
+ private static final String[] CLASS_SCOPE_KEYWORDS = new String[]{
+ "public", "private", "protected", "import", "final", "class", "interface", "abstract", "enum", null};
+ private static final String[] CLASS_SCOPE_KEYWORDS_2 = new String[]{
+ "package", "public", "private", "protected", "transient", "volatile", "static", "import", "final", "class", "interface", "abstract"};
+
@Override
protected String getTestDataPath() {
return JavaTestUtil.getJavaTestDataPath();
}
- private static final String[] ourPackageScopeKeywords =
- new String[]{"package", "public", "private", "import", "final", "class", "interface", "abstract", "enum", null};
+ public void testFileScope1() throws Exception { doTest(8, FILE_SCOPE_KEYWORDS); }
+ public void testFileScope2() throws Exception { doTest(7, CLASS_SCOPE_KEYWORDS); }
+ public void testClassScope1() throws Exception { doTest(5, CLASS_SCOPE_KEYWORDS); }
+ public void testClassScope2() throws Exception { doTest(4, CLASS_SCOPE_KEYWORDS); }
+ public void testClassScope3() throws Exception { doTest(0, CLASS_SCOPE_KEYWORDS); }
+ public void testClassScope4() throws Exception { doTest(10, CLASS_SCOPE_KEYWORDS_2); }
+ public void testAfterAnnotations() throws Exception { doTest(6, "public", "final", "class", "interface", "abstract", "enum", null); }
+ public void testExtends1() throws Exception { doTest(2, "extends", "implements", null); }
+ public void testExtends2() throws Exception { doTest(1, "extends", "implements", "AAA", "BBB", "instanceof"); }
+ public void testExtends3() throws Exception { doTest(2, "extends", "implements", "AAA", "BBB", "CCC", "instanceof"); }
+ public void testExtends4() throws Exception { doTest(2, "extends", "implements", "AAA", "BBB", "CCC", "instanceof"); }
+ public void testExtends5() throws Exception { doTest(1, "extends", "implements", "AAA", "BBB", "CCC", "instanceof"); }
+ public void testExtends6() throws Exception { doTest(1, "extends", "implements", "AAA", "BBB", "CCC", "instanceof"); }
+ public void testExtends7() throws Exception { doTest(false); }
+ public void testExtends8() throws Exception { doTest(false); }
+ public void testExtends9() throws Exception { doTest(false); }
+ public void testExtends10() throws Exception { doTest(false); }
+ public void testExtends11() throws Exception { doTest(false); }
+ public void testExtends12() throws Exception { doTest(false); }
+ public void testSynchronized1() throws Exception { doTest(false); }
- public void testModifiersFileScope_1() throws Exception {
- configureByFile(BASE_PATH + "/fileScope-1.java");
- testByCount(8, ourPackageScopeKeywords);
- }
-
- private static final String[] ourClassScopeKeywords =
- new String[]{"public", "private", "protected", "import", "final", "class", "interface", "abstract", "enum", null};
-
- public void testModifiersFileScope_2() throws Exception {
- configureByFile(BASE_PATH + "/fileScope-2.java");
- testByCount(7, ourClassScopeKeywords);
- }
-
- public void testModifiersClassScope_1() throws Exception {
- configureByFile(BASE_PATH + "/classScope-1.java");
- testByCount(5, ourClassScopeKeywords);
- }
-
- public void testModifiersClassScope_2() throws Exception {
- configureByFile(BASE_PATH + "/classScope-2.java");
- testByCount(4, ourClassScopeKeywords);
- }
-
- public void testModifiersClassScope_3() throws Exception {
- configureByFile(BASE_PATH + "/classScope-3.java");
- testByCount(0, ourClassScopeKeywords);
- }
-
- public void testAfterAnnotations() throws Exception {
- configureByFile(BASE_PATH + "/afterAnnotations.java");
- testByCount(6, "public", "final", "class", "interface", "abstract", "enum", null);
- }
-
- public void testExtends_1() throws Exception {
- configureByFile(BASE_PATH + "/extends-1.java");
- testByCount(2, "extends", "implements", null);
- }
-
- public void testExtends_2() throws Exception {
- configureByFile(BASE_PATH + "/extends-2.java");
- testByCount(1, "extends", "implements", "AAA", "BBB", "instanceof");
- }
-
- public void testExtends_3() throws Exception {
- configureByFile(BASE_PATH + "/extends-3.java");
- testByCount(2, "extends", "implements", "AAA", "BBB", "CCC", "instanceof");
- }
-
- public void testExtends_4() throws Exception {
- configureByFile(BASE_PATH + "/extends-4.java");
- testByCount(2, "extends", "implements", "AAA", "BBB", "CCC", "instanceof");
- }
-
- public void testExtends_5() throws Exception {
- configureByFile(BASE_PATH + "/extends-5.java");
- testByCount(1, "extends", "implements", "AAA", "BBB", "CCC", "instanceof");
- }
-
- public void testExtends_6() throws Exception {
- configureByFile(BASE_PATH + "/extends-6.java");
- testByCount(1, "extends", "implements", "AAA", "BBB", "CCC", "instanceof");
- }
-
- public void testExtends_7() throws Exception {
- configureByFile(BASE_PATH + "/extends-7.java");
- checkResultByFile(BASE_PATH + "/extends-7-result.java");
- }
-
- public void testExtends_8() throws Exception {
- configureByFile(BASE_PATH + "/extends-8.java");
- checkResultByFile(BASE_PATH + "/extends-8-result.java");
- }
-
- public void testExtends_9() throws Exception {
- configureByFile(BASE_PATH + "/extends-9.java");
- checkResultByFile(BASE_PATH + "/extends-9-result.java");
- }
-
- public void testExtends_10() throws Exception {
- configureByFile(BASE_PATH + "/extends-10.java");
- checkResultByFile(BASE_PATH + "/extends-10-result.java");
- }
-
- public void testExtends_11() throws Exception {
- configureByFile(BASE_PATH + "/extends-11.java");
- checkResultByFile(BASE_PATH + "/extends-11-result.java");
- }
-
- public void testExtends_12() throws Exception {
- configureByFile(BASE_PATH + "/extends-12.java");
- checkResultByFile(BASE_PATH + "/extends-12-result.java");
- }
-
- public void testSynchronized_1() throws Exception {
- configureByFile(BASE_PATH + "/synchronized-1.java");
- checkResultByFile(BASE_PATH + "/synchronized-1-result.java");
- }
-
- public void testSynchronized_2() throws Exception {
+ public void testSynchronized2() throws Exception {
CodeStyleSettingsManager.getSettings(getProject()).SPACE_BEFORE_SYNCHRONIZED_PARENTHESES = false;
- configureByFile(BASE_PATH + "/synchronized-2.java");
- checkResultByFile(BASE_PATH + "/synchronized-2-result.java");
+ doTest(false);
}
- public void testModifiersClassScope() throws Exception{
- configureByFile(BASE_PATH + "/classScope-4.java");
- testByCount(10, "package", "public", "private", "protected", "transient", "volatile", "static", "import", "final", "class", "interface",
- "abstract");
- }
+ public void testMethodScope1() throws Exception { doTest(1, "throws"); }
+ public void testMethodScope2() throws Exception { doTest(1, "final", "public", "static", "volatile", "abstract"); }
+ public void testMethodScope3() throws Exception { doTest(1, "final", "public", "static", "volatile", "abstract", "throws", "instanceof"); }
+ public void testMethodScope4() throws Exception { doTest(6, "final", "try", "for", "while", "return", "throw"); }
+ public void testMethodScope5() throws Exception { doTest(false); }
+ public void testExtraBracketAfterFinally1() throws Exception { doTest(true); }
+ public void testExtraBracketAfterFinally2() throws Exception { doTest(true); }
+ public void testExtendsInCastTypeParameters() throws Exception { doTest(false); }
+ public void testExtendsWithRightContextInClassTypeParameters() throws Exception { doTest(false); }
+ public void testTrueInVariableDeclaration() throws Exception { doTest(false); }
+ public void testNullInIf() throws Exception { doTest(false); }
+ public void testNullInReturn() throws Exception { doTest(false); }
+ public void testExtendsInMethodParameters() throws Exception { doTest(false); }
+ public void testInstanceOf1() throws Exception { doTest(false); }
+ public void testInstanceOf2() throws Exception { doTest(false); }
+ public void testInstanceOf3() throws Exception { doTest(false); }
+ public void testCatchFinally() throws Exception { doTest(2, "catch", "finally"); }
+ public void testSuper1() throws Exception { doTest(1, "super"); }
+ public void testSuper2() throws Exception { doTest(0, "super"); }
+ public void testContinue() throws Exception { doTest(false); }
+ public void testThrowsOnSeparateLine() throws Exception { doTest(false); }
+ public void testDefaultInAnno() throws Exception { doTest(false); }
+ public void testDefaultInExtMethod() throws Exception { doTest(false); }
+ public void testNullInMethodCall() throws Exception { doTest(false); }
+ public void testNullInMethodCall2() throws Exception { doTest(false); }
- public void testMethodThrows() throws Exception{
- configureByFile(BASE_PATH + "/methodScope-1.java");
- testByCount(1, "throws");
- }
-
- public void testModifiersInMethodScope_1() throws Exception{
- configureByFile(BASE_PATH + "/methodScope-2.java");
- testByCount(1, "final", "public", "static", "volatile", "abstract");
- }
-
- public void testModifiersInMethodScope_2() throws Exception{
- configureByFile(BASE_PATH + "/methodScope-3.java");
- testByCount(1, "final", "public", "static", "volatile", "abstract", "throws", "instanceof");
- }
-
- public void testModifiersInMethodScope_3() throws Exception{
- configureByFile(BASE_PATH + "/methodScope-4.java");
- testByCount(6, "final", "try", "for", "while", "return", "throw");
- }
-
- public void testModifiersInMethodScope_5() throws Exception{
- configureByFile(BASE_PATH + "/methodScope-5.java");
- checkResultByFile(BASE_PATH + "/methodScope-5-out.java");
- }
-
- public void testExtendsInCastTypeParameters() throws Throwable { doTest(); }
- public void testExtendsWithRightContextInClassTypeParameters() throws Throwable { doTest(); }
-
- public void testExtraBracketAfterFinally() throws Throwable {
- configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
- selectItem(myItems[1]);
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-out.java");
- }
-
- public void testExtraBracketAfterFinally1() throws Throwable {
- configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
- selectItem(myItems[1]);
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-out.java");
- }
-
- public void testTrueInVariableDeclaration() throws Throwable { doTest(); }
- public void testNullInIf() throws Throwable { doTest(); }
- public void testNullInReturn() throws Throwable { doTest(); }
-
- public void testExtendsInMethodParameters() throws Throwable { doTest(); }
-
- private void doTest() throws Exception {
- configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-out.java");
- }
-
- public void testInstanceOf_1() throws Exception{
- configureByFile(BASE_PATH + "/instanceof-1.java");
- checkResultByFile(BASE_PATH + "/instanceof-1-result.java");
- //testByCount(new String[]{"instanceof"}, 1);
- }
-
- public void testInstanceOf_2() throws Exception{
- configureByFile(BASE_PATH + "/instanceof-2.java");
- checkResultByFile(BASE_PATH + "/instanceof-2-result.java");
- //testByCount(new String[]{"instanceof"}, 1);
- }
-
- public void testInstanceOf_3() throws Exception{
- configureByFile(BASE_PATH + "/instanceof-3.java");
- checkResultByFile(BASE_PATH + "/instanceof-3-result.java");
- //testByCount(new String[]{"instanceof"}, 1);
- }
-
- public void testCatchFinally() throws Exception{
- configureByFile(BASE_PATH + "/catch-1.java");
- testByCount(2, "catch", "finally");
- }
-
- public void testSuper1() throws Exception{
- configureByFile(BASE_PATH + "/super-1.java");
- testByCount(1, "super");
- }
-
- public void testSuper2() throws Exception{
- configureByFile(BASE_PATH + "/super-2.java");
- testByCount(0, "super");
- }
-
- public void testContinue() throws Exception{
- configureByFile(BASE_PATH + "/continue.java");
- checkResultByFile(BASE_PATH + "/continue_after.java");
- }
-
- public void testThrowsOnSeparateLine() throws Exception{
- configureByFile(BASE_PATH + "/throwsOnSeparateLine.java");
- checkResultByFile(BASE_PATH + "/throwsOnSeparateLine_after.java");
- }
-
- public void testDefaultInAnno() throws Exception{
- configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
- checkResultByFile(BASE_PATH + "/" + getTestName(true) + "_after.java");
- }
-
- public void testTryInExpression() throws Throwable {
+ public void testTryInExpression() throws Exception {
configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
assertStringItems("toString", "this");
}
- public void testNull() throws Exception{
- configureByFile(BASE_PATH + "/NullInMethodCall.java");
- checkResultByFile(BASE_PATH + "/NullInMethodCall_After.java");
- configureByFile(BASE_PATH + "/NullInMethodCall2.java");
- checkResultByFile(BASE_PATH + "/NullInMethodCall2_After.java");
+ private void doTest(boolean select) throws Exception {
+ configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
+ if (select) {
+ selectItem(myItems[1]);
+ }
+ checkResultByFile(BASE_PATH + "/" + getTestName(true) + "_after.java");
+ }
+
+ protected void doTest(int finalCount, @NonNls String... values) {
+ configureByFile(BASE_PATH + "/" + getTestName(true) + ".java");
+ testByCount(finalCount, values);
}
}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithListAccessTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithListAccessTest.java
new file mode 100644
index 000000000000..e5777643c4a8
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithListAccessTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInsight.daemon.quickFix;
+
+/**
+ * @author Danila Ponomarenko
+ */
+public class ReplaceWithListAccessTest extends LightQuickFixTestCase {
+
+ public void test() throws Exception { doAllTests(); }
+
+ @Override
+ protected String getBasePath() {
+ return "/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithListAccess";
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithTernaryOperatorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithTernaryOperatorTest.java
new file mode 100644
index 000000000000..6419088e9583
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/quickFix/ReplaceWithTernaryOperatorTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * User: anna
+ * Date: 21-Mar-2008
+ */
+package com.intellij.codeInsight.daemon.quickFix;
+
+import com.intellij.codeInspection.LocalInspectionTool;
+import com.intellij.codeInspection.dataFlow.DataFlowInspection;
+import com.intellij.codeInspection.nullable.NullableStuffInspection;
+
+public class ReplaceWithTernaryOperatorTest extends LightQuickFixTestCase {
+ @Override
+ protected LocalInspectionTool[] configureLocalInspectionTools() {
+ return new LocalInspectionTool[]{new DataFlowInspection(), new NullableStuffInspection()};
+ }
+
+ public void test() throws Exception {
+ doAllTests();
+ }
+
+ @Override
+ protected String getBasePath() {
+ return "/codeInsight/daemonCodeAnalyzer/quickFix/replaceWithTernaryOperator";
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
index 20830a89f107..f993262b32ac 100644
--- a/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
+++ b/java/java-tests/testSrc/com/intellij/codeInsight/folding/JavaFoldingTest.groovy
@@ -168,6 +168,27 @@ class Test {
assertNotNull closureFolds
assertEquals(2, closureFolds.size())
}
+
+ public void "test builder style setter"() {
+ myFoldingSettings.COLLAPSE_ACCESSORS = true
+ def text = """\
+class Foo {
+ private String bar;
+
+ public Foo setBar(String bar) {
+ this.bar = bar;
+ return this;
+ }
+}
+"""
+
+ configure text
+ def foldingModel = myFixture.editor.foldingModel as FoldingModelImpl
+ int indexOfBar = text.indexOf("this.bar")
+ def accessorStartFold = foldingModel.getCollapsedRegionAtOffset(indexOfBar)
+ assertNotNull accessorStartFold
+ assertFalse accessorStartFold.expanded
+ }
public void "test closure folding doesn't expand when editing inside"() {
def text = """\
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/GlobalInspectionContextTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/GlobalInspectionContextTest.java
new file mode 100644
index 000000000000..809f49672384
--- /dev/null
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/GlobalInspectionContextTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.codeInspection;
+
+import com.intellij.JavaTestUtil;
+import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInsight.CodeInsightTestCase;
+import com.intellij.codeInspection.ex.*;
+import com.intellij.codeInspection.visibility.VisibilityInspection;
+
+/**
+ * @author Dmitry Avdeev
+ * Date: 5/24/12
+ */
+public class GlobalInspectionContextTest extends CodeInsightTestCase {
+
+ public void testProblemDuplication() throws Exception {
+ String shortName = new VisibilityInspection().getShortName();
+ InspectionProfileImpl profile = new InspectionProfileImpl("Foo");
+ profile.disableAllTools();
+ profile.enableTool(shortName);
+
+ GlobalInspectionContextImpl context = ((InspectionManagerEx)InspectionManager.getInstance(getProject())).createNewGlobalContext(false);
+ context.setExternalProfile(profile);
+ configureByFile("Foo.java");
+
+ AnalysisScope scope = new AnalysisScope(getFile());
+ context.doInspections(scope, InspectionManager.getInstance(getProject()));
+
+ Tools tools = context.getTools().get(shortName);
+ GlobalInspectionToolWrapper tool = (GlobalInspectionToolWrapper)tools.getTool();
+ assertEquals(1, tool.getProblemDescriptors().size());
+
+ context.doInspections(scope, InspectionManager.getInstance(getProject()));
+ tools = context.getTools().get(shortName);
+ tool = (GlobalInspectionToolWrapper)tools.getTool();
+ assertEquals(1, tool.getProblemDescriptors().size());
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ InspectionProfileImpl.INIT_INSPECTIONS = true;
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ InspectionProfileImpl.INIT_INSPECTIONS = false;
+ super.tearDown();
+ }
+
+ @Override
+ protected String getTestDataPath() {
+ return JavaTestUtil.getJavaTestDataPath() + "/inspection/globalContext/";
+ }
+}
diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java
index bb012a5b2665..94c1e9100a8c 100644
--- a/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java
+++ b/java/java-tests/testSrc/com/intellij/codeInspection/InspectionProfileTest.java
@@ -28,7 +28,6 @@ import org.jdom.JDOMException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import static com.intellij.testFramework.PlatformTestUtil.assertElementsEqual;
@@ -221,8 +220,6 @@ public class InspectionProfileTest extends LightIdeaTestCase {
GlobalInspectionContextImpl context = ((InspectionManagerEx)InspectionManager.getInstance(getProject())).createNewGlobalContext(false);
context.setExternalProfile(profile);
context.initializeTools(new ArrayList(), new ArrayList(), new ArrayList