Added PsiAnnotationWithFlags interface uniting JetClassAnnotation and JetMethodAnnotation.

This commit is contained in:
Evgeny Gerashchenko
2012-06-14 21:41:36 +04:00
parent e26d7fb75e
commit 78393b766d
3 changed files with 40 additions and 2 deletions
@@ -28,7 +28,7 @@ import java.util.BitSet;
/**
* @author Stepan Koltsov
*/
public class JetClassAnnotation extends PsiAnnotationWrapper {
public class JetClassAnnotation extends PsiAnnotationWithFlags {
public JetClassAnnotation(@Nullable PsiAnnotation psiAnnotation) {
super(psiAnnotation);
@@ -44,6 +44,7 @@ public class JetClassAnnotation extends PsiAnnotationWrapper {
private BitSet flags = null;
@NotNull
public BitSet flags() {
if (flags == null) {
flags = BitSetUtils.toBitSet(getIntAttribute(JvmStdlibNames.JET_CLASS_FLAGS_FIELD, JvmStdlibNames.FLAGS_DEFAULT_VALUE));
@@ -28,13 +28,14 @@ import java.util.BitSet;
/**
* @author Stepan Koltsov
*/
public class JetMethodAnnotation extends PsiAnnotationWrapper {
public class JetMethodAnnotation extends PsiAnnotationWithFlags {
public JetMethodAnnotation(@Nullable PsiAnnotation psiAnnotation) {
super(psiAnnotation);
}
private BitSet flags = null;
@NotNull
public BitSet flags() {
if (flags == null) {
int flagsValue = getIntAttribute(JvmStdlibNames.JET_METHOD_FLAGS_FIELD, JvmStdlibNames.FLAGS_DEFAULT_VALUE);
@@ -0,0 +1,36 @@
/*
* 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.lang.resolve.java.kt;
import com.intellij.psi.PsiAnnotation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.BitSet;
/**
* @author Evgeny Gerashchenko
* @since 6/14/12
*/
public abstract class PsiAnnotationWithFlags extends PsiAnnotationWrapper {
protected PsiAnnotationWithFlags(@Nullable PsiAnnotation psiAnnotation) {
super(psiAnnotation);
}
@NotNull
public abstract BitSet flags();
}