diff --git a/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java b/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java index 4868321f9ca2..9d34478d9e53 100644 --- a/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java +++ b/java/compiler/impl/src/com/intellij/openapi/compiler/util/InspectionValidatorWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,13 +29,11 @@ import com.intellij.lang.annotation.AnnotationSession; import com.intellij.lang.annotation.ExternalAnnotator; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ReadAction; -import com.intellij.openapi.application.ReadActionProcessor; -import com.intellij.openapi.application.Result; import com.intellij.openapi.compiler.*; import com.intellij.openapi.compiler.options.ExcludesConfiguration; import com.intellij.openapi.editor.Document; import com.intellij.openapi.module.Module; +import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.vfs.VirtualFile; @@ -143,41 +141,41 @@ public class InspectionValidatorWrapper implements Validator { return ProcessingItem.EMPTY_ARRAY; } final ExcludesConfiguration excludesConfiguration = ValidationConfiguration.getExcludedEntriesConfiguration(project); - final List items = new ReadAction>() { - @Override - protected void run(final Result> result) { - final CompileScope compileScope = context.getCompileScope(); - if (!myValidator.isAvailableOnScope(compileScope)) return; + final List items = + DumbService.getInstance(project).runReadActionInSmartMode(new Computable>() { + @Override + public List compute() { + final CompileScope compileScope = context.getCompileScope(); + if (!myValidator.isAvailableOnScope(compileScope)) return null; - final ArrayList items = new ArrayList(); + final ArrayList items = new ArrayList(); - final Processor processor = new ReadActionProcessor() { - @Override - public boolean processInReadAction(VirtualFile file) { - if (!file.isValid()) { - return true; - } - - if (myCompilerManager.isExcludedFromCompilation(file) || - excludesConfiguration.isExcluded(file)) { - return true; - } - - final Module module = context.getModuleByFile(file); - if (module != null) { - final PsiFile psiFile = myPsiManager.findFile(file); - if (psiFile != null) { - items.add(new MyValidatorProcessingItem(psiFile)); + final Processor processor = new Processor() { + @Override + public boolean process(VirtualFile file) { + if (!file.isValid()) { + return true; } - } - return true; - } - }; - ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor); - result.setResult(items); - } - }.execute().getResultObject(); + if (myCompilerManager.isExcludedFromCompilation(file) || + excludesConfiguration.isExcluded(file)) { + return true; + } + + final Module module = context.getModuleByFile(file); + if (module != null) { + final PsiFile psiFile = myPsiManager.findFile(file); + if (psiFile != null) { + items.add(new MyValidatorProcessingItem(psiFile)); + } + } + return true; + } + }; + ContainerUtil.process(myValidator.getFilesToProcess(myPsiManager.getProject(), context), processor); + return items; + } + }); if (items == null) return ProcessingItem.EMPTY_ARRAY; return items.toArray(new ProcessingItem[items.size()]); diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.java index 392cacfb2ac9..ef1085f32bb6 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/PatternPackageReferenceSet.java @@ -1,19 +1,35 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.impl.source.resolve.reference.impl.providers; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiPackage; -import com.intellij.psi.impl.source.resolve.reference.impl.providers.PackageReferenceSet; import com.intellij.util.PatternUtil; import com.intellij.util.Processor; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.Set; import java.util.regex.Pattern; public class PatternPackageReferenceSet extends PackageReferenceSet { + public PatternPackageReferenceSet(String packageName, PsiElement element, int startInElement) { super(packageName, element, startInElement); } @@ -24,7 +40,7 @@ public class PatternPackageReferenceSet extends PackageReferenceSet { if (packageName.contains("*")) { final Pattern pattern = PatternUtil.fromMask(packageName); - final Set packages = new HashSet(); + final Set packages = new LinkedHashSet(); processSubPackages(context, new Processor() { @Override @@ -39,16 +55,13 @@ public class PatternPackageReferenceSet extends PackageReferenceSet { return packages; } - else { - return super.resolvePackageName(context, packageName); - } + + return super.resolvePackageName(context, packageName); } - protected static boolean processSubPackages(final PsiPackage pkg, final Processor processor) { + protected static boolean processSubPackages(final PsiPackage pkg, final Processor processor) { if (!processor.process(pkg)) return false; - for (final PsiPackage aPackage : pkg.getSubPackages()) { - if (!processSubPackages(aPackage, processor)) return false; - } - return true; + + return ContainerUtil.process(pkg.getSubPackages(), processor); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java index c7c05dc68d74..3f644c04fd39 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateSettings.java @@ -452,12 +452,10 @@ public class TemplateSettings implements PersistentStateComponent stateClass = ComponentSerializationUtil.getStateClass(component.getClass()); + // todo remove assert before last EAP + if (!stateSpec.defaultStateAsResource() && getDefaultState(component, name, stateClass) != null) { + LOG.error(name + " has default state, but not marked to load it"); + } + T state = stateSpec.defaultStateAsResource() ? getDefaultState(component, name, stateClass) : null; Storage[] storageSpecs = getComponentStorageSpecs(component, stateSpec, StateStorageOperation.READ); for (Storage storageSpec : storageSpecs) { diff --git a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMapDecoder.java b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMapDecoder.java index 397e04ef9f59..cf4d40ab9eb7 100644 --- a/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMapDecoder.java +++ b/platform/script-debugger/backend/src/org/jetbrains/debugger/sourcemap/SourceMapDecoder.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jetbrains.debugger.sourcemap; import com.google.gson.stream.JsonToken; @@ -98,7 +113,7 @@ public final class SourceMapDecoder { else if (propertyName.equals("sourceRoot")) { sourceRoot = readSourcePath(reader); if (sourceRoot != null) { - sourceRoot = UriUtil.trimLeadingSlashes(sourceRoot); + sourceRoot = UriUtil.trimTrailingSlashes(sourceRoot); } } else if (propertyName.equals("sources")) { diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java index 7b4a539a4721..b8e276354945 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java @@ -99,7 +99,8 @@ public class SMTRunnerNotificationsHandler extends SMTRunnerEventsAdapter { type = null; } - TestStatusListener.notifySuiteFinished(testsRoot, myConsoleProperties.getProject()); + // todo: need to provide default implementation before notifying test status listeners to avoid IAE + //TestStatusListener.notifySuiteFinished(testsRoot, myConsoleProperties.getProject()); if (msg != null) { notify(msg, type, testsRoot); diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java index b2bfefce47e6..8db552b12ee6 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/Configuration.java @@ -76,6 +76,7 @@ public class Configuration extends SimpleModificationTracker implements Persiste @State( name = Configuration.COMPONENT_NAME, + defaultStateAsResource = true, storages = {@Storage(file = StoragePathMacros.APP_CONFIG + "/IntelliLang.xml", scheme = StorageScheme.DIRECTORY_BASED)}) public static class App extends Configuration { @@ -110,8 +111,10 @@ public class Configuration extends SimpleModificationTracker implements Persiste return getState(element); } } + @State( name = Configuration.COMPONENT_NAME, + defaultStateAsResource = true, storages = { @Storage(file = StoragePathMacros.PROJECT_FILE), @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/IntelliLang.xml", scheme = StorageScheme.DIRECTORY_BASED) diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java b/plugins/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java index abe744594ca7..4627efd195f0 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/palette/Palette.java @@ -65,6 +65,7 @@ import java.util.Map; */ @State( name = "Palette2", + defaultStateAsResource = true, storages = { @Storage(file = StoragePathMacros.PROJECT_FILE), @Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/uiDesigner.xml", scheme = StorageScheme.DIRECTORY_BASED)