This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 86300 - Should not gen code for generalizations to a class' own inner class
Summary: Should not gen code for generalizations to a class' own inner class
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Craig Conover
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-02 13:22 UTC by Andrew Korostelev
Modified: 2007-02-17 05:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Korostelev 2006-10-02 13:22:56 UTC
it is allowed in Java-Model uml project to add generalization link from class
element to it's nested class.
The same for implementing nested interface.

While we restrict relations, unsupported in java, these should also be prohibited.
Code generated for such relation is uncompilable.

steps to reproduce:
- create Java-Model uml project
- create class diagram
- put two classes and name them A and B.
- add nested link from B to A (B is nested class of A)
- add Generalization link from A to B
This relation generates the following uncompilable code and should not be allowed:

public class A extends A.B {
    public class B {
    }
}
Comment 1 Craig Conover 2007-02-08 18:32:35 UTC
If UML allows it, we should continue to allow it in the model, and let the
modeler decide that it is the right thing to do, but code gen will have to
simply ignore these violations for Java and not generation the extends or
implements to nested classes. I'll test these implementations to see if this is
the right thing to do.
Comment 2 Craig Conover 2007-02-09 00:23:15 UTC
UML also allows an interface to generalize its own inner interface, and Java
doesn't support that either. I will fix that as well.
Comment 3 Craig Conover 2007-02-09 00:30:33 UTC
I rephrased the summary and reclassified as Code Generation since the diagram is
actually working to UML spec. A fix is ready, but waiting for the go ahead on
integration.
Comment 4 Craig Conover 2007-02-13 20:16:54 UTC
Integrated
Comment 5 Peter Lam 2007-02-17 05:47:01 UTC
Verified in build 070216_4. The original bug has been fixed and the generated
code is below.


public class A {

    public A() {
    }
    public class B {
        public B() {
        }
    }

}

As for "UML also allows an interface to generalize its own inner interface, and
Javadoesn't support that either. I will fix that as well." It's not yet fixed
and the following uncompilable code is generated. I'll open a separate issue for
this but the original bug here is fixed.

public interface I1 extends I1.I2 {
    public interface I2 {
    }

}
Comment 6 Peter Lam 2007-02-17 05:55:42 UTC
the interface case has been filed in issue 95865.