Issue 998 in moose-technology: VerveineJ: Method in EnumValue -> anonymous or inner class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 998 in moose-technology: VerveineJ: Method in EnumValue -> anonymous or inner class

moose-technology
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Component-VerveineJ

New issue 998 by [hidden email]: VerveineJ: Method in EnumValue ->  
anonymous or inner class
http://code.google.com/p/moose-technology/issues/detail?id=998

Consider the following Java code (real one, got from FindBugs plugin).
There are some method definitions in Enum Value. How VerveineJ should  
consider the enum values? as anonymous or inner classes? If it is inner  
classes the definition of innerClass method has to be modified since it  
considers only that the container is a class (and not a type).

  enum FilterKind {
         INCLUDE("property.includefilter") {
             Collection<String> selectedFiles(UserPreferences u) {
                 return u.getIncludeFilterFiles();
             }

             Collection<String> excludedFiles(UserPreferences u) {
                 return u.getExcludeFilterFiles();
             }
             void setFiles(UserPreferences u, Collection<String> files) {
                 u.setIncludeFilterFiles(files);
             }
         },
         EXCLUDE("property.excludefilter") {
             Collection<String> selectedFiles(UserPreferences u) {
                 return u.getExcludeFilterFiles();
             }

             Collection<String> excludedFiles(UserPreferences u) {
                 return u.getIncludeFilterFiles();
             }
             void setFiles(UserPreferences u, Collection<String> files) {
                 u.setExcludeFilterFiles(files);
             }
         },
         EXCLUDE_BUGS("property.excludebugs") {
             Collection<String> selectedFiles(UserPreferences u) {
                 return u.getExcludeBugsFiles();
             }

             Collection<String> excludedFiles(UserPreferences u) {
                 return Collections.emptyList();
             }
             void setFiles(UserPreferences u, Collection<String> files) {
                 u.setExcludeBugsFiles(files);
             }
         };
         final String propertyName;

         FilterKind(String propertyName) {
             this.propertyName = propertyName;
         }

         abstract Collection<String> selectedFiles(UserPreferences u);

         abstract Collection<String> excludedFiles(UserPreferences u);
         abstract void setFiles(UserPreferences u, Collection<String> files);
     }

Additional information: platform, context which may impact the problem


Please fill in the labels with the following information:
* Type-Defect, Type-Enhancement, Type-Engineering, Type-Review, Type-Other
* Component-XXX

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 998 in moose-technology: VerveineJ: Method in EnumValue -> anonymous or inner class

moose-technology

Comment #1 on issue 998 by [hidden email]: VerveineJ: Method in  
EnumValue -> anonymous or inner class
http://code.google.com/p/moose-technology/issues/detail?id=998

Hmm, this situation should indeed be changed. The current model only  
considers simple Enums. At the moment, EXCLUDE_BUGS will appear as an  
EnumValue (which is a structural entity). I think this is good given that  
we can have accesses to such enum values.

Now, the question is how to treat the initializer. Essentially, when we  
have:
EXCLUDE_BUGS("property.excludebugs") {... }

it's kind of equivalent to something like:

private FilterKind EXCLUDE_BUGS = new FilterKind("property.excludebugs")  
{ ... }

In this case, we can simply create a static initializer method entity for  
the FAMIXEnum, and create the anonymous classes inside.

What do you think?

--
You received this message because this project is configured to send all  
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 998 in moose-technology: VerveineJ: Method in EnumValue -> anonymous or inner class

Nicolas Anquetil
agreed
(except for the "simply create" :-) )

nicolas

On 11/14/2013 09:24 PM, [hidden email] wrote:

>
> Comment #1 on issue 998 by [hidden email]: VerveineJ: Method in
> EnumValue -> anonymous or inner class
> http://code.google.com/p/moose-technology/issues/detail?id=998
>
> Hmm, this situation should indeed be changed. The current model only
> considers simple Enums. At the moment, EXCLUDE_BUGS will appear as an
> EnumValue (which is a structural entity). I think this is good given
> that we can have accesses to such enum values.
>
> Now, the question is how to treat the initializer. Essentially, when
> we have:
> EXCLUDE_BUGS("property.excludebugs") {... }
>
> it's kind of equivalent to something like:
>
> private FilterKind EXCLUDE_BUGS = new
> FilterKind("property.excludebugs") { ... }
>
> In this case, we can simply create a static initializer method entity
> for the FAMIXEnum, and create the anonymous classes inside.
>
> What do you think?
>

--
Nicolas Anquetil -- RMod research team (Inria)

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Issue 998 in moose-technology: VerveineJ: Method in EnumValue -> anonymous or inner class

Tudor Girba-2
Great. Let me know when I should test this :))

Doru


On Thu, Nov 14, 2013 at 10:06 PM, Nicolas Anquetil <[hidden email]> wrote:
agreed
(except for the "simply create" :-) )

nicolas


On 11/14/2013 09:24 PM, [hidden email] wrote:

Comment #1 on issue 998 by [hidden email]: VerveineJ: Method in EnumValue -> anonymous or inner class
http://code.google.com/p/moose-technology/issues/detail?id=998

Hmm, this situation should indeed be changed. The current model only considers simple Enums. At the moment, EXCLUDE_BUGS will appear as an EnumValue (which is a structural entity). I think this is good given that we can have accesses to such enum values.

Now, the question is how to treat the initializer. Essentially, when we have:
EXCLUDE_BUGS("property.excludebugs") {... }

it's kind of equivalent to something like:

private FilterKind EXCLUDE_BUGS = new FilterKind("property.excludebugs") { ... }

In this case, we can simply create a static initializer method entity for the FAMIXEnum, and create the anonymous classes inside.

What do you think?


--
Nicolas Anquetil -- RMod research team (Inria)


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev