[Spoon-discuss] Spoon eats enum methods

Matías Costa m.costacano at gmail.com
Wed Oct 28 11:39:39 CET 2009


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>



More information about the Spoon-discuss mailing list