/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** Utility class containing inspector methods for trees.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
public class TreeInfo {
return instance;
}
/** The names of all operators.
*/
}
/** Return name of operator with given tree tag.
*/
}
/** Is tree a constructor declaration?
*/
} else {
return false;
}
}
/** Is there a constructor declaration in the given list of trees?
*/
if (isConstructor(l.head)) return true;
return false;
}
}
/** Is statement an initializer for a synthetic field?
*/
return true;
}
}
}
}
return false;
}
/** If the expression is a method call, return the method name, null
* otherwise. */
return mname;
}
}
return null;
}
/** Is this a call to this or super?
*/
} else {
return false;
}
}
/** Is this a call to super?
*/
} else {
return false;
}
}
/** Is this a constructor whose first (non-synthetic) statement is not
* of the form this(...)?
*/
}
/** Return the first call in a constructor definition. */
// Synthetic initializations can appear before the super call.
}
/** Return true if a tree represents a diamond new expr. */
default: return false;
}
}
default:
return false;
}
}
/** Return true if a tree represents the null literal. */
return false;
}
/** The position of the first statement in a block, or the position of
* the block itself if it is empty.
*/
else
}
/** The end position of given tree, if it is a block with
* defined endpos.
*/
? t.finalizer
} else
}
/** Get the start position for a tree node. The start position is
* defined to be the position of the first character of the first
* token of the node's source text.
* @param tree The tree node
*/
break;
}
}
break;
}
} else {
}
}
}
}
}
/** The end position of given tree, given a table of end positions generated by the parser
*/
if (endPositions == null) {
// fall back on limited info in the tree
}
return mapPos;
case(JCTree.FOREACHLOOP):
} else {
}
}
case(JCTree.SYNCHRONIZED):
} else {
}
}
}
}
}
/** A DiagnosticPosition with the preferred position set to the
* end position of given tree, if it is a block with
* defined endpos.
*/
return new DiagnosticPosition() {
public int getPreferredPosition() { return endPos; }
}
};
}
/** The position of the finalizer of given try/synchronized statement.
*/
return firstStatPos(t.finalizer);
} else {
throw new AssertionError();
}
}
/** Find the position for reporting an error about a symbol, where
* that symbol is defined somewhere in the given tree. */
}
/** Find the position for reporting an error about a symbol, where
* that symbol is defined somewhere in the given tree. */
}
/** Find the declaration for a symbol, where
* that symbol is defined somewhere in the given tree. */
class DeclScanner extends TreeScanner {
}
else super.visitTopLevel(that);
}
else super.visitClassDef(that);
}
else super.visitMethodDef(that);
}
else super.visitVarDef(that);
}
else super.visitTypeParameter(that);
}
}
DeclScanner s = new DeclScanner();
return s.result;
}
}
// TODO: not implemented yet
throw new UnsupportedOperationException("not implemented yet");
}
static final long serialVersionUID = -5942088234594905625L;
}
}
class PathFinder extends TreeScanner {
}
}
}
try {
}
}
/** Return the statement referenced by a label.
* If the label refers to a loop or switch, return that switch
* otherwise return the labelled statement itself
*/
do t = ((JCLabeledStatement) t).body;
switch (t.getTag()) {
case JCTree.DOLOOP: case JCTree.WHILELOOP: case JCTree.FORLOOP: case JCTree.FOREACHLOOP: case JCTree.SWITCH:
return t;
default:
return tree;
}
}
/** Skip parens and return the enclosed expression
*/
}
return tree;
}
/** Skip parens and return the enclosed expression
*/
else
return tree;
}
/** Return the types of a list of trees.
*/
}
/** If this tree is an identifier or a field or a parameterized type,
* return its name, otherwise return null.
*/
default:
return null;
}
}
/** If this tree is a qualified identifier, its return fully qualified name,
* otherwise return null.
*/
default:
return null;
}
}
default:
return null;
}
}
return true;
default:
return false;
}
}
/** If this tree is an identifier or a field, return its symbol,
* otherwise return null.
*/
default:
return null;
}
}
/** Return true if this is a nonstatic selection. */
}
/** If this tree is an identifier or a field, set its symbol, otherwise skip.
*/
default:
}
}
/** If this tree is a declaration or a block, return its flags field,
* otherwise return 0.
*/
default:
return 0;
}
}
/** Return first (smallest) flag in `flags':
* pre: flags != 0
*/
int flag = 1;
return flag;
}
/** Return flags as a string, separated by " ".
*/
}
/** Operator precedences values.
*/
public static final int
/** Map operators to their precedence levels.
*/
switch(op) {
case JCTree.BITXOR_ASG:
case JCTree.BITAND_ASG:
default: throw new AssertionError();
}
}
switch (tag) {
// Postfix expressions
// Unary operators
// Binary operators
// Multiplicative operators
// Additive operators
// Shift operators
// Relational operators
// Equality operators
// Bitwise and logical operators
// Conditional operators
// Assignment operators
// Null check (implementation detail), for example, __.getClass()
default:
return null;
}
}
/**
* Returns the underlying type of the tree if it is annotated type,
* or the tree itself otherwise
*/
return tree;
default:
}
}
default:
return type;
}
}
}