mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
do not use guava immutable map (part 2)
GitOrigin-RevId: a30122e0670b70932eed14da4c391317153c5024
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4420b58bc9
commit
1c5f802ea3
@@ -14,7 +14,6 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel" exported="" />
|
||||
<orderEntry type="module" module-name="intellij.platform.projectModel.impl" />
|
||||
<orderEntry type="module" module-name="intellij.java.indexing" exported="" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="library" name="kotlin-stdlib" level="project" />
|
||||
<orderEntry type="library" name="fastutil-min" level="project" />
|
||||
</component>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.impl
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.lang.LighterAST
|
||||
import com.intellij.lang.LighterASTNode
|
||||
@@ -28,6 +27,7 @@ import com.intellij.util.io.EnumeratorStringDescriptor
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap
|
||||
import org.jetbrains.annotations.VisibleForTesting
|
||||
import java.io.DataInput
|
||||
import java.io.DataOutput
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.impl.java;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.DataInputOutputUtilRt;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -23,7 +22,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class FunExprOccurrence {
|
||||
public final class FunExprOccurrence {
|
||||
private final int argIndex;
|
||||
private final List<? extends ReferenceChainLink> referenceContext;
|
||||
|
||||
@@ -45,10 +44,7 @@ public class FunExprOccurrence {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this)
|
||||
.add("argIndex", argIndex)
|
||||
.add("chain", referenceContext)
|
||||
.toString();
|
||||
return "FunExprOccurrence(argIndex=" + argIndex + ", chain=" + referenceContext + ")";
|
||||
}
|
||||
|
||||
void serialize(DataOutput out) throws IOException {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.json.highlighting;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.json.JsonBundle;
|
||||
import com.intellij.json.JsonLanguage;
|
||||
@@ -15,7 +14,6 @@ import com.intellij.openapi.options.colors.RainbowColorSettingsPage;
|
||||
import com.intellij.psi.codeStyle.DisplayPriority;
|
||||
import com.intellij.psi.codeStyle.DisplayPrioritySortable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Map;
|
||||
@@ -25,8 +23,8 @@ import static com.intellij.json.highlighting.JsonSyntaxHighlighterFactory.*;
|
||||
/**
|
||||
* @author Mikhail Golubev
|
||||
*/
|
||||
public class JsonColorsPage implements RainbowColorSettingsPage, DisplayPrioritySortable {
|
||||
private static final Map<String, TextAttributesKey> ourAdditionalHighlighting = ImmutableMap.of("propertyKey", JSON_PROPERTY_KEY);
|
||||
public final class JsonColorsPage implements RainbowColorSettingsPage, DisplayPrioritySortable {
|
||||
private static final Map<String, TextAttributesKey> ourAdditionalHighlighting = Map.of("propertyKey", JSON_PROPERTY_KEY);
|
||||
|
||||
private static final AttributesDescriptor[] ourAttributeDescriptors = new AttributesDescriptor[]{
|
||||
new AttributesDescriptor(JsonBundle.messagePointer("color.page.attribute.property.key"), JSON_PROPERTY_KEY),
|
||||
@@ -46,7 +44,7 @@ public class JsonColorsPage implements RainbowColorSettingsPage, DisplayPriority
|
||||
};
|
||||
|
||||
@Override
|
||||
public @Nullable Icon getIcon() {
|
||||
public @NotNull Icon getIcon() {
|
||||
return AllIcons.FileTypes.Json;
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ public class JsonColorsPage implements RainbowColorSettingsPage, DisplayPriority
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
|
||||
public @NotNull Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
|
||||
return ourAdditionalHighlighting;
|
||||
}
|
||||
|
||||
@@ -111,7 +109,7 @@ public class JsonColorsPage implements RainbowColorSettingsPage, DisplayPriority
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Language getLanguage() {
|
||||
public @NotNull Language getLanguage() {
|
||||
return JsonLanguage.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.remote;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.credentialStore.CredentialAttributes;
|
||||
import com.intellij.credentialStore.CredentialAttributesKt;
|
||||
import com.intellij.credentialStore.Credentials;
|
||||
@@ -39,7 +38,7 @@ public class RemoteCredentialsHolder implements MutableRemoteCredentials {
|
||||
|
||||
@NonNls public static final String SSH_PREFIX = "ssh://";
|
||||
|
||||
private static final Map<AuthType, @NonNls String> CREDENTIAL_ATTRIBUTES_QUALIFIERS = ImmutableMap.of(AuthType.PASSWORD, "password",
|
||||
private static final Map<AuthType, @NonNls String> CREDENTIAL_ATTRIBUTES_QUALIFIERS = Map.of(AuthType.PASSWORD, "password",
|
||||
AuthType.KEY_PAIR, "passphrase",
|
||||
AuthType.OPEN_SSH, "empty");
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="org.codehaus.groovy:groovy" level="project" />
|
||||
<orderEntry type="library" name="Guava" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.java.testFramework" scope="TEST" />
|
||||
<orderEntry type="module" module-name="intellij.java" />
|
||||
<orderEntry type="module" module-name="intellij.junit" scope="TEST" />
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// 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.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.ext.spock;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.intellij.openapi.util.RecursionManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.VisibleForTesting;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightVariable;
|
||||
@@ -15,7 +15,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GrLightVariable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SpockVariableDescriptor {
|
||||
public final class SpockVariableDescriptor {
|
||||
|
||||
private final String myName;
|
||||
|
||||
@@ -63,8 +63,7 @@ public class SpockVariableDescriptor {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@NotNull
|
||||
public PsiType getType() {
|
||||
public @NotNull PsiType getType() {
|
||||
PsiManager manager = myNavigationElement.getManager();
|
||||
PsiType type = RecursionManager.doPreventingRecursion(this, true, () -> {
|
||||
PsiType res = null;
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
/*
|
||||
* 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.lang.resolve.ast;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
|
||||
@@ -25,14 +10,21 @@ import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
import org.jetbrains.plugins.groovy.transformations.AstTransformationSupport;
|
||||
import org.jetbrains.plugins.groovy.transformations.TransformationContext;
|
||||
|
||||
public class LoggingContributor implements AstTransformationSupport {
|
||||
private static final ImmutableMap<String, String> ourLoggers = ImmutableMap.<String, String>builder().
|
||||
put("groovy.util.logging.Log", "java.util.logging.Logger").
|
||||
put("groovy.util.logging.Commons", "org.apache.commons.logging.Log").
|
||||
put("groovy.util.logging.Log4j", "org.apache.log4j.Logger").
|
||||
put("groovy.util.logging.Log4j2", "org.apache.logging.log4j.core.Logger").
|
||||
put("groovy.util.logging.Slf4j", "org.slf4j.Logger").
|
||||
build();
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public final class LoggingContributor implements AstTransformationSupport {
|
||||
private static final Map<String, String> loggers;
|
||||
|
||||
static {
|
||||
Map<String, String> map = new HashMap<>(5);
|
||||
map.put("groovy.util.logging.Log", "java.util.logging.Logger");
|
||||
map.put("groovy.util.logging.Commons", "org.apache.commons.logging.Log");
|
||||
map.put("groovy.util.logging.Log4j", "org.apache.log4j.Logger");
|
||||
map.put("groovy.util.logging.Log4j2", "org.apache.logging.log4j.core.Logger");
|
||||
map.put("groovy.util.logging.Slf4j", "org.slf4j.Logger");
|
||||
loggers = map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTransformation(@NotNull TransformationContext context) {
|
||||
@@ -41,7 +33,7 @@ public class LoggingContributor implements AstTransformationSupport {
|
||||
|
||||
for (GrAnnotation annotation : modifierList.getAnnotations()) {
|
||||
String qname = annotation.getQualifiedName();
|
||||
String logger = ourLoggers.get(qname);
|
||||
String logger = loggers.get(qname);
|
||||
if (logger != null) {
|
||||
String fieldName = PsiUtil.getAnnoAttributeValue(annotation, "value", "log");
|
||||
GrLightField field = new GrLightField(fieldName, logger, context.getCodeClass());
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.groovy.swingBuilder;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.UserDataHolderEx;
|
||||
@@ -26,7 +25,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContributor {
|
||||
public final class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContributor {
|
||||
|
||||
private static final Key<MultiMap<String, PsiMethod>> KEY = Key.create("SwingBuilderNonCodeMemberContributor.KEY");
|
||||
|
||||
@@ -191,21 +190,21 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
Map.entry("group", NamedArgumentDescriptor.SIMPLE_ON_TOP)));
|
||||
|
||||
methodObject("bindProxy", "org.codehaus.groovy.binding.BindingProxy", "groovy.swing.factory.BindProxyFactory",
|
||||
ImmutableMap.of("bind", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("bind", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
methodObject("bindGroup", "org.codehaus.groovy.binding.AggregateBinding", "groovy.swing.factory.BindGroupFactory",
|
||||
ImmutableMap.of("bind", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("bind", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
|
||||
// registerPassThruNodes()
|
||||
methodObject("widget", "java.awt.Component", "groovy.swing.factory.WidgetFactory", ImmutableMap
|
||||
methodObject("widget", "java.awt.Component", "groovy.swing.factory.WidgetFactory", Map
|
||||
.of("widget", new TypeCondition(type("java.awt.Component"))));
|
||||
|
||||
methodObject("container", "java.awt.Component", "groovy.swing.factory.WidgetFactory", ImmutableMap
|
||||
methodObject("container", "java.awt.Component", "groovy.swing.factory.WidgetFactory", Map
|
||||
.of("container", new TypeCondition(type("java.awt.Component"))));
|
||||
|
||||
methodObject("bean", CommonClassNames.JAVA_LANG_OBJECT, "groovy.swing.factory.WidgetFactory",
|
||||
ImmutableMap.of("bean", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("bean", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
// registerWindows()
|
||||
methodObject("dialog", "javax.swing.JDialog", "groovy.swing.factory.DialogFactory",
|
||||
@@ -243,7 +242,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
methodObject("textField", "javax.swing.JTextField", "groovy.swing.factory.TextArgWidgetFactory");
|
||||
methodObject("textPane", "javax.swing.JTextPane", "groovy.swing.factory.TextArgWidgetFactory");
|
||||
methodObject("formattedTextField", "javax.swing.JFormattedTextField", "groovy.swing.factory.FormattedTextFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"format", new TypeCondition(type("java.text.Format")),
|
||||
"value", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
@@ -254,10 +253,10 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
// registerBasicWidgets()
|
||||
methodObject("colorChooser", "javax.swing.JColorChooser", null);
|
||||
methodObject("comboBox", "javax.swing.JComboBox", "groovy.swing.factory.ComboBoxFactory",
|
||||
ImmutableMap.of("items", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("items", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
methodObject("list", "javax.swing.JList", "groovy.swing.factory.ListFactory",
|
||||
ImmutableMap.of("items", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("items", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
methodObject("progressBar", "javax.swing.JProgressBar", null);
|
||||
methodObject("separator", "javax.swing.JSeparator", "groovy.swing.factory.SeparatorFactory");
|
||||
@@ -291,14 +290,14 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
methodObject("table", "javax.swing.JTable", "groovy.swing.factory.TableFactory");
|
||||
methodObject("tableColumn", "javax.swing.table.TableColumn", null);
|
||||
methodObject("tableModel", "javax.swing.table.TableModel", "groovy.swing.factory.TableModelFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"tableModel", new TypeCondition(type("javax.swing.table.TableModel")),
|
||||
"model", new TypeCondition(type("groovy.model.ValueModel")),
|
||||
"list", NamedArgumentDescriptor.SIMPLE_ON_TOP
|
||||
));
|
||||
|
||||
methodObject("propertyColumn", "javax.swing.table.TableColumn", "groovy.swing.factory.PropertyColumnFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"propertyName", NamedArgumentDescriptor.TYPE_STRING,
|
||||
"header", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
"type", new TypeCondition(type(CommonClassNames.JAVA_LANG_CLASS)),
|
||||
@@ -306,7 +305,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
));
|
||||
|
||||
methodObject("closureColumn", "javax.swing.table.TableColumn", "groovy.swing.factory.ClosureColumnFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"header", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
"read", new TypeCondition(type(GroovyCommonClassNames.GROOVY_LANG_CLOSURE)),
|
||||
"write", new TypeCondition(type(GroovyCommonClassNames.GROOVY_LANG_CLOSURE)),
|
||||
@@ -316,7 +315,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
methodObject("columnModel", "javax.swing.table.TableColumnModel", "groovy.swing.factory.ColumnModelFactory");
|
||||
|
||||
methodObject("column", "javax.swing.table.TableColumn", "groovy.swing.factory.ColumnFactory",
|
||||
ImmutableMap.of("width", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("width", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
// registerBasicLayouts()
|
||||
methodObject("borderLayout", "java.awt.BorderLayout", "groovy.swing.factory.LayoutFactory");
|
||||
@@ -331,24 +330,24 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
|
||||
// registerBoxLayout()
|
||||
methodObject("boxLayout", "javax.swing.BoxLayout", "groovy.swing.factory.BoxLayoutFactory",
|
||||
ImmutableMap.of("axis", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
Map.of("axis", NamedArgumentDescriptor.SIMPLE_ON_TOP));
|
||||
|
||||
methodObject("box", "javax.swing.Box", "groovy.swing.factory.BoxFactory", ImmutableMap.of(
|
||||
methodObject("box", "javax.swing.Box", "groovy.swing.factory.BoxFactory", Map.of(
|
||||
"axis", new TypeCondition(type("java.lang.Number"))));
|
||||
|
||||
methodObject("hbox", "javax.swing.Box", "groovy.swing.factory.HBoxFactory");
|
||||
methodObject("hglue", "java.awt.Component", "groovy.swing.factory.HGlueFactory");
|
||||
methodObject("hstrut", "java.awt.Component", "groovy.swing.factory.HStrutFactory", ImmutableMap.of(
|
||||
methodObject("hstrut", "java.awt.Component", "groovy.swing.factory.HStrutFactory", Map.of(
|
||||
"width", new TypeCondition(type("java.lang.Number"))));
|
||||
|
||||
methodObject("vbox", "javax.swing.Box", "groovy.swing.factory.VBoxFactory");
|
||||
methodObject("vglue", "java.awt.Component", "groovy.swing.factory.VGlueFactory");
|
||||
methodObject("vstrut", "java.awt.Component", "groovy.swing.factory.VStrutFactory", ImmutableMap.of(
|
||||
methodObject("vstrut", "java.awt.Component", "groovy.swing.factory.VStrutFactory", Map.of(
|
||||
"height", new TypeCondition(type("java.lang.Number"))));
|
||||
|
||||
methodObject("glue", "java.awt.Component", "groovy.swing.factory.GlueFactory");
|
||||
methodObject("rigidArea", "java.awt.Component", "groovy.swing.factory.RigidAreaFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"size", new TypeCondition(type("java.awt.Dimension")),
|
||||
"height", new TypeCondition(type("java.lang.Number")),
|
||||
"width", new TypeCondition(type("java.lang.Number"))
|
||||
@@ -361,7 +360,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
|
||||
// registerBorders()
|
||||
methodObject("lineBorder", "javax.swing.border.LineBorder", "groovy.swing.factory.LineBorderFactory",
|
||||
ImmutableMap.of(
|
||||
Map.of(
|
||||
"parent", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
"color", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
"thickness", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
@@ -721,7 +720,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
// .setNamedParameters(m).setMethodKind(null));
|
||||
//
|
||||
//
|
||||
// m = ImmutableMap.of(
|
||||
// m = Map.of(
|
||||
// "parent", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
// "highlight", namedArgColor,
|
||||
// "shadow", namedArgColor
|
||||
@@ -752,7 +751,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
// CommonClassNames.JAVA_UTIL_LIST, false)
|
||||
// .setMethodKind(null));
|
||||
// add(methodWithAttr("emptyBorder", "javax.swing.border.Border", "groovy.swing.factory.EmptyBorderFactory").addClosureParam()
|
||||
// .setNamedParameters(ImmutableMap.of(
|
||||
// .setNamedParameters(Map.of(
|
||||
// "parent", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
// "top", NamedArgumentDescriptor.TYPE_INTEGER,
|
||||
// "left", NamedArgumentDescriptor.TYPE_INTEGER,
|
||||
@@ -761,7 +760,7 @@ public class SwingBuilderNonCodeMemberContributor extends NonCodeMembersContribu
|
||||
// ))
|
||||
// );
|
||||
// add(method("compoundBorder", "javax.swing.border.CompoundBorder", "groovy.swing.factory.CompoundBorderFactory", "value",CommonClassNames.JAVA_UTIL_LIST, false)
|
||||
// .setNamedParameters(ImmutableMap.of(
|
||||
// .setNamedParameters(Map.of(
|
||||
// "parent", NamedArgumentDescriptor.SIMPLE_ON_TOP,
|
||||
// "inner", new NamedArgumentDescriptor.TypeCondition(type("javax.swing.border.Border")),
|
||||
// "outer", new NamedArgumentDescriptor.TypeCondition(type("javax.swing.border.Border"))
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.maven.importing;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.intellij.build.events.MessageEvent;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.ide.highlighter.ModuleFileType;
|
||||
@@ -44,26 +43,24 @@ public final class MavenImportUtil {
|
||||
public static final String TEST_SUFFIX = ".test";
|
||||
public static final String MAIN_SUFFIX = ".main";
|
||||
|
||||
private static final Map<String, LanguageLevel> MAVEN_IDEA_PLUGIN_LEVELS = ImmutableMap.of(
|
||||
private static final Map<String, LanguageLevel> MAVEN_IDEA_PLUGIN_LEVELS = Map.of(
|
||||
"JDK_1_3", LanguageLevel.JDK_1_3,
|
||||
"JDK_1_4", LanguageLevel.JDK_1_4,
|
||||
"JDK_1_5", LanguageLevel.JDK_1_5,
|
||||
"JDK_1_6", LanguageLevel.JDK_1_6,
|
||||
"JDK_1_7", LanguageLevel.JDK_1_7);
|
||||
|
||||
@NotNull
|
||||
public static String getArtifactUrlForClassifierAndExtension(@NotNull MavenArtifact artifact,
|
||||
@Nullable String classifier,
|
||||
@Nullable String extension) {
|
||||
public static @NotNull String getArtifactUrlForClassifierAndExtension(@NotNull MavenArtifact artifact,
|
||||
@Nullable String classifier,
|
||||
@Nullable String extension) {
|
||||
|
||||
String newPath = artifact.getPathForExtraArtifact(classifier, extension);
|
||||
return VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, newPath) + JarFileSystem.JAR_SEPARATOR;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getArtifactUrl(@NotNull MavenArtifact artifact,
|
||||
@NotNull MavenExtraArtifactType artifactType,
|
||||
@NotNull MavenProject project) {
|
||||
public static @NotNull String getArtifactUrl(@NotNull MavenArtifact artifact,
|
||||
@NotNull MavenExtraArtifactType artifactType,
|
||||
@NotNull MavenProject project) {
|
||||
|
||||
Pair<String, String> result = project.getClassifierAndExtension(artifact, artifactType);
|
||||
String classifier = result.first;
|
||||
@@ -90,7 +87,8 @@ public final class MavenImportUtil {
|
||||
|
||||
Element cfg = mavenProject.getPluginConfiguration("com.googlecode", "maven-idea-plugin");
|
||||
if (cfg != null) {
|
||||
level = MAVEN_IDEA_PLUGIN_LEVELS.get(cfg.getChildTextTrim("jdkLevel"));
|
||||
String key = cfg.getChildTextTrim("jdkLevel");
|
||||
level = key == null ? null : MAVEN_IDEA_PLUGIN_LEVELS.get(key);
|
||||
}
|
||||
|
||||
if (level == null) {
|
||||
@@ -109,8 +107,7 @@ public final class MavenImportUtil {
|
||||
return level;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static MavenJavaVersionHolder getMavenJavaVersions(@NotNull MavenProject mavenProject) {
|
||||
public static @NotNull MavenJavaVersionHolder getMavenJavaVersions(@NotNull MavenProject mavenProject) {
|
||||
boolean useReleaseCompilerProp = isReleaseCompilerProp(mavenProject);
|
||||
LanguageLevel sourceVersion = getMavenLanguageLevel(mavenProject, useReleaseCompilerProp, true, false);
|
||||
LanguageLevel sourceTestVersion = getMavenLanguageLevel(mavenProject, useReleaseCompilerProp, true, true);
|
||||
@@ -119,11 +116,10 @@ public final class MavenImportUtil {
|
||||
return new MavenJavaVersionHolder(sourceVersion, targetVersion, sourceTestVersion, targetTestVersion);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static LanguageLevel getMavenLanguageLevel(@NotNull MavenProject mavenProject,
|
||||
boolean useReleaseCompilerProp,
|
||||
boolean isSource,
|
||||
boolean isTest) {
|
||||
private static @Nullable LanguageLevel getMavenLanguageLevel(@NotNull MavenProject mavenProject,
|
||||
boolean useReleaseCompilerProp,
|
||||
boolean isSource,
|
||||
boolean isTest) {
|
||||
String mavenProjectReleaseLevel = useReleaseCompilerProp
|
||||
? isTest ? mavenProject.getTestReleaseLevel() : mavenProject.getReleaseLevel()
|
||||
: null;
|
||||
@@ -138,8 +134,7 @@ public final class MavenImportUtil {
|
||||
return level;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static LanguageLevel adjustLevelAndNotify(@NotNull Project project, @NotNull LanguageLevel level) {
|
||||
public static @NotNull LanguageLevel adjustLevelAndNotify(@NotNull Project project, @NotNull LanguageLevel level) {
|
||||
if (!AcceptedLanguageLevelsSettings.isLanguageLevelAccepted(level)) {
|
||||
LanguageLevel highestAcceptedLevel = AcceptedLanguageLevelsSettings.getHighestAcceptedLevel();
|
||||
if (highestAcceptedLevel.isLessThan(level)) {
|
||||
@@ -160,8 +155,7 @@ public final class MavenImportUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static LanguageLevel getDefaultLevel(MavenProject mavenProject) {
|
||||
public static @NotNull LanguageLevel getDefaultLevel(MavenProject mavenProject) {
|
||||
MavenPlugin plugin = mavenProject.findPlugin("org.apache.maven.plugins", "maven-compiler-plugin");
|
||||
if (plugin != null && plugin.getVersion() != null) {
|
||||
//https://github.com/apache/maven-compiler-plugin/blob/master/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
|
||||
@@ -226,8 +220,7 @@ public final class MavenImportUtil {
|
||||
return moduleName.length() > 5 && moduleName.endsWith(TEST_SUFFIX);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getParentModuleName(@NotNull String moduleName) {
|
||||
public static @NotNull String getParentModuleName(@NotNull String moduleName) {
|
||||
if (isMainModule(moduleName)) {
|
||||
return StringUtil.trimEnd(moduleName, MAIN_SUFFIX);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.maven.tasks;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.RunManagerEx;
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
@@ -22,6 +21,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.DisposableWrapperList;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -127,7 +127,7 @@ public final class MavenTasksManager extends MavenSimpleProjectComponent impleme
|
||||
var tasks = before ? myState.beforeCompileTasks : myState.afterCompileTasks;
|
||||
|
||||
if (context.isRebuild()) {
|
||||
tasks = Sets.union(before ? myState.beforeRebuildTask : myState.afterRebuildTask, tasks);
|
||||
tasks = ContainerUtil.union(before ? myState.beforeRebuildTask : myState.afterRebuildTask, tasks);
|
||||
}
|
||||
|
||||
var projectsManager = MavenProjectsManager.getInstance(myProject);
|
||||
|
||||
Reference in New Issue
Block a user