• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Unchecked call warning

 
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

with the following code:




I'm getting this warning:

warning: [unchecked] unchecked call to addListener(ChangeListener<? super T>> as a member of the raw type
ObservableValue

where T is a type-variable:
T extends Object declared in interface ObservableValue


Any suggestions ? I'm not sure what's wrong here.
 
Marshal
Posts: 79973
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know. But when I looked up ChangeListener, it said ChangeListener, not ChangeListener<T>, so maybe you are not supposed to make Change Listeners parametrised in the first place.
By the way: what does <T extends String> mean? String is a final class so you cannot make subclasses of it.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what happens when a question is posted in the wrong section. Nikolas, please read Carefully Choose One Forum. I'll move this to JavaFX.

You're getting a warning because ChoiceBox is a raw type; ChoiceBox<String> wouldn't be.
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Thanks for both the answers.
I wasn't sure about which forum to place this In. I'll read the guidelines.
I know It's JavaFX but I thought If It's a beginner type question , It should still go In the
beginner's forum.
 
Darryl Burke
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, but many of the FX classes -- like ChangeListener -- have counterparts with the same name in AWT and/or Swing. This leads to confusion when FX questions are posted in teh core Java sections.

Have you got rid of the warning?
 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. Noted.
Yes Thanks ! ChoiceBox<String> fixed It.
 
I AM MIGHTY! Especially when I hold this 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