Refine search
public static Collection< Artifact > filterArtifacts( @NonNull Iterable< Artifact > artifacts, final boolean skipDependencies, @Nullable final Collection< String > includeArtifactTypes, @Nullable final Collection< String > excludeArtifactTypes, @Nullable final Collection< String > includeArtifactQualifiers, @Nullable final Collection< String > excludeArtifactQualifiers )
@Override public AstVisitor createJavaVisitor(@NonNull final JavaContext context) { return new ForwardingAstVisitor() { @Override public boolean visitMethodInvocation(MethodInvocation node) { Expression operand = node.astOperand(); if (node.astName().toString().equals("sleep") && operand.toString().equals("Thread") && !context.isSuppressedWithComment(node, ISSUE)) { context.report(ISSUE, node, context.getLocation(node), "Don't call sleep. Use MockTimer instead."); } return super.visitMethodInvocation(node); } }; } }
@Override public AstVisitor createJavaVisitor(@NonNull final JavaContext context) { return new ForwardingAstVisitor() { @Override public boolean visitMethodInvocation(MethodInvocation node) { Expression operand = node.astOperand(); if (node.astName().toString().equals("wait") && !context.isSuppressedWithComment(node, ISSUE)) { context.report(ISSUE, context.getLocation(node), "Don't wait on object. Use Timer's wait instead."); } return super.visitMethodInvocation(node); } }; } }
@Override public AstVisitor createJavaVisitor(@NonNull final JavaContext context) { return new ForwardingAstVisitor() { @Override public boolean visitMethodInvocation(MethodInvocation node) { Expression operand = node.astOperand(); String methodName = node.astName().toString(); if (BAD_METHODS.contains(methodName) && !context.isSuppressedWithComment(node, ISSUE)) { context.report(ISSUE, context.getLocation(node), "Don't call " + methodName + " directly. Use" + " Timer instead."); } return super.visitMethodInvocation(node); } }; } }
@Override public AstVisitor createJavaVisitor(@NonNull final JavaContext context) { return new ForwardingAstVisitor() { @Override public boolean visitMethodInvocation(MethodInvocation node) { Expression operand = node.astOperand(); String methodName = node.astName().toString(); if (BAD_METHODS.contains(methodName) && operand.toString().equals("System") && !context.isSuppressedWithComment(node, ISSUE)) { context.report(ISSUE, context.getLocation(node), "Don't call " + methodName + " on system. Use" + " Timer instead."); } return super.visitMethodInvocation(node); } }; } }
public MavenErrorReporter( ILogger logger, @NonNull EvaluationMode mode ) { super( mode ); this.logger = logger; }
private static File checkPath(@NonNull String path) throws FileNotFoundException { File file = new File(path); if (!file.exists()) { System.err.println(path + " does not exist"); throw new FileNotFoundException(path); } return file; }
/** * Installs an Android Sdk Tool if it's not already installed. * * @param sdkLibData contains all the components for downloading. * @param packageId the package/id path of the required Tool component. * @return a {@code File} representing the locations to the directory where the Tool component * is installed or null if we haven't managed to find such a component. **/ @Nullable File installSdkTool(@NonNull SdkLibData sdkLibData, @NonNull String packageId); }
@Override public void warning( @NonNull String s, Object... objects ) { final Formatter formatter = new Formatter(); log.warn( formatter.format( s, objects ).out().toString() ); }
@Override public void verbose( @NonNull String s, Object... objects ) { final Formatter formatter = new Formatter(); log.debug( formatter.format( s, objects ).out().toString() ); } }
/** * @deprecated replaced by {@link #transform(TransformInvocation)}. */ @Deprecated @SuppressWarnings("UnusedParameters") public void transform( @NonNull Context context, @NonNull Collection<TransformInput> inputs, @NonNull Collection<TransformInput> referencedInputs, @Nullable TransformOutputProvider outputProvider, boolean isIncremental) throws IOException, TransformException, InterruptedException { }
private static ILogger createLogger(@NonNull StdLogger.Level level) { return new StdLogger(level); } }
ProductFlavorData( @NonNull T productFlavor, @NonNull DefaultAndroidSourceSet sourceSet, @Nullable DefaultAndroidSourceSet androidTestSourceSet, @Nullable DefaultAndroidSourceSet unitTestSourceSet, @NonNull Project project) { super(sourceSet, androidTestSourceSet, unitTestSourceSet, project); this.productFlavor = productFlavor; }
@Override public void visitAttribute(@NonNull XmlContext context, @NonNull Attr attribute) { // 判断资源文件夹是否存在 Project project = context.getProject(); List<File> resourceFolder = project.getResourceFolders(); if (resourceFolder.isEmpty()) { return; } // 获取项目资源文件夹路径 String resourcePath = resourceFolder.get(0).getAbsolutePath(); // 获取 drawable 名字 String drawableName = attribute.getValue().replace("@drawable/", ""); try { // 若 drawable 为 Vector Drawable,则文件后缀为 xml,根据 resource 路径,drawable 名字,文件后缀拼接出完整路径 FileInputStream fileInputStream = new FileInputStream(resourcePath + "/drawable/" + drawableName + ".xml"); BufferedReader reader = new BufferedReader(new InputStreamReader(fileInputStream)); String line = reader.readLine(); if (line.contains("vector")) { // 若文件存在,并且包含首行包含 vector,则为 Vector Drawable,抛出警告 context.report(ISSUE_XML_VECTOR_DRAWABLE, attribute, context.getLocation(attribute), attribute.getValue() + " 为 Vector Drawable,请使用 Vector 属性进行设置,避免 4.0 及以下版本的系统产生 Crash"); } fileInputStream.close(); } catch (Exception ignored) { } } }
FlatDependencyContainer( @NonNull DependencyGraph dependencyGraph, @NonNull List<Dependency> allDependencies, @NonNull List<Dependency> directDependencies, @Nullable AtomDependency baseAtom, @NonNull MutableDependencyDataMap mutableDependencyDataMap) { this.dependencyGraph = dependencyGraph; this.allDependencies = ImmutableList.copyOf(allDependencies); this.directDependencies = ImmutableList.copyOf(directDependencies); this.baseAtom = baseAtom; this.mutableDependencyDataMap = mutableDependencyDataMap; }