本文整理汇总了Java中com.sun.tools.javac.comp.MemberEnter类的典型用法代码示例。如果您正苦于以下问题:Java MemberEnter类的具体用法?Java MemberEnter怎么用?Java MemberEnter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MemberEnter类属于com.sun.tools.javac.comp包,在下文中一共展示了MemberEnter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private void init(Context context) {
modules = Modules.instance(context);
attr = Attr.instance(context);
enter = Enter.instance(context);
elements = JavacElements.instance(context);
log = Log.instance(context);
resolve = Resolve.instance(context);
treeMaker = TreeMaker.instance(context);
memberEnter = MemberEnter.instance(context);
names = Names.instance(context);
types = Types.instance(context);
docTreeMaker = DocTreeMaker.instance(context);
parser = ParserFactory.instance(context);
syms = Symtab.instance(context);
fileManager = context.get(JavaFileManager.class);
JavacTask t = context.get(JavacTask.class);
if (t instanceof JavacTaskImpl)
javacTaskImpl = (JavacTaskImpl) t;
}
示例2: findIdent
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
/** Finds a declaration with the given name and type that is in scope at the current location. */
public static Symbol findIdent(String name, VisitorState state, KindSelector kind) {
ClassType enclosingClass = ASTHelpers.getType(state.findEnclosing(ClassTree.class));
if (enclosingClass == null || enclosingClass.tsym == null) {
return null;
}
Env<AttrContext> env = Enter.instance(state.context).getClassEnv(enclosingClass.tsym);
MethodTree enclosingMethod = state.findEnclosing(MethodTree.class);
if (enclosingMethod != null) {
env = MemberEnter.instance(state.context).getMethodEnv((JCMethodDecl) enclosingMethod, env);
}
try {
Method method =
Resolve.class.getDeclaredMethod("findIdent", Env.class, Name.class, KindSelector.class);
method.setAccessible(true);
Symbol result =
(Symbol) method.invoke(Resolve.instance(state.context), env, state.getName(name), kind);
return result.exists() ? result : null;
} catch (ReflectiveOperationException e) {
throw new LinkageError(e.getMessage(), e);
}
}
示例3: getQueryCallExpression
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
/**
* Returns a {@link JCMethodInvocation} node which calls the query call method defined
* by the defineQueryCallMethod method.
* <p>
* The returned node is intended to replace the {@link JCSqlQuery} node, as it is a normal
* method call that can be handled appropriately.
* @param memberEnter The current MemberEnter instance to enter live-generated code.
* @return A {@link JCMethodInvocation} node which is intended to replace the {@link JCSqlQuery} node.
*/
public JCMethodInvocation getQueryCallExpression(MemberEnter memberEnter) {
MethodCallCodeGenerator codeGenerator = new MethodCallCodeGenerator();
String queryCall = codeGenerator.getQueryCall(this);
// create expression parse node from string
JCExpression queryCallExpression = Reifier.getInstance().reifyExpression(queryCall);
if (queryCallExpression instanceof JCMethodInvocation) {
// enter it to symbol table
queryCallExpression.accept(memberEnter);
// note: attribution will happen in the calling method in the Attr
// class, as this will need the expected type
return (JCMethodInvocation) queryCallExpression;
}
// tbd: checked exception handling
throw new RuntimeException("Parsed query call expression is no method invocation");
}
示例4: TreeScannerStateful
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
public TreeScannerStateful(CompilationTask task, JCCompilationUnit jcc) {
this.jcc = jcc ;
trees = Trees.instance(task);
treesC = (JavacTrees)trees;
//Rabbit hole to Wonderland
context = ((BasicJavacTask)task).getContext() ;
this.task = ((BasicJavacTask)task) ;
//Initialize magical classes !
make = TreeMaker.instance(context) ;
names = Names.instance(context) ;
syms = Symtab.instance(context);
types = Types.instance(context) ;
typesC = JavacTypes.instance(context) ;
attr = Attr.instance(context) ;
enter = Enter.instance(context) ;
resolve = Resolve.instance(context) ;
memberEnter = MemberEnter.instance(context) ;
javacElements = JavacElements.instance(context) ;
info = TreeInfo.instance(context) ;
sourcePositions = trees.getSourcePositions();
elements = ((JavacTask)task).getElements();
elementsC = (JavacElements)elements;
}
示例5: preRegister
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
public MemberEnter make(Context c) {
return new NBJavadocMemberEnter(c);
}
});
}
示例6: preRegister
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(MemberEnter.class, new Context.Factory<MemberEnter>() {
public MemberEnter make(Context c) {
return new NBMemberEnter(c);
}
});
}
示例7: init
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private void init(Context context) {
attr = Attr.instance(context);
enter = Enter.instance(context);
elements = JavacElements.instance(context);
log = Log.instance(context);
resolve = Resolve.instance(context);
treeMaker = TreeMaker.instance(context);
memberEnter = MemberEnter.instance(context);
javacTaskImpl = context.get(JavacTaskImpl.class);
}
示例8: preRegister
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
public MemberEnter make(Context c) {
return new JavadocMemberEnter(c);
}
});
}
示例9: init
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private void init(Context context) {
attr = Attr.instance(context);
enter = Enter.instance(context);
elements = JavacElements.instance(context);
log = Log.instance(context);
resolve = Resolve.instance(context);
treeMaker = TreeMaker.instance(context);
memberEnter = MemberEnter.instance(context);
names = Names.instance(context);
types = Types.instance(context);
JavacTask t = context.get(JavacTask.class);
if (t instanceof JavacTaskImpl)
javacTaskImpl = (JavacTaskImpl) t;
}
示例10: getMemberEnterDotEnv
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private static Field getMemberEnterDotEnv() {
if (memberEnterDotEnv != null) return memberEnterDotEnv;
try {
Field f = MemberEnter.class.getDeclaredField("env");
f.setAccessible(true);
memberEnterDotEnv = f;
} catch (NoSuchFieldException e) {
return null;
}
return memberEnterDotEnv;
}
示例11: getEnvOfMemberEnter
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static Env<AttrContext> getEnvOfMemberEnter(MemberEnter memberEnter) {
Field f = getMemberEnterDotEnv();
try {
return (Env<AttrContext>) f.get(memberEnter);
} catch (Exception e) {
return null;
}
}
示例12: setEnvOfMemberEnter
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private static void setEnvOfMemberEnter(MemberEnter memberEnter, Env<AttrContext> env) {
Field f = getMemberEnterDotEnv();
try {
f.set(memberEnter, env);
} catch (Exception e) {
return;
}
}
示例13: memberEnterAndAttribute
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private void memberEnterAndAttribute(JCTree copy, Env<AttrContext> env, Context context) {
MemberEnter memberEnter = MemberEnter.instance(context);
Env<AttrContext> oldEnv = getEnvOfMemberEnter(memberEnter);
setEnvOfMemberEnter(memberEnter, env);
try {
copy.accept(memberEnter);
} catch (Exception ignore) {
// intentionally ignored; usually even if this step fails, val will work (but not for val in method local inner classes and anonymous inner classes).
AssertionLogger.assertLog("member enter failed.", ignore);
} finally {
setEnvOfMemberEnter(memberEnter, oldEnv);
}
attrib(copy, env);
}
示例14: JavacTrees
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
private JavacTrees(Context context) {
context.put(JavacTrees.class, this);
attr = Attr.instance(context);
enter = Enter.instance(context);
elements = JavacElements.instance(context);
log = Log.instance(context);
resolve = Resolve.instance(context);
treeMaker = TreeMaker.instance(context);
memberEnter = MemberEnter.instance(context);
javacTaskImpl = context.get(JavacTaskImpl.class);
}
示例15: preRegister
import com.sun.tools.javac.comp.MemberEnter; //导入依赖的package包/类
public static void preRegister(final Context context) {
context.put(memberEnterKey, new Context.Factory<MemberEnter>() {
public MemberEnter make() {
return new JavadocMemberEnter(context);
}
});
}