[jbosstools-issues] [JBoss JIRA] (JBIDE-17801) JAX-RS validation: Bogus warning for parameter whose type is an enumeration

Xavier Coulon (JIRA) issues at jboss.org
Thu Jul 24 04:47:29 EDT 2014


    [ https://issues.jboss.org/browse/JBIDE-17801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12987594#comment-12987594 ] 

Xavier Coulon commented on JBIDE-17801:
---------------------------------------

[~clovisseragiotto ],

The validation message refers to the section 3.2 of the JAX-RS 2.0 spec because there should be a Message#fromString(String) or a Message#valueOf(String) method that was not found, but it is implicit in the case of Enumerations, which is clearly something I forgot when coding the validator :( 

{quote}
Valid parameter types for each of the above annotations are listed in the corresponding Javadoc, however in general (excluding @Context) the following types are supported:
1. Types for which a ParamConverter is available via a registered ParamConverterProvider. See Javadoc for these classes for more information.
2. Primitive types.
3. Types that have a constructor that accepts a single String argument.
4. Types that have a static method named valueOf or fromString with a single String argument that return an instance of the type. If both methods are present then valueOf MUST be used unless the type is an enum in which case fromString MUST be used(1).
5. List<T>, Set<T>, or SortedSet<T>, where T satisfies 3 or 4 above.

(1) Due to limitations of the built-in valueOf method that is part of all Java enumerations, a fromString method is often defined by the enum writers. Consequently, the fromString method is preferred when available.
{quote}

I'll fix that today.
Thanks for reporting that bug ! And please, feel free to report any other problem you can find, or missing features you'd like to see in the tooling!

> JAX-RS validation: Bogus warning for parameter whose type is an enumeration
> ---------------------------------------------------------------------------
>
>                 Key: JBIDE-17801
>                 URL: https://issues.jboss.org/browse/JBIDE-17801
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: webservices
>    Affects Versions: 4.2.0.Beta2
>            Reporter: Clovis Seragiotto
>            Assignee: Xavier Coulon
>             Fix For: 4.2.0.CR1
>
>
> The JAX-RS validation wrongly complains about the type of the parameter when it is an enumeration defined in the same class of the resource.
> "The type 'Resources.InstanceType' is not valid for this parameter. See JAX-RS 2.0 Specification (section 3.2) for more information."	
> (the error message just telling that something is invalid doesn't help too much either when you are trying to understand how the validation is reasoning)



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jbosstools-issues mailing list