当前位置: 首页>>代码示例>>Java>>正文


Java JCArrayTypeTree类代码示例

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


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

示例1: visitArrayType

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
@Override
public Pair<ASTRecord, Integer> visitArrayType(ArrayTypeTree node, Insertion ins) {
  dbug.debug("TypePositionFinder.visitArrayType(%s)%n", node);
  JCArrayTypeTree att = (JCArrayTypeTree) node;
  dbug.debug("TypePositionFinder.visitArrayType(%s) preferred = %s%n",
      node, att.getPreferredPosition());
  // If the code has a type like "String[][][]", then this gets called
  // three times:  for String[][][], String[][], and String[]
  // respectively.  For each of the three, call String[][][] "largest".
  ArrayTypeTree largest = largestContainingArray(node);
  int largestLevels = arrayLevels(largest);
  int levels = arrayLevels(node);
  int start = arrayContentType(att).getPreferredPosition() + 1;
  int end = att.getEndPosition(tree.endPositions);
  int pos = arrayInsertPos(start, end);

  dbug.debug("  levels=%d largestLevels=%d%n", levels, largestLevels);
  for (int i=levels; i<largestLevels; i++) {
    pos = getFirstInstanceAfter('[', pos+1);
    dbug.debug("  pos %d at i=%d%n", pos, i);
  }
  return Pair.of(astRecord(node), pos);
}
 
开发者ID:typetools,项目名称:annotation-tools,代码行数:24,代码来源:TreeFinder.java

示例2: dimension

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private int dimension(JCTree t, int afterPos) {
    if (t.getKind() != Kind.ARRAY_TYPE) {
        return 0;
    }
    int add;
    if (afterPos >= 0) {
        final int[] bounds =  getBounds(t);
        add = afterPos < bounds[1] ? 1 : 0;
    } else {
        add = 1;
    }
    return add + dimension (((JCTree.JCArrayTypeTree)t).getType(), afterPos);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CasualDiff.java

示例3: diffTypeArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
protected int diffTypeArray(JCArrayTypeTree oldT, JCArrayTypeTree newT, int[] bounds) {
    int localPointer = bounds[0];
    int[] elemtypeBounds = getBounds(oldT.elemtype);
    localPointer = diffTree(oldT.elemtype, newT.elemtype, elemtypeBounds);
    copyTo(localPointer, bounds[1]);
    return bounds[1];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CasualDiff.java

示例4: dims

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private int dims(JCExpression vartype) {
	if (vartype instanceof JCArrayTypeTree) {
		return 1 + dims(((JCArrayTypeTree) vartype).elemtype);
	}
	
	return 0;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:PrettyPrinter.java

示例5: printVarDef0

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private void printVarDef0(JCVariableDecl tree) {
	boolean varargs = (tree.mods.flags & VARARGS) != 0;
	if (varargs && tree.vartype instanceof JCArrayTypeTree) {
		print(((JCArrayTypeTree) tree.vartype).elemtype);
		print("...");
	} else {
		print(tree.vartype);
	}
	print(" ");
	print(tree.name);
	if (tree.init != null) {
		print(" = ");
		print(tree.init);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:16,代码来源:PrettyPrinter.java

示例6: visitNewArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
@Override public void visitNewArray(JCNewArray tree) {
	JCTree elem = tree.elemtype;
	int dims = 0;
	if (elem != null) {
		print("new ");
		
		while (elem instanceof JCArrayTypeTree) {
			dims++;
			elem = ((JCArrayTypeTree) elem).elemtype;
		}
		print(elem);
		
		for (JCExpression expr : tree.dims) {
			print("[");
			print(expr);
			print("]");
		}
	}
	
	for (int i = 0; i < dims; i++) print("[]");
	
	if (tree.elems != null) {
		if (elem != null) print("[] ");
		print("{");
		print(tree.elems, ", ");
		print("}");
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:29,代码来源:PrettyPrinter.java

示例7: visitTypeArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
public void visitTypeArray(JCArrayTypeTree that) {
    try {
        print("JCArrayTypeTree:");
    } catch (Exception e) {
    }
    super.visitTypeArray(that);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java

示例8: visitVarDef

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
public void visitVarDef(JCVariableDecl tree) {
	try {
		boolean suppressSemi = suppressFinalAndSemicolonsInTry;
		if (getJavadocFor(tree) != null) {
			println(); align();
		}
		printDocComment(tree);
		if ((tree.mods.flags & ENUM) != 0) {
			printEnumMember(tree);
		} else {
			printExpr(tree.mods);
			if ((tree.mods.flags & VARARGS) != 0) {
				printExpr(((JCArrayTypeTree) tree.vartype).elemtype);
				print("... " + tree.name);
			} else {
				printExpr(tree.vartype);
				print(" " + tree.name);
			}
			if (tree.init != null) {
				print(" = ");
				printExpr(tree.init);
			}
			if (prec == TreeInfo.notExpression && !suppressSemi) print(";");
		}
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:29,代码来源:PrettyCommentsPrinter.java

示例9: visitNewArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
public void visitNewArray(JCNewArray tree) {
	try {
		if (tree.elemtype != null) {
			print("new ");
			JCTree elem = tree.elemtype;
			if (elem instanceof JCArrayTypeTree)
				printBaseElementType((JCArrayTypeTree) elem);
			else
				printExpr(elem);
			for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
				print("[");
				printExpr(l.head);
				print("]");
			}
			if (elem instanceof JCArrayTypeTree)
				printBrackets((JCArrayTypeTree) elem);
		}
		if (tree.elems != null) {
			if (tree.elemtype != null) print("[]");
			print("{");
			printExprs(tree.elems);
			print("}");
		}
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:28,代码来源:PrettyCommentsPrinter.java

示例10: visitTypeArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
public void visitTypeArray(JCArrayTypeTree tree) {
	try {
		printBaseElementType(tree);
		printBrackets(tree);
	} catch (IOException e) {
		throw new UncheckedIOException(e);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:9,代码来源:PrettyCommentsPrinter.java

示例11: printBaseElementType

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private void printBaseElementType(JCArrayTypeTree tree) throws IOException {
	JCTree elem = tree.elemtype;
	while (elem instanceof JCWildcard)
		elem = ((JCWildcard) elem).inner;
	if (elem instanceof JCArrayTypeTree)
		printBaseElementType((JCArrayTypeTree) elem);
	else
		printExpr(elem);
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:10,代码来源:PrettyCommentsPrinter.java

示例12: arrayContentType

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private JCTree arrayContentType(JCArrayTypeTree att) {
  JCTree node = att;
  do {
    node = ((JCArrayTypeTree) node).getType();
  } while (node.getKind() == Tree.Kind.ARRAY_TYPE);
  return node;
}
 
开发者ID:typetools,项目名称:annotation-tools,代码行数:8,代码来源:TreeFinder.java

示例13: countDims

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
private static int countDims(JCExpression type) {
	int dims = 0;
	while (type instanceof JCArrayTypeTree) {
		type = ((JCArrayTypeTree) type).elemtype;
		dims++;
	}
	return dims;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:9,代码来源:JcTreeConverter.java

示例14: visitTypeArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
@Override public void visitTypeArray(JCArrayTypeTree node) {
	TypeReference ref = (TypeReference) toTree(node.getType(), FlagKey.TYPE_REFERENCE);
	int currentDim = ref.astArrayDimensions();
	ref.astArrayDimensions(currentDim + 1);
	setConversionPositionInfo(ref, "[]" + currentDim, getPosition(node));
	set(node, ref);
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:8,代码来源:JcTreeConverter.java

示例15: visitNewArray

import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; //导入依赖的package包/类
public void visitNewArray(JCNewArray tree) {
    try {
        if (tree.elemtype != null) {
            print("new ");
            JCTree elem = tree.elemtype;
            if (elem.getTag() == JCTree.TYPEARRAY)
                printBaseElementType((JCArrayTypeTree) elem);
            else
                printExpr(elem);
            for (List<JCExpression> l = tree.dims; l.nonEmpty(); l = l.tail) {
                print("[");
                printExpr(l.head);
                print("]");
            }
            if (elem instanceof JCArrayTypeTree)
                printBrackets((JCArrayTypeTree) elem);
        }
        if (tree.elems != null) {
            if (tree.elemtype != null) print("[]");
            print("{");
            printExprs(tree.elems);
            print("}");
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:28,代码来源:Pretty.java


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