prefer to use ArchiveFileType.INSTANCE directly to avoid possible earlier initialization due to FileTypeManager.getInstance call

This commit is contained in:
Vladimir Krivosheev
2018-11-19 10:45:48 +01:00
parent 7e6cefdb06
commit 5a5780076e
19 changed files with 49 additions and 184 deletions
@@ -1,22 +1,9 @@
/*
* Copyright 2000-2009 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-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.
package com.intellij.compiler.ant;
import com.intellij.compiler.ant.taskdefs.Include;
import com.intellij.compiler.ant.taskdefs.PatternSet;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.fileTypes.*;
import com.intellij.openapi.project.Project;
@@ -25,7 +12,7 @@ import java.io.PrintWriter;
import java.util.List;
/**
* Library pattern generation (based on {@link FileTypes#ARCHIVE} file type).
* Library pattern generation (based on {@link ArchiveFileType#INSTANCE} file type).
*/
public class LibraryPatterns extends Generator {
/**
@@ -41,7 +28,7 @@ public class LibraryPatterns extends Generator {
*/
public LibraryPatterns(Project project, GenerationOptions genOptions) {
myPatternSet = new PatternSet(BuildProperties.PROPERTY_LIBRARIES_PATTERNS);
final FileType type = FileTypes.ARCHIVE;
final FileType type = ArchiveFileType.INSTANCE;
final List<FileNameMatcher> matchers = FileTypeManager.getInstance().getAssociations(type);
for (FileNameMatcher m : matchers) {
if (m instanceof ExactFileNameMatcher) {
@@ -1,25 +1,11 @@
/*
* Copyright 2000-2009 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-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.
package com.intellij.compiler.impl.javaCompiler.eclipse;
import com.intellij.compiler.impl.javaCompiler.CompilerModuleOptionsComponent;
import com.intellij.compiler.options.ComparingUtils;
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
@@ -52,7 +38,7 @@ public class EclipseCompilerConfigurable implements Configurable {
myAdditionalOptionsField.setDescriptor(null, false);
myPathToEcjField.addBrowseFolderListener(
"Path to ecj compiler tool", null, project,
new FileChooserDescriptor(true, false, true, true, false, false).withFileFilter(file -> file.getFileType() == StdFileTypes.ARCHIVE)
new FileChooserDescriptor(true, false, true, true, false, false).withFileFilter(file -> file.getFileType() == ArchiveFileType.INSTANCE)
);
}