| author | szarnekow | 2009-03-10 12:37:09 (EDT) |
|---|---|---|
| committer | sefftinge | 2009-03-10 12:37:09 (EDT) |
| commit | a1afd2062f461acfc7edc55627874d3f25477d3e (patch) (side-by-side diff) | |
| tree | 373e4b50e7d8f8a77453a359ec9ce098bb463a07 | |
| parent | 4ff6ac653cea74447062cdddf7002a97be0821f7 (diff) | |
| download | org.eclipse.xtext-a1afd2062f461acfc7edc55627874d3f25477d3e.zip org.eclipse.xtext-a1afd2062f461acfc7edc55627874d3f25477d3e.tar.gz org.eclipse.xtext-a1afd2062f461acfc7edc55627874d3f25477d3e.tar.bz2 | |
Patch for guice: don't generate proxy classes with cglib in the package, that contains the original class
| -rw-r--r-- | plugins/com.google.guice/.classpath | 2 | ||||
| -rw-r--r-- | plugins/com.google.guice/META-INF/MANIFEST.MF | 4 | ||||
| -rw-r--r-- | plugins/com.google.guice/build.properties | 4 | ||||
| -rw-r--r-- | plugins/com.google.guice/guice-1.0_patched.jar (renamed from plugins/com.google.guice/guice-1.0.jar) | bin | 556135 -> 563657 bytes | |||
| -rw-r--r-- | plugins/com.google.guice/patches/com/google/inject/util/GuiceNamingPolicy.java | 59 |
5 files changed, 64 insertions, 5 deletions
diff --git a/plugins/com.google.guice/.classpath b/plugins/com.google.guice/.classpath index a772a32..7ce9530 100644 --- a/plugins/com.google.guice/.classpath +++ b/plugins/com.google.guice/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry exported="true" kind="lib" path="guice-1.0.jar" sourcepath="src"/> + <classpathentry exported="true" kind="lib" path="guice-1.0_patched.jar" sourcepath="src"/> <classpathentry exported="true" kind="lib" path="aopalliance.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> diff --git a/plugins/com.google.guice/META-INF/MANIFEST.MF b/plugins/com.google.guice/META-INF/MANIFEST.MF index 96f12d2..b0ee179 100644 --- a/plugins/com.google.guice/META-INF/MANIFEST.MF +++ b/plugins/com.google.guice/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Guice Plug-in Bundle-SymbolicName: com.google.guice -Bundle-Version: 1.0.0 +Bundle-Version: 1.0.1 Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ClassPath: aopalliance.jar, - guice-1.0.jar + guice-1.0_patched.jar Export-Package: com.google.inject, com.google.inject.asm, com.google.inject.asm.signature, diff --git a/plugins/com.google.guice/build.properties b/plugins/com.google.guice/build.properties index 4297b49..007bc68 100644 --- a/plugins/com.google.guice/build.properties +++ b/plugins/com.google.guice/build.properties @@ -1,6 +1,6 @@ output.. = bin/ bin.includes = META-INF/,\ aopalliance.jar,\ - guice-1.0.jar -jars.compile.order = guice-1.0.jar,\ + guice-1.0_patched.jar +jars.compile.order = guice-1.0_patched.jar,\ . diff --git a/plugins/com.google.guice/guice-1.0.jar b/plugins/com.google.guice/guice-1.0_patched.jar Binary files differindex d78cd33..85998bb 100644 --- a/plugins/com.google.guice/guice-1.0.jar +++ b/plugins/com.google.guice/guice-1.0_patched.jar diff --git a/plugins/com.google.guice/patches/com/google/inject/util/GuiceNamingPolicy.java b/plugins/com.google.guice/patches/com/google/inject/util/GuiceNamingPolicy.java new file mode 100644 index 0000000..cce3c9e --- a/dev/null +++ b/plugins/com.google.guice/patches/com/google/inject/util/GuiceNamingPolicy.java @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2006 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.inject.util; + +import com.google.inject.cglib.core.NamingPolicy; +import com.google.inject.cglib.core.Predicate; + +/** + * Cglib class naming policy for Guice. + * + * @author crazybob@google.com (Bob Lee) + */ +public class GuiceNamingPolicy implements NamingPolicy { + + public String getClassName(String prefix, String source, Object key, + Predicate names) { + StringBuffer sb = new StringBuffer(); + sb.append( + (prefix != null) ? + ( +// SZ: see http://code.google.com/p/google-guice/issues/detail?id=149 and +// http://markmail.org/message/c32gbo3dynbalqsa#query:guice%20disable%20cglib+page:1+mid:c32gbo3dynbalqsa+state:results +// guice uses cglib which does not play well with signing +// that's why we may not create classes in packages that already exist +// we simply prefix everything with a $ as it is done for already for java packages +// prefix.startsWith("java") ? + "$" + prefix +// : prefix + ) + : "net.sf.cglib.empty.Object" + ); + sb.append("$$"); + sb.append(source.substring(source.lastIndexOf('.') + 1)); + sb.append("ByGuice$$"); + sb.append(Integer.toHexString(key.hashCode())); + String base = sb.toString(); + String attempt = base; + int index = 2; + while (names.evaluate(attempt)) { + attempt = base + "_" + index++; + } + + return attempt; + } +} |

