internal DEBUG_PROPERTY_INFO GetDebugPropertyInfo(enum_DEBUGPROP_INFO_FLAGS dwFields) { var propertyInfo = new DEBUG_PROPERTY_INFO(); var mirrorInfo = GetMirrorInfo(_currentMirror) ?? new MirrorCommonInfo { FullName = "UNKNOWN-FullName", Name = "UNKNOWN-Name", Type = null }; System.Diagnostics.Debug.WriteLine($"GetDebugPropertyInfo: {mirrorInfo.Name} [{mirrorInfo.FullName}] - typeMirror: {_arrayElementType?.ToString()} childMirror: {_arrayValue?.GetType().FullName}"); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME) != 0) { propertyInfo.bstrFullName = mirrorInfo.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_FULLNAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME) != 0) { propertyInfo.bstrName = (_arrayIndices != null) ? $"[{_arrayIndices}]" : mirrorInfo.Name; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_NAME; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE) != 0) { propertyInfo.bstrType = mirrorInfo.Type?.FullName ?? "UNKNOWN-Type"; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_TYPE; } var isExpandable = false; var attributeInfos = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_NONE; string valueError = null; Value value = _arrayValue ?? GetValue(_currentMirror, out attributeInfos, out valueError); if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE) != 0) { if (value is StringMirror) { var obj = ((StringMirror)value); propertyInfo.bstrValue = $"\"{obj.Value}\""; propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_RAW_STRING; } else if (value is ArrayMirror) { var obj = ((ArrayMirror)value); isExpandable = obj.Length > 0; if (obj.Rank == 1) { propertyInfo.bstrValue = $"{{{obj.Type.GetElementType().Name}[{obj.Length}]}}"; } else { // Support multi dim array [,,] var dimUpperBound = new int[obj.Rank]; for (int dim = 0; dim < obj.Rank; dim++) { dimUpperBound[dim] = obj.GetLowerBound(dim) + obj.GetLength(dim); } propertyInfo.bstrValue = $"{_arrayElementType?.Name ?? obj.Type.GetElementType().Name}[{string.Join(",", dimUpperBound)}]"; } } else if (value is StructMirror) { if (value is EnumMirror) { var obj = ((EnumMirror)value); propertyInfo.bstrValue = $"{obj.StringValue}"; } else { isExpandable = true; var obj = ((StructMirror)value); propertyInfo.bstrValue = $"{{{obj.Type.Namespace}.{obj.Type.Name}}}"; } } else if (value is ObjectMirror) { isExpandable = true; var obj = ((ObjectMirror)value); propertyInfo.bstrValue = $"{{{obj.Type.Namespace}.{obj.Type.Name}}}"; } else if (value is PrimitiveValue) { var obj = ((PrimitiveValue)value); propertyInfo.bstrValue = obj.Value?.ToString() ?? $"null"; } else if (value != null) { propertyInfo.bstrValue = $"Unsupported value has Type: {value?.GetType().FullName}"; } else { propertyInfo.bstrValue = valueError ?? $"Value evaluation error!"; } propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_VALUE; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB) != 0) { propertyInfo.dwAttrib = enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_VALUE_READONLY; if (isExpandable) { propertyInfo.dwAttrib |= enum_DBG_ATTRIB_FLAGS.DBG_ATTRIB_OBJ_IS_EXPANDABLE; } propertyInfo.dwAttrib |= attributeInfos; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_ATTRIB; } if ((dwFields & enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP) != 0) { propertyInfo.pProperty = this; propertyInfo.dwFields |= enum_DEBUGPROP_INFO_FLAGS.DEBUGPROP_INFO_PROP; } return(propertyInfo); }
private Stream <CompilationMessage> ValidateAggregationType(ExecutableElement aggregationFunction) { TypeMirror returnType = aggregationFunction.ReturnType; Element returnTypeElement = _types.asElement(returnType); if (returnTypeElement == null) { return(Stream.of(new AggregationError(aggregationFunction, "Unsupported return type <%s> of aggregation function.", returnType.ToString(), aggregationFunction.EnclosingElement))); } IList <ExecutableElement> updateMethods = MethodsAnnotatedWith(returnTypeElement, typeof(UserAggregationUpdate)); IList <ExecutableElement> resultMethods = MethodsAnnotatedWith(returnTypeElement, typeof(UserAggregationResult)); return(Stream.concat(ValidateAggregationUpdateMethod(aggregationFunction, returnTypeElement, updateMethods), ValidateAggregationResultMethod(aggregationFunction, returnTypeElement, resultMethods))); }
private Stream <CompilationMessage> ValidateInjectedTypes(VariableElement field) { TypeMirror fieldType = field.asType(); if (InjectsAllowedType(fieldType)) { return(Stream.empty()); } if (InjectsRestrictedType(fieldType)) { if (_ignoresWarnings) { return(Stream.empty()); } //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: return(Stream.of(new ContextFieldWarning(field, "@%s usage warning: found unsupported restricted type <%s> on %s.\n" + "The procedure will not load unless declared via the configuration option 'dbms.security.procedures.unrestricted'.\n" + "You can ignore this warning by passing the option -A%s to the Java compiler", typeof(Context).FullName, fieldType.ToString(), FieldFullName(field), IGNORE_CONTEXT_WARNINGS_OPTION))); } //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: return(Stream.of(new ContextFieldError(field, "@%s usage error: found unknown type <%s> on field %s, expected one of: %s", typeof(Context).FullName, fieldType.ToString(), FieldFullName(field), JoinTypes(_supportedTypes)))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override protected void process(javax.lang.model.element.TypeElement annotationType, javax.lang.model.element.Element annotated, javax.lang.model.element.AnnotationMirror annotation, java.util.Map<? extends javax.lang.model.element.ExecutableElement, ? extends javax.lang.model.element.AnnotationValue> values) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: protected internal override void Process <T1>(TypeElement annotationType, Element annotated, AnnotationMirror annotation, IDictionary <T1> values) where T1 : javax.lang.model.element.ExecutableElement { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (javax.lang.model.element.AnnotationValue o : (java.util.List<? extends javax.lang.model.element.AnnotationValue>) values.values().iterator().next().getValue()) foreach (AnnotationValue o in (IList <AnnotationValue>)values.Values.GetEnumerator().next().Value) { TypeMirror service = ( TypeMirror )o.Value; AddTo((( TypeElement )annotated).QualifiedName.ToString(), "META-INF", "services", service.ToString()); } }