private static Pair<Dependency, DependencyNode> createRenderscriptSupport( @NonNull Pair<File, String> pair) { Dependency dependency = new JavaDependency( pair.getFirst(), new MavenCoordinatesImpl("com.android.support", "renderscript", pair.getSecond()), "renderscript-" + pair.getSecond(), null /*projectPath*/); return Pair.of( dependency, new DependencyNode(dependency.getAddress(), JAVA, ImmutableList.of(), null)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof LayoutlibVersionMixin)) { return false; } LayoutlibVersionMixin other = (LayoutlibVersionMixin) obj; if (!mLayoutlibVersion.equals(other.mLayoutlibVersion)) { return false; } return true; }
/** * Create a map for this build from anonymized ID back to project name. * * Used for the debugging and profiling json output only. */ Map<Long, Pair<String, Map<Long,String>>> createDeanonymizer() { return mProjects.asMap().entrySet().stream() .collect(Collectors.toMap( entry -> entry.getValue().mId, entry -> Pair.of( entry.getKey(), HashBiMap.create(entry.getValue().mVariantIds.asMap()).inverse()))); }
private void addAllFields(Api info, Set<String> set) { for (String field : mFields.keySet()) { set.add(field); } for (Pair<String, Integer> superClass : mSuperClasses) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllFields(info, set); } } // Get methods from implemented interfaces as well; for (Pair<String, Integer> superClass : mInterfaces) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllFields(info, set); } } }
synchronized void invalidClassReference(String from, String to) { if (from.contains(".")) { from = ByteCodeUtils.getClassName(from); } if (mWarningsEmitted.contains(Pair.of(from, to))) { return; } for (FilterSpecification dontWarnSpec : mDontWarnSpecs) { if (dontWarnSpec.matches(from) || dontWarnSpec.matches(to)) { return; } } mWarningsEmitted.add(Pair.of(from, to)); mLogger.warn("{} references unknown class: {}", from, to); }
private void addAllMethods(Api info, Set<String> set, boolean includeConstructors) { if (!includeConstructors) { for (String method : mMethods.keySet()) { if (!method.startsWith(CONSTRUCTOR_NAME)) { set.add(method); } } } else { for (String method : mMethods.keySet()) { set.add(method); } } for (Pair<String, Integer> superClass : mSuperClasses) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllMethods(info, set, false); } } // Get methods from implemented interfaces as well; for (Pair<String, Integer> superClass : mInterfaces) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllMethods(info, set, false); } } }
/** * Stores the layoutlib version in the given {@link Properties}. */ void saveProperties(Properties props) { if (mLayoutlibVersion.getFirst().intValue() != LAYOUTLIB_API_NOT_SPECIFIED) { props.setProperty(PkgProps.LAYOUTLIB_API, mLayoutlibVersion.getFirst().toString()); props.setProperty(PkgProps.LAYOUTLIB_REV, mLayoutlibVersion.getSecond().toString()); } }
private void addAllMethods(Api info, Set<String> set, boolean includeConstructors) { if (!includeConstructors) { for (String method : mMethods.keySet()) { if (!method.startsWith(CONSTRUCTOR_NAME)) { set.add(method); } } } else { for (String method : mMethods.keySet()) { set.add(method); } } for (Pair<String, Integer> superClass : mSuperClasses) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllMethods(info, set, false); } } // Get methods from implemented interfaces as well; for (Pair<String, Integer> superClass : mInterfaces) { ApiClass clz = info.getClass(superClass.getFirst()); if (clz != null) { clz.addAllMethods(info, set, false); } } }
synchronized void invalidMemberReference(String from, String to) { if (mWarningsEmitted.contains(Pair.of(from, to))) { return; } String fromClassName; if (from.contains(".")) { fromClassName = ByteCodeUtils.getClassName(from); } else { fromClassName = from; } String toClassName = ByteCodeUtils.getClassName(to); for (FilterSpecification dontWarnSpec : mDontWarnSpecs) { if (dontWarnSpec.matches(fromClassName) || dontWarnSpec.matches(toClassName)) { return; } } mWarningsEmitted.add(Pair.of(from, to)); mLogger.warn("{} references unknown class member: {}", from, to); }
@Override protected int getStartOffset(@NonNull Context context, @NonNull Object cookie) { ASTNode node = (ASTNode) cookie; Pair<Integer, Integer> offsets = getOffsets(node, context); return offsets.getFirst(); }