diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java index f9d6392d81a3..a5426cd1c564 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2017 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl; import com.intellij.codeHighlighting.Pass; @@ -57,8 +43,6 @@ import java.awt.event.MouseEvent; import java.util.*; public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor { - protected final DaemonCodeAnalyzerSettings myDaemonSettings; - protected final EditorColorsManager myColorsManager; private final Option myLambdaOption = new Option("java.lambda", "Lambda", AllIcons.Gutter.ImplementingFunctionalInterface); private final Option myOverriddenOption = new Option("java.overridden", "Overridden method", AllIcons.Gutter.OverridenMethod); private final Option myImplementedOption = new Option("java.implemented", "Implemented method", AllIcons.Gutter.ImplementedMethod); @@ -69,9 +53,12 @@ public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor { private static final CallMatcher SERVICE_LOADER_LOAD = CallMatcher.staticCall("java.util.ServiceLoader", "load", "loadInstalled"); + public JavaLineMarkerProvider() { + } + + @SuppressWarnings("unused") + @Deprecated public JavaLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings, EditorColorsManager colorsManager) { - myDaemonSettings = daemonSettings; - myColorsManager = colorsManager; } @Override @@ -112,7 +99,7 @@ public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor { } } - if (myDaemonSettings.SHOW_METHOD_SEPARATORS && element.getFirstChild() == null) { + if (DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS && element.getFirstChild() == null) { PsiElement element1 = element; boolean isMember = false; while (element1 != null && !(element1 instanceof PsiFile) && element1.getPrevSibling() == null) { @@ -139,7 +126,7 @@ public class JavaLineMarkerProvider extends LineMarkerProviderDescriptor { } if (drawSeparator) { - return LineMarkersPass.createMethodSeparatorLineMarker(element, myColorsManager); + return LineMarkersPass.createMethodSeparatorLineMarker(element, EditorColorsManager.getInstance()); } } } diff --git a/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java b/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java index e4870790eacf..7b4e76010673 100644 --- a/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java +++ b/java/manifest/src/org/jetbrains/lang/manifest/completion/ManifestCompletionContributor.java @@ -41,8 +41,8 @@ import org.jetbrains.lang.manifest.psi.ManifestTokenType; * @author Jan Thomä * @author Robert F. Beeger (robert@beeger.net) */ -public class ManifestCompletionContributor extends CompletionContributor { - public ManifestCompletionContributor(@NotNull final HeaderParserRepository repository) { +final class ManifestCompletionContributor extends CompletionContributor { + ManifestCompletionContributor() { extend(CompletionType.BASIC, PlatformPatterns.psiElement(ManifestTokenType.HEADER_NAME).withLanguage(ManifestLanguage.INSTANCE), new CompletionProvider() { @@ -50,7 +50,7 @@ public class ManifestCompletionContributor extends CompletionContributor { public void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet resultSet) { - for (String header : repository.getAllHeaderNames()) { + for (String header : HeaderParserRepository.getInstance().getAllHeaderNames()) { resultSet.addElement(LookupElementBuilder.create(header).withInsertHandler(HEADER_INSERT_HANDLER)); } } diff --git a/java/manifest/src/org/jetbrains/lang/manifest/highlighting/HeaderAnnotator.java b/java/manifest/src/org/jetbrains/lang/manifest/highlighting/HeaderAnnotator.java index 9131877a0279..13031ed0f55e 100644 --- a/java/manifest/src/org/jetbrains/lang/manifest/highlighting/HeaderAnnotator.java +++ b/java/manifest/src/org/jetbrains/lang/manifest/highlighting/HeaderAnnotator.java @@ -37,13 +37,7 @@ import org.jetbrains.lang.manifest.psi.Header; /** * @author Robert F. Beeger (robert@beeger.net) */ -public class HeaderAnnotator implements Annotator { - private final HeaderParserRepository myRepository; - - public HeaderAnnotator(@NotNull HeaderParserRepository repository) { - myRepository = repository; - } - +final class HeaderAnnotator implements Annotator { @Override public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { if (psiElement instanceof Header) { @@ -53,7 +47,7 @@ public class HeaderAnnotator implements Annotator { holder.createAnnotation(HighlightSeverity.ERROR, header.getNameElement().getTextRange(), ManifestBundle.message("header.name.invalid")); } else { - HeaderParser headerParser = myRepository.getHeaderParser(name); + HeaderParser headerParser = HeaderParserRepository.getInstance().getHeaderParser(name); if (headerParser != null) { headerParser.annotate(header, holder); } diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ThreadLocalAnnotatorMap.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ThreadLocalAnnotatorMap.java index 893b2e50fba8..95adfa907571 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ThreadLocalAnnotatorMap.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/ThreadLocalAnnotatorMap.java @@ -1,21 +1,9 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl; +import com.intellij.lang.annotation.Annotator; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.util.ReflectionUtil; import com.intellij.util.pico.CachingConstructorInjectionComponentAdapter; import gnu.trove.THashMap; import org.jetbrains.annotations.NotNull; @@ -52,7 +40,14 @@ abstract class ThreadLocalAnnotatorMap { PicoContainer container = ApplicationManager.getApplication().getPicoContainer(); for (V template : templates) { Class aClass = (Class)template.getClass(); - V clone = (V)new CachingConstructorInjectionComponentAdapter(aClass.getName(), aClass).getComponentInstance(container); + V clone; + // todo in general CachingConstructorInjectionComponentAdapter should be not used at all, but for now disable it only for known cases + if (Annotator.class.isAssignableFrom(aClass)) { + clone = ReflectionUtil.newInstance(aClass); + } + else { + clone = (V)new CachingConstructorInjectionComponentAdapter(aClass.getName(), aClass, null, true).getComponentInstance(container); + } result.add(clone); } return result; diff --git a/platform/extensions/src/com/intellij/openapi/extensions/AbstractExtensionPointBean.java b/platform/extensions/src/com/intellij/openapi/extensions/AbstractExtensionPointBean.java index 2511b2412df9..07b68c8214b5 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/AbstractExtensionPointBean.java +++ b/platform/extensions/src/com/intellij/openapi/extensions/AbstractExtensionPointBean.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.extensions; import com.intellij.openapi.diagnostic.Logger; @@ -12,7 +12,8 @@ import org.picocontainer.PicoContainer; * @author peter */ public abstract class AbstractExtensionPointBean implements PluginAware { - private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.extensions.AbstractExtensionPointBean"); + protected static final Logger LOG = Logger.getInstance("#com.intellij.openapi.extensions.AbstractExtensionPointBean"); + protected PluginDescriptor myPluginDescriptor; @Transient diff --git a/platform/extensions/src/com/intellij/openapi/extensions/CustomLoadingExtensionPointBean.java b/platform/extensions/src/com/intellij/openapi/extensions/CustomLoadingExtensionPointBean.java index e13544076a9f..21677c6742d7 100644 --- a/platform/extensions/src/com/intellij/openapi/extensions/CustomLoadingExtensionPointBean.java +++ b/platform/extensions/src/com/intellij/openapi/extensions/CustomLoadingExtensionPointBean.java @@ -1,21 +1,8 @@ -/* - * 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.extensions; +import com.intellij.util.ReflectionUtil; import com.intellij.util.xmlb.annotations.Attribute; import org.jetbrains.annotations.NotNull; import org.picocontainer.PicoContainer; @@ -43,7 +30,19 @@ public class CustomLoadingExtensionPointBean extends AbstractExtensionPointBean (myPluginDescriptor == null ? "" : myPluginDescriptor.getPluginId()) + ". " + "Check if 'implementationClass' attribute is specified"); } - return instantiate(findClass(implementationClass), picoContainer, true); + Class clazz = findClass(implementationClass); + try { + return ReflectionUtil.newInstance(clazz); + } + catch (RuntimeException e) { + if (e.getCause() instanceof NoSuchMethodException) { + LOG.error("Bean extension class constructor must not have parameters: " + implementationClass); + return instantiate(clazz, picoContainer, true); + } + else { + throw e; + } + } } } } diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt index 06e9d5eaa0b5..a9f8e93114f2 100644 --- a/platform/platform-resources/src/brokenPlugins.txt +++ b/platform/platform-resources/src/brokenPlugins.txt @@ -113,4 +113,5 @@ PerforceIC 0.10.0 0.9.6 0.9.5 0.9.4 0.9.3 0.9.2 0.9.1 0.9.0 0.8.7 com.compilerexplorer.compilerexplorer 1.13 1.12 1.11 1.10 1.9 1.8 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0 Bazel 2018.12.03.0.2 2018.11.12.0.4 ru.makkarpov.ucl 0.1 0.1.1 0.1.2 -com.undo_software.clion.reverse 2.0.0 \ No newline at end of file +com.undo_software.clion.reverse 2.0.0 +"Randori Compiler" 0.2.0 0.2.1 0.2.3 0.2.4 0.3.0 \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index ae871d0efa21..1d6e7760d3c9 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -422,7 +422,7 @@ public class ReflectionUtil { return t; } - ExceptionUtil.rethrow(e); + ExceptionUtilRt.rethrow(e); } // error will be thrown diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java index c998a68ff726..8e57f6fe5b5c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2016 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. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.codeInsight; import com.intellij.codeHighlighting.Pass; @@ -62,12 +48,7 @@ import java.util.*; * @author ilyas * Same logic as for Java LMP */ -public class GroovyLineMarkerProvider extends JavaLineMarkerProvider { - - public GroovyLineMarkerProvider(DaemonCodeAnalyzerSettings daemonSettings, EditorColorsManager colorsManager) { - super(daemonSettings, colorsManager); - } - +final class GroovyLineMarkerProvider extends JavaLineMarkerProvider { @Override public LineMarkerInfo getLineMarkerInfo(@NotNull final PsiElement element) { final PsiElement parent = element.getParent(); @@ -97,7 +78,7 @@ public class GroovyLineMarkerProvider extends JavaLineMarkerProvider { } } //need to draw method separator above docComment - if (myDaemonSettings.SHOW_METHOD_SEPARATORS && element.getFirstChild() == null) { + if (DaemonCodeAnalyzerSettings.getInstance().SHOW_METHOD_SEPARATORS && element.getFirstChild() == null) { PsiElement element1 = element; boolean isMember = false; while (element1 != null && !(element1 instanceof PsiFile) && element1.getPrevSibling() == null) { @@ -132,7 +113,7 @@ public class GroovyLineMarkerProvider extends JavaLineMarkerProvider { new LineMarkerInfo<>(element, comment != null ? comment.getTextRange() : element.getTextRange(), null, Pass.LINE_MARKERS, FunctionUtil.nullConstant(), null, GutterIconRenderer.Alignment.RIGHT); - EditorColorsScheme scheme = myColorsManager.getGlobalScheme(); + EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR); info.separatorPlacement = SeparatorPlacement.TOP; return info;