java treemarker_Java TreeMaker類代碼示例

本文整理匯總了Java中com.sun.tools.javac.tree.TreeMaker類的典型用法代碼示例。如果您正苦於以下問題:Java TreeMaker類的具體用法?Java TreeMaker怎麽用?Java TreeMaker使用的例子?那麽恭喜您, 這裏精選的類代碼示例或許可以為您提供幫助。

TreeMaker類屬於com.sun.tools.javac.tree包,在下文中一共展示了TreeMaker類的26個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: buildReturnCheck

​點讚 3

import com.sun.tools.javac.tree.TreeMaker; //導入依賴的package包/類

@NotNull

private static Optional> buildReturnCheck(@NotNull ReturnToInstrumentInfo info) {

CompilationUnitProcessingContext context = info.getContext();

ExpressionTree returnExpression = info.getReturnExpression().getExpression();

if (!(returnExpression instanceof JCTree.JCExpression)) {

context.getLogger().reportDetails(String.format(

"find a 'return' expression of type %s but got %s",

JCTree.JCExpression.class.getName(), returnExpression.getClass().getName()

));

return Optional.empty();

}

JCTree.JCExpression returnJcExpression = (JCTree.JCExpression) returnExpression;

TreeMaker factory = context.getAstFactory();

Names symbolsTable = context.getSymbolsTable();

ExceptionTextGenerator generator =

context.getExceptionTextGeneratorManager().getGenerator(METHOD_RETURN, context.getPluginSettings());

String errorMessage = generator.generate(info);

List result = List.of(

factory.VarDef(

factory.Modifiers(0),

symbolsTable.fromString(info.getTmpVariableName()),

info.getReturnType(),

returnJcExpression

)

);

String exceptionToThrow = info.getContext().getPluginSettings().getExceptionToThrow(METHOD_RETURN);

result = result.append(InstrumentationUtil.buildVarCheck(factory,

symbolsTable,

info.getTmpVariableName(),

errorMessage,

exceptionToThrow));

result = result.append(

factory.Return(

factory.Ident(symbolsTable.fromString(info.getTmpVariableName()))));

return Optional.of(result);

}

開發者ID:denis-zhdanov,項目名稱:traute,代碼行數:39,

示例2: CompilationUnitProcessingContext

​點讚 3

import com.sun.tools.javac.tree.TreeMaker; //導入依賴的package包/類

public CompilationUnitProcessingContext(

@NotNull TrautePluginSettings pluginSettings,

@NotNull TreeMaker astFactory,

@NotNull Names symbolsTable,

@NotNull TrautePluginLogger logger,

@NotNull StatsCollector statsCollector,

@NotNull ExceptionTextGeneratorManager exceptionTextGeneratorManager,

@NotNull PackageInfoManager packageInfoManager)

{

this.pluginSettings = pluginSettings;

this.statsCollector = statsCollector;

this.astFactory = astFactory;

this.symbolsTable = symbolsTable;

this.logger = logger;

this.exceptionTextGeneratorManager = exceptionTextGeneratorManager;

this.packageInfoManager = packageInfoManager;

}

開發者ID:denis-zhdanov,項目名稱:traute,代碼行數:18,

示例3: Enter

​點讚 3

import com.sun.tools.javac.tree.TreeMaker; //導入依賴的package包/類

protected Enter(Context context) {

context.put(enterKey, this);

log = Log.instance(context);

reader = ClassReader.instance(context);

make = TreeMaker.instance(context);

syms = Symtab.instance(context);

chk = Check.instance(context);

memberEnter = MemberEnter.instance(context);

types = Types.instance(context);

annotate = Annotate.instance(context);

lint = Lint.instance(context);

names = Names.instance(context);

predefClassDef = make.ClassDef(

make.Modifiers(PUBLIC),

syms.predefClass.name, null, null, null, null);

predefClassDef.sym = syms.predefClass;

todo = Todo.instance(context);

fileManager = context.get(JavaFileManager.class);

Options options = Options.instance(context);

pkginfoOpt = PkgInfo.get(options);

}

開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:25,

示例4: LambdaToMethod

​點讚 3

import com.sun.tools.javac.tree.TreeMaker; //導入依賴的package包/類

private LambdaToMethod(Context context) {

context.put(unlambdaKey, this);

diags = JCDiagnostic.Factory.instance(context);

log = Log.instance(context);

lower = Lower.instance(context);

names = Names.instance(context);

syms = Symtab.instance(context);

rs = Resolve.instance(context);

make = TreeMaker.instance(context);

types = Types.instance(context);

transTypes = TransTypes.instance(context);

analyzer = new LambdaAnalyzerPreprocessor();

Options options = Options.instance(context);

dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");

attr = Attr.instance(context);

forceSerializable = options.isSet("forceSerializable");

}

開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,

示例5: init

​點讚 3

import com.sun.tools.javac.tree.TreeMaker; //導入依賴的package包/類

private void init(Context context) {

modules = Modules.instance(context);

attr = Attr.instance(context);

enter = Enter.instance(context);

elements = JavacElements.instance(context);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值