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

  • Home
  • SEARCH
  • 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 9171245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:08:12+00:00 2026-06-17T16:08:12+00:00

I could workaround this problem but I cannot understand it, so I am asking

  • 0

I could workaround this problem but I cannot understand it, so I am asking for some explanation (and maybe a better question title as well).

Please consider this:

public class TBGService {
    // TBGObject is an abstract base class which is extended by model classes
    public <T> T doGet(TBGObject model) throws TBGServiceException {
        String uri = model.buildUrl(repository) + model.getObjectKey();
        GetMethod method = new GetMethod(uri); 
        T returned = execute(method, credentials, model.getClass());
        return returned;
    }
}

and this:

public enum TBGTaskAttributes {
    private TBGTaskAttributes(String id, String type, String label, Object... flags) {
        builder = new TaskAttributeBuilder();
        builder.withId(id).withLabel(label);
        for (Object flag : flags) {
            processFlag(flag);
        }
    }

    public abstract String getValueFromIssue(TBGIssue issue);

    public abstract void setValueInIssue(TBGIssue issue, String value);

}

when I write this code to define an enum item:

PROJECT(TaskAttribute.PRODUCT, TaskAttribute.TYPE_SINGLE_SELECT, "Project", new OptionProvider() {
    @Override
    public Set<Entry<String, String>> getOptions(TaskRepository repository) {
        try {
            List<TBGProject> list = TBGService.get(repository)
                .doGet(new TBGProjects()).getProjects();
            [...]
            return map.entrySet();
         } catch (TBGServiceException e) { [...] }
         return null;
    }
}) {
    @Override
    public String getValueFromIssue(TBGIssue issue) {
        return issue.getProjectKey();
    }
    @Override
    public void setValueInIssue(TBGIssue issue, String value) {
        issue.setProjectKey(value);
    }
},
[... other items ...]

I get compiler error (also eclipse auto-completion does not work):

The method getProjects() is undefined for the type Object

and if I hover the doGet method, eclipse show it as defined like:

 <Object> Object TBGService.doGet(TBGObject model)

Elsewhere, hovering shows the signature correctly as:

 <TBGProjects> TBGProjects TBGService.doGet(TBGObject model)

when called with parameter new TBGProjects().

Just changing:

List<TBGProject> list = TBGService.get(repository)
    .doGet(new TBGProjects()).getProjects();

with:

TBGProjects projects = TBGService.get(repository).doGet(new TBGProjects());
List<TBGProject> = projects.getProjects();

makes it work. But what’s happening here? What am I missing?

  • 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-17T16:08:12+00:00Added an answer on June 17, 2026 at 4:08 pm

    Java infers the type of T based on what you assign the return value of the method to.

    If you don’t assign the return value to anything, Java has no idea what T should be.

    To fix this, you can change the parameter to be of type T so Java can infer T from the parameter you pass:

    public <T extends TBGObject> T doGet(T model) throws TBGServiceException {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone please suggest why this is happening... I’ve got some code to pretty
this problem has been bothering me for days and I cannot figure out why
Since some people got me wrong: this is not about saving. The problem is
So for some time now I keep having this problem: on windows 7 (64bit),
This may be a bad question, but I've noticed that as I'm writing coding
Could someone please tell me why this <%= destroy_password_url @user.password_reset_token %> generates http://localhost:3000/api/destroy_password.4G5EoRVYMUAtiIKqOerKsw routes.rb
Could this be done with javascript/jQuery : <div class=number>99,123,123</div> <div class=number>123,123,123</div> <div class=number>1,123,123,123</div> <div
could somebody please take a look at this http://jsfiddle.net/bloodygeese/EzkFR/1/ My aim is to on
I started to write python programs for some time, but I am not so
UPDATE: In trying to replicate this problem one more time to answer your questions

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.