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 87194 - [java 5] Fully qualified name is incorrectly generated for Generic types
Summary: [java 5] Fully qualified name is incorrectly generated for Generic types
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-16 12:56 UTC by Alexandr Scherbatiy
Modified: 2007-10-19 21:06 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 Alexandr Scherbatiy 2006-10-16 12:56:27 UTC
My Java class has 'void test(Class<Integer> cls)' method.
I reverse engineer the class and generate code for them.

The result method is 'void test(pack.Class<Integer> cls)'.
But 'Class' should be from 'java.lang' package or should have default
package, not 'pack' package.


Steps to reproduce:

- Create an empty Java project
- Add 'pack' package into the Java project
- Add 'MyClass'  class under the package
 
--------------------------------------------------------------------------------------------------
  public class MyClass {
        void test(Class<Integer> cls) throws InstantiationException,
IllegalAccessException {
        Integer i = cls.newInstance();
    }
  }
 
--------------------------------------------------------------------------------------------------

- Reverse Engineer the Java project into  UML project
- Generate code for the UML project
  The generated source for 'MyClass' class is
 
--------------------------------------------------------------------------------------------------
  package pack;

  public class MyClass {
    void test(pack.Class<Integer> cls) throws InstantiationException,
IllegalAccessException {
    }
  }
 
--------------------------------------------------------------------------------------------------
  Note that 'test' method has 'pack.Class<Integer>' argument type instead of
'Class<Integer>'

- Build the generated code:
  The code is not compiled:

 
--------------------------------------------------------------------------------------------------
  JavaApplication1-ModelSources\src\pack\MyClass.java:4: cannot find symbol
  symbol  : class Class
  location: package pack
    void test(pack.Class<Integer> cls) throws InstantiationException,
IllegalAccessException {
  1 error
  BUILD FAILED (total time: 0 seconds)
 
--------------------------------------------------------------------------------------------------
Comment 1 Craig Conover 2006-10-31 02:15:18 UTC
Fixed with the collection override code gen overhaul mods.
Comment 2 Alexandr Scherbatiy 2006-11-07 11:26:17 UTC
The import lines are generated instead of Fully qualified names.