@Override public void visitClass(UClass node) { if (evaluator.isAbstract(node)) { return; if (!evaluator.isPublic(node)) { String message = String.format("This ControllerChangeHandler class should be public (%1$s)", node.getQualifiedName()); context.report(ISSUE, node, context.getLocation((UElement) node), message); if (node.getContainingClass() != null && !evaluator.isStatic(node)) { String message = String.format("This ControllerChangeHandler inner class should be static (%1$s)", node.getQualifiedName()); context.report(ISSUE, node, context.getLocation((UElement) node), message); if (method.isConstructor()) { hasConstructor = true; if (evaluator.isPublic(method) && method.getUastParameters().size() == 0) { hasDefaultConstructor = true; break;
/** * Returns the list of source folders for Java source files * * @return a list of source folders to search for .java files */ public List<File> getJavaSourceFolders() { if (mJavaSourceFolders == null) { mJavaSourceFolders = mTool.getJavaSourceFolders(this); } return mJavaSourceFolders; }
/** * Returns the current phase number. The first pass is numbered 1. Only one pass * will be performed, unless a {@link Detector} calls {@link #requestRepeat}. * * @return the current phase, usually 1 */ public int getPhase() { return driver.getPhase(); }
private static boolean overridesIsValidFragment(ResolvedClass resolvedClass) { Iterable<ResolvedMethod> resolvedMethods = resolvedClass.getMethods(IS_VALID_FRAGMENT, false); for (ResolvedMethod resolvedMethod : resolvedMethods) { if (resolvedMethod.getArgumentCount() == 1 && resolvedMethod.getArgumentType(0).getName().equals(TYPE_STRING)) { return true; } } return false; } }
private static boolean hasLooperConstructorParameter(@NonNull ResolvedClass cls) { for (ResolvedMethod constructor : cls.getConstructors()) { for (int i = 0, n = constructor.getArgumentCount(); i < n; i++) { TypeDescriptor type = constructor.getArgumentType(i); if (type.matchesSignature(LOOPER_CLS)) { return true; } } } return false; } }
public String getContents() { if (contents == null) { contents = client.readFile(file); } return contents; }
public TypeDescriptor getType() { return new DefaultTypeDescriptor(getName()); }
@Override public void beforeCheckProject(Context context) { Configuration configuration = context.configuration; mCheckDashes = configuration.isEnabled(DASHES); mCheckQuotes = configuration.isEnabled(QUOTES); mCheckFractions = configuration.isEnabled(FRACTIONS); mCheckEllipsis = configuration.isEnabled(ELLIPSIS); mCheckMisc = configuration.isEnabled(OTHER); }
/** * Returns the list of source folders for Java source files * * @param project the project to look up Java source file locations for * @return a list of source folders to search for .java files */ @NonNull public List<File> getJavaSourceFolders(@NonNull Project project) { return getClassPath(project).getSourceFolders(); }
/** * Returns the folder version. For example, for the file values-v14/foo.xml, * it returns 14. * * @return the folder version, or -1 if no specific version was specified */ public int getFolderVersion() { return driver.getResourceFolderVersion(file); } }
/** * Creates a new {@link DefaultConfiguration} * * @param client the client to report errors to etc * @param project the associated project * @param parent the parent/fallback configuration or null * @return a new configuration */ public static DefaultConfiguration create(LintClient client, Project project, Configuration parent) { return new DefaultConfiguration(client, project, parent); }
private void ensureInitialized() { if (suppressed == null) { readConfig(); } }
@Override public String toString() { return getName(); } }
@Override public void finishBulkEditing() { mBulkEditing = false; writeConfig(); } }
/** * Returns the list of output folders for class files * @param project the project to look up class file locations for * @return a list of output folders to search for .class files */ public List<File> getJavaClassFolders(Project project) { return getEclipseClasspath(project, "output", "bin"); //$NON-NLS-1$ //$NON-NLS-2$ }
/** * Returns true if this project is a Gradle-based Android project * * @return true if this is a Gradle-based project */ public boolean isGradleProject() { if (gradleProject == null) { gradleProject = client.isGradleProject(this); } return gradleProject; }
@Override public void visitClass(UClass node) { if (evaluator.isAbstract(node)) { return; if (!evaluator.isPublic(node)) { String message = String.format("This Controller class should be public (%1$s)", node.getQualifiedName()); context.report(ISSUE, node, context.getLocation((UElement) node), message); if (node.getContainingClass() != null && !evaluator.isStatic(node)) { String message = String.format("This Controller inner class should be static (%1$s)", node.getQualifiedName()); context.report(ISSUE, node, context.getLocation((UElement) node), message); if (method.isConstructor()) { hasConstructor = true; if (evaluator.isPublic(method)) { List<UParameter> parameters = method.getUastParameters(); if (parameters.size() == 0) {
/** * Creates a new {@link DefaultConfiguration} for the given lint config * file, not affiliated with a project. This is used for global * configurations. * * @param client the client to report errors to etc * @param lintFile the lint file containing the configuration * @return a new configuration */ public static DefaultConfiguration create(LintClient client, File lintFile) { return new DefaultConfiguration(client, null /*project*/, null /*parent*/, lintFile); }
private void ensureInitialized() { if (mSuppressed == null) { readConfig(); } }
/** * Returns the list of source folders for Java source files * * @param project the project to look up Java source file locations for * @return a list of source folders to search for .java files */ public List<File> getJavaSourceFolders(Project project) { return getEclipseClasspath(project, "src", "src", "gen"); //$NON-NLS-1$ //$NON-NLS-2$ }