- This topic has 2 replies, 2 voices, and was last updated 18 years, 4 months ago by Greg.
-
AuthorPosts
-
nidgetMemberHi,
I’m using Eclipse 3.1.1 with MyEclipse 4.1.0
I’m currently migrating a large project into Java 5.0 and I have a few (actually a lot of, as the project is really large) warnings with type safety because it wasn’t using Generics. Usually, I can fix them, but I have a problem in a specific case:Some of the classes of this project are EJB interfaces generated by XDoclet. The JDK 5 build is activated in the XDoclet configuration dialog.
I have modified some methods like this one in the source of some CMP entity beans:
public abstract java.util.Collection<AdvanceBean> getAdvanceBean();
It should, i presume, generate this in the local home interface:
public java.util.Collection<AdvanceLocal> getAdvanceBean();
Or, at least, if I have this in the source of the EJB:
public abstract java.util.Collection<Object> getAdvanceBean();
I should get this in the generated interfaces:
public java.util.Collection<Object> getAdvanceBean();
[This is not perfect, but would disable the warnings.]
However, it doesn’t work and it just skips the generics. In all cases, I have this in the generated interfaces and I get a lot of warnings because the type of the collection is not specified:
public java.util.Collection getAdvanceBean();
Can you help me to find a solution?
Regards,
Nidget.
nidgetMemberI’ve actually found a solution to eliminate the warnings, but it’s actually more a workaround than a real solution. Where the methods of the EJB interfaces are called, I add the annotation @SuppressWarnings(“unchecked”)
It’s not clean as I have to do it in a lot of places. So, if you have something better, don’t hesitate.
GregMemberTo my knowledge XDoclet will allow the user of java5 generics in your source files but it won’t actually generate interface code with java5 generics. Or at least Xdoclet 1.2.3 will not.
-
AuthorPosts