File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics and jar files

 
Luke Murphy
Ranch Hand
Posts: 300
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Stephan van Hulst
Bartender
Pie
Posts: 4826
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Care to post your error messages?
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the client project configured to use the same Java version?
 
Luke Murphy
Ranch Hand
Posts: 300
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic