Use new annotations throughout JetFromJavaDescriptorHelper

Remove rest of JetClass annotation uses
This commit is contained in:
Pavel V. Talanov
2013-07-05 19:40:53 +04:00
parent ba8732d10f
commit 33d40f8a50
6 changed files with 178 additions and 222 deletions
@@ -1,60 +0,0 @@
/*
* Copyright 2010-2013 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.lang.resolve.java.kt;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiClass;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver;
public class JetClassAnnotation extends PsiAnnotationWithAbiVersion {
private static final JetClassAnnotation NULL_ANNOTATION = new JetClassAnnotation(null);
static {
NULL_ANNOTATION.checkInitialized();
}
private String signature;
private JetClassAnnotation(@Nullable PsiAnnotation psiAnnotation) {
super(psiAnnotation);
}
@Override
protected void initialize() {
super.initialize();
signature = getStringAttribute(JvmStdlibNames.JET_CLASS_SIGNATURE, "");
}
@NotNull
public String signature() {
checkInitialized();
return signature;
}
public int kind() {
return flags() & JvmStdlibNames.FLAG_CLASS_KIND_MASK;
}
@NotNull
public static JetClassAnnotation get(PsiClass psiClass) {
PsiAnnotation annotation = JavaAnnotationResolver.findOwnAnnotation(psiClass,
JvmStdlibNames.JET_CLASS.getFqName().asString());
return annotation != null ? new JetClassAnnotation(annotation) : NULL_ANNOTATION;
}
}
@@ -53,6 +53,17 @@ import static org.jetbrains.jet.lang.resolve.java.resolver.DeserializedResolverU
import static org.jetbrains.jet.lang.resolve.java.resolver.DeserializedResolverUtils.kotlinFqNameToJavaFqName;
public final class DeserializedDescriptorResolver {
@Nullable
public static ClassData readClassDataNoErrorReporting(@NotNull VirtualFile virtualFile) {
String[] data = visitClassFile(virtualFile).getData();
return data != null ? JavaProtoBufUtil.readClassDataFrom(data) : null;
}
@Nullable
public static PackageData readPackageDataNoErrorReporting(@NotNull VirtualFile virtualFile) {
String[] data = visitClassFile(virtualFile).getData();
return data != null ? JavaProtoBufUtil.readPackageDataFrom(data) : null;
}
private AnnotationDescriptorDeserializer annotationDeserializer;