Skip to content

How to update existing class #5003

Open
@esfomeado

Description

@esfomeado

Describe the bug

I just discovered this library and I'm trying to see if it's possible to do something that I require.

I have the following code:

@MyAnnotation
public class Book
{
    private String name;
}

And I want this to get generated:

public class Book
{
    private String name;

    boolean isValid()
    {
        return name != null;
    }
}

I'm already able to generate this code but the output file is created in a generated folder with the same name.

I changed the output folder to be the same as the generated code but it's replacing the existing class.

It's possible to just generate the file in memory and then compile it?

I don't want to generate a new file or change the source code of the existing one.

I can't use other libraries such as Byte-Buddy because I need this new file available during compilation.

Any help is welcome.

Thanks

Spoon Version

10.2.0

JVM Version

11

What operating system are you using?

Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions