• Post Reply Bookmark Topic Watch Topic
  • New Topic

Generics warning unchecked conversion - Can't understand why I am getting it.  RSS feed

 
Chan Ag
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a part structure of some requirement I am working on.



The above interface is implemented by



Similarly I have a MultiDimensionalBookShopCreator.

There are many other classes I have ( It's quite huge to document here). But they are not relevant from the question's perspective.

Now my main class, the BookShopManager class, and it's structure is like this.



I also have the following interface.



I also have two implementations of the above interface.


Similarly I also have a MultiDimensionalBookShopFactory. I have roughly this.




With the above structure - I get the following generics warning. I don't see why i should be getting this warning.

C:\Users\ChanAg\Documents\NetBeansProjects\DesignPatterns\src\CodingExercise\BookShop.java:34: warning: [unchecked] unchecked conversion
this.masterData = factory.getBookShop(scanner);
required: Map<Integer, BookSlot>
found: Map


I think everywhere I have declared Map as Map<Integer, BookSlot>, so why should I get this warning?

Please help.
Thanks,
Chan.
 
Chan Ag
Rancher
Posts: 1090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is resolved. The culprit was this silly mistake I spent one hour figuring. God knows why I do such, so many silly mistakes. Such a waste of time ( yours too I know, if you spent time reading it )!


Corrected it as follows.
public interface BookShopFactory

I know we don't create generic classes that way. It should be just a variable ( just a reference ), not a class. Also my interface is not a generic interface. So those <> there are wrong.

Chan.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!