mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
EA-52004 (NPE: CyclicClassDependencyInspection.checkElement)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-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.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.reference;
|
||||
|
||||
import com.intellij.psi.PsiClass;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -65,6 +66,7 @@ public interface RefClass extends RefJavaElement {
|
||||
|
||||
boolean isSelfInheritor(PsiClass psiClass);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
PsiClass getElement();
|
||||
}
|
||||
|
||||
@@ -211,6 +211,7 @@ public class RefClassImpl extends RefJavaElementImpl implements RefClass {
|
||||
return isSelfInheritor(psiClass, new ArrayList<PsiClass>());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiClass getElement() {
|
||||
return (PsiClass)super.getElement();
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2011 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2006-2013 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public class CyclicClassDependencyInspection extends BaseGlobalInspection {
|
||||
}
|
||||
final RefClass refClass = (RefClass)refEntity;
|
||||
final PsiClass aClass = refClass.getElement();
|
||||
if (aClass.getContainingClass() != null) {
|
||||
if (aClass == null || aClass.getContainingClass() != null) {
|
||||
return null;
|
||||
}
|
||||
final Set<RefClass> dependencies =
|
||||
@@ -67,7 +67,7 @@ public class CyclicClassDependencyInspection extends BaseGlobalInspection {
|
||||
}
|
||||
final String errorString = InspectionGadgetsBundle.message(
|
||||
"cyclic.class.dependency.problem.descriptor",
|
||||
refEntity.getName(), numMutualDependents - 1);
|
||||
refEntity.getName(), Integer.valueOf(numMutualDependents - 1));
|
||||
return new CommonProblemDescriptor[]{
|
||||
inspectionManager.createProblemDescriptor(errorString)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user