diff --git a/java/java-impl/src/com/intellij/spi/SPIFileType.java b/java/java-impl/src/com/intellij/spi/SPIFileType.java index ad254be57360..215ca3b30f99 100644 --- a/java/java-impl/src/com/intellij/spi/SPIFileType.java +++ b/java/java-impl/src/com/intellij/spi/SPIFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -88,7 +88,7 @@ public class SPIFileType extends LanguageFileType implements FileTypeIdentifiabl @Nullable @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java index eef4824cfbd1..d8dc8ad1e87a 100644 --- a/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java +++ b/java/java-psi-impl/src/com/intellij/ide/highlighter/JavaClassFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -73,7 +73,7 @@ public class JavaClassFileType implements FileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } } diff --git a/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java b/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java index 72b2b9bae445..4c61d42cb84f 100644 --- a/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java +++ b/platform/core-api/src/com/intellij/ide/highlighter/ArchiveFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -69,7 +69,7 @@ public class ArchiveFileType implements FileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } } diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java index 97c85807817a..40a04418b311 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/FileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -34,7 +34,6 @@ public interface FileType extends Scheme { * Returns the name of the file type. The name must be unique among all file types registered in the system. * @return The file type name. */ - @Override @NotNull @NonNls @@ -82,12 +81,11 @@ public interface FileType extends Scheme { /** * Returns the character set for the specified file. * @param file The file for which the character set is requested. - * @param content * @return The character set name, in the format supported by {@link java.nio.charset.Charset} class. */ @Nullable @NonNls - String getCharset(@NotNull VirtualFile file, final byte[] content); + String getCharset(@NotNull VirtualFile file, @NotNull byte[] content); } diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java index 9fc9f112053a..4e74b2d043ec 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/LanguageFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -58,7 +58,7 @@ public abstract class LanguageFileType implements FileType{ } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java index 6b71c76a5206..5e34421c6ca3 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/UnknownFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -68,7 +68,7 @@ public class UnknownFileType implements FileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } } diff --git a/platform/core-impl/src/com/intellij/util/indexing/SubstitutedFileType.java b/platform/core-impl/src/com/intellij/util/indexing/SubstitutedFileType.java index 3af0ef4665b9..83c257338a5c 100644 --- a/platform/core-impl/src/com/intellij/util/indexing/SubstitutedFileType.java +++ b/platform/core-impl/src/com/intellij/util/indexing/SubstitutedFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -81,7 +81,7 @@ public class SubstitutedFileType extends LanguageFileType{ } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return myFileType.getCharset(file, content); } diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java index 4300898ea57e..10de34286fb1 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -854,7 +854,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return null; } } diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeFactory.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeFactory.java index 801887614413..b0c58d302009 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeFactory.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * 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. @@ -91,7 +91,7 @@ public class EnforcedPlainTextFileTypeFactory extends FileTypeFactory { } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return null; } }; diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/UiScriptFileType.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/UiScriptFileType.java index ce374bbb2f71..b92a3c0432ab 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/UiScriptFileType.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/UiScriptFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * 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. @@ -77,7 +77,7 @@ public class UiScriptFileType implements FileType { } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/TaskQueue.java b/platform/lang-impl/src/com/intellij/util/indexing/TaskQueue.java index 22be737ddba1..3742c2a901e6 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/TaskQueue.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/TaskQueue.java @@ -1,10 +1,25 @@ +/* + * 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. + */ package com.intellij.util.indexing; -import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.util.Computable; +import org.jetbrains.annotations.NotNull; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -15,8 +30,8 @@ import java.util.concurrent.atomic.AtomicInteger; class TaskQueue { private final AtomicInteger myDoWorkRequest = new AtomicInteger(); private final AtomicInteger myUpdatesCount = new AtomicInteger(); - private final LinkedBlockingQueue myPendingWriteRequestsQueue = new LinkedBlockingQueue(); - private final LinkedBlockingQueue myTimestampUpdates = new LinkedBlockingQueue(); + private final BlockingQueue myPendingWriteRequestsQueue = new LinkedBlockingQueue(); + private final BlockingQueue myTimestampUpdates = new LinkedBlockingQueue(); private final int myLimit; private final int myStealLimit; private final int myTimeStampUpdateSizeLimit; @@ -27,7 +42,7 @@ class TaskQueue { myTimeStampUpdateSizeLimit = 32; } - void submit(final Computable update, final Runnable successRunnable) { + void submit(@NotNull final Computable update, @NotNull final Runnable successRunnable) { int currentTasksCount = myUpdatesCount.incrementAndGet(); myPendingWriteRequestsQueue.add(new Runnable() { @@ -61,20 +76,19 @@ class TaskQueue { } } - private void applyTimeStamps(int max) { - Runnable runnable = myTimestampUpdates.poll(); + private void applyTimeStamps(final int max) { + final Runnable runnable = myTimestampUpdates.poll(); if (runnable == null) return; - int updates = 0; - AccessToken accessToken = ReadAction.start(); - try { - while(runnable != null) { - runnable.run(); - if (++updates == max) break; - runnable = myTimestampUpdates.poll(); + ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override + public void run() { + int updates = 0; + for (Runnable r = runnable; r != null; r = myTimestampUpdates.poll()) { + r.run(); + if (++updates == max) break; + } } - } finally { - accessToken.finish(); - } + }); } public void ensureUpToDate() { @@ -84,7 +98,8 @@ class TaskQueue { if (runnable != null) runnable.run(); } applyTimeStamps(Integer.MAX_VALUE); - } catch (Exception e) { + } + catch (InterruptedException e) { throw new RuntimeException(e); } } diff --git a/platform/platform-api/src/com/intellij/ide/highlighter/WorkspaceFileType.java b/platform/platform-api/src/com/intellij/ide/highlighter/WorkspaceFileType.java index 0b30e86ceba0..bff9dc107e43 100644 --- a/platform/platform-api/src/com/intellij/ide/highlighter/WorkspaceFileType.java +++ b/platform/platform-api/src/com/intellij/ide/highlighter/WorkspaceFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -63,7 +63,7 @@ public class WorkspaceFileType implements InternalFileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeConsumer.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeConsumer.java index 9718f0b4dd2c..274a69275184 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeConsumer.java +++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -27,9 +27,9 @@ public interface FileTypeConsumer { void consume(@NotNull FileType fileType); - void consume(@NotNull FileType fileType, @NonNls final String extensions); + void consume(@NotNull FileType fileType, @NonNls String extensions); - void consume(@NotNull FileType fileType, final FileNameMatcher... matchers); + void consume(@NotNull FileType fileType, @NotNull FileNameMatcher... matchers); @Nullable FileType getStandardFileTypeByName(@NonNls @NotNull String name); diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/NativeFileType.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/NativeFileType.java index afb00378c0b8..d9b3946cce74 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/NativeFileType.java +++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/NativeFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -61,7 +61,7 @@ public class NativeFileType implements INativeFileType { return false; } - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return null; } diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/UserFileType.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/UserFileType.java index f7ab208f14cd..3ad19615454b 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/UserFileType.java +++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/UserFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -69,7 +69,7 @@ public abstract class UserFileType implements FileType, return false; } - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileAttribute.java b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileAttribute.java index 51edca1107ee..6f3b59cf7a69 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileAttribute.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/FileAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -55,7 +55,7 @@ public class FileAttribute { } @Nullable - public DataInputStream readAttribute(VirtualFile file) { + public DataInputStream readAttribute(@NotNull VirtualFile file) { DataInputStream stream = ManagingFS.getInstance().readAttribute(file, this); if (stream != null) { try { @@ -72,7 +72,8 @@ public class FileAttribute { return stream; } - public DataOutputStream writeAttribute(VirtualFile file) { + @NotNull + public DataOutputStream writeAttribute(@NotNull VirtualFile file) { final DataOutputStream stream = ManagingFS.getInstance().writeAttribute(file, this); try { DataInputOutputUtil.writeINT(stream, myVersion); diff --git a/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FakeFileType.java b/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FakeFileType.java index ee2c8f00a5e6..4038a6ec18fc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FakeFileType.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileTypes/ex/FakeFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -46,7 +46,7 @@ public abstract class FakeFileType implements FileTypeIdentifiableByVirtualFile return true; } - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } } \ No newline at end of file diff --git a/platform/projectModel-api/src/com/intellij/ide/highlighter/ModuleFileType.java b/platform/projectModel-api/src/com/intellij/ide/highlighter/ModuleFileType.java index 9d060283c7fd..6cc0f8b21305 100644 --- a/platform/projectModel-api/src/com/intellij/ide/highlighter/ModuleFileType.java +++ b/platform/projectModel-api/src/com/intellij/ide/highlighter/ModuleFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -63,7 +63,7 @@ public class ModuleFileType implements InternalFileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/platform/projectModel-api/src/com/intellij/ide/highlighter/ProjectFileType.java b/platform/projectModel-api/src/com/intellij/ide/highlighter/ProjectFileType.java index 20f7a62b3a37..347908a22a08 100644 --- a/platform/projectModel-api/src/com/intellij/ide/highlighter/ProjectFileType.java +++ b/platform/projectModel-api/src/com/intellij/ide/highlighter/ProjectFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -63,7 +63,7 @@ public class ProjectFileType implements InternalFileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/PatchFileType.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/PatchFileType.java index e68bc51f0105..a1ee6520d223 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/PatchFileType.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/PatchFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -70,7 +70,7 @@ public class PatchFileType implements FileType { @Nullable @NonNls - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return null; } diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseFileType.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseFileType.java index 2cdc36904dbc..b4d8cd06a9c6 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseFileType.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/config/EclipseFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -61,7 +61,7 @@ public class EclipseFileType implements FileType { return false; } - public String getCharset(@NotNull final VirtualFile file, final byte[] content) { + public String getCharset(@NotNull final VirtualFile file, @NotNull final byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesFileType.java b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesFileType.java index fb0f8d4fdaf3..8173aa4915ca 100644 --- a/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesFileType.java +++ b/plugins/properties/properties-psi-api/src/com/intellij/lang/properties/PropertiesFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -62,7 +62,7 @@ public class PropertiesFileType extends LanguageFileType { } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { Charset charset = EncodingRegistry.getInstance().getDefaultCharsetForPropertiesFiles(file); if (charset == null) { charset = CharsetToolkit.getDefaultSystemCharset(); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiFormFileType.java b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiFormFileType.java index 0495f89e055b..8318d9ba5842 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/GuiFormFileType.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/GuiFormFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -59,7 +59,7 @@ public class GuiFormFileType implements /*UIBased*/FileType { return false; } - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { return CharsetToolkit.UTF8; } } diff --git a/python/psi-api/src/com/jetbrains/python/PythonFileType.java b/python/psi-api/src/com/jetbrains/python/PythonFileType.java index d3d78c5ab98f..ef59f8915329 100644 --- a/python/psi-api/src/com/jetbrains/python/PythonFileType.java +++ b/python/psi-api/src/com/jetbrains/python/PythonFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -78,7 +78,7 @@ public class PythonFileType extends LanguageFileType { } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { if (CharsetToolkit.hasUTF8Bom(content)) { return CharsetToolkit.UTF8; } diff --git a/python/src/com/jetbrains/pyqt/QtFileType.java b/python/src/com/jetbrains/pyqt/QtFileType.java index 28e4c986bdf7..eac3c0c8e8e8 100644 --- a/python/src/com/jetbrains/pyqt/QtFileType.java +++ b/python/src/com/jetbrains/pyqt/QtFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -85,7 +85,7 @@ public abstract class QtFileType implements FileType, INativeFileType { } @Override - public String getCharset(@NotNull VirtualFile file, byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) { return null; } diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java index ca24a52762db..1c7009f58dc8 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -69,7 +69,7 @@ public class HtmlFileType extends XmlLikeFileType { } @Override - public String getCharset(@NotNull final VirtualFile file, final byte[] content) { + public String getCharset(@NotNull final VirtualFile file, @NotNull final byte[] content) { String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content); if (charset != null) return charset; @NonNls String strContent; diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java index 6addac11ddc0..267a6981f4ce 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlLikeFileType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -31,7 +31,7 @@ public abstract class XmlLikeFileType extends LanguageFileType { super(language); } @Override - public String getCharset(@NotNull VirtualFile file, final byte[] content) { + public String getCharset(@NotNull VirtualFile file, @NotNull final byte[] content) { String charset = XmlCharsetDetector.extractXmlEncodingFromProlog(content); return charset == null ? CharsetToolkit.UTF8 : charset; }