Skip to Main Content

Java APIs

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Override generic parameters

966867Nov 25 2012 — edited Nov 30 2012
Hello,

do you know a possibility to override methods with generic parameters. For example I've go a failure in class B because I use SortedMap instead of Map.

I understand that it is logically not possible to increase the restriction for parameter, you know any method how to do so.

public class A {



	public void setMap(Map<Integer, String> map) {



	}

}



public class B extends A {



	@Override

	public void setMap(SortedMap<Integer, String> map) {//failure here: can't override

		super.setMap(map);

	}

}
Thank you

Andrej
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 28 2012
Added on Nov 25 2012
22 comments
11,427 views