• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unchecked call warning

 
Nikolas Nikolaou
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Posts: 51366
87
  • Mark post as helpful
  • send pies
  • 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.
 
Darryl Burke
Bartender
Posts: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
  • 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: 5149
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ok. Noted.
Yes Thanks ! ChoiceBox<String> fixed It.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic