Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Guava vs. Google Collections
Guava vs. Google Collections [message #652860] Mon, 07 February 2011 12:25 Go to next message
Franz-Stefan Mising name is currently offline Franz-Stefan Mising nameFriend
Messages: 12
Registered: December 2010
Junior Member
Hi, I want to use functionality (in particular, the method Sets.cartesianProduct(...)) from Google's Guava in my Xtext project.
When running my application with the latest Guava .jar file in my Build Path, I get a security exception:
---------------------------
java.lang.SecurityException: class "com.google.common.collect.ReferenceMap"'s signer information does not match signer information of other classes in the same package
---------------------------

To circumvent that problem, I removed the com.google.common plugin from my PDE Target Platform.
I expected this to work as Guava claims: "Guava contains a strictly compatible superset of the old, deprecated Google Collections Library. You should not use that library" [1].
However, this causes another problem:
--------------------------------
java.lang.ClassNotFoundException: com.google.common.collect.ReferenceMap
--------------------------------
Some web search reveals that the ReferenceMap was apparently kicked out of Google Collections at some point [2], thus, it's also not part of Guava.

So, does anybody have a hint on how I can get Guava into my Xtext project?
Is there maybe a version of Xtext that is already dependent on Guava rather than the outdated Google Collections?

[1] http://code.google.com/p/guava-libraries/
[2] http://stackoverflow.com/questions/2045618/mapmaker-and-refe rencemap-google-collections

Thank you.

[Updated on: Mon, 07 February 2011 12:29]

Report message to a moderator

Re: Guava vs. Google Collections [message #653838 is a reply to message #652860] Fri, 11 February 2011 13:18 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
We haven't migrated ti Guava, since it is not available in a >= 1.x
version. We use require bundle dependencies so you would have to
replace the com.google.collect bundle shipped with Xtext with a bundle
containing the guava sources (but with a bundle name com.google.collect).

Sven

Am 2/7/11 1:25 PM, schrieb Franz-Stefan:
> Hi, I want to use functionality (in particular, the method
> Sets.cartesianProduct(...)) from Google's Guava in my Xtext project.
> When running my application with the latest Guava .jar file in my Build
> Path, I get a security exception:
> ---------------------------
> java.lang.SecurityException: class
> "com.google.common.collect.ReferenceMap"'s signer information does not
> match signer information of other classes in the same package
> ---------------------------
>
> To circumvent that problem, I removed the com.google.common plugin from
> my PDE Target Platform.
> I expected this to work as Guava claims: "Guava contains a strictly
> compatible superset of the old, deprecated Google Collections Library.
> You should not use that library" [1].
> However, this causes another problem:
> --------------------------------
> java.lang.ClassNotFoundException: com.google.common.collect.ReferenceMap
> --------------------------------
> Some web search reveals that the ReferenceMap was apparently kicked out
> of Google Collections at some point [2], thus, it's also not part of Guava.
>
> So, does anybody have a hint on how I can get Guava into my Xtext project?
> Is there maybe a version of Xtext that is already dependent on Guava
> rather than the outdated Google Collections?
>
> [1] http://code.google.com/p/guava-libraries/
> [2]
> http://stackoverflow.com/questions/2045618/mapmaker-and-refe rencemap-google-collections
>
>
> Thank you.


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: Guava vs. Google Collections [message #654069 is a reply to message #653838] Sun, 13 February 2011 23:24 Go to previous messageGo to next message
Franz-Stefan Mising name is currently offline Franz-Stefan Mising nameFriend
Messages: 12
Registered: December 2010
Junior Member
Sven, I'm afraid wrapping Guava in a com.google.collect bundle would not solve the problem:
Xtext depends on some classes that are only contained in version 0.8.0 of com.google.collect, but not in higher versions.
Guava is a proper superset of com.google.collect version 1.0.0. Thus, Guava does not contain all classes that Xtext depends on.

In particular, two of the classes missing in version 1.0.0 (and thus in Guava) are:
> com.google.common.base.ReferenceType
> com.google.common.collect.ReferenceMap
Exactly these classes are used, e.g., in EcoreUtil2 though (see the last two 'import' statements).

So, the only solution to permanently allow Xtext to be used together with Guava seems to be the removal of the dependencies on those classes, i.e., to substitute the dependency on version 0.8.0 by 1.0.0 or even by Guava itself.

Regards, Franz-Stefan.
Re: Guava vs. Google Collections [message #654119 is a reply to message #654069] Mon, 14 February 2011 09:12 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Franz-Stefan,

you could try to extract the parts of your code that depends on guava
into an own bundle. It should be possible to define appropriate bundle
dependencies with OSGi.
Please note that Xtext 2.0 depends on google.collect 1.0.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 14.02.11 00:24, schrieb Franz-Stefan:
> Sven, I'm afraid wrapping Guava in a com.google.collect bundle would not
> solve the problem:
> Xtext depends on some classes that are only contained in version 0.8.0
> of com.google.collect, but not in higher versions.
> Guava is a proper superset of com.google.collect version 1.0.0. Thus,
> Guava does not contain all classes that Xtext depends on.
>
> In particular, two of the classes missing in version 1.0.0 (and thus in
> Guava) are:
>> com.google.common.base.ReferenceType
>> com.google.common.collect.ReferenceMap
> Exactly these classes are used, e.g., in
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tmf/org .eclipse.xtext/plugins/org.eclipse.xtext/src/org/eclipse/xte xt/EcoreUtil2.java?root=Modeling_Project&view=co
> though (see the last two 'import' statements).
>
> So, the only solution to permanently allow Xtext to be used together
> with Guava seems to be the removal of the dependencies on those classes,
> i.e., to substitute the dependency on version 0.8.0 by 1.0.0 or even by
> Guava itself.
>
> Regards, Franz-Stefan.
Previous Topic:Help with converting LALR to LL
Next Topic:building xtext documentation
Goto Forum:
  


Current Time: Wed Apr 24 22:35:00 GMT 2024

Powered by FUDForum. Page generated in 0.02878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top