I understand the restrictions on modifying existing source with an annotation processor, but if I can get JAX-WS to generate the interface with @Generated, will that allow Filer.createSourceFile to succeed so that I can modify it?

The JAX-WS RI wsimport tool creates FooPortType and MyService already exists (it's not generated). What I need is a way for annotation processing to modify FooPortType "in place" to make it extend MyService, but I understand that's not really supported. The Javadoc for Filer seems to imply that modifying existing code might be allowed as long as it's been marked with @Generated, so I was looking for clarification on that possibility.

kschneid wrote:
The JAX-WS RI wsimport tool creates FooPortType and MyService already exists (it's not generated). What I need is a way for annotation processing to modify FooPortType "in place" to make it extend MyService, but I understand that's not really supported.

That is not supported by annotation processing in apt or javac. To get that effect, you have to generate a superclass or subclass of the type in question.

The Javadoc for Filer seems to imply that modifying existing code might be allowed as long as it's been marked with @Generated, so I was looking for clarification on that possibility.

The Filer uses different checks for files coming from different locations. If a file is on the source path, it cannot be overwritten. If it is on the source output location, it can be written once. While the @Generated annotation is a recommended practice, the annotation processing infrastructure in javac does not use the presence or absence of this annotation to alter the overwriting policy.