From b5808d2c51055a1d445ea51edad68f830829a09c Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Mon, 6 Mar 2023 13:17:33 +0100 Subject: [PATCH] Warnings fixed GitOrigin-RevId: a4b665021ed3e1a3ea81d9333db0811afe2a529f --- .../PersistentFSAttributeAccessor.java | 16 +++++++-------- .../CreateXmlElementIntentionAction.java | 20 +++---------------- ...erateInstanceDocumentFromSchemaDialog.java | 17 ++++++++-------- 3 files changed, 19 insertions(+), 34 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSAttributeAccessor.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSAttributeAccessor.java index 20073df02a9c..6b99962f7066 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSAttributeAccessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSAttributeAccessor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.openapi.vfs.newvfs.persistent; import com.intellij.openapi.vfs.newvfs.AttributeInputStream; @@ -50,7 +50,7 @@ final class PersistentFSAttributeAccessor { //======== RC: methods to access attributesStorage raw byteBuffer, if storage supports it - protected boolean supportsRawAccess() { + boolean supportsRawAccess() { return attributesStorage instanceof AttributesStorageOverBlobStorage; } @@ -61,11 +61,10 @@ final class PersistentFSAttributeAccessor { * * @return null if an appropriate attribute record does not exist */ - protected @Nullable R readAttributeRaw(final int fileId, - final @NotNull FileAttribute attribute, - final ByteBufferReader reader) throws IOException { - if (attributesStorage instanceof AttributesStorageOverBlobStorage) { - final AttributesStorageOverBlobStorage storage = (AttributesStorageOverBlobStorage)attributesStorage; + @Nullable R readAttributeRaw(final int fileId, + final @NotNull FileAttribute attribute, + final ByteBufferReader reader) throws IOException { + if (attributesStorage instanceof AttributesStorageOverBlobStorage storage) { return storage.readAttributeRaw(connection, fileId, attribute, buffer -> { if (attribute.isVersioned()) { final int actualVersion = DataInputOutputUtil.readINT(buffer); @@ -84,8 +83,7 @@ final class PersistentFSAttributeAccessor { public void writeAttributeRaw(final int fileId, final @NotNull FileAttribute attribute, final ByteBufferWriter writer) { - if (attributesStorage instanceof AttributesStorageOverBlobStorage) { - final AttributesStorageOverBlobStorage storage = (AttributesStorageOverBlobStorage)attributesStorage; + if (attributesStorage instanceof AttributesStorageOverBlobStorage storage) { throw new UnsupportedOperationException("Method not implemented yet"); //TODO RC: drill hole for storage.writeAttributeRaw(connection, fileId, attribute, writer) //return storage.writeAttribute(connection, fileId, attribute, buffer -> { diff --git a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java index d1efaa4d5f18..fb99eeb5adf2 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java +++ b/xml/impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/CreateXmlElementIntentionAction.java @@ -1,18 +1,4 @@ -/* - * 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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.source.resolve.reference.impl.providers; import com.intellij.codeInsight.intention.FileModifier; @@ -112,7 +98,7 @@ final class CreateXmlElementIntentionAction implements IntentionAction { manager.startTemplate(targetEditor, template); } - protected void addTextTo(Template template, XmlTag rootTag) { + private void addTextTo(Template template, XmlTag rootTag) { String schemaPrefix = rootTag.getPrefixByNamespace(XmlUtil.XML_SCHEMA_URI); if (!schemaPrefix.isEmpty()) schemaPrefix += ":"; @@ -132,7 +118,7 @@ final class CreateXmlElementIntentionAction implements IntentionAction { } @Override - public @Nullable FileModifier getFileModifierForPreview(@NotNull PsiFile target) { + public @NotNull FileModifier getFileModifierForPreview(@NotNull PsiFile target) { PsiElement copy = PsiTreeUtil.findSameElementInCopy(myRef.getElement(), target); PsiReference reference = copy.getReference(); diff --git a/xml/xmlbeans/src/com/intellij/xml/tools/GenerateInstanceDocumentFromSchemaDialog.java b/xml/xmlbeans/src/com/intellij/xml/tools/GenerateInstanceDocumentFromSchemaDialog.java index 5f4e6d34b436..bbbeab502b5c 100644 --- a/xml/xmlbeans/src/com/intellij/xml/tools/GenerateInstanceDocumentFromSchemaDialog.java +++ b/xml/xmlbeans/src/com/intellij/xml/tools/GenerateInstanceDocumentFromSchemaDialog.java @@ -210,9 +210,10 @@ final class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { } @Nullable - protected @InspectionMessage String doValidateWithData() { + @InspectionMessage + private String doValidateWithData() { String rootElementName = getElementName(); - if (rootElementName == null || rootElementName.length() == 0) { + if (rootElementName == null || rootElementName.isEmpty()) { return XmlBundle.message("schema2.instance.no.valid.root.element.name.validation.error"); } @@ -229,31 +230,31 @@ final class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { } final String fileName = getOutputFileName(); - if (fileName == null || fileName.length() == 0) { + if (fileName == null || fileName.isEmpty()) { return XmlBundle.message("schema2.instance.output.file.name.is.empty.validation.problem"); } return null; } - protected static boolean isAcceptableFile(VirtualFile virtualFile) { + private static boolean isAcceptableFile(VirtualFile virtualFile) { return GenerateInstanceDocumentFromSchemaAction.isAcceptableFileForGenerateSchemaFromInstanceDocument(virtualFile); } - protected TextFieldWithBrowseButton getUrl() { + TextFieldWithBrowseButton getUrl() { return generateFromUrl; } - protected JLabel getUrlText() { + private JLabel getUrlText() { return generateFromUrlText; } - protected JLabel getStatusTextField() { + private JLabel getStatusTextField() { return statusText; } - protected JLabel getStatusField() { + private JLabel getStatusField() { return status; }