use of com.android.annotations.NonNull in project android by JetBrains.
the class MultiResourceRepository method getMap.
@NonNull
@Override
protected Map<ResourceType, ListMultimap<String, ResourceItem>> getMap() {
if (myItems == null) {
if (myChildren.size() == 1) {
myItems = myChildren.get(0).getItems();
} else {
Map<ResourceType, ListMultimap<String, ResourceItem>> map = Maps.newEnumMap(ResourceType.class);
for (ResourceType type : ResourceType.values()) {
// should pass create is true, but as described below we interpret this differently
map.put(type, getMap(type, false));
}
myItems = map;
}
}
return myItems;
}
use of com.android.annotations.NonNull in project kotlin by JetBrains.
the class SupportAnnotationDetector method addLocalPermissions.
@NonNull
private static PermissionHolder addLocalPermissions(@NonNull PermissionHolder permissions, @NonNull UElement node) {
// Accumulate @RequirePermissions available in the local context
UMethod method = UastUtils.getParentOfType(node, UMethod.class, true);
if (method == null) {
return permissions;
}
UAnnotation annotation = method.findAnnotation(PERMISSION_ANNOTATION);
permissions = mergeAnnotationPermissions(permissions, annotation);
UClass containingClass = UastUtils.getContainingUClass(method);
if (containingClass != null) {
annotation = containingClass.findAnnotation(PERMISSION_ANNOTATION);
permissions = mergeAnnotationPermissions(permissions, annotation);
}
return permissions;
}
use of com.android.annotations.NonNull in project kotlin by JetBrains.
the class DomPsiParser method getValueLocation.
@NonNull
@Override
public Location getValueLocation(@NonNull XmlContext context, @NonNull Attr node) {
TextRange textRange = DomPsiConverter.getTextValueRange(node);
Position start = new DefaultPosition(-1, -1, textRange.getStartOffset());
Position end = new DefaultPosition(-1, -1, textRange.getEndOffset());
return Location.create(context.file, start, end);
}
use of com.android.annotations.NonNull in project kotlin by JetBrains.
the class IntellijLintProject method create.
/** Creates a set of projects for the given IntelliJ modules */
@NonNull
public static List<Project> create(@NonNull IntellijLintClient client, @Nullable List<VirtualFile> files, @NonNull Module... modules) {
List<Project> projects = Lists.newArrayList();
Map<Project, Module> projectMap = Maps.newHashMap();
Map<Module, Project> moduleMap = Maps.newHashMap();
Map<AndroidLibrary, Project> libraryMap = Maps.newHashMap();
if (files != null && !files.isEmpty()) {
// Wrap list with a mutable list since we'll be removing the files as we see them
files = Lists.newArrayList(files);
}
for (Module module : modules) {
addProjects(client, module, files, moduleMap, libraryMap, projectMap, projects);
}
client.setModuleMap(projectMap);
if (projects.size() > 1) {
// Partition the projects up such that we only return projects that aren't
// included by other projects (e.g. because they are library projects)
Set<Project> roots = new HashSet<Project>(projects);
for (Project project : projects) {
roots.removeAll(project.getAllLibraries());
}
return Lists.newArrayList(roots);
} else {
return projects;
}
}
use of com.android.annotations.NonNull in project kotlin by JetBrains.
the class IntellijLintUtils method getLocation.
/**
* Gets the location of the given element
*
* @param file the file containing the location
* @param element the element to look up the location for
* @return the location of the given element
*/
@NonNull
public static Location getLocation(@NonNull File file, @NonNull PsiElement element) {
//noinspection ConstantConditions
assert element.getContainingFile().getVirtualFile() == null || FileUtil.filesEqual(VfsUtilCore.virtualToIoFile(element.getContainingFile().getVirtualFile()), file);
if (element instanceof PsiClass) {
// Point to the name rather than the beginning of the javadoc
PsiClass clz = (PsiClass) element;
PsiIdentifier nameIdentifier = clz.getNameIdentifier();
if (nameIdentifier != null) {
element = nameIdentifier;
}
}
TextRange textRange = element.getTextRange();
Position start = new DefaultPosition(-1, -1, textRange.getStartOffset());
Position end = new DefaultPosition(-1, -1, textRange.getEndOffset());
return Location.create(file, start, end);
}
Aggregations