Tabnine Logo
JCTree$JCUnary
Code IndexAdd Tabnine to your IDE (free)

How to use
JCTree$JCUnary
in
com.sun.tools.javac.tree

Best Java code snippets using com.sun.tools.javac.tree.JCTree$JCUnary (Showing top 20 results out of 315)

origin: google/error-prone

@Override
public Choice<State<JCUnary>> visitUnary(UnaryTree node, State<?> state) {
 final Tag tag = ((JCUnary) node).getTag();
 return chooseSubtrees(
     state, s -> unifyExpression(node.getExpression(), s), expr -> maker().Unary(tag, expr))
   .condition(
     s ->
       !MUTATING_UNARY_TAGS.contains(tag)
         || !(s.result().getExpression() instanceof PlaceholderParamIdent));
}
origin: mopemope/meghanada-server

JCTree.JCExpression expression = unary.getExpression();
analyzeParsedTree(context, expression);
origin: mopemope/meghanada-server

 JCTree.JCExpression args = jcUnary.getExpression();
 analyzeParsedTree(context, args);
if (expressionTree instanceof JCTree.JCUnary) {
 JCTree.JCUnary jcUnary = (JCTree.JCUnary) expressionTree;
 JCTree.JCExpression args = jcUnary.getExpression();
 analyzeParsedTree(context, args);
origin: org.gosu-lang.gosu/gosu-lab

JCTree.JCUnary up = (JCTree.JCUnary)expression;
String var = cond.getLeftOperand().accept( this, v );
if( var.equals( up.getExpression().accept( this, v ) ) &&
  var.equals( iniz.getName().toString() ) &&
  (up.getTag() == JCTree.Tag.PREINC || up.getTag() == JCTree.Tag.POSTINC) &&
  "0".equals( iniz.getInitializer().accept( this, v ) ) )
origin: konsoletyper/teavm-javac

public void visitUnary(JCUnary tree) {
  OperatorSymbol operator = (OperatorSymbol)tree.operator;
  if (tree.hasTag(NOT)) {
    CondItem od = genCond(tree.arg, false);
    result = od.negate();
  } else {
    Item od = genExpr(tree.arg, operator.type.getParameterTypes().head);
    switch (tree.getTag()) {
    case POS:
      result = od.load();
      if (od instanceof LocalItem &&
        (operator.opcode == iadd || operator.opcode == isub)) {
        ((LocalItem)od).incr(tree.hasTag(PREINC) ? 1 : -1);
        result = od;
      } else {
        (operator.opcode == iadd || operator.opcode == isub)) {
        Item res = od.load();
        ((LocalItem)od).incr(tree.hasTag(POSTINC) ? 1 : -1);
        result = res;
      } else {
      result = od.load();
      code.emitop0(dup);
      genNullCheck(tree.pos());
      break;
    default:
origin: org.jvnet.sorcerer/sorcerer-javac

  result = od.load();
code.emitop0(dup);
genNullCheck(tree.pos());
break;
default:
origin: sc.fiji/javac

public void visitUnary(JCUnary tree) {
  OperatorSymbol operator = (OperatorSymbol)tree.operator;
  if (tree.getTag() == JCTree.NOT) {
    CondItem od = genCond(tree.arg, false);
    result = od.negate();
  } else {
    Item od = genExpr(tree.arg, operator.type.getParameterTypes().head);
    switch (tree.getTag()) {
    case JCTree.POS:
      result = od.load();
      if (od instanceof LocalItem &&
        (operator.opcode == iadd || operator.opcode == isub)) {
        ((LocalItem)od).incr(tree.getTag() == JCTree.PREINC ? 1 : -1);
        result = od;
      } else {
        (operator.opcode == iadd || operator.opcode == isub)) {
        Item res = od.load();
        ((LocalItem)od).incr(tree.getTag() == JCTree.POSTINC ? 1 : -1);
        result = res;
      } else {
      result = od.load();
      code.emitop0(dup);
      genNullCheck(tree.pos());
      break;
    default:
origin: org.kohsuke.sorcerer/sorcerer-javac

public void visitUnary(JCUnary tree) {
  OperatorSymbol operator = (OperatorSymbol)tree.operator;
  if (tree.hasTag(NOT)) {
    CondItem od = genCond(tree.arg, false);
    result = od.negate();
  } else {
    Item od = genExpr(tree.arg, operator.type.getParameterTypes().head);
    switch (tree.getTag()) {
    case POS:
      result = od.load();
      if (od instanceof LocalItem &&
        (operator.opcode == iadd || operator.opcode == isub)) {
        ((LocalItem)od).incr(tree.hasTag(PREINC) ? 1 : -1);
        result = od;
      } else {
        (operator.opcode == iadd || operator.opcode == isub)) {
        Item res = od.load();
        ((LocalItem)od).incr(tree.hasTag(POSTINC) ? 1 : -1);
        result = res;
      } else {
      result = od.load();
      code.emitop0(dup);
      genNullCheck(tree.pos());
      break;
    default:
origin: org.gosu-lang.gosu/gosu-editor

JCTree.JCUnary up = (JCTree.JCUnary) expression;
String var = cond.getLeftOperand().accept(this, v);
if (var.equals(up.getExpression().accept(this, v)) &&
    var.equals(iniz.getName().toString()) &&
    (up.getTag() == JCTree.Tag.PREINC || up.getTag() == JCTree.Tag.POSTINC) &&
    "0".equals(iniz.getInitializer().accept(this, v))) {
 JCTree.JCExpression condRight = cond.getRightOperand();
origin: sc.fiji/javac

public void visitUnary(JCUnary tree) {
  boolean isUpdateOperator =
    JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC;
  if (isUpdateOperator && !tree.arg.type.isPrimitive()) {
    switch(tree.getTag()) {
    case JCTree.PREINC:            // ++ e
        int opcode = (tree.getTag() == JCTree.PREINC)
          ? JCTree.PLUS_ASG : JCTree.MINUS_ASG;
        JCAssignOp newTree = makeAssignop(opcode,
  if (tree.getTag() == JCTree.NOT && tree.arg.type.constValue() != null) {
    tree.type = cfolder.fold1(bool_not, tree.arg.type);
origin: konsoletyper/teavm-javac

public void visitUnary(JCUnary tree) {
  boolean isUpdateOperator = tree.getTag().isIncOrDecUnaryOp();
  if (isUpdateOperator && !tree.arg.type.isPrimitive()) {
    switch(tree.getTag()) {
    case PREINC:            // ++ e
        JCTree.Tag opcode = (tree.hasTag(PREINC))
          ? PLUS_ASG : MINUS_ASG;
        JCAssignOp newTree = makeAssignop(opcode,
  if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) {
    tree.type = cfolder.fold1(bool_not, tree.arg.type);
origin: org.kohsuke.sorcerer/sorcerer-javac

public void visitUnary(JCUnary tree) {
  boolean isUpdateOperator = tree.getTag().isIncOrDecUnaryOp();
  if (isUpdateOperator && !tree.arg.type.isPrimitive()) {
    switch(tree.getTag()) {
    case PREINC:            // ++ e
        JCTree.Tag opcode = (tree.hasTag(PREINC))
          ? PLUS_ASG : MINUS_ASG;
        JCAssignOp newTree = makeAssignop(opcode,
  if (tree.hasTag(NOT) && tree.arg.type.constValue() != null) {
    tree.type = cfolder.fold1(bool_not, tree.arg.type);
origin: org.kohsuke.sorcerer/sorcerer-javac

public void visitUnary(JCUnary tree) {
  Type argtype = (tree.getTag().isIncOrDecUnaryOp())
    ? attribTree(tree.arg, env, varInfo)
    : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
    rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
    owntype = (tree.getTag().isIncOrDecUnaryOp())
      ? tree.arg.type
      : operator.type.getReturnType();
origin: org.jvnet.sorcerer/sorcerer-javac

rs.resolveUnaryOperator(tree.pos(), tree.tag, env, argtype);
origin: org.netbeans.api/org-netbeans-modules-java-source-base

@Override
public void visitUnary(JCUnary tree) {
int ownprec = TreeInfo.opPrec(tree.getTag());
Name opname;
  switch (tree.getTag()) {
    case POS: opname = names.fromString("+"); break;
    case NEG: opname = names.fromString("-"); break;
    default: opname = operators.operatorName(tree.getTag()); break;
if (tree.getTag().ordinal() <= JCTree.Tag.PREDEC.ordinal()) { //XXX: comparing ordinals!
    if (cs.spaceAroundUnaryOps()) {
      needSpace();
    } else {
      print(opname);
      if (   (tree.getTag() == JCTree.Tag.POS && (tree.arg.getTag() == JCTree.Tag.POS || tree.arg.getTag() == JCTree.Tag.PREINC))
        || (tree.getTag() == JCTree.Tag.NEG && (tree.arg.getTag() == JCTree.Tag.NEG || tree.arg.getTag() == JCTree.Tag.PREDEC))) {
        print(' ');
origin: sc.fiji/javac

public void visitUnary(JCUnary tree) {
  Type argtype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
    ? attribTree(tree.arg, env, VAR, Type.noType)
    : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
    rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
    owntype = (JCTree.PREINC <= tree.getTag() && tree.getTag() <= JCTree.POSTDEC)
      ? tree.arg.type
      : operator.type.getReturnType();
origin: com.google.errorprone/error_prone_core

private static void replaceAssert(
  SuggestedFix.Builder fix, AssertTree foundAssert, VisitorState state) {
 ExpressionTree expr = foundAssert.getCondition();
 expr = (ExpressionTree) TreeInfo.skipParens((JCTree) expr);
 // case: "assert !expr"
 if (expr.getKind().equals(LOGICAL_COMPLEMENT)) {
  addFix(fix, ((JCUnary) expr).getExpression(), foundAssert, state, IS_FALSE);
  return;
 }
 // case: "assert expr1.equals(expr2)"
 if (instanceMethod().onClass(Any.INSTANCE).named("equals").matches(expr, state)) {
  JCMethodInvocation equalsCall = ((JCMethodInvocation) expr);
  JCExpression expr1 = ((JCFieldAccess) ((JCMethodInvocation) expr).meth).selected;
  JCExpression expr2 = equalsCall.getArguments().get(0);
  addFix(
    fix,
    expr1,
    foundAssert,
    state,
    String.format(IS_EQUAL_TO, normalizedSourceForExpression(expr2, state)));
  return;
 }
 // case: "assert expr1 == expr2" or "assert expr1 != expr2"
 if (expr.getKind().equals(Kind.EQUAL_TO) || expr.getKind().equals(Kind.NOT_EQUAL_TO)) {
  suggestFixForSameReference(fix, foundAssert, state, expr.getKind().equals(Kind.EQUAL_TO));
  return;
 }
 // case: "assert expr", which didn't match any of the previous cases.
 addFix(fix, (JCExpression) expr, foundAssert, state, IS_TRUE);
}
origin: manifold-systems/manifold

@Override
public void visitUnary( JCTree.JCUnary tree )
{
 super.visitUnary( tree );
 if( _tp.isGenerate() && !shouldProcessForGeneration() )
 {
  // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
  return;
 }
 if( isJailbreakReceiver( tree ) )
 {
  Tree.Kind kind = tree.getKind();
  if( kind == Tree.Kind.POSTFIX_INCREMENT || kind == Tree.Kind.POSTFIX_DECREMENT ||
    kind == Tree.Kind.PREFIX_INCREMENT || kind == Tree.Kind.PREFIX_DECREMENT )
  {
   // ++, -- operators not supported with jailbreak access to fields, only direct assignment
   _tp.report( tree, Diagnostic.Kind.ERROR, ExtIssueMsg.MSG_INCREMENT_OP_NOT_ALLOWED_REFLECTION.get() );
   Types types = Types.instance( ((BasicJavacTask)_tp.getJavacTask()).getContext() );
   tree.type = types.createErrorType( tree.type );
  }
  result = tree;
 }
 else
 {
  result = tree;
 }
}
origin: systems.manifold/manifold-ext

@Override
public void visitUnary( JCTree.JCUnary tree )
{
 super.visitUnary( tree );
 if( _tp.isGenerate() && !shouldProcessForGeneration() )
 {
  // Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
  return;
 }
 if( isJailbreakReceiver( tree ) )
 {
  Tree.Kind kind = tree.getKind();
  if( kind == Tree.Kind.POSTFIX_INCREMENT || kind == Tree.Kind.POSTFIX_DECREMENT ||
    kind == Tree.Kind.PREFIX_INCREMENT || kind == Tree.Kind.PREFIX_DECREMENT )
  {
   // ++, -- operators not supported with jailbreak access to fields, only direct assignment
   _tp.report( tree, Diagnostic.Kind.ERROR, ExtIssueMsg.MSG_INCREMENT_OP_NOT_ALLOWED_REFLECTION.get() );
   Types types = Types.instance( ((BasicJavacTask)_tp.getJavacTask()).getContext() );
   tree.type = types.createErrorType( tree.type );
  }
  result = tree;
 }
 else
 {
  result = tree;
 }
}
origin: konsoletyper/teavm-javac

public void visitUnary(JCUnary tree) {
  // Attribute arguments.
  Type argtype = (tree.getTag().isIncOrDecUnaryOp())
    ? attribTree(tree.arg, env, varInfo)
    : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
  // Find operator.
  Symbol operator = tree.operator =
    rs.resolveUnaryOperator(tree.pos(), tree.getTag(), env, argtype);
  Type owntype = types.createErrorType(tree.type);
  if (operator.kind == MTH &&
      !argtype.isErroneous()) {
    owntype = (tree.getTag().isIncOrDecUnaryOp())
      ? tree.arg.type
      : operator.type.getReturnType();
    int opc = ((OperatorSymbol)operator).opcode;
    // If the argument is constant, fold it.
    if (argtype.constValue() != null) {
      Type ctype = cfolder.fold1(opc, argtype);
      if (ctype != null) {
        owntype = cfolder.coerce(ctype, owntype);
      }
    }
  }
  result = check(tree, owntype, VAL, resultInfo);
}
com.sun.tools.javac.treeJCTree$JCUnary

Javadoc

A unary operation.

Most used methods

  • getTag
  • getExpression
  • <init>
  • pos
  • getKind
  • setTag
  • hasTag

Popular in Java

  • Reactive rest calls using spring rest template
  • getSystemService (Context)
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Reference (javax.naming)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now