Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8250493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:54:33+00:00 2026-06-07T23:54:33+00:00

I have public class First<T> {} public class Second<T extends SomeConcreteClass> extends First<T> {}

  • 0

I have

public class First<T> {}

public class Second<T extends SomeConcreteClass> extends First<T> {}

public class Third<T> extends Second<T> {} //Compile-time error

I get the compile-time error

Type argument T is not with bounds of type-variable T.

When I contruct a Third, I want to be able to give the generic parameter as SomeConcreteClass (or derived class thereof), and for a run-time error to be thrown if I’ve offered up a type that is not part of SomeConcreteClass‘s inheritance hierarchy.

I would think that the specification in Second‘s declaration would simply propagate downward, i.e. it should be implicit in the declaration (and any instantiations) of Third.

What’s with the error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:54:35+00:00Added an answer on June 7, 2026 at 11:54 pm

    All you need is

    public class Third<T extends SomeConcreteClass> extends Second<T>
    

    You just need to respecify the bound. It doesn’t propagate like you think it does.

    (I’m not positive of the reason for this, but I have some guesses — what if it was Third<T> extends Second<Foo<T>>? The appropriate bound on T isn’t obvious, if there even is one. So instead, it just doesn’t propagate automatically; you have to specify it.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one class. Class First { private Second second; public First(int num, String
I have three class in my app. First extends Activity public class TestProjActivity extends
my code is like this: i have two classes first class: public class Box<E>
I have a class like Quete (first in , first out) public class Tor<T>
I have an entity defined as in a db First Model: public class Merlin_BR_Condiciones_Item
I'm using the Code First approach and have the following Model: public class Person
I have some questions with relationship of ef code first. My code: public class
I have two programs, the first is a producer: public class Producer { public
I'm using EF 4.3.1 Code First Migrations. I have a table like: public class
I have an example class containing two data points: public enum Sort { First,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.