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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:24:17+00:00 2026-06-10T09:24:17+00:00

I have some Groovy code which works fine in the Groovy bytecode compiler, but

  • 0

I have some Groovy code which works fine in the Groovy bytecode compiler, but the Java stub generated by it causes an error in the Java compiler. I think this is probably yet another bug in the Groovy stub generator, but I really can’t figure out why the Java compiler doesn’t like the generated code.

Here’s a truncated version of the generated Java class (please excuse the ugly formatting):

@groovy.util.logging.Log4j() public abstract class AbstractProcessingQueue
<T>  extends nz.ac.auckland.digitizer.AbstractAgent  implements
    groovy.lang.GroovyObject {
        protected int retryFrequency;
        protected java.util.Queue<nz.ac.auckland.digitizer.AbstractProcessingQueue.ProcessingQueueMember<T>> items;
        public AbstractProcessingQueue
        (int processFrequency, int timeout, int retryFrequency) {
             super ((int)0, (int)0);
    }

    private enum ProcessState
      implements
    groovy.lang.GroovyObject {
        NEW, FAILED, FINISHED;
    }

    private class ProcessingQueueMember<E>  extends java.lang.Object  implements
    groovy.lang.GroovyObject {
        public ProcessingQueueMember
        (E object) {}
    }
}

The offending line in the generated code is this:

protected java.util.Queue<nz.ac.auckland.digitizer.AbstractProcessingQueue.ProcessingQueueMember<T>> items;

which produces the following compile error:

[ERROR] C:\Documents and Settings\Administrator\digitizer\target\generated-sources\groovy-stubs\main\nz\ac\auckland\digitizer\AbstractProcessingQueue.java:[14,96] error: improperly formed type, type arguments given on a raw type

The column index of 96 in the compile error points to the <T> parameterization of the ProcessingQueueMember type. But ProcessingQueueMember is not a raw type as the compiler claims, it is a generic type:

private class ProcessingQueueMember
<E>  extends java.lang.Object  implements
groovy.lang.GroovyObject { ...

I am very confused as to why the compiler thinks that the type Queue<ProcessingQueueMember<T>> is invalid. The Groovy source compiles fine, and the generated Java code looks perfectly correct to me too. What am I missing here? Is it something to do with the fact that the type in question is a nested class?

(in case anyone is interested, I have filed this bug report relating to the issue in this question)

Edit: Turns out this was indeed a stub compiler bug- this issue is now fixed in 1.8.9, 2.0.4 and 2.1, so if you’re still having this issue just upgrade to one of those versions. 🙂

  • 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-10T09:24:18+00:00Added an answer on June 10, 2026 at 9:24 am

    Since the ProcessingQueueMember class is a non-static inner class of AbstractProcessingQueue, its body can refer to the T type parameter of AbstractProcessingQueue. Thus, a non-raw reference to the ProcessingQueueMember must supply both the type arguments. For example,

    protected java.util.Queue<AbstractProcessingQueue<T>.ProcessingQueueMember<T>> items;
    

    will compile. This code is probably excessively generic. I believe you actually want one of these two alternatives:

    1. Make ProcessingQueueMember<E> static (i.e. a nested class as opposed to an inner class)
    2. Remove the type parameter from ProcessingQueueMember

    I do not know anything about the groovy stub generator, but maybe there is some way to annotate your groovy code to express this?

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

Sidebar

Related Questions

I have some legacy Java code inside which I'd like to call a groovy
I have a situation where some of my groovy code references my java files,
I have to ship some groovy code to some users that have only java
I have the following Groovy code but it wont work: xml = new groovy.xml.MarkupBuilder()
We have rather large code base (150+ projects, 400000+ lines of Java code, some
I have a fairly complicated groovy script which performs some operations on an Oracle
I have some groovy code like this: def dest = destSql.dataSet('destination_table') sourceSql.eachRow('select * from
I have some code on two systems running kernel 2.4.20 and kernel 2.4.38 .
I have some code that will change the background color of a specific label
I have some code here that uses bitsets to store many 1 bit values

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.