mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -31,6 +31,7 @@ import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.requests.RequestManagerImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.debugger.requests.Requestor;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -146,7 +147,7 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
|
||||
RequestManagerImpl requestManager = debugProcess.getRequestsManager();
|
||||
if (isWatchEntry()) {
|
||||
MethodEntryRequest entryRequest = (MethodEntryRequest)findRequest(debugProcess, MethodEntryRequest.class);
|
||||
MethodEntryRequest entryRequest = findRequest(debugProcess, MethodEntryRequest.class, this);
|
||||
if (entryRequest == null) {
|
||||
entryRequest = requestManager.createMethodEntryRequest(this);
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
debugProcess.getRequestsManager().enableRequest(entryRequest);
|
||||
}
|
||||
if (isWatchExit()) {
|
||||
MethodExitRequest exitRequest = (MethodExitRequest)findRequest(debugProcess, MethodExitRequest.class);
|
||||
MethodExitRequest exitRequest = findRequest(debugProcess, MethodExitRequest.class, this);
|
||||
if (exitRequest == null) {
|
||||
exitRequest = requestManager.createMethodExitRequest(this);
|
||||
}
|
||||
@@ -353,15 +354,13 @@ public class MethodBreakpoint extends BreakpointWithHighlighter<JavaMethodBreakp
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private EventRequest findRequest(@NotNull DebugProcessImpl debugProcess, Class requestClass) {
|
||||
Set reqSet = debugProcess.getRequestsManager().findRequests(this);
|
||||
for (Iterator iterator = reqSet.iterator(); iterator.hasNext();) {
|
||||
EventRequest eventRequest = (EventRequest) iterator.next();
|
||||
if(eventRequest.getClass().equals(requestClass)) {
|
||||
return eventRequest;
|
||||
static <T extends EventRequest> T findRequest(@NotNull DebugProcessImpl debugProcess, Class<T> requestClass, Requestor requestor) {
|
||||
Set<EventRequest> requests = debugProcess.getRequestsManager().findRequests(requestor);
|
||||
for (EventRequest eventRequest : requests) {
|
||||
if (eventRequest.getClass().equals(requestClass)) {
|
||||
return (T)eventRequest;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+2
-14
@@ -135,7 +135,7 @@ public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointPro
|
||||
try {
|
||||
RequestManagerImpl requestManager = debugProcess.getRequestsManager();
|
||||
if (isWatchEntry()) {
|
||||
MethodEntryRequest entryRequest = (MethodEntryRequest)findRequest(debugProcess, MethodEntryRequest.class);
|
||||
MethodEntryRequest entryRequest = MethodBreakpoint.findRequest(debugProcess, MethodEntryRequest.class, this);
|
||||
if (entryRequest == null) {
|
||||
entryRequest = requestManager.createMethodEntryRequest(this);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointPro
|
||||
debugProcess.getRequestsManager().enableRequest(entryRequest);
|
||||
}
|
||||
if (isWatchExit()) {
|
||||
MethodExitRequest exitRequest = (MethodExitRequest)findRequest(debugProcess, MethodExitRequest.class);
|
||||
MethodExitRequest exitRequest = MethodBreakpoint.findRequest(debugProcess, MethodExitRequest.class, this);
|
||||
if (exitRequest == null) {
|
||||
exitRequest = requestManager.createMethodExitRequest(this);
|
||||
}
|
||||
@@ -162,18 +162,6 @@ public class WildcardMethodBreakpoint extends Breakpoint<JavaMethodBreakpointPro
|
||||
}
|
||||
}
|
||||
|
||||
private EventRequest findRequest(DebugProcessImpl debugProcess, Class requestClass) {
|
||||
Set reqSet = debugProcess.getRequestsManager().findRequests(this);
|
||||
for (Iterator iterator = reqSet.iterator(); iterator.hasNext();) {
|
||||
EventRequest eventRequest = (EventRequest) iterator.next();
|
||||
if(eventRequest.getClass().equals(requestClass)) {
|
||||
return eventRequest;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void processClassPrepare(DebugProcess debugProcess, ReferenceType refType) {
|
||||
// should be emty - does not make sense for this breakpoint
|
||||
}
|
||||
|
||||
+6
-6
@@ -18,11 +18,9 @@ package com.intellij.codeInspection.miscGenerics;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil;
|
||||
import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.PsiImplUtil;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.*;
|
||||
import com.intellij.util.containers.IntArrayList;
|
||||
import com.sun.corba.se.impl.corba.TCUtility;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -47,10 +45,12 @@ public class SuspiciousMethodCallUtil {
|
||||
PsiMethod contains = MethodSignatureUtil.findMethodBySignature(collectionClass, containsSignature, false);
|
||||
addMethod(contains, 0, patternMethods, indices);
|
||||
|
||||
PsiClassType wildcardCollection = javaPsiFacade.getElementFactory().createType(collectionClass, PsiWildcardType.createUnbounded(manager));
|
||||
MethodSignature removeAllSignature = MethodSignatureUtil.createMethodSignature("removeAll", new PsiType[] {wildcardCollection}, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
|
||||
PsiMethod removeAll = MethodSignatureUtil.findMethodBySignature(collectionClass, removeAllSignature, false);
|
||||
addMethod(removeAll, 0, patternMethods, indices);
|
||||
if (PsiUtil.isLanguageLevel5OrHigher(collectionClass)) {
|
||||
PsiClassType wildcardCollection = javaPsiFacade.getElementFactory().createType(collectionClass, PsiWildcardType.createUnbounded(manager));
|
||||
MethodSignature removeAllSignature = MethodSignatureUtil.createMethodSignature("removeAll", new PsiType[] {wildcardCollection}, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
|
||||
PsiMethod removeAll = MethodSignatureUtil.findMethodBySignature(collectionClass, removeAllSignature, false);
|
||||
addMethod(removeAll, 0, patternMethods, indices);
|
||||
}
|
||||
}
|
||||
|
||||
final PsiClass listClass = javaPsiFacade.findClass(CommonClassNames.JAVA_UTIL_LIST, searchScope);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
|
||||
class Simple {
|
||||
public static void main(Set set, Set setO) {
|
||||
class O {}
|
||||
|
||||
Map someData = new HashMap();
|
||||
|
||||
set.removeAll(someData.keySet());
|
||||
setO.removeAll(someData.keySet());
|
||||
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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.codeInspection.miscGenerics.SuspiciousCollectionsMethodCallsInspection;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SuspiciousCollectionMethodCalls14Test extends LightCodeInsightFixtureTestCase {
|
||||
private final SuspiciousCollectionsMethodCallsInspection myTool = new SuspiciousCollectionsMethodCallsInspection();
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/suspiciousCalls";
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
myFixture.enableInspections(myTool);
|
||||
myFixture.testHighlighting(getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testRemoveAll14() throws Exception { doTest(); }
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_1_4;
|
||||
}
|
||||
}
|
||||
+12
@@ -36,6 +36,18 @@ import java.io.File;
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class LightCodeInsightFixtureTestCase extends UsefulTestCase{
|
||||
public static final LightProjectDescriptor JAVA_1_4 = new DefaultLightProjectDescriptor() {
|
||||
@Override
|
||||
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
|
||||
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_6);
|
||||
}
|
||||
};
|
||||
public static final LightProjectDescriptor JAVA_1_5 = new DefaultLightProjectDescriptor() {
|
||||
@Override
|
||||
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
|
||||
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_6);
|
||||
}
|
||||
};
|
||||
public static final LightProjectDescriptor JAVA_1_6 = new DefaultLightProjectDescriptor() {
|
||||
@Override
|
||||
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,9 +19,14 @@
|
||||
*/
|
||||
package com.intellij.openapi.module;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.psi.util.ParameterizedCachedValue;
|
||||
@@ -103,4 +108,33 @@ public class ModuleUtil extends ModuleUtilCore {
|
||||
String type = module.getOptionValue(Module.ELEMENT_TYPE);
|
||||
return ModuleTypeManager.getInstance().findByID(type);
|
||||
}
|
||||
|
||||
public static void updateExcludedFoldersInWriteAction(final Module module,
|
||||
@NotNull final VirtualFile contentRoot,
|
||||
final Collection<String> urlsToUnExclude,
|
||||
final Collection<String> urlsToExclude) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
final ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
|
||||
try {
|
||||
for (final ContentEntry contentEntry : modifiableModel.getContentEntries()) {
|
||||
if (contentRoot.equals(contentEntry.getFile())) {
|
||||
for (String url : urlsToUnExclude) {
|
||||
contentEntry.removeExcludeFolder(url);
|
||||
}
|
||||
for (String url : urlsToExclude) {
|
||||
contentEntry.addExcludeFolder(url);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
modifiableModel.commit();
|
||||
}
|
||||
catch (Exception e) {
|
||||
modifiableModel.dispose();
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
|
||||
myExecuteActionHandler.addToCommandHistoryAndExecute(myConsole, myConsoleView, text);
|
||||
}
|
||||
|
||||
static abstract class ConsoleExecuteActionHandler {
|
||||
public static abstract class ConsoleExecuteActionHandler {
|
||||
private final ConsoleHistoryModel myCommandHistoryModel;
|
||||
|
||||
private boolean myAddToHistory = true;
|
||||
|
||||
+10
-4
@@ -167,7 +167,10 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
|
||||
}
|
||||
|
||||
public void setConditionEnabled(boolean conditionEnabled) {
|
||||
myConditionEnabled = conditionEnabled;
|
||||
if (myConditionEnabled != conditionEnabled) {
|
||||
myConditionEnabled = conditionEnabled;
|
||||
fireBreakpointChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLogExpressionEnabled() {
|
||||
@@ -175,7 +178,10 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
|
||||
}
|
||||
|
||||
public void setLogExpressionEnabled(boolean logExpressionEnabled) {
|
||||
myLogExpressionEnabled = logExpressionEnabled;
|
||||
if (myLogExpressionEnabled != logExpressionEnabled) {
|
||||
myLogExpressionEnabled = logExpressionEnabled;
|
||||
fireBreakpointChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,7 +210,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
|
||||
|
||||
@Override
|
||||
public void setLogExpressionObject(@Nullable XExpression expression) {
|
||||
if (!Comparing.equal(getLogExpressionObject(), expression)) {
|
||||
if (!Comparing.equal(myLogExpression, expression)) {
|
||||
myLogExpression = expression;
|
||||
fireBreakpointChanged();
|
||||
}
|
||||
@@ -236,7 +242,7 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP
|
||||
|
||||
@Override
|
||||
public void setConditionExpression(@Nullable XExpression condition) {
|
||||
if (!Comparing.equal(condition, getConditionExpression())) {
|
||||
if (!Comparing.equal(condition, myCondition)) {
|
||||
myCondition = condition;
|
||||
fireBreakpointChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user