public Symtab getSymtab() { return Symtab.instance(context); }
initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, "<any?>"); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); stringBuilderType = enterClass("java.lang.StringBuilder"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); exceptionType = enterClass("java.lang.Exception"); runtimeExceptionType = enterClass("java.lang.RuntimeException"); classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError"); assertionErrorType = enterClass("java.lang.AssertionError");
initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, "<any?>"); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); stringBuilderType = enterClass("java.lang.StringBuilder"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); exceptionType = enterClass("java.lang.Exception"); runtimeExceptionType = enterClass("java.lang.RuntimeException"); classNotFoundExceptionType = enterClass("java.lang.ClassNotFoundException"); noClassDefFoundErrorType = enterClass("java.lang.NoClassDefFoundError"); noSuchFieldErrorType = enterClass("java.lang.NoSuchFieldError"); assertionErrorType = enterClass("java.lang.AssertionError");
private Element getElementByFQN(String fqn) { Elements elements = copy.getElements(); Element element = elements.getTypeElement(fqn); if (element == null) element = elements.getPackageElement(fqn); if (element == null) element = Symtab.instance(copy.impl.getJavacTask().getContext()).enterClass((com.sun.tools.javac.util.Name)elements.getName(fqn)); return element; }
public void initType(Type type, String name, String bname) { initType(type, name); boxedName[type.tag] = names.fromString("java.lang." + bname); }
/** Get the symbol table instance. */ public static Symtab instance(Context context) { Symtab instance = context.get(symtabKey); if (instance == null) instance = new Symtab(context); return instance; }
/** Enter a binary operation, as above but with two opcodes, * which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2. * @param opcode1 First opcode. * @param opcode2 Second opcode. */ private void enterBinop(String name, Type left, Type right, Type res, int opcode1, int opcode2) { enterBinop( name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2); }
private Type enterSyntheticAnnotation(String name) { ClassType type = (ClassType)enterClass(name); ClassSymbol sym = (ClassSymbol)type.tsym; sym.completer = null; sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; sym.erasure_field = type; sym.members_field = new Scope(sym); type.typarams_field = List.nil(); type.allparams_field = List.nil(); type.supertype_field = annotationType; type.interfaces_field = List.nil(); return type; }
initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, unknownSymbol); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); stringBuilderType = enterClass("java.lang.StringBuilder"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda"); methodHandleType = enterClass("java.lang.invoke.MethodHandle"); methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup"); methodTypeType = enterClass("java.lang.invoke.MethodType"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); interruptedExceptionType = enterClass("java.lang.InterruptedException"); exceptionType = enterClass("java.lang.Exception");
public void initType(Type type, String name, String bname) { initType(type, name); boxedName[type.tag] = names.fromString("java.lang." + bname); }
/** Get the symbol table instance. */ public static Symtab instance(Context context) { Symtab instance = context.get(symtabKey); if (instance == null) instance = new Symtab(context); return instance; }
/** Enter a binary operation, as above but with two opcodes, * which get encoded as * {@code (opcode1 << ByteCodeTags.preShift) + opcode2 }. * @param opcode1 First opcode. * @param opcode2 Second opcode. */ private void enterBinop(String name, Type left, Type right, Type res, int opcode1, int opcode2) { enterBinop( name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2); }
private Type enterSyntheticAnnotation(String name) { ClassType type = (ClassType)enterClass(name); ClassSymbol sym = (ClassSymbol)type.tsym; sym.completer = null; sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE; sym.erasure_field = type; sym.members_field = new Scope(sym); type.typarams_field = List.nil(); type.allparams_field = List.nil(); type.supertype_field = annotationType; type.interfaces_field = List.nil(); return type; }
public Symtab symtab() { return Symtab.instance(context); }
initType(byteType, "byte", "Byte"); initType(shortType, "short", "Short"); initType(charType, "char", "Character"); initType(intType, "int", "Integer"); initType(longType, "long", "Long"); initType(floatType, "float", "Float"); initType(doubleType, "double", "Double"); initType(booleanType, "boolean", "Boolean"); initType(voidType, "void", "Void"); initType(botType, "<nulltype>"); initType(errType, errSymbol); initType(unknownType, unknownSymbol); objectType = enterClass("java.lang.Object"); classType = enterClass("java.lang.Class"); stringType = enterClass("java.lang.String"); stringBufferType = enterClass("java.lang.StringBuffer"); stringBuilderType = enterClass("java.lang.StringBuilder"); cloneableType = enterClass("java.lang.Cloneable"); throwableType = enterClass("java.lang.Throwable"); serializableType = enterClass("java.io.Serializable"); serializedLambdaType = enterClass("java.lang.invoke.SerializedLambda"); methodHandleType = enterClass("java.lang.invoke.MethodHandle"); methodHandleLookupType = enterClass("java.lang.invoke.MethodHandles$Lookup"); methodTypeType = enterClass("java.lang.invoke.MethodType"); errorType = enterClass("java.lang.Error"); illegalArgumentExceptionType = enterClass("java.lang.IllegalArgumentException"); interruptedExceptionType = enterClass("java.lang.InterruptedException"); exceptionType = enterClass("java.lang.Exception");
public void initType(Type type, String name) { initType( type, new ClassSymbol( PUBLIC, names.fromString(name), type, rootPackage)); }
/** Get the symbol table instance. */ public static Symtab instance(Context context) { Symtab instance = context.get(symtabKey); if (instance == null) instance = new Symtab(context); return instance; }
/** Enter a binary operation, as above but with two opcodes, * which get encoded as (opcode1 << ByteCodeTags.preShift) + opcode2. * @param opcode1 First opcode. * @param opcode2 Second opcode. */ private void enterBinop(String name, Type left, Type right, Type res, int opcode1, int opcode2) { enterBinop( name, left, right, res, (opcode1 << ByteCodes.preShift) | opcode2); }
/** * Refines the receiver of a method invocation to type non-null after successful invocation, and * refines the value of the expression as a whole to non-null if applicable (e.g., if the method * returns a primitive type). * * <p>NOTE: This transfer makes the unsound assumption that fields reachable via the actual params * of this method invocation are not mutated by the callee. To be sound with respect to escaping * mutable references in general, we would have to set to top (i.e. NULLABLE) any tracked access * path that could contain an alias of an actual parameter of this invocation. */ @Override Nullness visitMethodInvocation( MethodInvocationNode node, Updates thenUpdates, Updates elseUpdates, Updates bothUpdates) { ClassAndMethod callee = tryGetMethodSymbol(node.getTree(), Types.instance(context)); if (callee != null && !callee.isStatic) { setNonnullIfTrackable(bothUpdates, node.getTarget().getReceiver()); } setUnconditionalArgumentNullness(bothUpdates, node.getArguments(), callee); setConditionalArgumentNullness( thenUpdates, elseUpdates, node.getArguments(), callee, Types.instance(context), Symtab.instance(context)); return returnValueNullness(node, callee); }
public void initType(Type type, String name) { initType( type, new ClassSymbol( PUBLIC, names.fromString(name), type, rootPackage)); }