本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCBlock类的典型用法代码示例。如果您正苦于以下问题:Java JCBlock类的具体用法?Java JCBlock怎么用?Java JCBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCBlock类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitMethodDef
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
@Override
public void visitMethodDef(JCMethodDecl tree) {
cancelService.abortIfCanceled();
JCBlock body = tree.body;
try {
super.visitMethodDef(tree);
} finally {
//reinstall body:
tree.body = body;
}
if (trees instanceof NBJavacTrees && !env.enclClass.defs.contains(tree)) {
TreePath path = trees.getPath(env.toplevel, env.enclClass);
if (path != null) {
((NBJavacTrees)trees).addPathForElement(tree.sym, new TreePath(path, tree));
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NBJavadocMemberEnter.java
示例2: resolutionExceptionBlock
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private JCBlock resolutionExceptionBlock() {
if (resolutionExceptionBlock == null) {
JCExpression expClass = null;
// Split the exception class name at dots
for (String id : SPIResolutionException.class.getName().split("\\.")) {
Name nm = names.fromString(id);
if (expClass == null) {
expClass = make.Ident(nm);
} else {
expClass = make.Select(expClass, nm);
}
}
JCNewClass exp = make.NewClass(null,
null, expClass, List.of(make.Literal(keyIndex)), null);
resolutionExceptionBlock = make.Block(0L, List.of(make.Throw(exp)));
}
return resolutionExceptionBlock;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Corraller.java
示例3: resolutionExceptionBlock
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private JCBlock resolutionExceptionBlock() {
if (resolutionExceptionBlock == null) {
JCExpression expClass = null;
// Split the exception class name at dots
for (String id : SPIResolutionException.class.getName().split("\\.")) {
Name nm = names.fromString(id);
if (expClass == null) {
expClass = make.Ident(nm);
} else {
expClass = make.Select(expClass, nm);
}
}
JCNewClass exp = make.NewClass(null,
null, expClass, List.of(make.Literal(keyIndex)), null);
resolutionExceptionBlock = make.Block(0L, List.<JCStatement>of(
make.Throw(exp)));
}
return resolutionExceptionBlock;
}
开发者ID:campolake,项目名称:openjdk9,代码行数:20,代码来源:Corraller.java
示例4: suppress
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private boolean suppress(JCTree tree) {
if (tree instanceof JCBlock) {
JCBlock block = (JCBlock) tree;
return (Position.NOPOS == block.pos) && block.stats.isEmpty();
}
if (tree instanceof JCExpressionStatement) {
JCExpression expr = ((JCExpressionStatement)tree).expr;
if (expr instanceof JCMethodInvocation) {
JCMethodInvocation inv = (JCMethodInvocation) expr;
if (!inv.typeargs.isEmpty() || !inv.args.isEmpty()) return false;
if (!(inv.meth instanceof JCIdent)) return false;
return ((JCIdent) inv.meth).name.toString().equals("super");
}
}
return false;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:PrettyPrinter.java
示例5: visitDoLoop
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
@Override public void visitDoLoop(JCDoWhileLoop tree) {
aPrint("do ");
if (tree.body instanceof JCBlock) {
println("{");
indent++;
print(((JCBlock) tree.body).stats, "");
indent--;
aPrint("}");
} else print(tree.body);
print(" while ");
if (tree.cond instanceof JCParens) {
print(tree.cond);
} else {
print("(");
print(tree.cond);
print(")");
}
println(";", tree);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:PrettyPrinter.java
示例6: buildTree
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected JavacNode buildTree(JCTree node, Kind kind) {
switch (kind) {
case COMPILATION_UNIT:
return buildCompilationUnit((JCCompilationUnit) node);
case TYPE:
return buildType((JCClassDecl) node);
case FIELD:
return buildField((JCVariableDecl) node);
case INITIALIZER:
return buildInitializer((JCBlock) node);
case METHOD:
return buildMethod((JCMethodDecl) node);
case ARGUMENT:
return buildLocalVar((JCVariableDecl) node, kind);
case LOCAL:
return buildLocalVar((JCVariableDecl) node, kind);
case STATEMENT:
return buildStatementOrExpression(node);
case ANNOTATION:
return buildAnnotation((JCAnnotation) node, false);
default:
throw new AssertionError("Did not expect: " + kind);
}
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:26,代码来源:JavacAST.java
示例7: buildType
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private JavacNode buildType(JCClassDecl type) {
if (setAndGetAsHandled(type)) return null;
List<JavacNode> childNodes = new ArrayList<JavacNode>();
for (JCAnnotation annotation : type.mods.annotations) addIfNotNull(childNodes, buildAnnotation(annotation, false));
for (JCTree def : type.defs) {
/* A def can be:
* JCClassDecl for inner types
* JCMethodDecl for constructors and methods
* JCVariableDecl for fields
* JCBlock for (static) initializers
*/
if (def instanceof JCMethodDecl) addIfNotNull(childNodes, buildMethod((JCMethodDecl)def));
else if (def instanceof JCClassDecl) addIfNotNull(childNodes, buildType((JCClassDecl)def));
else if (def instanceof JCVariableDecl) addIfNotNull(childNodes, buildField((JCVariableDecl)def));
else if (def instanceof JCBlock) addIfNotNull(childNodes, buildInitializer((JCBlock)def));
}
return putInMap(new JavacNode(this, type, childNodes, Kind.TYPE));
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:JavacAST.java
示例8: buildTryCatchBlock
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
public JCStatement buildTryCatchBlock(JavacNode node, List<JCStatement> contents, String exception, JCTree source) {
JavacTreeMaker maker = node.getTreeMaker();
Context context = node.getContext();
JCBlock tryBlock = setGeneratedBy(maker.Block(0, contents), source, context);
JCExpression varType = chainDots(node, exception.split("\\."));
JCVariableDecl catchParam = maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER), node.toName("$ex"), varType, null);
JCExpression lombokLombokSneakyThrowNameRef = chainDots(node, "lombok", "Lombok", "sneakyThrow");
JCBlock catchBody = maker.Block(0, List.<JCStatement>of(maker.Throw(maker.Apply(
List.<JCExpression>nil(), lombokLombokSneakyThrowNameRef,
List.<JCExpression>of(maker.Ident(node.toName("$ex")))))));
JCTry tryStatement = maker.Try(tryBlock, List.of(recursiveSetGeneratedBy(maker.Catch(catchParam, catchBody), source, context)), null);
if (JavacHandlerUtil.inNetbeansEditor(node)) {
//set span (start and end position) of the try statement and the main block
//this allows NetBeans to dive into the statement correctly:
JCCompilationUnit top = (JCCompilationUnit) node.top().get();
int startPos = contents.head.pos;
int endPos = Javac.getEndPosition(contents.last().pos(), top);
tryBlock.pos = startPos;
tryStatement.pos = startPos;
Javac.storeEnd(tryBlock, endPos, top);
Javac.storeEnd(tryStatement, endPos, top);
}
return setGeneratedBy(tryStatement, source, context);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:27,代码来源:HandleSneakyThrows.java
示例9: generateCleanMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private JCMethodDecl generateCleanMethod(java.util.List<BuilderFieldData> builderFields, JavacNode type, JCTree source) {
JavacTreeMaker maker = type.getTreeMaker();
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
for (BuilderFieldData bfd : builderFields) {
if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, type, source, statements);
}
}
statements.append(maker.Exec(maker.Assign(maker.Select(maker.Ident(type.toName("this")), type.toName("$lombokUnclean")), maker.Literal(CTC_BOOLEAN, false))));
JCBlock body = maker.Block(0, statements.toList());
return maker.MethodDef(maker.Modifiers(Flags.PUBLIC), type.toName("$lombokClean"), maker.Type(Javac.createVoidType(maker, CTC_VOID)), List.<JCTypeParameter>nil(), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null);
/*
* if (shouldReturnThis) {
methodType = cloneSelfType(field);
}
if (methodType == null) {
//WARNING: Do not use field.getSymbolTable().voidType - that field has gone through non-backwards compatible API changes within javac1.6.
methodType = treeMaker.Type(Javac.createVoidType(treeMaker, CTC_VOID));
shouldReturnThis = false;
}
*/
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:27,代码来源:HandleBuilder.java
示例10: generateBuilderMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
public JCMethodDecl generateBuilderMethod(boolean isStatic, String builderMethodName, String builderClassName, JavacNode type, List<JCTypeParameter> typeParams) {
JavacTreeMaker maker = type.getTreeMaker();
ListBuffer<JCExpression> typeArgs = new ListBuffer<JCExpression>();
for (JCTypeParameter typeParam : typeParams) {
typeArgs.append(maker.Ident(typeParam.name));
}
JCExpression call = maker.NewClass(null, List.<JCExpression>nil(), namePlusTypeParamsToTypeReference(maker, type.toName(builderClassName), typeParams), List.<JCExpression>nil(), null);
JCStatement statement = maker.Return(call);
JCBlock body = maker.Block(0, List.<JCStatement>of(statement));
int modifiers = Flags.PUBLIC;
if (isStatic) modifiers |= Flags.STATIC;
return maker.MethodDef(maker.Modifiers(modifiers), type.toName(builderMethodName), namePlusTypeParamsToTypeReference(maker, type.toName(builderClassName), typeParams), copyTypeParams(maker, typeParams), List.<JCVariableDecl>nil(), List.<JCExpression>nil(), body, null);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:HandleBuilder.java
示例11: createCanEqual
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
public JCMethodDecl createCanEqual(JavacNode typeNode, JCTree source, List<JCAnnotation> onParam) {
/* protected boolean canEqual(final java.lang.Object other) {
* return other instanceof Outer.Inner.MyType;
* }
*/
JavacTreeMaker maker = typeNode.getTreeMaker();
JCModifiers mods = maker.Modifiers(Flags.PROTECTED, List.<JCAnnotation>nil());
JCExpression returnType = maker.TypeIdent(CTC_BOOLEAN);
Name canEqualName = typeNode.toName("canEqual");
JCExpression objectType = genJavaLangTypeRef(typeNode, "Object");
Name otherName = typeNode.toName("other");
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(flags, onParam), otherName, objectType, null));
JCBlock body = maker.Block(0, List.<JCStatement>of(
maker.Return(maker.TypeTest(maker.Ident(otherName), createTypeReference(typeNode)))));
return recursiveSetGeneratedBy(maker.MethodDef(mods, canEqualName, returnType, List.<JCTypeParameter>nil(), params, List.<JCExpression>nil(), body, null), source, typeNode.getContext());
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:HandleEqualsAndHashCode.java
示例12: generateClearMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private void generateClearMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) {
JCModifiers mods = maker.Modifiers(Flags.PUBLIC);
List<JCTypeParameter> typeParams = List.nil();
List<JCExpression> thrown = List.nil();
List<JCVariableDecl> params = List.nil();
List<JCExpression> jceBlank = List.nil();
JCExpression thisDotKeyField = chainDots(builderType, "this", data.getPluralName() + "$key");
JCExpression thisDotKeyFieldDotClear = chainDots(builderType, "this", data.getPluralName() + "$key", "clear");
JCExpression thisDotValueFieldDotClear = chainDots(builderType, "this", data.getPluralName() + "$value", "clear");
JCStatement clearKeyCall = maker.Exec(maker.Apply(jceBlank, thisDotKeyFieldDotClear, jceBlank));
JCStatement clearValueCall = maker.Exec(maker.Apply(jceBlank, thisDotValueFieldDotClear, jceBlank));
JCExpression cond = maker.Binary(CTC_NOT_EQUAL, thisDotKeyField, maker.Literal(CTC_BOT, null));
JCBlock clearCalls = maker.Block(0, List.of(clearKeyCall, clearValueCall));
JCStatement ifSetCallClear = maker.If(cond, clearCalls, null);
List<JCStatement> statements = returnStatement != null ? List.of(ifSetCallClear, returnStatement) : List.of(ifSetCallClear);
JCBlock body = maker.Block(0, statements);
Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString()));
JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, params, thrown, body, null);
injectMethod(builderType, method);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:23,代码来源:JavacJavaUtilMapSingularizer.java
示例13: generateClearMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
private void generateClearMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source) {
JCModifiers mods = maker.Modifiers(Flags.PUBLIC);
List<JCTypeParameter> typeParams = List.nil();
List<JCExpression> thrown = List.nil();
List<JCVariableDecl> params = List.nil();
List<JCExpression> jceBlank = List.nil();
JCExpression thisDotField = maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName());
JCExpression thisDotFieldDotClear = maker.Select(maker.Select(maker.Ident(builderType.toName("this")), data.getPluralName()), builderType.toName("clear"));
JCStatement clearCall = maker.Exec(maker.Apply(jceBlank, thisDotFieldDotClear, jceBlank));
JCExpression cond = maker.Binary(CTC_NOT_EQUAL, thisDotField, maker.Literal(CTC_BOT, null));
JCStatement ifSetCallClear = maker.If(cond, clearCall, null);
List<JCStatement> statements = returnStatement != null ? List.of(ifSetCallClear, returnStatement) : List.of(ifSetCallClear);
JCBlock body = maker.Block(0, statements);
Name methodName = builderType.toName(HandlerUtil.buildAccessorName("clear", data.getPluralName().toString()));
JCMethodDecl method = maker.MethodDef(mods, methodName, returnType, typeParams, params, thrown, body, null);
injectMethod(builderType, method);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:20,代码来源:JavacJavaUtilListSetSingularizer.java
示例14: generateSingularMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
void generateSingularMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) {
List<JCTypeParameter> typeParams = List.nil();
List<JCExpression> thrown = List.nil();
JCModifiers mods = maker.Modifiers(Flags.PUBLIC);
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, false, source));
JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), "add");
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getSingularName())));
statements.append(maker.Exec(invokeAdd));
if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Name name = data.getSingularName();
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("add", name.toString()));
JCExpression paramType = cloneParamType(0, maker, data.getTypeArgs(), builderType, source);
JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getSingularName(), paramType, null);
JCMethodDecl method = maker.MethodDef(mods, name, returnType, typeParams, List.of(param), thrown, body, null);
injectMethod(builderType, method);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:JavacJavaUtilListSetSingularizer.java
示例15: generatePluralMethod
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
void generatePluralMethod(JavacTreeMaker maker, JCExpression returnType, JCStatement returnStatement, SingularData data, JavacNode builderType, JCTree source, boolean fluent) {
List<JCTypeParameter> typeParams = List.nil();
List<JCExpression> thrown = List.nil();
JCModifiers mods = maker.Modifiers(Flags.PUBLIC);
ListBuffer<JCStatement> statements = new ListBuffer<JCStatement>();
statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, false, source));
JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), "addAll");
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getPluralName())));
statements.append(maker.Exec(invokeAdd));
if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Name name = data.getPluralName();
long paramFlags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, builderType.getContext());
if (!fluent) name = builderType.toName(HandlerUtil.buildAccessorName("addAll", name.toString()));
JCExpression paramType = chainDots(builderType, "java", "util", "Collection");
paramType = addTypeArgs(1, true, builderType, paramType, data.getTypeArgs(), source);
JCVariableDecl param = maker.VarDef(maker.Modifiers(paramFlags), data.getPluralName(), paramType, null);
JCMethodDecl method = maker.MethodDef(mods, name, returnType, typeParams, List.of(param), thrown, body, null);
injectMethod(builderType, method);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:22,代码来源:JavacJavaUtilListSetSingularizer.java
示例16: visitLabelled
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
public void visitLabelled(JCLabeledStatement tree) {
try {
print(tree.label + ":");
if (isEmptyStat(tree.body) || tree.body instanceof JCSkip) {
print(" ;");
} else if (tree.body instanceof JCBlock) {
print(" ");
printStat(tree.body);
} else {
println();
align();
printStat(tree.body);
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:18,代码来源:PrettyCommentsPrinter.java
示例17: createCanEqual
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
public JCMethodDecl createCanEqual(JavacNode typeNode, JCTree source, List<JCAnnotation> onParam) {
/* public boolean canEqual(final java.lang.Object other) {
* return other instanceof Outer.Inner.MyType;
* }
*/
JavacTreeMaker maker = typeNode.getTreeMaker();
JCModifiers mods = maker.Modifiers(Flags.PROTECTED, List.<JCAnnotation>nil());
JCExpression returnType = maker.TypeIdent(CTC_BOOLEAN);
Name canEqualName = typeNode.toName("canEqual");
JCExpression objectType = genJavaLangTypeRef(typeNode, "Object");
Name otherName = typeNode.toName("other");
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, typeNode.getContext());
List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(flags, onParam), otherName, objectType, null));
JCBlock body = maker.Block(0, List.<JCStatement>of(
maker.Return(maker.TypeTest(maker.Ident(otherName), createTypeReference(typeNode)))));
return recursiveSetGeneratedBy(maker.MethodDef(mods, canEqualName, returnType, List.<JCTypeParameter>nil(), params, List.<JCExpression>nil(), body, null), source, typeNode.getContext());
}
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:21,代码来源:HandleEqualsAndHashCode.java
示例18: match
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
/**
* If the tree is a {@link JCBlock}, returns a list of disjoint matches corresponding to
* the exact list of template statements found consecutively; otherwise, returns an
* empty list.
*/
@Override
public Iterable<BlockTemplateMatch> match(JCTree tree, Context context) {
// TODO(lowasser): consider nonconsecutive matches?
if (tree instanceof JCBlock) {
JCBlock block = (JCBlock) tree;
List<JCStatement> targetStatements = ImmutableList.copyOf(block.getStatements());
ImmutableList.Builder<BlockTemplateMatch> builder = ImmutableList.builder();
for (int start = 0; start + templateStatements().size() <= targetStatements.size();
start++) {
int end = start + templateStatements().size();
Unifier unifier = match(targetStatements.subList(start, end), context);
if (unifier != null) {
builder.add(new BlockTemplateMatch(block, unifier, start, end));
start = end - 1;
}
}
return builder.build();
}
return ImmutableList.of();
}
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:26,代码来源:BlockTemplate.java
示例19: visitMethodDeclaration
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
@Override
public boolean visitMethodDeclaration(MethodDeclaration node) {
JCMethodDecl methodDef = treeMaker.MethodDef(
(JCModifiers)toTree(node.astModifiers()),
toName(node.astMethodName()),
toExpression(node.astReturnTypeReference()),
toList(JCTypeParameter.class, node.astTypeVariables()),
toList(JCVariableDecl.class, node.astParameters()),
toList(JCExpression.class, node.astThrownTypeReferences()),
(JCBlock)toTree(node.astBody()),
null
);
for (JCVariableDecl decl : methodDef.params) {
decl.mods.flags |= Flags.PARAMETER;
}
int start = node.astMethodName().getPosition().getStart();
int end = node.getPosition().getEnd();
return set(node, setPos(start, end, methodDef));
}
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:22,代码来源:JcTreeBuilder.java
示例20: visitConstructorDeclaration
import com.sun.tools.javac.tree.JCTree.JCBlock; //导入依赖的package包/类
@Override
public boolean visitConstructorDeclaration(ConstructorDeclaration node) {
JCMethodDecl constrDef = treeMaker.MethodDef(
(JCModifiers)toTree(node.astModifiers()),
table.init, null,
toList(JCTypeParameter.class, node.astTypeVariables()),
toList(JCVariableDecl.class, node.astParameters()),
toList(JCExpression.class, node.astThrownTypeReferences()),
(JCBlock)toTree(node.astBody()),
null
);
for (JCVariableDecl decl : constrDef.params) {
decl.mods.flags |= Flags.PARAMETER;
}
int start = node.astTypeName().getPosition().getStart();
int end = node.getPosition().getEnd();
return set(node, setPos(start, end, constrDef));
}
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:21,代码来源:JcTreeBuilder.java
注:本文中的com.sun.tools.javac.tree.JCTree.JCBlock类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论