mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Interfaces + AspectJ = <3
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.light;
|
||||
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.ElementPresentationUtil;
|
||||
import com.intellij.psi.impl.PsiClassImplUtil;
|
||||
@@ -41,8 +41,12 @@ public class LightMethod extends LightElement implements PsiMethod {
|
||||
private final PsiMethod myMethod;
|
||||
private final PsiClass myContainingClass;
|
||||
|
||||
public LightMethod(PsiMethod method, PsiClass containingClass) {
|
||||
this(method.getManager(), method, containingClass);
|
||||
}
|
||||
|
||||
public LightMethod(PsiManager manager, PsiMethod method, PsiClass containingClass) {
|
||||
super(manager, StdFileTypes.JAVA.getLanguage());
|
||||
super(manager, StdLanguages.JAVA);
|
||||
myMethod = method;
|
||||
myContainingClass = containingClass;
|
||||
}
|
||||
@@ -154,6 +158,7 @@ public class LightMethod extends LightElement implements PsiMethod {
|
||||
return myMethod.findSuperMethodSignaturesIncludingStatic(checkAccess);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public PsiMethod findDeepestSuperMethod() {
|
||||
return myMethod.findDeepestSuperMethod();
|
||||
}
|
||||
@@ -216,6 +221,7 @@ public class LightMethod extends LightElement implements PsiMethod {
|
||||
public PsiMethodReceiver getMethodReceiver() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PsiType getReturnTypeNoResolve() {
|
||||
return getReturnType();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -26,14 +26,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class LightModifierList extends LightElement implements PsiModifierList{
|
||||
public class LightModifierList extends LightElement implements PsiModifierList {
|
||||
private final Set<String> myModifiers;
|
||||
|
||||
public LightModifierList(PsiManager manager){
|
||||
public LightModifierList(PsiModifierListOwner modifierListOwner) {
|
||||
this(modifierListOwner.getManager());
|
||||
copyModifiers(modifierListOwner.getModifierList());
|
||||
}
|
||||
|
||||
public LightModifierList(PsiManager manager) {
|
||||
this(manager, StdLanguages.JAVA);
|
||||
}
|
||||
|
||||
public LightModifierList(PsiManager manager, final Language language, String... modifiers){
|
||||
public LightModifierList(PsiManager manager, final Language language, String... modifiers) {
|
||||
super(manager, language);
|
||||
myModifiers = CollectionFactory.newTroveSet(modifiers);
|
||||
}
|
||||
@@ -42,11 +47,20 @@ public class LightModifierList extends LightElement implements PsiModifierList{
|
||||
myModifiers.add(modifier);
|
||||
}
|
||||
|
||||
public void copyModifiers(PsiModifierList modifierList) {
|
||||
if (modifierList == null) return;
|
||||
for (@Modifier String modifier : PsiModifier.MODIFIERS) {
|
||||
if (modifierList.hasExplicitModifier(modifier)) {
|
||||
addModifier(modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearModifiers() {
|
||||
myModifiers.clear();
|
||||
}
|
||||
|
||||
public boolean hasModifierProperty(@NotNull String name){
|
||||
public boolean hasModifierProperty(@NotNull String name) {
|
||||
return myModifiers.contains(name);
|
||||
}
|
||||
|
||||
@@ -54,11 +68,11 @@ public class LightModifierList extends LightElement implements PsiModifierList{
|
||||
return myModifiers.contains(name);
|
||||
}
|
||||
|
||||
public void setModifierProperty(@NotNull String name, boolean value) throws IncorrectOperationException{
|
||||
public void setModifierProperty(@NotNull String name, boolean value) throws IncorrectOperationException {
|
||||
throw new IncorrectOperationException();
|
||||
}
|
||||
|
||||
public void checkSetModifierProperty(@NotNull String name, boolean value) throws IncorrectOperationException{
|
||||
public void checkSetModifierProperty(@NotNull String name, boolean value) throws IncorrectOperationException {
|
||||
throw new IncorrectOperationException();
|
||||
}
|
||||
|
||||
@@ -79,10 +93,10 @@ public class LightModifierList extends LightElement implements PsiModifierList{
|
||||
|
||||
@NotNull
|
||||
public PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName) {
|
||||
throw new UnsupportedOperationException("Method addAnnotation is not yet implemented in " + getClass().getName());
|
||||
throw new IncorrectOperationException();
|
||||
}
|
||||
|
||||
public void accept(@NotNull PsiElementVisitor visitor){
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor)visitor).visitModifierList(this);
|
||||
}
|
||||
@@ -91,12 +105,11 @@ public class LightModifierList extends LightElement implements PsiModifierList{
|
||||
}
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
public String toString() {
|
||||
return "PsiModifierList";
|
||||
}
|
||||
|
||||
public String[] getModifiers() {
|
||||
return ArrayUtil.toStringArray(myModifiers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.impl.light;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -33,6 +34,9 @@ public class LightReferenceListBuilder extends LightElement implements PsiRefere
|
||||
private final Role myRole;
|
||||
private final PsiElementFactory myFactory;
|
||||
|
||||
public LightReferenceListBuilder(PsiManager manager, Role role) {
|
||||
this(manager, StdLanguages.JAVA, role);
|
||||
}
|
||||
|
||||
public LightReferenceListBuilder(PsiManager manager, Language language, Role role) {
|
||||
super(manager, language);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 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.
|
||||
@@ -33,4 +33,8 @@ public interface PsiModifier {
|
||||
@NonNls String STRICTFP = "strictfp";
|
||||
@NonNls String TRANSIENT = "transient";
|
||||
@NonNls String VOLATILE = "volatile";
|
||||
|
||||
@NonNls String[] MODIFIERS = {
|
||||
PUBLIC, PROTECTED, PRIVATE, STATIC, ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, STRICTFP, TRANSIENT, VOLATILE
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user