public void fillExceptionParameterPositions() { for (int i = 0; i < varBufferSize; ++i) { LocalVar lv = varBuffer[i]; if (lv == null || lv.sym == null || !lv.sym.hasTypeAnnotations() || !lv.sym.isExceptionParameter()) continue; for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { TypeAnnotationPosition p = ta.position; // At this point p.type_index contains the catch type index. // Use that index to determine the exception table index. // We can afterwards discard the type_index. // A TA position is shared for all type annotations in the // same location; updating one is enough. // Use -666 as a marker that the exception_index was already updated. if (p.type_index != -666) { p.exception_index = findExceptionIndex(p.type_index); p.type_index = -666; } } } }
/** Put a live variable range into the buffer to be output to the * class file. */ void putVar(LocalVar var) { // Keep local variables if // 1) we need them for debug information // 2) it is an exception type and it contains type annotations boolean keepLocalVariables = varDebugInfo || (var.sym.isExceptionParameter() && var.sym.hasTypeAnnotations()); if (!keepLocalVariables) return; //don't keep synthetic vars, unless they are lambda method parameters boolean ignoredSyntheticVar = (var.sym.flags() & Flags.SYNTHETIC) != 0 && ((var.sym.owner.flags() & Flags.LAMBDA_METHOD) == 0 || (var.sym.flags() & Flags.PARAMETER) == 0); if (ignoredSyntheticVar) return; if (varBuffer == null) varBuffer = new LocalVar[20]; else varBuffer = ArrayUtils.ensureCapacity(varBuffer, varBufferSize); varBuffer[varBufferSize++] = var; }
public void fillExceptionParameterPositions() { for (int i = 0; i < varBufferSize; ++i) { LocalVar lv = varBuffer[i]; if (lv == null || lv.sym == null || !lv.sym.hasTypeAnnotations() || !lv.sym.isExceptionParameter()) continue; for (Attribute.TypeCompound ta : lv.sym.getRawTypeAttributes()) { TypeAnnotationPosition p = ta.position; // At this point p.type_index contains the catch type index. // Use that index to determine the exception table index. // We can afterwards discard the type_index. // A TA position is shared for all type annotations in the // same location; updating one is enough. // Use -666 as a marker that the exception_index was already updated. if (p.type_index != -666) { p.exception_index = findExceptionIndex(p.type_index); p.type_index = -666; } } } }
public ElementKind getKind() { long flags = flags(); if ((flags & PARAMETER) != 0) { if (isExceptionParameter()) return ElementKind.EXCEPTION_PARAMETER; else return ElementKind.PARAMETER; } else if ((flags & ENUM) != 0) { return ElementKind.ENUM_CONSTANT; } else if (owner.kind == TYP || owner.kind == ERR) { return ElementKind.FIELD; } else if (isResourceVariable()) { return ElementKind.RESOURCE_VARIABLE; } else { return ElementKind.LOCAL_VARIABLE; } }
/** Put a live variable range into the buffer to be output to the * class file. */ void putVar(LocalVar var) { // Keep local variables if // 1) we need them for debug information // 2) it is an exception type and it contains type annotations if (!varDebugInfo && (!var.sym.isExceptionParameter() || var.sym.hasTypeAnnotations())) return; if ((var.sym.flags() & Flags.SYNTHETIC) != 0) return; if (varBuffer == null) varBuffer = new LocalVar[20]; else varBuffer = ArrayUtils.ensureCapacity(varBuffer, varBufferSize); varBuffer[varBufferSize++] = var; }
public ElementKind getKind() { long flags = flags(); if ((flags & PARAMETER) != 0) { if (isExceptionParameter()) return ElementKind.EXCEPTION_PARAMETER; else return ElementKind.PARAMETER; } else if ((flags & ENUM) != 0) { return ElementKind.ENUM_CONSTANT; } else if (owner.kind == TYP || owner.kind == ERR) { return ElementKind.FIELD; } else if (isResourceVariable()) { return ElementKind.RESOURCE_VARIABLE; } else { return ElementKind.LOCAL_VARIABLE; } }
public ElementKind getKind() { long flags = flags(); if ((flags & PARAMETER) != 0) { if (isExceptionParameter()) return ElementKind.EXCEPTION_PARAMETER; else return ElementKind.PARAMETER; } else if ((flags & ENUM) != 0) { return ElementKind.ENUM_CONSTANT; } else if (owner.kind == TYP || owner.kind == ERR) { return ElementKind.FIELD; } else { return ElementKind.LOCAL_VARIABLE; } }
public ElementKind getKind() { long flags = flags(); if ((flags & PARAMETER) != 0) { if (isExceptionParameter()) return ElementKind.EXCEPTION_PARAMETER; else return ElementKind.PARAMETER; } else if ((flags & ENUM) != 0) { return ElementKind.ENUM_CONSTANT; } else if (owner.kind == TYP || owner.kind == ERR) { return ElementKind.FIELD; } else { return ElementKind.LOCAL_VARIABLE; } }