• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Filter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.tools.javac.util.Filter的典型用法代码示例。如果您正苦于以下问题:Java Filter类的具体用法?Java Filter怎么用?Java Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Filter类属于com.sun.tools.javac.util包,在下文中一共展示了Filter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: get

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
MethodSymbol get(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) {
    SoftReference<Map<TypeSymbol, Entry>> ref_cache = _map.get(ms);
    Map<TypeSymbol, Entry> cache = ref_cache != null ? ref_cache.get() : null;
    if (cache == null) {
        cache = new HashMap<TypeSymbol, Entry>();
        _map.put(ms, new SoftReference<Map<TypeSymbol, Entry>>(cache));
    }
    Entry e = cache.get(origin);
    CompoundScope members = membersClosure(origin.type, true);
    if (e == null ||
            !e.matches(implFilter, checkResult, members.getMark())) {
        MethodSymbol impl = implementationInternal(ms, origin, checkResult, implFilter);
        cache.put(origin, new Entry(impl, implFilter, checkResult, members.getMark()));
        return impl;
    }
    else {
        return e.cachedImpl;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:20,代码来源:Types.java


示例2: getMethodRecursive

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public Symbol.MethodSymbol getMethodRecursive(String name, Filter<Symbol> filter) {
    Symbol.MethodSymbol methodSymbol = deepMethodsCache.get(name);
    if (methodSymbol == null) {
        methodSymbol = (Symbol.MethodSymbol) getMember(name, filter);
    }
    Symbol.ClassSymbol classSymbol = getClassSymbol();
    while (classSymbol != null && methodSymbol == null) {
        classSymbol = (Symbol.ClassSymbol) classSymbol.getSuperclass().asElement();
        Iterator<Symbol> iterator = classSymbol.members().getElementsByName(utils.getName(name), filter).iterator();
        if (iterator.hasNext()) {
            methodSymbol = (Symbol.MethodSymbol) iterator.next();
            deepMethodsCache.put(name, methodSymbol);
            return methodSymbol;
        }
    }
    return methodSymbol;
}
 
开发者ID:ixkor,项目名称:genaroid,代码行数:18,代码来源:BaseClassWrapper.java


示例3: findMatchingMethods

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * Finds all methods in any superclass of {@code startClass} with a certain {@code name} that
 * match the given {@code predicate}.
 *
 * @return The (possibly empty) set of methods in any superclass that match {@code predicate} and
 *     have the given {@code name}.
 */
public static Set<MethodSymbol> findMatchingMethods(
    Name name, final Predicate<MethodSymbol> predicate, Type startClass, Types types) {
  Filter<Symbol> matchesMethodPredicate =
      sym -> sym instanceof MethodSymbol && predicate.apply((MethodSymbol) sym);

  Set<MethodSymbol> matchingMethods = new HashSet<>();
  // Iterate over all classes and interfaces that startClass inherits from.
  for (Type superClass : types.closure(startClass)) {
    // Iterate over all the methods declared in superClass.
    TypeSymbol superClassSymbol = superClass.tsym;
    Scope superClassSymbols = superClassSymbol.members();
    if (superClassSymbols != null) { // Can be null if superClass is a type variable
      for (Symbol symbol :
          superClassSymbols.getSymbolsByName(name, matchesMethodPredicate, NON_RECURSIVE)) {
        // By definition of the filter, we know that the symbol is a MethodSymbol.
        matchingMethods.add((MethodSymbol) symbol);
      }
    }
  }
  return matchingMethods;
}
 
开发者ID:google,项目名称:error-prone,代码行数:29,代码来源:ASTHelpers.java


示例4: getSettersOfType

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public List<MethodSymbol> getSettersOfType(Type type) {
	List<MethodSymbol> setters = Lists.newArrayList();
	
	Filter<Symbol> setterFilter = new Filter<Symbol>() {
		@Override
		public boolean accepts(Symbol t) {
			if (t instanceof MethodSymbol) {
				MethodSymbol ms = (MethodSymbol) t;
				// filter for methods that start with set and have exactly 1 parameter
				return ms.name.toString().startsWith("set") && ms.params.size() == 1;
			}
			return false;
		}
	};
	
	for (Symbol sym : type.tsym.members().getElements(setterFilter)) {
		setters.add((MethodSymbol) sym);
	}
	
	return setters;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:22,代码来源:ExpectedTypesHelper.java


示例5: Entry

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public Entry(MethodSymbol cachedImpl,
        Filter<Symbol> scopeFilter,
        boolean checkResult,
        int prevMark) {
    this.cachedImpl = cachedImpl;
    this.implFilter = scopeFilter;
    this.checkResult = checkResult;
    this.prevMark = prevMark;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:Types.java


示例6: implementationInternal

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
private MethodSymbol implementationInternal(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) {
    for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = supertype(t)) {
        while (t.tag == TYPEVAR)
            t = t.getUpperBound();
        TypeSymbol c = t.tsym;
        for (Scope.Entry e = c.members().lookup(ms.name, implFilter);
             e.scope != null;
             e = e.next(implFilter)) {
            if (e.sym != null &&
                     e.sym.overrides(ms, origin, Types.this, checkResult))
                return (MethodSymbol)e.sym;
        }
    }
    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:16,代码来源:Types.java


示例7: filter

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public static List<Type> filter(List<Type> ts, Filter<Type> tf) {
    ListBuffer<Type> buf = ListBuffer.lb();
    for (Type t : ts) {
        if (tf.accepts(t)) {
            buf.append(t);
        }
    }
    return buf.toList();
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:10,代码来源:Type.java


示例8: checkConsistent

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    int expectedKind = -1;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = Kinds.VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = Kinds.MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = Kinds.MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:Pool.java


示例9: checkConsistent

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * Check consistency of reference kind and symbol (see JVMS 4.4.8)
 */
@SuppressWarnings("fallthrough")
private void checkConsistent() {
    boolean staticOk = false;
    Kind expectedKind = null;
    Filter<Name> nameFilter = nonInitFilter;
    boolean interfaceOwner = false;
    switch (refKind) {
        case ClassFile.REF_getStatic:
        case ClassFile.REF_putStatic:
            staticOk = true;
        case ClassFile.REF_getField:
        case ClassFile.REF_putField:
            expectedKind = VAR;
            break;
        case ClassFile.REF_newInvokeSpecial:
            nameFilter = initFilter;
            expectedKind = MTH;
            break;
        case ClassFile.REF_invokeInterface:
            interfaceOwner = true;
            expectedKind = MTH;
            break;
        case ClassFile.REF_invokeStatic:
            interfaceOwner = true;
            staticOk = true;
        case ClassFile.REF_invokeVirtual:
            expectedKind = MTH;
            break;
        case ClassFile.REF_invokeSpecial:
            interfaceOwner = true;
            expectedKind = MTH;
            break;
    }
    Assert.check(!refSym.isStatic() || staticOk);
    Assert.check(refSym.kind == expectedKind);
    Assert.check(nameFilter.accepts(refSym.name));
    Assert.check(!refSym.owner.isInterface() || interfaceOwner);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:Pool.java


示例10: filterVars

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
private List<Type> filterVars(Filter<UndetVar> fu) {
    ListBuffer<Type> res = new ListBuffer<>();
    for (Type t : undetvars) {
        UndetVar uv = (UndetVar)t;
        if (fu.accepts(uv)) {
            res.append(uv.qtype);
        }
    }
    return res.toList();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:InferenceContext.java


示例11: iterator

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public Iterator<Symbol> iterator() {
    return scope.getSymbols(new Filter<Symbol>() {
        public boolean accepts(Symbol t) {
            return !unwanted(t);
        }
    }, NON_RECURSIVE).iterator();
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:8,代码来源:FilteredMemberList.java


示例12: restvars

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * returns the list of uninstantiated variables (as type-variables) in this
 * inference context
 */
List<Type> restvars() {
    return filterVars(new Filter<UndetVar>() {
        public boolean accepts(UndetVar uv) {
            return uv.getInst() == null;
        }
    });
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:12,代码来源:InferenceContext.java


示例13: instvars

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * returns the list of instantiated variables (as type-variables) in this
 * inference context
 */
List<Type> instvars() {
    return filterVars(new Filter<UndetVar>() {
        public boolean accepts(UndetVar uv) {
            return uv.getInst() != null;
        }
    });
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:12,代码来源:InferenceContext.java


示例14: boundedVars

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
/**
 * Get list of bounded inference variables (where bound is other than
 * declared bounds).
 */
final List<Type> boundedVars() {
    return filterVars(new Filter<UndetVar>() {
        public boolean accepts(UndetVar uv) {
            return uv.getBounds(InferenceBound.UPPER)
                     .diff(uv.getDeclaredBounds())
                     .appendList(uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)).nonEmpty();
        }
    });
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:14,代码来源:InferenceContext.java


示例15: getMember

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public Symbol getMember(String name, Filter<Symbol> filter) {
    Symbol member = membersCache.get(name);
    if (member == null) {
        Iterator<Symbol> iterator = classSymbol.members().getElementsByName(utils.getName(name), filter).iterator();
        if (iterator.hasNext()) {
            member = iterator.next();
            membersCache.put(name, member);
        }
    }
    return member;
}
 
开发者ID:ixkor,项目名称:genaroid,代码行数:12,代码来源:BaseClassWrapper.java


示例16: getOnCreateMethod

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
@Override
public MethodSymbol getOnCreateMethod() {
    return (MethodSymbol) getMember("onCreate", new Filter<Symbol>() {
        @Override
        public boolean accepts(Symbol symbol) {
            return symbol.asType().getParameterTypes().size() == 1;
        }
    });
}
 
开发者ID:ixkor,项目名称:genaroid,代码行数:10,代码来源:ActivityWrapper.java


示例17: getOnSaveInstanceStateMethod

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
@Override
public MethodSymbol getOnSaveInstanceStateMethod() {
    return (MethodSymbol) getMember("onSaveInstanceState", new Filter<Symbol>() {
        @Override
        public boolean accepts(Symbol symbol) {
            return symbol.asType().getParameterTypes().size() == 1;
        }
    });
}
 
开发者ID:ixkor,项目名称:genaroid,代码行数:10,代码来源:ActivityWrapper.java


示例18: matches

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
boolean matches(Filter<Symbol> scopeFilter, boolean checkResult, int mark) {
    return this.implFilter == scopeFilter &&
            this.checkResult == checkResult &&
            this.prevMark == mark;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:6,代码来源:Types.java


示例19: implementation

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
public MethodSymbol implementation(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter<Symbol> implFilter) {
    return implCache.get(ms, origin, checkResult, implFilter);
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:4,代码来源:Types.java


示例20: getMembers

import com.sun.tools.javac.util.Filter; //导入依赖的package包/类
Iterable<Symbol> getMembers( Symbol.ClassSymbol classSym, Filter<Symbol> filter ); 
开发者ID:manifold-systems,项目名称:manifold,代码行数:2,代码来源:IDynamicJdk.java



注:本文中的com.sun.tools.javac.util.Filter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BadPositionCategoryException类代码示例发布时间:2022-05-21
下一篇:
Java TiViewProxy类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap