WebStorm and jsdoc3, defining allowed parameters doesn't work? - intellij-idea

Based on the documentation, the JSDoc implementation in WebStorm seems to be very limited. Is there anyway to extend it? I can't find any plugins.
Specifically, I would like "allowed parameters" to work (as implemented 2014-04-11)

they do work - if the argument doesn't match the value specified in #param annotation, WebStorm shows type mismatch warning:
But parameter hint shows expected parameter type, not value

Related

What are all the different error types in Rust?

I'm learning Rust and can't find a list of all error types. When a function is returning a Result, does the standard library have a group of predefined errors available for use?
I know custom error types can be made in Rust, is that the solution? Make all custom errors types?
It's not well defined what "an error type" would mean, so no, there is no global list of errors.
If you mean "is there a list of all the types that are used as Result::Err, the answer is still no. There are methods like slice::binary_search which return Result<usize, usize>. Is usize to be considered an error type? What if a Result::Err is constructed entirely inside of a function and never leaves it; is that type considered an error type? What about a generic type that contains a Result<i32, E>; should any concrete E be called an error type?
If you mean "is there a list of all the types that implement std::error::Error, then the answer is "kind of". See How can I get a list of structs that implement a particular trait in Rust? for details.
does the standard library have a group of predefined errors
Yes.
available for use
Sometimes. io::Error allows you to construct your own error value, but num::ParseIntError does not.
is that the solution? Make all custom errors types?
Generally, yes.
See also:
How do you define custom `Error` types in Rust?
Result types are often aliased in the standard library. If you see a function in the standard library documentation, you can click on Result, which should lead you to the aliased type (e.g. std::io::Result)
You can then see which kind of Error is used in the Result.
The documentation also has a list of all enums and structs in the standard library that implement the Error trait.
a list, although not complete, can be found at
https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/share/doc/rust/html/std/error/trait.Error.html

Reference parameters are not allowed with RFC

Can anyone advise me on this error?
Follow #Jagger's advice and make your module not RFC or make all your parameters pass by value (without reference), it's the column with the heading 'Pa...'.
In RFC modules only TYPE and LIKE typing is allowed, references are prohibited.

How the EXPORTING method parameters passed by value?

I'm wondering about the definition of a call-by-value EXPORTING argument of an ABAP method call.
The SAP Help Portal states that EXPORTING parameters can be defined call-by-value (and call by reference). It does not give a precise definition of how this parameter type is handled. Instead, it states
For precise details of the relevant ABAP statements, refer to the
corresponding keyword documentation in the ABAP Editor.
Now, the ABAP Keyword Documentation of the SAP editor does not mention pass-by-value for EXPORTING. (It does mention pass-by-value for IMPORTING and CHANGING).
I can guess the meaning of pass-by-value EXPORTING. But I want to read the definition. From FORM/PERFORM, I know that details can be subtle. Could you point me to an official description of this case?
I'm not sure in what way the details can be subtle even when using FORMs - but anyway, it's in the documentation:
There are two ways in which parameters can be passed: pass by
reference and pass by value. Pass by value is selected in the Function
Builder by selecting pass by value, and in the above syntax, differs
from pass by reference by the specification of VALUE( ).
In pass by reference, the formal parameter points directly to the actual parameter, so that changes to the formal parameters have an
immediate effect on the actual parameter.
In pass by value, when the function module is called, the formal parameter is created as a copy of the actual parameter (in IMPORTING
and CHANGING parameters), or initial (in EXPORTING parameters) in
the stack. In CHANGING and EXPORTING parameters, the formal
parameter is copied to the actual parameter when returning from the
function module.

Morphia Gives "Possible Heterogeneous Collection" Warning For Non-Collection Field

This is a follow-up question to Manual Conversion of 3rd Party Class With Morphia
I've an #Entity class which has a field of type javax.activation.MimeType. When I run my application I see a warning message in the output window, telling
WARNING: The multi-valued field
'javax.activation.MimeTypeParameterList.parameters' is a possible
heterogeneous collection. It cannot be verified. Please declare a
valid type to get rid of this warning. class java.lang.Object
I've already written and registered a type converter class for the type "MimeType", which effectively just ignores its 'parameters' field. But the warning keeps coming.I debugged it and saw that the warning was issued when datastore.ensureIndexes(); is called.
I tried writing a type converter for "MimeTypeParameterList" type but it didn't supress the warning. I can't just go and put a #Transient annotation over the field declaration because it's third party code (Java SE core!), not mine.
Is there an "elegant" way to eliminate this warning?
I just pushed a change to morphia's github repo that suppresses that logging for you. It'll be in 0.108 or you can build it locally if you want to try it out.

How to fire our aspects conditionally in PostSharp 2.0

We are in the progress of introducing PostSharp in one of our projects. It's been working great so far! There is one thing though that we haven't managed to solve: how to fire an advice conditionally.
Details:
- we have an attribute StopWatchAttribute which makes it possible to record the time needed to run methods
- this attribute accepts an enumeration "LoggingLevel" which is set in the config file with values like 0, 1, 2 etc
- this parameter is read in a base class called BaseService during runtime: new BaseService().CurrentLoggingSettings
- we tried to set up the attribute constructor like StopWatchAttribute(new BaseService().CurrentLoggingLevel) but we get a compile error: an attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.
--> summary: we would like the advice to be called conditionally and the condition depends on the parameter in the constructor of the attribute.
Is this possible to do?
Thanks for your help,
Andras
You cannot give variables to attributes, PostSharp or not. Since you're already reading the values from the config, just set your aspect to do the same on the Initialize() method. Override it in the aspect class and then save the value to a local field. You can use that field throughout the aspect. This compiles the value into the aspect essentially hard coding it.
Or, you can pull the value from the config from your advice method (OnMethodStart, etc) so that you can change it in the config at runtime. This is a more 'flexible' way to do it as it doesn't hard code anything.
Remember, your variables are being set at Runtime. PostSharp is a post-compile framework which means it does it's work long before your variables are even known to JIT.