mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (deprecated .class decompiler API dropped)
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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.psi;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/** @deprecated API no longer supported, use {@link com.intellij.psi.compiled.ClassFileDecompilers} instead (to remove in IDEA 14) */
|
||||
@SuppressWarnings({"UnusedDeclaration", "deprecation"})
|
||||
public interface ClsFileDecompiledPsiFileProvider {
|
||||
ExtensionPointName<ClsFileDecompiledPsiFileProvider> EP_NAME = ExtensionPointName.create("com.intellij.psi.clsDecompiledFileProvider");
|
||||
|
||||
PsiFile getDecompiledPsiFile(@NotNull PsiJavaFile clsFile);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.BinaryFileDecompiler;
|
||||
import com.intellij.openapi.project.DefaultProjectFactory;
|
||||
@@ -23,7 +22,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -31,12 +29,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class ClassFileDecompiler implements BinaryFileDecompiler {
|
||||
private static final Logger LOG = Logger.getInstance(ClassFileDecompiler.class);
|
||||
|
||||
/** @deprecated temporary solution, to remove in IDEA 14 */
|
||||
public interface PlatformDecompiler {
|
||||
@Nullable
|
||||
CharSequence decompile(@NotNull VirtualFile file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public CharSequence decompile(@NotNull VirtualFile file) {
|
||||
@@ -46,12 +38,6 @@ public class ClassFileDecompiler implements BinaryFileDecompiler {
|
||||
return ((ClassFileDecompilers.Full)decompiler).createFileViewProvider(file, manager, true).getContents();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") PlatformDecompiler platformDecompiler = ServiceManager.getService(PlatformDecompiler.class);
|
||||
if (platformDecompiler != null) {
|
||||
CharSequence result = platformDecompiler.decompile(file);
|
||||
if (result != null) return result;
|
||||
}
|
||||
|
||||
if (decompiler instanceof ClassFileDecompilers.Light) {
|
||||
try {
|
||||
return ((ClassFileDecompilers.Light)decompiler).getText(file);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -16,8 +16,6 @@
|
||||
package com.intellij.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.compiled.ClassFileDecompilers;
|
||||
import com.intellij.psi.stubs.BinaryFileStubBuilder;
|
||||
@@ -47,7 +45,6 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public StubElement buildStubTree(@NotNull FileContent fileContent) {
|
||||
VirtualFile file = fileContent.getFile();
|
||||
@@ -63,19 +60,6 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
LOG.debug(e);
|
||||
}
|
||||
|
||||
try {
|
||||
Project project = fileContent.getProject();
|
||||
for (ClsStubBuilderFactory factory : Extensions.getExtensions(ClsStubBuilderFactory.EP_NAME)) {
|
||||
if (!factory.isInnerClass(file) && factory.canBeProcessed(file, content)) {
|
||||
PsiFileStub stub = factory.buildFileStub(file, content, project);
|
||||
if (stub != null) return stub;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ClsFormatException e) {
|
||||
LOG.debug(e);
|
||||
}
|
||||
|
||||
try {
|
||||
PsiFileStub<?> stub = ClsFileImpl.buildFileStub(file, content);
|
||||
if (stub == null && !fileContent.getFileName().contains("$")) {
|
||||
@@ -97,7 +81,6 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getStubVersion() {
|
||||
int version = STUB_VERSION;
|
||||
@@ -110,12 +93,6 @@ public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
List<ClsStubBuilderFactory> factories = ContainerUtil.newArrayList(Extensions.getExtensions(ClsStubBuilderFactory.EP_NAME));
|
||||
Collections.sort(factories, CLASS_NAME_COMPARATOR);
|
||||
for (ClsStubBuilderFactory factory : factories) {
|
||||
version = version * 31 + factory.getStubVersion() + factory.getClass().getName().hashCode();
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.psi.impl.compiled;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.stubs.PsiFileStub;
|
||||
import com.intellij.util.cls.ClsFormatException;
|
||||
|
||||
/** @deprecated API no longer supported, use {@link com.intellij.psi.compiled.ClassFileDecompilers} instead (to remove in IDEA 14) */
|
||||
@SuppressWarnings({"deprecation", "unused"})
|
||||
public abstract class ClsStubBuilderFactory<T extends PsiFile> {
|
||||
public static final ExtensionPointName<ClsStubBuilderFactory> EP_NAME = ExtensionPointName.create("com.intellij.clsStubBuilderFactory");
|
||||
|
||||
public abstract PsiFileStub<T> buildFileStub(final VirtualFile file, byte[] bytes) throws ClsFormatException;
|
||||
|
||||
public PsiFileStub<T> buildFileStub(final VirtualFile file, byte[] bytes, Project project) throws ClsFormatException {
|
||||
return buildFileStub(file, bytes);
|
||||
}
|
||||
|
||||
public abstract boolean canBeProcessed(final VirtualFile file, byte[] bytes);
|
||||
|
||||
public abstract boolean isInnerClass(final VirtualFile file);
|
||||
|
||||
public int getStubVersion() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,6 @@
|
||||
|
||||
<extensionPoint name="unscrambleSupport" interface="com.intellij.unscramble.UnscrambleSupport"/>
|
||||
|
||||
<extensionPoint name="clsStubBuilderFactory" interface="com.intellij.psi.impl.compiled.ClsStubBuilderFactory"/>
|
||||
<extensionPoint name="javaMainMethodProvider" interface="com.intellij.codeInsight.runner.JavaMainMethodProvider"/>
|
||||
|
||||
<extensionPoint name="importFilter" interface="com.intellij.codeInsight.ImportFilter"/>
|
||||
@@ -269,8 +268,6 @@
|
||||
<!-- deprecated API -->
|
||||
<!--suppress DeprecatedClassUsageInspection -->
|
||||
<extensionPoint name="psi.clsCustomNavigationPolicy" interface="com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy"/>
|
||||
<!--suppress DeprecatedClassUsageInspection -->
|
||||
<extensionPoint name="psi.clsDecompiledFileProvider" interface="com.intellij.psi.ClsFileDecompiledPsiFileProvider"/>
|
||||
|
||||
<extensionPoint name="vetoSPICondition" interface="com.intellij.openapi.util.Condition"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user