aspose file tools*
The moose likes Java in General and the fly likes incompatible types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "incompatible types" Watch "incompatible types" New topic
Author

incompatible types

sneha krishna
Greenhorn

Joined: Nov 29, 2011
Posts: 7
In my class, at the line

for (String coveredTestCase : getCoveredQCTestCases()) {

I am getting this error

TestBase.java:122: error: incompatible types
for (String coveredTestCase : getCoveredQCTestCases()) {

required: String
found: Object

Please help me how to debug this error.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

What does getCoveredQCTestCases() return?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Aj Maven
Greenhorn

Joined: Jul 04, 2011
Posts: 22

Method getCoveredQCTestCases() seems to return an object. Check its return type first. Anyways you can convert the object to string by calling toString(). But know what the method is returning first.


Thanks
-Aj
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19722
    
  20

Not Object but something that's an Iterable<Object>, Iterable<?> or Iterable (raw type). That Iterable could be a Collection, List, Set, etc. My guess is that the method does not use generics yet.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: incompatible types