private boolean writeKeepRules(@NonNull File proguardCfg) { if (!keepItems.isEmpty()) { try { Writer writer = new BufferedWriter(new FileWriter(proguardCfg)); try { Collections.sort(keepItems); for (Item item : keepItems) { writer.write(item.getKeepRule()); writer.write('\n'); } } finally { writer.close(); } } catch (IOException ioe) { error(ioe.toString()); return true; } // Now that we've handled these items, remove them from the list // such that we don't accidentally also emit them into the annotations.zip // file, where they are not needed for (Item item : keepItems) { removeItem(item.getQualifiedClassName(), item); } } else if (proguardCfg.exists()) { //noinspection ResultOfMethodCallIgnored proguardCfg.delete(); } return false; }
void write(PrintWriter writer) { if (annotations.isEmpty()) { return; } writer.print(" <item name=\""); writer.print(getSignature()); writer.println("\">"); for (AnnotationData annotation : annotations) { annotation.write(writer); } writer.print(" </item>"); writer.println(); }
Collections.sort(items); for (Item item : items) { item.write(writer);
Collections.sort(items); for (Item item : items) { item.write(writer);
private boolean writeKeepRules(@NonNull File proguardCfg) { if (!keepItems.isEmpty()) { try { try (Writer writer = new BufferedWriter(new FileWriter(proguardCfg))) { Collections.sort(keepItems); for (Item item : keepItems) { writer.write(item.getKeepRule()); writer.write('\n'); } } } catch (IOException ioe) { error(ioe.toString()); return true; } // Now that we've handled these items, remove them from the list // such that we don't accidentally also emit them into the annotations.zip // file, where they are not needed for (Item item : keepItems) { removeItem(item.getQualifiedClassName(), item); } } else if (proguardCfg.exists()) { //noinspection ResultOfMethodCallIgnored proguardCfg.delete(); } return false; }
private void addItem(@NonNull String fqn, @NonNull Item item) { // Not part of the API? if (apiFilter != null && item.isFiltered(apiFilter)) { if (isListIgnored()) { info("Skipping API because it is not part of the API file: " + item); } filteredCount++; return; } String pkg = getPackage(fqn); Map<String, List<Item>> classMap = itemMap.get(pkg); if (classMap == null) { classMap = Maps.newHashMapWithExpectedSize(100); itemMap.put(pkg, classMap); } List<Item> items = classMap.get(fqn); if (items == null) { items = Lists.newArrayList(); classMap.put(fqn, items); } items.add(item); }
void write(PrintWriter writer) { if (annotations.isEmpty()) { return; } writer.print(" <item name=\""); writer.print(getSignature()); writer.println("\">"); for (AnnotationData annotation : annotations) { annotation.write(writer); } writer.print(" </item>"); writer.println(); }
@Override public int compareTo(@SuppressWarnings("NullableProblems") @NonNull Item item) { String signature1 = getSignature(); String signature2 = item.getSignature(); // IntelliJ's sorting order is not on the escaped HTML but the original // signatures, which means android.os.AsyncTask<Params,Progress,Result> // should appear *after* android.os.AsyncTask.Status, which when the <'s are // escaped it does not signature1 = signature1.replace('&', '.'); signature2 = signature2.replace('&', '.'); return signature1.compareTo(signature2); }
private void addItem(@NonNull String fqn, @NonNull Item item) { // Not part of the API? if (apiFilter != null && item.isFiltered(apiFilter)) { if (isListIgnored()) { info("Skipping API because it is not part of the API file: " + item); } filteredCount++; return; } addItemUnconditionally(fqn, item); }
@Override public int compareTo(@SuppressWarnings("NullableProblems") @NonNull Item item) { String signature1 = getSignature(); String signature2 = item.getSignature(); // IntelliJ's sorting order is not on the escaped HTML but the original // signatures, which means android.os.AsyncTask<Params,Progress,Result> // should appear *after* android.os.AsyncTask.Status, which when the <'s are // escaped it does not signature1 = signature1.replace('&', '.'); signature2 = signature2.replace('&', '.'); return signature1.compareTo(signature2); }