Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Compile problem: incompatible types; no instance(s) of type variable(s)

807589Aug 16 2008 — edited Aug 16 2008
Hello,

I'm working on a project and with eclipse I can compile my whole project without any problems.
But when I try it manually with javac I get an incompatible types; no instance(s) of type variable(s) error :(

The error message is:

PlayerFactory.java:8: incompatible types; no instance(s) of type variable(s) S exist so that Player<T,S> conforms to Player<T,S>
found : <S>Player<T,S>
required: Player<T,S>
return createRemotePlayer((RemotePlayerInfo)info, termfactory);
1 error

I localize the problem files and delete all contents to show you the problem.

When you try to compile this you get the error:
public abstract class AbstractPlayer<
		T extends TermInterface,
		S extends StateInterface<T,S>
		> implements Player<T,S> {
}

public interface Player<
		T extends TermInterface,
		S extends StateInterface<T,S>
		> {
}

public class RemotePlayer<
		T extends TermInterface,
		S extends StateInterface<T,S>
		> extends AbstractPlayer<T,S> {
}

public interface TermInterface {
}

public interface StateInterface<T extends TermInterface, S extends StateInterface<T,S>> {
}

public class RemotePlayerInfo extends PlayerInfo {
}

public abstract class PlayerInfo {
}


public interface TermFactoryInterface<T extends TermInterface> {
}

public class PlayerFactory {
	public static <T extends TermInterface, S extends StateInterface<T, S>> Player<T,S> createRemotePlayer(RemotePlayerInfo info, TermFactoryInterface<T> termfactory) {
		return new RemotePlayer<T,S>();
	}
	public static <T extends TermInterface, S extends StateInterface<T, S>> Player<T,S> createPlayer(PlayerInfo info, TermFactoryInterface<T> termfactory) {
		if(info instanceof RemotePlayerInfo){
			return createRemotePlayer((RemotePlayerInfo)info, termfactory);
		}
		return null;
	}
}
Do you have an idea where the problem is?

Thank you so much!

Martin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2008
Added on Aug 16 2008
2 comments
1,887 views