nmatt opened a new issue, #9563:
URL: https://github.com/apache/netbeans/issues/9563
### Apache NetBeans version
Apache NetBeans 31
### What happened
Copying or renaming a Java class results in broken syntax in certain cases,
see the examples below.
The error appears to be related to the fact that the class name appears
multiple times as type argument in the interface list.
### Language / Project Type / NetBeans Component
Java, Editor, Refactoring
### How to reproduce
Create the following Java interface in a non-default package:
```java
package org.example;
interface Example extends Comparable<Example>, Iterable<Example>, Cloneable
{ }
```
Refactor-copy or refactor-rename the interface within the same package. The
result is:
```java
interface Example1 extends Comparable<Example1>,Iterable<Example1>, ,
Cloneable { }
```
Notice the extra comma (which breaks the syntax) and the missing space
before "Iterable".
The analogous example with a(n abstract) class instead of an interface
exhibits the same error.
Dirfferent variations of the faulty result happen with different spacing.
For example, adding an extra space before "Iterable" results in (notice the
"null"):
```java
interface Example1 extends Comparable<Example1>,null Iterable<Example1>, ,
Cloneable { }
```
Similarly, removing the space before "Iterable" results in:
```java
interface Example1 extends Comparable<Example1>,nullIterable<Example1>, ,
Cloneable { }
```
Likewise, if the original uses multiple lines:
```java
interface Example
extends
Comparable<Example>,
Iterable<Example>,
Cloneable
{ }
```
the result is:
```java
interface Example1
extends
Comparable<Example1>,null
Iterable<Example1>, ,
Cloneable
{ }
```
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
Windows
### JDK
JDK 21
### Apache NetBeans packaging
Apache NetBeans binary zip
### Anything else
The issue doesn't appear to happen in the default package.
The issue already occurred in NetBeans 30.
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists