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 9288305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:53:02+00:00 2026-06-18T19:53:02+00:00

Recently I encounter a weird problem with respect to Java generics . I simplified

  • 0

Recently I encounter a weird problem with respect to Java generics. I simplified the problem with snippet below :

public static void main(String[] args) {
        String s = "Hello";
        System.out.println(blindlyReturnGetObject());
    }

    private static <T> T getObject() {
        return (T) new Object();
    }

    private static <T> T blindlyReturnGetObject() {
        return getObject();
    }

In case of JDK 1.6.0_03 and earlier versions, we were getting infamous compilation error

type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object

whereas this code works perfectly in JDK 1.6.0_26 and later versions.

Is there anyway to get rid of this issue for earlier version of jdk 1.6 since our build servers are still running in earlier version of jdk 1.6?

  • 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-18T19:53:04+00:00Added an answer on June 18, 2026 at 7:53 pm

    While googling related to this issue, I came across a bug raised in sun related to this generics type inference issue.

    https://bugs.java.com/bugdatabase/view_bug?bug_id=6302954

    So this is found to be fixed in later versions of jdk 1.6.0_20 and hence it was working in jdk 1.6.0_26

    Thought its worth sharing.

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

Sidebar

Related Questions

recently, while reading former's code in my current project, I encounter the problems below:
I recently encountered a problem with my Profile provider: it wouldn't retrieve profiles correctly
I've recently encountered a problem designing a web page. I needed to have rounded
I've recently begun learning C# but have encountered an annoying problem. Every variable I
While poking around the questions, I recently discovered the assert keyword in Java. At
I recently encountered a problem where a value was null if accessed with Request.Form
I recently upgraded Xcode to start ios5 development, but for some reason I encounter
I recently encountered very strange behaviour with the UIImagePickerController. On our main view we
I recently encountered an problem where I am not creating an array correctly for
I recently encountered a problem in my website - some users do not have

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.