mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -265,7 +265,7 @@ public class RefClassImpl extends RefJavaElementImpl implements RefClass {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
if (visitor instanceof RefJavaVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -100,7 +100,7 @@ public class RefFieldImpl extends RefJavaElementImpl implements RefField {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
if (visitor instanceof RefJavaVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
+2
@@ -29,6 +29,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiModifierListOwner;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RefImplicitConstructorImpl extends RefMethodImpl implements RefImplicitConstructor {
|
||||
@@ -47,6 +48,7 @@ public class RefImplicitConstructorImpl extends RefMethodImpl implements RefImpl
|
||||
return ((RefClassImpl)getOwnerClass()).isSuspicious();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return InspectionsBundle.message("inspection.reference.implicit.constructor.name", getOwnerClass().getName());
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class RefJavaElementImpl extends RefElementImpl implements RefJa
|
||||
private static final int IS_USES_DEPRECATION_MASK = 0x200;
|
||||
private static final int IS_SYNTHETIC_JSP_ELEMENT = 0x400;
|
||||
|
||||
protected RefJavaElementImpl(String name, RefJavaElement owner) {
|
||||
protected RefJavaElementImpl(String name, @NotNull RefJavaElement owner) {
|
||||
super(name, owner);
|
||||
String am = owner.getAccessModifier();
|
||||
doSetAccessModifier(am);
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -53,7 +54,7 @@ public class RefJavaManagerImpl extends RefJavaManager {
|
||||
private PsiElementVisitor myProjectIterator;
|
||||
private EntryPointsManager myEntryPointsManager;
|
||||
|
||||
public RefJavaManagerImpl(RefManagerImpl manager) {
|
||||
public RefJavaManagerImpl(@NotNull RefManagerImpl manager) {
|
||||
myRefManager = manager;
|
||||
final Project project = manager.getProject();
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
@@ -174,7 +175,7 @@ public class RefJavaManagerImpl extends RefJavaManager {
|
||||
|
||||
|
||||
@Override
|
||||
public void iterate(final RefVisitor visitor) {
|
||||
public void iterate(@NotNull final RefVisitor visitor) {
|
||||
if (myPackages != null) {
|
||||
for (RefPackage refPackage : myPackages.values()) {
|
||||
refPackage.accept(visitor);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
}
|
||||
|
||||
// To be used only from RefImplicitConstructor.
|
||||
protected RefMethodImpl(String name, RefClass ownerClass) {
|
||||
protected RefMethodImpl(String name, @NotNull RefClass ownerClass) {
|
||||
super(name, ownerClass);
|
||||
myOwnerClass = ownerClass;
|
||||
((RefClassImpl)ownerClass).add(this);
|
||||
@@ -325,7 +325,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
if (visitor instanceof RefJavaVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
@@ -417,6 +417,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
return (RefClass) getOwner();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isValid()) {
|
||||
|
||||
@@ -26,6 +26,7 @@ package com.intellij.codeInspection.reference;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -33,24 +34,25 @@ import javax.swing.*;
|
||||
public class RefPackageImpl extends RefEntityImpl implements RefPackage {
|
||||
private final String myQualifiedName;
|
||||
|
||||
public RefPackageImpl(String name, RefManager refManager) {
|
||||
public RefPackageImpl(@NotNull String name, @NotNull RefManager refManager) {
|
||||
super(getPackageSuffix(name), refManager);
|
||||
myQualifiedName = name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getQualifiedName() {
|
||||
return myQualifiedName;
|
||||
}
|
||||
|
||||
private static String getPackageSuffix(String fullName) {
|
||||
private static String getPackageSuffix(@NotNull String fullName) {
|
||||
int dotIndex = fullName.lastIndexOf('.');
|
||||
return (dotIndex >= 0) ? fullName.substring(dotIndex + 1) : fullName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
if (visitor instanceof RefJavaVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RefParameterImpl extends RefJavaElementImpl implements RefParameter {
|
||||
@@ -83,7 +84,7 @@ public class RefParameterImpl extends RefJavaElementImpl implements RefParameter
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
if (visitor instanceof RefJavaVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class RefJavaManager implements RefManagerExtension<RefJavaManager> {
|
||||
@NonNls public static final String CLASS = "class";
|
||||
@@ -70,11 +71,13 @@ public abstract class RefJavaManager implements RefManagerExtension<RefJavaManag
|
||||
|
||||
public abstract EntryPointsManager getEntryPointsManager();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return StdLanguages.JAVA;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Key<RefJavaManager> getID() {
|
||||
return MANAGER;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.reference;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* A node in the reference graph corresponding to a Java package.
|
||||
*
|
||||
@@ -28,6 +30,7 @@ public interface RefPackage extends RefEntity {
|
||||
*
|
||||
* @return the full-qualified name for the package.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
String getQualifiedName();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInspection.reference;
|
||||
|
||||
import com.intellij.openapi.util.UserDataHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -34,8 +35,10 @@ public interface RefEntity extends UserDataHolder {
|
||||
*
|
||||
* @return the name of the node.
|
||||
*/
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
@NotNull
|
||||
String getQualifiedName();
|
||||
|
||||
/**
|
||||
@@ -57,7 +60,7 @@ public interface RefEntity extends UserDataHolder {
|
||||
*
|
||||
* @param refVisitor the visitor to accept.
|
||||
*/
|
||||
void accept(final RefVisitor refVisitor);
|
||||
void accept(@NotNull RefVisitor refVisitor);
|
||||
|
||||
/**
|
||||
* Returns a user-readable name for the element corresponding to the node.
|
||||
@@ -78,6 +81,7 @@ public interface RefEntity extends UserDataHolder {
|
||||
*
|
||||
* @return the reference graph element for the instance.
|
||||
*/
|
||||
@NotNull
|
||||
RefManager getRefManager();
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,7 +40,7 @@ public abstract class RefManager {
|
||||
*
|
||||
* @param visitor the visitor to run.
|
||||
*/
|
||||
public abstract void iterate(RefVisitor visitor);
|
||||
public abstract void iterate(@NotNull RefVisitor visitor);
|
||||
|
||||
/**
|
||||
* Returns the analysis scope for which the reference graph has been built.
|
||||
@@ -53,6 +54,7 @@ public abstract class RefManager {
|
||||
*
|
||||
* @return the project instance.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Project getProject();
|
||||
|
||||
/**
|
||||
@@ -61,6 +63,7 @@ public abstract class RefManager {
|
||||
*
|
||||
* @return the node for the project.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract RefProject getRefProject();
|
||||
|
||||
/**
|
||||
@@ -95,7 +98,7 @@ public abstract class RefManager {
|
||||
|
||||
public abstract int getLastUsedMask();
|
||||
|
||||
public abstract <T> T getExtension(Key<T> key);
|
||||
public abstract <T> T getExtension(@NotNull Key<T> key);
|
||||
|
||||
@Nullable
|
||||
public abstract String getType(final RefEntity ref);
|
||||
@@ -113,5 +116,6 @@ public abstract class RefManager {
|
||||
|
||||
public abstract void removeRefElement(RefElement refElement, List<RefElement> deletedRefs);
|
||||
|
||||
@NotNull
|
||||
public abstract PsiManager getPsiManager();
|
||||
}
|
||||
|
||||
@@ -27,14 +27,17 @@ import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface RefManagerExtension<T> {
|
||||
@NotNull
|
||||
Key<T> getID();
|
||||
|
||||
@NotNull
|
||||
Language getLanguage();
|
||||
|
||||
void iterate(RefVisitor visitor);
|
||||
void iterate(@NotNull RefVisitor visitor);
|
||||
|
||||
void cleanup();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RefDirectoryImpl extends RefElementImpl implements RefDirectory{
|
||||
protected RefDirectoryImpl(PsiDirectory psiElement, RefManager refManager) {
|
||||
@@ -49,7 +50,7 @@ public class RefDirectoryImpl extends RefElementImpl implements RefDirectory{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -62,6 +63,7 @@ public class RefDirectoryImpl extends RefElementImpl implements RefDirectory{
|
||||
protected void initialize() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getQualifiedName() {
|
||||
return getName(); //todo relative name
|
||||
|
||||
@@ -36,7 +36,6 @@ import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.SmartPointerManager;
|
||||
import com.intellij.psi.SmartPsiElementPointer;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -46,9 +45,10 @@ import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class RefElementImpl extends RefEntityImpl implements RefElement {
|
||||
private static final ArrayList<RefElement> EMPTY_REFERNCES_LIST = new ArrayList<RefElement>(0);
|
||||
private static final List<RefElement> EMPTY_REFERNCES_LIST = new ArrayList<RefElement>(0);
|
||||
protected static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.reference.RefElement");
|
||||
|
||||
private static final int IS_ENTRY_MASK = 0x80;
|
||||
@@ -57,8 +57,8 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement
|
||||
|
||||
private final SmartPsiElementPointer myID;
|
||||
|
||||
private ArrayList<RefElement> myOutReferences;
|
||||
private ArrayList<RefElement> myInReferences;
|
||||
private List<RefElement> myOutReferences;
|
||||
private List<RefElement> myInReferences;
|
||||
|
||||
private String[] mySuppressions = null;
|
||||
|
||||
@@ -66,7 +66,7 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement
|
||||
private final Module myModule;
|
||||
protected static final int IS_REACHABLE_MASK = 0x40;
|
||||
|
||||
protected RefElementImpl(String name, RefElement owner) {
|
||||
protected RefElementImpl(String name, @NotNull RefElement owner) {
|
||||
super(name, owner.getRefManager());
|
||||
myID = null;
|
||||
myFlags = 0;
|
||||
@@ -77,7 +77,7 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement
|
||||
this(file.getName(), file, manager);
|
||||
}
|
||||
|
||||
protected RefElementImpl(String name, PsiElement element, RefManager manager) {
|
||||
protected RefElementImpl(String name, @NotNull PsiElement element, @NotNull RefManager manager) {
|
||||
super(name, manager);
|
||||
myID = SmartPointerManager.getInstance(manager.getProject()).createSmartPsiElementPointer(element);
|
||||
myFlags = 0;
|
||||
|
||||
@@ -37,24 +37,26 @@ import java.util.List;
|
||||
public abstract class RefEntityImpl implements RefEntity {
|
||||
private static final String NO_NAME = InspectionsBundle.message("inspection.reference.noname");
|
||||
private RefEntityImpl myOwner;
|
||||
protected ArrayList<RefEntity> myChildren;
|
||||
protected List<RefEntity> myChildren;
|
||||
private final String myName;
|
||||
private THashMap myUserMap = null;
|
||||
protected int myFlags = 0;
|
||||
protected final RefManagerImpl myManager;
|
||||
|
||||
protected RefEntityImpl(String name, final RefManager manager) {
|
||||
protected RefEntityImpl(String name, @NotNull RefManager manager) {
|
||||
myManager = (RefManagerImpl)manager;
|
||||
myName = name != null ? name : NO_NAME;
|
||||
myOwner = null;
|
||||
myChildren = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getQualifiedName() {
|
||||
return myName;
|
||||
@@ -105,7 +107,7 @@ public abstract class RefEntityImpl implements RefEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor refVisitor) {
|
||||
public void accept(@NotNull final RefVisitor refVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -152,6 +154,7 @@ public abstract class RefEntityImpl implements RefEntity {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RefManagerImpl getRefManager() {
|
||||
return myManager;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
@@ -47,7 +48,7 @@ public class RefFileImpl extends RefElementImpl implements RefFile {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor visitor) {
|
||||
public void accept(@NotNull final RefVisitor visitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -62,6 +62,7 @@ public class RefManagerImpl extends RefManager {
|
||||
|
||||
private int myLastUsedMask = 256 * 256 * 256 * 4;
|
||||
|
||||
@NotNull
|
||||
private final Project myProject;
|
||||
private AnalysisScope myScope;
|
||||
private RefProject myRefProject;
|
||||
@@ -82,7 +83,7 @@ public class RefManagerImpl extends RefManager {
|
||||
|
||||
private final ReentrantReadWriteLock myLock = new ReentrantReadWriteLock();
|
||||
|
||||
public RefManagerImpl(Project project, AnalysisScope scope, GlobalInspectionContextImpl context) {
|
||||
public RefManagerImpl(@NotNull Project project, AnalysisScope scope, GlobalInspectionContextImpl context) {
|
||||
myDeclarationsFound = false;
|
||||
myProject = project;
|
||||
myScope = scope;
|
||||
@@ -104,7 +105,7 @@ public class RefManagerImpl extends RefManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterate(RefVisitor visitor) {
|
||||
public void iterate(@NotNull RefVisitor visitor) {
|
||||
myLock.readLock().lock();
|
||||
try {
|
||||
for (RefElement refElement : getSortedElements()) {
|
||||
@@ -176,7 +177,7 @@ public class RefManagerImpl extends RefManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getExtension(final Key<T> key) {
|
||||
public <T> T getExtension(@NotNull final Key<T> key) {
|
||||
return (T)myExtensions.get(key);
|
||||
}
|
||||
|
||||
@@ -306,11 +307,13 @@ public class RefManagerImpl extends RefManager {
|
||||
return myIsInProcess;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public RefProject getRefProject() {
|
||||
return myRefProject;
|
||||
@@ -338,6 +341,7 @@ public class RefManagerImpl extends RefManager {
|
||||
return answer;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiManager getPsiManager() {
|
||||
return myPsiManager;
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.ArrayList;
|
||||
public class RefModuleImpl extends RefEntityImpl implements RefModule {
|
||||
private final Module myModule;
|
||||
|
||||
protected RefModuleImpl(Module module, final RefManager manager) {
|
||||
protected RefModuleImpl(Module module, @NotNull RefManager manager) {
|
||||
super(module.getName(), manager);
|
||||
myModule = module;
|
||||
((RefProjectImpl)manager.getRefProject()).add(this);
|
||||
@@ -43,7 +43,7 @@ public class RefModuleImpl extends RefEntityImpl implements RefModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(final RefVisitor refVisitor) {
|
||||
public void accept(@NotNull final RefVisitor refVisitor) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -25,11 +25,12 @@
|
||||
package com.intellij.codeInspection.reference;
|
||||
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class RefProjectImpl extends RefEntityImpl implements RefProject {
|
||||
public RefProjectImpl(RefManager refManager) {
|
||||
public RefProjectImpl(@NotNull RefManager refManager) {
|
||||
super(refManager.getProject().getName(), refManager);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user