本文整理汇总了Java中com.sun.tools.javac.comp.Attr类的典型用法代码示例。如果您正苦于以下问题:Java Attr类的具体用法?Java Attr怎么用?Java Attr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attr类属于com.sun.tools.javac.comp包,在下文中一共展示了Attr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import com.sun.tools.javac.comp.Attr; //导入依赖的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;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:JavacTrees.java
示例2: DocEnv
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
/**
* Constructor
*
* @param context Context for this javadoc instance.
*/
private DocEnv(Context context) {
context.put(docEnvKey, this);
messager = Messager.instance0(context);
syms = Symtab.instance(context);
reader = JavadocClassReader.instance0(context);
enter = JavadocEnter.instance0(context);
attr = Attr.instance(context);
names = Name.Table.instance(context);
externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
chk = Check.instance(context);
types = Types.instance(context);
// Default. Should normally be reset with setLocale.
this.doclocale = new DocLocale(this, "", breakiterator);
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:22,代码来源:DocEnv.java
示例3: validateParameterCompatibility
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
@Override
public void validateParameterCompatibility(List<Parameter> params, Attr attr, Env<AttrContext> env)
throws ParameterValidationException {
List<Column> columns = insertQuery.getInsertColumns();
if (insertQuery.getValuesCount() > 0 && insertQuery.getValuesCount() % columns.size() == 0) {
// expect to have simple types
super.validateParameterCompatibility(params, attr, env);
} else if (insertQuery.isObjectInsert()) {
validateAllColumnsFillable();
} else {
// wrong column count
log.error("sql.insert.wrong.column.count", insertQuery.getValuesCount(), columns.size());
throw new ParameterValidationException();
}
validateUpsertIdColumns();
validateIllegalNullParameters(params);
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:20,代码来源:InsertQueryValidator.java
示例4: validateProjectionCompatibility
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
public void validateProjectionCompatibility(List<ProjectionItem> projections, Attr attr, Env<AttrContext> env, JCSqlQuery sqlQuery) {
Type expectedType = sqlQuery.getExpectedType();
if (typesHelper.isResultSet(expectedType)) {
// the projections for expected ResultSets are not validated anymore
return;
}
Type expectedRawType = typesHelper.getRawType(expectedType);
if (typesHelper.isSimpleType(expectedRawType)) {
validateTypeCompatibility(
expectedRawType, Iterables.getOnlyElement(projections).getTypeName());
} else if (typesHelper.isMapType(expectedType)) {
validateMapCompatibility(expectedRawType, projections);
} else {
// expect object type (or list of that)
BiMap<ProjectionItem, FlatObjectAttribute> projectionMapping =
validateObjectCompatibility(expectedRawType, projections);
sqlQuery.setProjectionsMapping(projectionMapping);
}
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:22,代码来源:SelectQueryValidator.java
示例5: CodeTranslator
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
public CodeTranslator(ProcessingEnvironment processingEnv) {
this.trees = Trees.instance(processingEnv);
this.SystemType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(System.class.getName()).asType();
this.ThrowableType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(Throwable.class.getName()).asType();
Context context = ((JavacProcessingEnvironment)processingEnv).getContext();
this.attr = Attr.instance(context);
this.typeUtils = processingEnv.getTypeUtils();
this.factory = new TypeMirrorFactory(processingEnv.getElementUtils(), processingEnv.getTypeUtils()) {
@Override
public TypeInfo create(TypeUse use, TypeMirror type) {
if (type.getKind() == TypeKind.WILDCARD) {
WildcardType wildcardType = (WildcardType) type;
if (wildcardType.getExtendsBound() != null) {
return super.create(wildcardType.getExtendsBound());
} else if (wildcardType.getSuperBound() != null) {
return super.create(use, wildcardType.getSuperBound());
}
}
return super.create(use, type);
}
};
}
开发者ID:vert-x3,项目名称:vertx-codetrans,代码行数:23,代码来源:CodeTranslator.java
示例6: TreeScannerStateful
import com.sun.tools.javac.comp.Attr; //导入依赖的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;
}
开发者ID:metabrain,项目名称:java8-plugin-persitent-local-vars,代码行数:27,代码来源:TreeScannerStateful.java
示例7: attributeTree
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors) {
Log log = Log.instance(jti.getContext());
JavaFileObject prev = log.useSource(new DummyJFO());
Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
@Override
public void report(JCDiagnostic diag) {
errors.add(diag);
}
};
NBResolve resolve = NBResolve.instance(jti.getContext());
resolve.disableAccessibilityChecks();
// Enter enter = Enter.instance(jti.getContext());
// enter.shadowTypeEnvs(true);
// ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
// ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
try {
Attr attr = Attr.instance(jti.getContext());
Env<AttrContext> env = getEnv(scope);
if (tree instanceof JCExpression)
return attr.attribExpr((JCTree) tree,env, Type.noType);
return attr.attribStat((JCTree) tree,env);
} finally {
// cacheContext.leave();
log.useSource(prev);
log.popDiagnosticHandler(discardHandler);
resolve.restoreAccessbilityChecks();
// enter.shadowTypeEnvs(false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:TreeUtilities.java
示例8: attributeTreeTo
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
private static Scope attributeTreeTo(JavacTaskImpl jti, Tree tree, Scope scope, Tree to, final List<Diagnostic<? extends JavaFileObject>> errors) {
Log log = Log.instance(jti.getContext());
JavaFileObject prev = log.useSource(new DummyJFO());
Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
@Override
public void report(JCDiagnostic diag) {
errors.add(diag);
}
};
NBResolve resolve = NBResolve.instance(jti.getContext());
resolve.disableAccessibilityChecks();
// Enter enter = Enter.instance(jti.getContext());
// enter.shadowTypeEnvs(true);
// ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
// ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
try {
Attr attr = Attr.instance(jti.getContext());
Env<AttrContext> env = getEnv(scope);
Env<AttrContext> result = tree instanceof JCExpression ?
attr.attribExprToTree((JCExpression) tree, env, (JCTree) to) :
attr.attribStatToTree((JCTree) tree, env, (JCTree) to);
try {
Constructor<JavacScope> c = JavacScope.class.getDeclaredConstructor(Env.class);
c.setAccessible(true);
return c.newInstance(result);
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
throw new IllegalStateException(ex);
}
} finally {
// cacheContext.leave();
log.useSource(prev);
log.popDiagnosticHandler(discardHandler);
resolve.restoreAccessbilityChecks();
// enter.shadowTypeEnvs(false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:TreeUtilities.java
示例9: attributeTree
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope, final List<Diagnostic<? extends JavaFileObject>> errors) {
Log log = Log.instance(jti.getContext());
JavaFileObject prev = log.useSource(new DummyJFO());
Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
@Override
public void report(JCDiagnostic diag) {
errors.add(diag);
}
};
NBResolve resolve = NBResolve.instance(jti.getContext());
resolve.disableAccessibilityChecks();
// Enter enter = Enter.instance(jti.getContext());
// enter.shadowTypeEnvs(true);
// ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
// ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
try {
Attr attr = Attr.instance(jti.getContext());
Env<AttrContext> env = ((JavacScope) scope).getEnv();
if (tree instanceof JCExpression)
return attr.attribExpr((JCTree) tree,env, Type.noType);
return attr.attribStat((JCTree) tree,env);
} finally {
// cacheContext.leave();
log.useSource(prev);
log.popDiagnosticHandler(discardHandler);
resolve.restoreAccessbilityChecks();
// enter.shadowTypeEnvs(false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:Utilities.java
示例10: attributeTree
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
private static TypeMirror attributeTree(JavacTaskImpl jti, Tree tree, Scope scope,
final List<Diagnostic<? extends JavaFileObject>> errors, @NullAllowed final Diagnostic.Kind filter) {
Log log = Log.instance(jti.getContext());
JavaFileObject prev = log.useSource(new DummyJFO());
Enter enter = Enter.instance(jti.getContext());
Log.DiagnosticHandler discardHandler = new Log.DiscardDiagnosticHandler(log) {
private Diagnostic.Kind f = filter == null ? Diagnostic.Kind.ERROR : filter;
@Override
public void report(JCDiagnostic diag) {
if (diag.getKind().compareTo(f) >= 0) {
errors.add(diag);
}
}
};
// ArgumentAttr argumentAttr = ArgumentAttr.instance(jti.getContext());
// ArgumentAttr.LocalCacheContext cacheContext = argumentAttr.withLocalCacheContext();
try {
// enter.shadowTypeEnvs(true);
Attr attr = Attr.instance(jti.getContext());
Env<AttrContext> env = ((JavacScope) scope).getEnv();
if (tree instanceof JCTree.JCExpression) {
return attr.attribExpr((JCTree) tree,env, Type.noType);
}
return attr.attribStat((JCTree) tree,env);
} finally {
// cacheContext.leave();
log.useSource(prev);
log.popDiagnosticHandler(discardHandler);
// enter.shadowTypeEnvs(false);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:Utilities.java
示例11: preRegister
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
public static void preRegister(Context context) {
context.put(attrKey, new Context.Factory<Attr>() {
public Attr make(Context c) {
return new NBAttr(c);
}
});
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:NBAttr.java
示例12: visitNewClass
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
@Override
public void visitNewClass(JCNewClass tree) {
super.visitNewClass(tree);
if (tree.def != null && tree.def.sym == null) {
try {
Field envField = Attr.class.getDeclaredField("env");
envField.setAccessible(true);
Env<AttrContext> env = (Env<AttrContext>) envField.get(this);
env = env.dup(tree);
attribStat(tree.def, env);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException ex) {
Logger.getLogger(NBAttr.class.getName()).log(Level.FINE, null, ex);
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NBAttr.java
示例13: init
import com.sun.tools.javac.comp.Attr; //导入依赖的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);
}
开发者ID:tranleduy2000,项目名称:javaide,代码行数:11,代码来源:JavacTrees.java
示例14: setLazyConstValue
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
public void setLazyConstValue(final Env<AttrContext> env,
final Attr attr,
final JCTree.JCExpression initializer)
{
setData(new Callable<Object>() {
public Object call() {
return attr.attribLazyConstantValue(env, initializer, type);
}
});
}
开发者ID:tranleduy2000,项目名称:javaide,代码行数:11,代码来源:Symbol.java
示例15: init
import com.sun.tools.javac.comp.Attr; //导入依赖的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;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:JavacTrees.java
示例16: TypeAnnotations
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
protected TypeAnnotations(Context context) {
context.put(typeAnnosKey, this);
names = Names.instance(context);
log = Log.instance(context);
syms = Symtab.instance(context);
annotate = Annotate.instance(context);
attr = Attr.instance(context);
Options options = Options.instance(context);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:TypeAnnotations.java
示例17: setLazyConstValue
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
public void setLazyConstValue(final Env<AttrContext> env,
final Attr attr,
final JCVariableDecl variable)
{
setData(new Callable<Object>() {
public Object call() {
return attr.attribLazyConstantValue(env, variable, type);
}
});
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:Symbol.java
示例18: TypeAnnotations
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
protected TypeAnnotations(Context context) {
context.put(typeAnnosKey, this);
names = Names.instance(context);
log = Log.instance(context);
syms = Symtab.instance(context);
annotate = Annotate.instance(context);
attr = Attr.instance(context);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:TypeAnnotations.java
示例19: preRegister
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
static void preRegister(Context context, final Counter counter) {
context.put(attrKey, new Context.Factory<Attr>() {
public Attr make(Context c) {
counter.count++;
return new MyAttr(c);
}
});
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:9,代码来源:T7021650.java
示例20: process
import com.sun.tools.javac.comp.Attr; //导入依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
round++;
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
// verify items in context as expected
check("Demo", Demo.instance(context), Demo.class);
check("Attr", Attr.instance(context), MyAttr.class);
// For a few rounds, generate new source files, so that we can check whether
// values in the context are correctly handled in subsequent processing rounds
if (round <= MAX_ROUNDS) {
String pkg = "p";
String currClass = "Gen" + round;
String curr = pkg + "." + currClass;
String next = (pkg + ".Gen" + (round + 1));
StringBuilder text = new StringBuilder();
text.append("package ").append(pkg).append(";\n");
text.append("public class ").append(currClass).append(" {\n");
if (round < MAX_ROUNDS)
text.append(" ").append(next).append(" x;\n");
text.append("}\n");
try {
JavaFileObject fo = filer.createSourceFile(curr);
Writer out = fo.openWriter();
try {
out.write(text.toString());
} finally {
out.close();
}
} catch (IOException e) {
throw new Error(e);
}
}
return true;
}
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:40,代码来源:T7021650.java
注:本文中的com.sun.tools.javac.comp.Attr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论