From 0ad48a35982ff2dfefe806cbdc18ae22a91ab91a Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 11 Jan 2013 16:04:25 +0400 Subject: [PATCH] LightClassGenerationStrategy removed --- .../asJava/LightClassGenerationStrategy.java | 85 ------------------- 1 file changed, 85 deletions(-) delete mode 100644 compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationStrategy.java diff --git a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationStrategy.java b/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationStrategy.java deleted file mode 100644 index 7a093ce23d8..00000000000 --- a/compiler/jet.as.java.psi/src/org/jetbrains/jet/asJava/LightClassGenerationStrategy.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2010-2012 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 org.jetbrains.jet.asJava; - -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.ClassFileViewProvider; -import com.intellij.psi.PsiManager; -import com.intellij.psi.impl.PsiManagerImpl; -import com.intellij.psi.impl.compiled.ClsFileImpl; -import com.intellij.psi.impl.java.stubs.impl.PsiJavaFileStubImpl; -import com.intellij.psi.stubs.PsiClassHolderFileStub; -import com.intellij.psi.stubs.StubElement; -import com.intellij.util.containers.Stack; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.codegen.CompilationErrorHandler; -import org.jetbrains.jet.codegen.state.GenerationState; -import org.jetbrains.jet.codegen.state.GenerationStrategy; -import org.jetbrains.jet.codegen.state.StandardGenerationStrategy; -import org.jetbrains.jet.lang.psi.JetFile; -import org.jetbrains.jet.lang.resolve.name.FqName; - -import java.util.Collection; - -class LightClassGenerationStrategy implements GenerationStrategy { - private static final Logger LOG = Logger.getInstance("#org.jetbrains.jet.asJava.LightClassGenerationStrategy"); - - private final Stack stubStack; - private final PsiJavaFileStubImpl answer; - private final VirtualFile virtualFile; - - public LightClassGenerationStrategy( - @NotNull VirtualFile virtualFile, - @NotNull Stack stubStack, - @NotNull PsiJavaFileStubImpl answer - ) { - this.virtualFile = virtualFile; - this.stubStack = stubStack; - this.answer = answer; - } - - @Override - public void generateNamespace( - @NotNull GenerationState state, - @NotNull FqName fqName, - @NotNull Collection namespaceFiles, - @NotNull CompilationErrorHandler errorHandler - ) { - PsiManager manager = PsiManager.getInstance(state.getProject()); - stubStack.push(answer); - - answer.setPsiFactory(new ClsWrapperStubPsiFactory()); - final ClsFileImpl fakeFile = - new ClsFileImpl((PsiManagerImpl) manager, new ClassFileViewProvider(manager, virtualFile)) { - @NotNull - @Override - public PsiClassHolderFileStub getStub() { - return answer; - } - }; - - fakeFile.setPhysical(false); - answer.setPsi(fakeFile); - - StandardGenerationStrategy.INSTANCE.generateNamespace(state, fqName, namespaceFiles, errorHandler); - final StubElement pop = stubStack.pop(); - if (pop != answer) { - LOG.error("Unbalanced stack operations: " + pop); - } - } -}