Search in sources :

Example 1 with Full

use of com.intellij.psi.compiled.ClassFileDecompilers.Full in project intellij-community by JetBrains.

the class ClassFileStubBuilder method buildStubTree.

@Override
public StubElement buildStubTree(@NotNull FileContent fileContent) {
    VirtualFile file = fileContent.getFile();
    byte[] content = fileContent.getContent();
    try {
        try {
            file.setPreloadedContentHint(content);
            ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
            if (decompiler instanceof Full) {
                return ((Full) decompiler).getStubBuilder().buildFileStub(fileContent);
            }
        } catch (ClsFormatException e) {
            if (LOG.isDebugEnabled())
                LOG.debug(file.getPath(), e);
            else
                LOG.info(file.getPath() + ": " + e.getMessage());
        }
        try {
            PsiFileStub<?> stub = ClsFileImpl.buildFileStub(file, content);
            if (stub == null && fileContent.getFileName().indexOf('$') < 0) {
                LOG.info("No stub built for file " + fileContent);
            }
            return stub;
        } catch (ClsFormatException e) {
            if (LOG.isDebugEnabled())
                LOG.debug(file.getPath(), e);
            else
                LOG.info(file.getPath() + ": " + e.getMessage());
        }
    } finally {
        file.setPreloadedContentHint(null);
    }
    return null;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ClassFileDecompilers(com.intellij.psi.compiled.ClassFileDecompilers) ClsFormatException(com.intellij.util.cls.ClsFormatException) Full(com.intellij.psi.compiled.ClassFileDecompilers.Full)

Aggregations

VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ClassFileDecompilers (com.intellij.psi.compiled.ClassFileDecompilers)1 Full (com.intellij.psi.compiled.ClassFileDecompilers.Full)1 ClsFormatException (com.intellij.util.cls.ClsFormatException)1