[Spoon-discuss] Spoon eats enum methods

Carlos Noguera cnoguera at soft.vub.ac.be
Wed Oct 28 15:24:24 CET 2009


I just ran the example by Spoon [SVN Head], and I got this back:


public enum NormalEnum {
    One(1);
    int v;
    NormalEnum(int i) {
        v = i;
    }
    public int getValue() {
        return v;
    }

    public void someMethod() {
        System.out.println("spoon\u0021");
    }

    public String anotherThing() {
        return (v) + "";
    }

}


I guess the problem has been solved.


Renaud Pawlak wrote:
> Could you be more specific on the version you use and your
> environement? Have you tried with the Eclipse plugin?
>
> Thanks.
>
> 2009/10/28 Matías Costa <m.costacano at gmail.com>:
>   
>> On Wed, Oct 28, 2009 at 8:09 AM, Renaud Pawlak <renaud.pawlak at gmail.com> wrote:
>>     
>>> Hi Matias,
>>>
>>> I have a hard time believing that this bug was found only now as many
>>> tests were performed on enums.
>>>       
>> Yes, me too. That's the reason I have done the mini test and I have
>> not filled a bug the forge.
>>
>>     
>>> If you declare several methods with other names, are they eaten also?
>>> Why is value() not public? What happens if you change the name and the
>>> visibility? Typically I would name it getValue() for a try.
>>>       
>> package test;
>>
>> public enum NormalEnum {
>>    One(1);
>>
>>    int v;
>>
>>    public int getValue() {
>>        return v;
>>    };
>>
>>    public void someMethod() {
>>        System.out.println("spoon!");
>>    };
>>
>>    public String anotherThing() {
>>        return v+"";
>>    };
>>
>>    NormalEnum(int i) {
>>        v = i;
>>    }
>> }
>>
>> All methods are removed. The build.xml:
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> <project name="test" default="spoonize" basedir=".">
>>        <path id="project.class.path">
>>                <fileset dir="lib" includes="*.jar" />
>>        </path>
>>
>>        <!-- define spoon task -->
>>        <taskdef name="spoon" classname="spoon.SpoonTask"
>> classpathref="project.class.path" />
>>
>>        <target name="spoonize" description="Spoon!">
>>                <spoon classpathref="project.class.path" verbose="true" debug="true"
>> output="src">
>>                        <sourceSet dir="src" includes="test/*.java" />
>>                        <!--templateset dir="src"
>> includes="omega/generate/fieldaccess/template/*.java" /-->
>>                </spoon>
>>        </target>
>> </project>
>>
>> _______________________________________________
>> Spoon-discuss mailing list
>> Spoon-discuss at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/spoon-discuss
>>
>>     
>
>
>
>   





More information about the Spoon-discuss mailing list