• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Generics and jar files

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a parameterised class in one jar file which is invoked by classes outside that jar file.
When I make calls to this class and treat like it is parameterised, it won't compile. The client does not recognise the parameterisation of the classes it invokes.

Calls to the parameterised class within the same jar file are fine but from outside the jar file don't work.

Any ideas?
 
Saloon Keeper
Posts: 15524
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Care to post your error messages?
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The obvious thing that springs to mind is that there might be another version of the class (possibly non-generic) somewhere on the classpath that's being used instead.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the client project configured to use the same Java version?
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:Is the client project configured to use the same Java version?



This must be some annoying / config issue.

But let me just clarify the concepts... generification happes pre compile so there is no change in the byte code.
Therefore, the jar file with the generifed classes is the exact same as the jar with no generified classes? Correct?

So when the client uses the generified jar file, how does it know it is permissable to use parameterised references to generified classes in the jar file?
If it can't get information about generification from byte code where does it get it from?

Error from my IDE is:

The type Rel is not generic; it cannot be parameterized with arguments <blah>


Rel is a class which I have generified.

java compiler level is 1.5

 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Luke Murphy wrote:

Rob Prime wrote:Is the client project configured to use the same Java version?



This must be some annoying / config issue.

But let me just clarify the concepts... generification happes pre compile so there is no change in the byte code.
Therefore, the jar file with the generifed classes is the exact same as the jar with no generified classes? Correct?

So when the client uses the generified jar file, how does it know it is permissable to use parameterised references to generified classes in the jar file?
If it can't get information about generification from byte code where does it get it from?

Error from my IDE is:

The type Rel is not generic; it cannot be parameterized with arguments <blah>


Rel is a class which I have generified.

java compiler level is 1.5



I found the problem. My jar was obfuscated.
Thanks to all for the help here.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic