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.
If you use a custom bean that supports generics it is not possible to declare the variable type with the generic. Example: You have created a gui component that shows a list of items. call it MyListViewer. MyListViewer is a bean, but also supports generics. so you can instance it like this. MyListViewer<SomeEntity> viewer = new MyListViewer<SomeEntity>(); But if you added MyListViewer to the palette and create it as a bean in the gui editor, the editor will instance it as. MyListViewer viewer = new MyListViewer(); In the current Netbeans form editor you can create the creation statement yourself (this is properly because you want to support sub classes of the bean) but you cannot define the generic type so the best you can get from the form editor as it is for now is. MyListViewer viewer = new MyListViewer<SomeEntity>(); Workaround: The current workaround i use for now is to create your own alias variable that supports generics. MyListViewer<SomeEntity> viewerAlias = (MyListViewer<SomeEntity>) viewer; This makes is possible for me to use the bean and generics properties of the bean at the same time. but it is a far from perfect solution. Possible solutions: Add a new property under "code" where you select the generic type of the bean. I know that this is properly a rare situation, but as people begin using generics the value of this enhancement will increase. calvin
*** Issue 73072 has been marked as a duplicate of this issue. ***
I agree that there should be a support like this. We will return to this issue once we switch NetBeans trunk builds to JDK 5.0 - that should be soon. We will be able to recognize whether the bean is generyfied and what are its type variables and will be able to provide a better support. I know that we can implement this already using Reflection API, but it seems a little weird to use Reflection classes (like TypeVariable) via Reflection API ;-).
Even being weird implement using Reflection, is a little effort to solve problem that become very common, since own Sun is investing on migration (from 1.3 and 1.4 to 5.0). At all, big projects moving to generics will use lots of custom controls, not basic swing ones... On my own, I have at last one component extending each main component from Swing, plus specialized ones (like CustomerSearcher, AccountSearcher, and so on). All of these use a custom base component that is being generified right now... Is not possible to release a GUI editor with property for generic type based on reflection until a more elegant solution is developed? Tkx.
This has been already implemented for 6.0, see issue 77086. *** This issue has been marked as a duplicate of 77086 ***