APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.comp

public Class Operators

extends Object
Class Inheritance
Imports
com.sun.tools.javac.code.Symbol, .Symbol.OperatorSymbol, .Symtab, .Type, .Type.MethodType, .TypeTag, .Types, com.sun.tools.javac.jvm.ByteCodes, com.sun.tools.javac.resources.CompilerProperties.Errors, com.sun.tools.javac.tree.JCTree, .JCTree.Tag, com.sun.tools.javac.util.Assert, .Context, .JCDiagnostic, .JCDiagnostic.DiagnosticPosition, .List, .Log, .Name, .Names, java.util.HashMap, .Map, .Optional, java.util.function.BiPredicate, .Function, .Predicate, .Supplier, java.util.stream.Stream

This class contains the logic for unary and binary operator resolution/lookup.

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.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
Operators.BinaryBooleanOperator

Class representing bitwise operator helpers that operate on boolean types (either boxed or unboxed).

pack-priv class
Operators.BinaryEqualityOperator

Class representing equality operator helper that operates on either numeric, boolean or reference types.

pack-priv class
Operators.BinaryNumericOperator

Class representing binary operator helpers that operate on numeric types (either boxed or unboxed).

pack-priv abstract class
pack-priv class
Operators.BinaryShiftOperator

Class representing shift operator helper that operates on integral operand types (either boxed or unboxed).

pack-priv class
Operators.BinaryStringOperator

Class representing string concatenation operator helper that operates on at least an string operand.

pack-priv static enum
Operators.ComparisonKind

This enum represent the possible kinds of an comparison test ('==' and '!=').

pack-priv abstract class
Operators.OperatorHelper

Common root for all operator helpers.

pack-priv static enum
Operators.OperatorType

The constants in this enum represent the types upon which all the operator helpers operate upon.

pack-priv class
Operators.UnaryBooleanOperator

Class representing unary operator helpers that operate on boolean types (either boxed or unboxed).

pack-priv class
Operators.UnaryNumericOperator

Class representing unary operator helpers that operate on numeric types (either boxed or unboxed).

pack-priv abstract class
Operators.UnaryOperatorHelper

Common superclass for all unary operator helpers.

pack-priv class
Operators.UnaryPrefixPostfixOperator

Class representing prefix/postfix unary operator helpers.

pack-priv class
Operators.UnaryReferenceOperator

Class representing unary operator helpers that operate on reference types.

Field Summary

Modifier and TypeField and Description
private Map<Name, List<Operators.BinaryOperatorHelper>>
binaryOperators

Binary operators map.

private final Log
private final Names
public final Symbol.OperatorSymbol
noOpSymbol

A symbol that stands for a missing operator.

protected static final Context.Key<Operators>
private Name[]
opname

The names of all operators.

private final Symtab
private final Types
private Map<Name, List<Operators.UnaryOperatorHelper>>
unaryOperators

Unary operators map.

Constructor Summary

AccessConstructor and Description
protected
Operators(Context context)

Method Summary

Modifier and TypeMethod and Description
pack-priv Type
binaryPromotion(Type t1, Type t2)

Perform binary promotion of a pair of types; this routine implements JLS 5.6.2.

private void
initBinaryOperators()

Initialize all binary operators.

private void
initOperatorNames()

Initialize operator name array.

private final <O extends Operators.OperatorHelper> void
initOperators(Map<Name, List<O>> opsMap, O... ops)

Complete the initialization of an operator helper by storing it into the corresponding operator map.

private void
initUnaryOperators()

Initialize all unary operators.

public static Operators
instance(Context context)

pack-priv Symbol.OperatorSymbol
private Symbol.OperatorSymbol
makeOperator(Name name, List<Operators.OperatorType> formals, Operators.OperatorType res, int... opcodes)

Creates an operator symbol.

private int
mergeOpcodes(int... opcodes)

Fold two opcodes in a single int value (if required).

public Name
operatorName(JCTree.Tag tag)

Return name of operator with given tree tag.

private Symbol.OperatorSymbol
reportErrorIfNeeded(JCDiagnostic.DiagnosticPosition pos, JCTree.Tag tag, Type... args)

Report an operator lookup error.

private <O> Symbol.OperatorSymbol
resolve(JCTree.Tag tag, Map<Name, List<O>> opMap, Predicate<O> opTestFunc, Function<O, Symbol.OperatorSymbol> resolveFunc, Supplier<Symbol.OperatorSymbol> noResultFunc)

Main operator lookup routine; lookup an operator (either unary or binary) in its corresponding map.

pack-priv Symbol.OperatorSymbol
resolveBinary(JCDiagnostic.DiagnosticPosition pos, JCTree.Tag tag, Type op1, Type op2)

Entry point for resolving a binary operator given an operator tag and a pair of argument types.

pack-priv Symbol.OperatorSymbol
resolveUnary(JCDiagnostic.DiagnosticPosition pos, JCTree.Tag tag, Type op)

Entry point for resolving a unary operator given an operator tag and an argument type.

private void
private void
pack-priv Type
unaryPromotion(Type t)

Perform unary promotion of a type; this routine implements JLS 5.6.1.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait