001 /*
002 * Copyright 2010-2013 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.jet.lang.resolve.lazy.data;
018
019 import com.intellij.psi.PsiElement;
020 import org.jetbrains.annotations.NotNull;
021 import org.jetbrains.annotations.Nullable;
022 import org.jetbrains.jet.lang.descriptors.ClassKind;
023 import org.jetbrains.jet.lang.psi.*;
024 import org.jetbrains.jet.lang.resolve.lazy.descriptors.LazyClassDescriptor;
025 import org.jetbrains.jet.lang.resolve.name.FqName;
026
027 import java.util.Collections;
028 import java.util.List;
029
030 public class SyntheticClassObjectInfo implements JetClassLikeInfo {
031 private final JetClassLikeInfo classInfo;
032 private final LazyClassDescriptor classDescriptor;
033
034 public SyntheticClassObjectInfo(@NotNull JetClassLikeInfo classInfo, @NotNull LazyClassDescriptor classDescriptor) {
035 this.classInfo = classInfo;
036 this.classDescriptor = classDescriptor;
037 }
038
039 @NotNull
040 public LazyClassDescriptor getClassDescriptor() {
041 return classDescriptor;
042 }
043
044
045 @NotNull
046 @Override
047 public FqName getContainingPackageFqName() {
048 return classInfo.getContainingPackageFqName();
049 }
050
051 @Nullable
052 @Override
053 public JetModifierList getModifierList() {
054 return null;
055 }
056
057 @Nullable
058 @Override
059 public JetClassObject getClassObject() {
060 return null;
061 }
062
063 @NotNull
064 @Override
065 public PsiElement getScopeAnchor() {
066 return classInfo.getScopeAnchor();
067 }
068
069 @Nullable
070 @Override
071 public JetClassOrObject getCorrespondingClassOrObject() {
072 return null;
073 }
074
075 @NotNull
076 @Override
077 public List<JetTypeParameter> getTypeParameters() {
078 return Collections.emptyList();
079 }
080
081 @NotNull
082 @Override
083 public List<? extends JetParameter> getPrimaryConstructorParameters() {
084 return Collections.emptyList();
085 }
086
087 @NotNull
088 @Override
089 public ClassKind getClassKind() {
090 return ClassKind.CLASS_OBJECT;
091 }
092
093 @NotNull
094 @Override
095 public List<JetDeclaration> getDeclarations() {
096 // There can be no declarations in a synthetic class object, all its members are fake overrides
097 return Collections.emptyList();
098 }
099
100 @Override
101 public String toString() {
102 return "class object of " + classInfo;
103 }
104 }