• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Warning output in eclipse, how to solve this the right way?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I have encountered some warning output in eclipse and I want to understand from someone more senior than I how they would handle this; before I start yes I am aware that we can simply suppress these warnings with annotations or simply tell the compiler but that's not exactly wise in this scenario I either want address them appropriately or leave them there ( the warnings) I am posting cause I am not 100% confident on my decision and want to arrive at the right solution with confidence for my team as this is for a customer .


Heres what i'm using:

- Eclipse
- Apache Tomcat
- package io.jsonwebtoken





WARNING OUTPUT : Jws is a raw type, Refrences to a generic type Jswheader<T> should be parameterized



SECOND ISSUE:





WARNING OUTPUT: Type saftey: the expression of type List needs unchecked conversions to conform to List<DbResult>





 
Ranch Hand
Posts: 67
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These are both errors invoving generics. The first one is telling you that you are using a raw type (no generics) where a generics type <SomeType> is expected. The second one is teling you that the method getListResult is returning a non-parameterized (non-genericized) List but it is being assigned to a List<DbResult> - type object.

The java tutorial on oracle's site has a good beginner's intro to generics that will get you past these issues.

It's not an eclipse thing.
 
Sheriff
Posts: 22816
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The fix for the first issue is to simply fill in a generic type or wildcard in the method signature. For instance:

The second issue requires you to use a different method, one that takes a class. This returns a TypedQueury (which is a generic sub type of Query):
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic