private void runLint() throws MojoExecutionException IssueRegistry registry = new BuiltinIssueRegistry();
@Override protected Resource declareResource(ResourceType type, String name, Node node) { Resource resource = super.declareResource(type, name, node); resource.addLocation(file); return resource; }
public Resource getResource(Element element, boolean declare) { ResourceType type = getResourceType(element); if (type != null) { String name = getFieldName(element); Resource resource = getResource(type, name); if (resource == null && declare) { resource = addResource(type, name, null); resource.setDeclared(true); } return resource; } return null; }
/** * Returns whether the given method declaration represents a method * where allocating objects is not allowed for performance reasons */ private static boolean isBlockedAllocationMethod(MethodDeclaration node) { return isOnDrawMethod(node) || isOnMeasureMethod(node) || isOnLayoutMethod(node) || isLayoutMethod(node); }
private boolean isSizeStyle(String style, Set<String> sizeStyles) { if (isFrameworkSizeStyle(style)) { return true; } if (sizeStyles == null) { return false; } return isSizeStyle(stripStylePrefix(style), sizeStyles, 0); }
@Override public void visitMethod(PsiMethod method) { if (isViewAdapterMethod(mContext, method)) { InflationVisitor visitor = new InflationVisitor(mContext); method.accept(visitor); visitor.finish(); } }
@Override public void afterCheckProject(Context context) { // NOTE - this will look for the presence of translation strings. // If you create a resource folder but don't actually place a file in it // we won't detect that, but it seems like a smaller problem. checkTranslations(context); mFileToNames = null; }
private void checkFormatCall(JavaContext context, MethodInvocation node) { lombok.ast.Node current = getParentMethod(node); if (current != null) { checkStringFormatCall(context, current, node); } }
private void checkTargetCompatibility(Context context, Object cookie) { if (mCompileSdkVersion > 0 && mTargetSdkVersion > 0 && mTargetSdkVersion > mCompileSdkVersion) { // NOTE: Keep this in sync with {@link #getOldValue} and {@link #getNewValue} String message = "The targetSdkVersion (" + mTargetSdkVersion + ") should not be higher than the compileSdkVersion (" + mCompileSdkVersion + ")"; report(context, cookie, DEPENDENCY, message); } }
@Override public String toString() { return getDisplayName(); } }
public void processToolsAttributes() { if (mKeepAttributes != null) { for (String keep : mKeepAttributes) { processKeepAttributes(keep); } } if (mDiscardAttributes != null) { for (String discard : mDiscardAttributes) { processDiscardAttributes(discard); } } }
private static void visit(Resource root, Map<Resource, Boolean> seen) { if (seen.containsKey(root)) { return; } seen.put(root, Boolean.TRUE); root.setReachable(true); if (root.references != null) { for (Resource referenced : root.references) { visit(referenced, seen); } } }
/** * Returns the level of the last applicable API level for this permission requirement, * if the requirement no longer applies. Returns {@link Integer#MAX_VALUE} if the permission * is not specific to a range and applies for all current API levels. * * @return the last applicable API level, or {@link Integer#MAX_VALUE} if applies anywhere. */ public int getLastApplicableApi() { initializeRange(); return lastApi; }
public void checkJavaSources(Context context, List<File> sourceFolders) { // For right now, this is hacked via String scanning in .java files instead. for (File dir : sourceFolders) { scanJavaFile(context, dir); } }
/** * Returns when a field was deprecated, or 0 if it's not deprecated * * @param name the name of the field. * @param info the corresponding info */ int getMemberDeprecatedIn(String name, Api info) { int deprecatedIn = findMemberDeprecatedIn(name, info); return deprecatedIn < Integer.MAX_VALUE ? deprecatedIn : 0; }
public void checkJavaSources(Context context, List<File> sourceFolders) { if (mActivities == null) { return; } // For right now, this is hacked via String scanning in .java files instead. for (File dir : sourceFolders) { scanJavaFile(context, dir, null); } }
private boolean isSizeStyle(String style, Set<String> sizeStyles) { if (isFrameworkSizeStyle(style)) { return true; } if (sizeStyles == null) { return false; } return isSizeStyle(stripStylePrefix(style), sizeStyles, 0); }
private void checkTargetCompatibility(Context context, Object cookie) { if (mCompileSdkVersion > 0 && mTargetSdkVersion > 0 && mTargetSdkVersion > mCompileSdkVersion) { // NOTE: Keep this in sync with {@link #getOldValue} and {@link #getNewValue} String message = "The targetSdkVersion (" + mTargetSdkVersion + ") should not be higher than the compileSdkVersion (" + mCompileSdkVersion + ")"; report(context, cookie, DEPENDENCY, message); } }
@Override public String toString() { return getDisplayName(); } }
/** * Returns the level of the first applicable API level, or 1 if the requirement does * not have a specific API range. * * @return the first applicable API level */ public int getFirstApplicableApi() { initializeRange(); return firstApi >= 1 ? firstApi : 1; }