From c76be0f88ea5b711ffa6a8d4ae1f365bab0c77b7 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 29 Apr 2015 19:10:35 +0200 Subject: [PATCH] Cleanup (deprecated .class decompiler API dropped) --- .../psi/ClsFileDecompiledPsiFileProvider.java | 27 ------------ .../impl/compiled/ClassFileDecompiler.java | 16 +------ .../impl/compiled/ClassFileStubBuilder.java | 25 +---------- .../impl/compiled/ClsStubBuilderFactory.java | 43 ------------------- resources/src/META-INF/IdeaPlugin.xml | 3 -- 5 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 java/java-psi-api/src/com/intellij/psi/ClsFileDecompiledPsiFileProvider.java delete mode 100644 java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilderFactory.java diff --git a/java/java-psi-api/src/com/intellij/psi/ClsFileDecompiledPsiFileProvider.java b/java/java-psi-api/src/com/intellij/psi/ClsFileDecompiledPsiFileProvider.java deleted file mode 100644 index 8b15e8f6259e..000000000000 --- a/java/java-psi-api/src/com/intellij/psi/ClsFileDecompiledPsiFileProvider.java +++ /dev/null @@ -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 EP_NAME = ExtensionPointName.create("com.intellij.psi.clsDecompiledFileProvider"); - - PsiFile getDecompiledPsiFile(@NotNull PsiJavaFile clsFile); -} diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileDecompiler.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileDecompiler.java index 25baddb42d11..8a47b1fa068a 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileDecompiler.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileDecompiler.java @@ -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); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java index 2871b48b2982..1d690b96b30b 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClassFileStubBuilder.java @@ -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 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; } } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilderFactory.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilderFactory.java deleted file mode 100644 index 5cfde3ebb959..000000000000 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsStubBuilderFactory.java +++ /dev/null @@ -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 { - public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.clsStubBuilderFactory"); - - public abstract PsiFileStub buildFileStub(final VirtualFile file, byte[] bytes) throws ClsFormatException; - - public PsiFileStub 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; - } -} diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 5475754ee879..9d300ef1cc45 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -172,7 +172,6 @@ - @@ -269,8 +268,6 @@ - -