GitOrigin-RevId: b2b54b70b651b62609822eeb5a59ba2a0fd61e5f
This commit is contained in:
Vladimir Krivosheev
2021-01-21 14:35:18 +00:00
committed by intellij-monorepo-bot
parent b6db9917e3
commit 3327e0668c
22 changed files with 51 additions and 159 deletions
@@ -13,9 +13,10 @@
<orderEntry type="module" module-name="intellij.platform.extensions" />
<orderEntry type="module" module-name="intellij.platform.core" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.editor" exported="" />
<orderEntry type="module" module-name="intellij.platform.editor" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.util.ex" />
</component>
</module>
@@ -1,14 +1,13 @@
// 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-2021 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.util.lang;
import com.intellij.util.io.DirectByteBufferPool;
import com.intellij.util.io.InputStreamEx;
import org.jetbrains.annotations.NotNull;
import java.io.InputStream;
import java.nio.ByteBuffer;
final class DirectByteBufferBackedInputStream extends InputStream implements InputStreamEx {
final class DirectByteBufferBackedInputStream extends InputStream {
private ByteBuffer buffer;
DirectByteBufferBackedInputStream(ByteBuffer buffer) {
@@ -152,11 +152,6 @@ public final class ZipResourceFile implements ResourceFile {
return new ZipFileResource(jarLoader.url, entry, zipFile);
}
@Override
public void close() throws IOException {
zipFile.close();
}
private static final class ZipFileResource implements Resource {
private final URL baseUrl;
private URL url;
@@ -15,5 +15,6 @@
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
<orderEntry type="library" name="StreamEx" level="project" />
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.editor" />
</component>
</module>
@@ -1,4 +1,4 @@
// 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-2021 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.formatting;
import com.intellij.CodeStyleBundle;
@@ -166,7 +166,7 @@ public final class FormattingProgressTask extends SequentialModalProgressTask im
}
}
private class MyCancelCallback implements Runnable {
private final class MyCancelCallback implements Runnable {
@Override
public void run() {
FORMATTING_CANCELLED_FLAG.set(true);
@@ -1,5 +1,4 @@
// 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-2021 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.psi.formatter;
import com.intellij.application.options.CodeStyle;
@@ -22,8 +21,7 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtilBase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class FormattingDocumentModelImpl implements FormattingDocumentModel {
public final class FormattingDocumentModelImpl implements FormattingDocumentModel {
private final WhiteSpaceFormattingStrategy myWhiteSpaceStrategy;
@NotNull private final Document myDocument;
@NotNull private final PsiFile myFile;
@@ -1,5 +1,4 @@
// 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-2021 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.psi.impl.source.codeStyle;
import com.intellij.CodeStyleBundle;
@@ -151,13 +151,6 @@ public class JarLoader extends Loader {
}
}
protected final void releaseZipFile(@NotNull ResourceFile zipFile) throws IOException {
// Closing of zip file when configuration.canLockJars=true happens in ZipFile.finalize
if (!configuration.lockJars) {
zipFile.close();
}
}
@Override
public final String toString() {
return "JarLoader [" + path + "]";
@@ -101,7 +101,6 @@ public final class JdkZipResourceFile implements ResourceFile {
return isSecureLoader ? new JarFile(file) : new ZipFile(file);
}
@Override
public void close() throws IOException {
SoftReference<ZipFile> ref = zipFileSoftReference;
ZipFile zipFile = ref == null ? null : ref.get();
@@ -173,7 +172,7 @@ public final class JdkZipResourceFile implements ResourceFile {
return new SecureJarResource(jarLoader.url, (JarEntry)entry, (SecureJarLoader)jarLoader);
}
else {
return new ZipFileResource(jarLoader.url, entry, jarLoader);
return new ZipFileResource(jarLoader.url, entry, this);
}
}
finally {
@@ -267,12 +266,12 @@ public final class JdkZipResourceFile implements ResourceFile {
protected final URL baseUrl;
private URL url;
protected final ZipEntry entry;
protected final JarLoader jarLoader;
protected final JdkZipResourceFile file;
private ZipFileResource(@NotNull URL baseUrl, @NotNull ZipEntry entry, @NotNull JarLoader jarLoader) {
private ZipFileResource(@NotNull URL baseUrl, @NotNull ZipEntry entry, @NotNull JdkZipResourceFile file) {
this.baseUrl = baseUrl;
this.entry = entry;
this.jarLoader = jarLoader;
this.file = file;
}
@Override
@@ -302,29 +301,31 @@ public final class JdkZipResourceFile implements ResourceFile {
@Override
public byte @NotNull [] getBytes() throws IOException {
JdkZipResourceFile file = (JdkZipResourceFile)jarLoader.zipFile;
try (InputStream stream = file.getZipFile().getInputStream(entry)) {
return loadBytes(stream, (int)entry.getSize());
}
finally {
jarLoader.releaseZipFile(file);
if (!file.lockJars) {
file.close();
}
}
}
}
private static final class SecureJarResource extends JdkZipResourceFile.ZipFileResource {
SecureJarResource(@NotNull URL baseUrl, @NotNull JarEntry entry, @NotNull SecureJarLoader jarLoader) {
super(baseUrl, entry, jarLoader);
super(baseUrl, entry, (JdkZipResourceFile)jarLoader.zipFile);
}
@Override
public byte @NotNull [] getBytes() throws IOException {
JdkZipResourceFile resourceFile = (JdkZipResourceFile)jarLoader.zipFile;
try (InputStream stream = resourceFile.getZipFile().getInputStream(entry)) {
try (InputStream stream = file.getZipFile().getInputStream(entry)) {
return loadBytes(stream, (int)entry.getSize());
}
finally {
jarLoader.releaseZipFile(resourceFile);
if (!file.lockJars) {
file.close();
}
}
}
}
@@ -4,14 +4,13 @@ package com.intellij.util.lang;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
import java.util.jar.Attributes;
public interface ResourceFile extends Closeable {
public interface ResourceFile {
@Nullable Attributes loadManifestAttributes() throws IOException;
@NotNull ClasspathCache.IndexRegistrar buildClassPathCacheData() throws IOException;
@@ -1,11 +1,8 @@
// 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-2021 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.util;
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
import com.intellij.openapi.util.io.FileUtilRt;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.Strings;
import com.intellij.util.io.InputStreamEx;
import com.intellij.util.io.URLUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -40,7 +37,6 @@ public final class ResourceUtil {
public static InputStream getResourceAsStream(@NotNull ClassLoader loader, @NonNls @NotNull String basePath, @NonNls @NotNull String fileName) {
String fixedPath = StringUtil.trimStart(Strings.trimEnd(basePath, "/"), "/");
if (fixedPath.isEmpty()) {
return loader.getResourceAsStream(fileName);
}
@@ -136,14 +132,7 @@ public final class ResourceUtil {
public static @NotNull String loadText(@NotNull InputStream in) throws IOException {
try {
if (in instanceof InputStreamEx) {
return new String(((InputStreamEx)in).readAllBytes(), StandardCharsets.UTF_8);
}
else {
BufferExposingByteArrayOutputStream buffer = new BufferExposingByteArrayOutputStream();
FileUtilRt.copy(in, buffer);
return new String(buffer.getInternalBuffer(), 0, buffer.size(), StandardCharsets.UTF_8);
}
return new String(in.readAllBytes(), StandardCharsets.UTF_8);
}
finally {
in.close();
@@ -1,15 +0,0 @@
// 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.
package com.intellij.util.io;
import com.intellij.ReviseWhenPortedToJDK;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
@ApiStatus.Internal
public interface InputStreamEx {
@NotNull
@ReviseWhenPortedToJDK("9") // there's is java.io.InputStream.readAllBytes
byte [] readAllBytes() throws IOException;
}
@@ -1,4 +1,4 @@
// 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-2021 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.vcs.changes.patch;
import com.intellij.diff.DiffDialogHints;
@@ -52,7 +52,6 @@ import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLoadingPanel;
import com.intellij.util.Alarm;
import com.intellij.util.NullableConsumer;
import com.intellij.util.concurrency.annotations.RequiresEdt;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
@@ -74,6 +73,7 @@ import java.io.InputStreamReader;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static com.intellij.openapi.util.text.StringUtil.isEmptyOrSpaces;
@@ -82,7 +82,6 @@ import static com.intellij.util.ObjectUtils.chooseNotNull;
import static com.intellij.util.containers.ContainerUtil.map;
public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
private static final Logger LOG = Logger.getInstance(ApplyPatchDifferentiatedDialog.class);
private final ZipperUpdater myLoadQueue;
private final TextFieldWithBrowseButton myPatchFile;
@@ -206,9 +205,9 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.areChangeListsEnabled()) {
myChangeListChooser = new ChangeListChooserPanel(project, new NullableConsumer<>() {
myChangeListChooser = new ChangeListChooserPanel(project, new Consumer<>() {
@Override
public void consume(final @Nullable @NlsContexts.DialogMessage String errorMessage) {
public void accept(final @Nullable @NlsContexts.DialogMessage String errorMessage) {
setOKActionEnabled(errorMessage == null && isChangeTreeEnabled());
setErrorText(errorMessage, myChangeListChooser);
}
@@ -1,18 +1,18 @@
// 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-2021 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.vcs.changes.ui;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.LocalChangeList;
import com.intellij.util.NullableConsumer;
import com.intellij.openapi.util.NlsContexts;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collection;
import java.util.function.Consumer;
public class ChangeListChooser extends DialogWrapper {
private final Project myProject;
@@ -27,9 +27,9 @@ public class ChangeListChooser extends DialogWrapper {
super(project, false);
myProject = project;
myPanel = new ChangeListChooserPanel(myProject, new NullableConsumer<>() {
myPanel = new ChangeListChooserPanel(myProject, new Consumer<>() {
@Override
public void consume(final @Nullable @NlsContexts.DialogMessage String errorMessage) {
public void accept(final @Nullable @NlsContexts.DialogMessage String errorMessage) {
setOKActionEnabled(errorMessage == null);
setErrorText(errorMessage, myPanel);
}
@@ -1,4 +1,4 @@
// 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-2021 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.vcs.changes.ui;
import com.intellij.openapi.application.ApplicationManager;
@@ -15,7 +15,6 @@ import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.ui.*;
import com.intellij.ui.scale.JBUIScale;
import com.intellij.util.NullableConsumer;
import com.intellij.util.concurrency.annotations.RequiresEdt;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.Nls;
@@ -28,18 +27,18 @@ import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.util.Collection;
import java.util.Objects;
import java.util.function.Consumer;
public class ChangeListChooserPanel extends JPanel {
public final class ChangeListChooserPanel extends JPanel {
private final MyEditorComboBox myExistingListsCombo;
private final NewEditChangelistPanel myListPanel;
private final NullableConsumer<? super String> myOkEnabledListener;
private final Consumer<? super String> myOkEnabledListener;
private final Project myProject;
private String myLastTypedDescription;
private boolean myNewNameSuggested = false;
@Nullable private ChangeListData myData;
public ChangeListChooserPanel(final Project project, @NotNull final NullableConsumer<? super String> okEnabledListener) {
public ChangeListChooserPanel(final Project project, @NotNull Consumer<? super @Nullable String> okEnabledListener) {
super(new BorderLayout());
myProject = project;
myExistingListsCombo = new MyEditorComboBox();
@@ -77,7 +76,7 @@ public class ChangeListChooserPanel extends JPanel {
protected void nameChanged(String errorMessage) {
//invoke later because of undo manager problem: when you try to undo changelist after description was already changed manually
ApplicationManager.getApplication().invokeLater(() -> updateDescription(), ModalityState.current());
myOkEnabledListener.consume(errorMessage);
myOkEnabledListener.accept(errorMessage);
}
@Override
@@ -24,5 +24,6 @@
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.core.ui" />
<orderEntry type="module" module-name="intellij.platform.codeStyle" />
<orderEntry type="module" module-name="intellij.platform.editor" />
</component>
</module>
@@ -14,5 +14,6 @@
<orderEntry type="module" module-name="intellij.xml.analysis" exported="" />
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="module" module-name="intellij.platform.editor" />
</component>
</module>
@@ -1,19 +1,4 @@
/*
* Copyright 2000-2013 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-2021 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.codeInspection.htmlInspections;
import com.intellij.codeInsight.intention.IntentionAction;
@@ -22,11 +7,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiErrorElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.XmlTag;
@@ -38,10 +19,7 @@ import com.intellij.xml.util.XmlTagUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author spleaner
*/
public class RenameTagBeginOrEndIntentionAction implements IntentionAction {
public final class RenameTagBeginOrEndIntentionAction implements IntentionAction {
private final boolean myStart;
private final String myTargetName;
private final String mySourceName;
@@ -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-2021 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.codeInspection.htmlInspections;
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
@@ -34,7 +20,6 @@ import org.jetbrains.annotations.Nullable;
* @author Eugene.Kudelevsky
*/
public class SwitchToHtml5Action implements LocalQuickFix, IntentionAction {
@NotNull
@Override
public String getFamilyName() {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 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-2021 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.codeInspection.htmlInspections;
import com.intellij.codeInsight.intention.HighPriorityAction;
@@ -20,5 +6,5 @@ import com.intellij.codeInsight.intention.HighPriorityAction;
/**
* @author Eugene.Kudelevsky
*/
public class SwitchToHtml5WithHighPriorityAction extends SwitchToHtml5Action implements HighPriorityAction {
public final class SwitchToHtml5WithHighPriorityAction extends SwitchToHtml5Action implements HighPriorityAction {
}
@@ -1,19 +1,4 @@
/*
* 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-2021 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.codeInspection.htmlInspections;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
@@ -34,10 +19,7 @@ import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* @author spleaner
*/
public class XmlWrongRootElementInspection extends HtmlLocalInspectionTool {
public final class XmlWrongRootElementInspection extends HtmlLocalInspectionTool {
@Override
@NonNls
@NotNull
+1
View File
@@ -12,5 +12,6 @@
<orderEntry type="module" module-name="intellij.platform.projectModel" />
<orderEntry type="module" module-name="intellij.platform.analysis" />
<orderEntry type="library" name="fastutil-min" level="project" />
<orderEntry type="module" module-name="intellij.platform.editor" />
</component>
</module>