Skip to content

Commit

Permalink
remove google collections dependency
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1796 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Mar 6, 2009
1 parent cde9456 commit 2730d3d
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 199 deletions.
5 changes: 0 additions & 5 deletions impl/pom.xml
Expand Up @@ -105,11 +105,6 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</dependency>

</dependencies>

<build>
Expand Down
Expand Up @@ -29,8 +29,8 @@
import javax.inject.manager.Bean;

import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.util.ConcurrentCache;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.collections.ConcurrentCache;

/**
* A proxy pool for holding scope adaptors (client proxies)
Expand Down
Expand Up @@ -22,6 +22,7 @@
import javax.context.ContextNotActiveException;
import javax.context.Contextual;
import javax.context.CreationalContext;
import javax.inject.manager.Bean;

import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.log.LogProvider;
Expand Down
Expand Up @@ -26,7 +26,7 @@

import javax.context.Context;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

/**
* A map from a scope to a list of contexts
Expand Down
Expand Up @@ -30,8 +30,7 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

/**
* The event bus is where observers are registered and events are fired.
Expand Down
Expand Up @@ -35,8 +35,8 @@
import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
import org.jboss.webbeans.metadata.BindingTypeModel;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.ConcurrentCache;
import org.jboss.webbeans.util.ListComparator;
import org.jboss.webbeans.util.collections.ConcurrentCache;

/**
* Implementation of Web Beans type safe and name based bean resolution
Expand Down
Expand Up @@ -8,7 +8,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ConcurrentCache;
import org.jboss.webbeans.util.collections.ConcurrentCache;

public class ServletInjector
{
Expand Down
Expand Up @@ -19,6 +19,8 @@

import java.lang.reflect.Field;

import javax.inject.manager.Manager;

/**
* AnnotatedField provides a uniform access to the annotations on an annotated
* field
Expand Down
Expand Up @@ -15,8 +15,7 @@

import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.util.Strings;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

public class AnnotationStore
{
Expand Down
Expand Up @@ -34,8 +34,7 @@
import org.jboss.webbeans.introspector.ForwardingAnnotatedMember;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

/**
* Represents an abstract annotated memeber (field, method or constructor)
Expand Down
Expand Up @@ -30,8 +30,7 @@
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.util.Strings;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

/**
* Represents an annotated annotation
Expand Down
Expand Up @@ -39,8 +39,7 @@
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;

import com.google.common.collect.ForwardingMap;
import org.jboss.webbeans.util.collections.ForwardingMap;

/**
* Represents an annotated class
Expand Down
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Set;

import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedConstructor;
import org.jboss.webbeans.introspector.AnnotatedParameter;
import org.jboss.webbeans.introspector.AnnotatedType;
Expand Down
Expand Up @@ -20,7 +20,7 @@
import java.lang.annotation.Annotation;
import java.util.concurrent.Callable;

import org.jboss.webbeans.util.ConcurrentCache;
import org.jboss.webbeans.util.collections.ConcurrentCache;

/**
* Metadata singleton for holding EJB metadata, scope models etc.
Expand Down
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.jboss.webbeans.util;
package org.jboss.webbeans.util.collections;

import java.util.Map;
import java.util.concurrent.Callable;
Expand All @@ -24,7 +24,6 @@
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;

import com.google.common.collect.ForwardingMap;

/**
* Represents a thread safe map
Expand Down
@@ -0,0 +1 @@
/* * Copyright (C) 2007 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 org.jboss.webbeans.util.collections;import java.util.Collection;import java.util.Iterator;/** * A collection which forwards all its method calls to another collection. * Subclasses should override one or more methods to modify the behavior of the * backing collection as desired per the <a * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. * * @see ForwardingObject * @author Kevin Bourrillion * @author Pete Muir */public abstract class ForwardingCollection<E> extends ForwardingObject implements Collection<E>{ @Override protected abstract Collection<E> delegate(); public Iterator<E> iterator() { return delegate().iterator(); } public int size() { return delegate().size(); } /** * {@inheritDoc} * * <p> * This method always throws a {@link NullPointerException} when {@code * collection} is null. */ public boolean removeAll(Collection<?> collection) { return delegate().removeAll(checkNotNull(collection)); } public boolean isEmpty() { return delegate().isEmpty(); } public boolean contains(Object object) { return delegate().contains(object); } public Object[] toArray() { return delegate().toArray(); } public <T> T[] toArray(T[] array) { return delegate().toArray(array); } public boolean add(E element) { return delegate().add(element); } public boolean remove(Object object) { return delegate().remove(object); } public boolean containsAll(Collection<?> collection) { return delegate().containsAll(collection); } public boolean addAll(Collection<? extends E> collection) { return delegate().addAll(collection); } /** * {@inheritDoc} * * <p> * This method always throws a {@link NullPointerException} when {@code * collection} is null. */ public boolean retainAll(Collection<?> collection) { return delegate().retainAll(checkNotNull(collection)); } public void clear() { delegate().clear(); } /** * Ensures that an object reference passed as a parameter to the calling * method is not null. * * @param reference * an object reference * @return the non-null reference that was validated * @throws NullPointerException * if {@code reference} is null */ public static <T> T checkNotNull(T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } }
Expand Down
@@ -0,0 +1 @@
/* * Copyright (C) 2007 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 org.jboss.webbeans.util.collections;import java.util.Collection;import java.util.Map;import java.util.Set;/** * A map which forwards all its method calls to another map. Subclasses should * override one or more methods to modify the behavior of the backing map as * desired per the <a * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. * * @see ForwardingObject * @author Kevin Bourrillion * @author Jared Levy */public abstract class ForwardingMap<K, V> extends ForwardingObject implements Map<K, V>{ @Override protected abstract Map<K, V> delegate(); public int size() { return delegate().size(); } public boolean isEmpty() { return delegate().isEmpty(); } public V remove(Object object) { return delegate().remove(object); } public void clear() { delegate().clear(); } public boolean containsKey(Object key) { return delegate().containsKey(key); } public boolean containsValue(Object value) { return delegate().containsValue(value); } public V get(Object key) { return delegate().get(key); } public V put(K key, V value) { return delegate().put(key, value); } public void putAll(Map<? extends K, ? extends V> map) { delegate().putAll(map); } private transient Set<K> keySet; /** * {@inheritDoc} * * <p> * The returned set's {@code removeAll} and {@code retainAll} methods always * throw a {@link NullPointerException} when given a null collection. */ public Set<K> keySet() { return (keySet == null) ? keySet = createKeySet() : keySet; } /** * Generates a {@link Set} for use by {@link #keySet()}. * * <p> * ForwardingMap's implementation of keySet() calls this method to generate a * collection of values, and then reuses that Set for subsequent invocations. * By default, this Set is essentially the result of invoking keySet() on the * delegate. Override this method if you want to provide another * implementation. * * @return A set for use by keySet(). */ protected Set<K> createKeySet() { final Set<K> delegate = delegate().keySet(); return new ForwardingSet<K>() { @Override protected Set<K> delegate() { return delegate; } }; } private transient Collection<V> values; /** * {@inheritDoc} * * <p> * The returned collection's {@code removeAll} and {@code retainAll} methods * always throw a {@link NullPointerException} when given a null collection. */ public Collection<V> values() { return (values == null) ? values = createValues() : values; } /** * Generates a {@link Collection} for use by {@link #values()}. * * <p> * ForwardingMap's implementation of {@code values()} calls this method to * generate a collection of values, and then reuses that collection for * subsequent invocations. By default, this collection is essentially the * result of invoking values() on the delegate. Override this method if you * want to provide another implementation. * * @return A set for use by values(). */ protected Collection<V> createValues() { final Collection<V> delegate = delegate().values(); return new ForwardingCollection<V>() { @Override protected Collection<V> delegate() { return delegate; } }; } private transient Set<Entry<K, V>> entrySet; /** * {@inheritDoc} * * <p> * The returned set's {@code removeAll} and {@code retainAll} methods always * throw a {@link NullPointerException} when given a null collection. */ public Set<Entry<K, V>> entrySet() { return (entrySet == null) ? entrySet = createEntrySet() : entrySet; } /** * Generates a {@link Set} for use by {@link #entrySet()}. * * <p> * ForwardingMap's implementation of entrySet() calls this method to generate * a set of entries, and then reuses that set for subsequent invocations. By * default, this set is essentially the result of invoking entrySet() on the * delegate. Override this method if you want to provide another * implementation. * * @return A set for use by entrySet(). */ protected Set<Entry<K, V>> createEntrySet() { final Set<Entry<K, V>> delegate = delegate().entrySet(); return new ForwardingSet<Entry<K, V>>() { @Override protected Set<Entry<K, V>> delegate() { return delegate; } }; } @Override public boolean equals(Object object) { return object == this || delegate().equals(object); } @Override public int hashCode() { return delegate().hashCode(); }}
Expand Down
@@ -0,0 +1 @@
/* * Copyright (C) 2007 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 org.jboss.webbeans.util.collections;import java.io.Serializable;/** * An abstract base class for implementing the <a * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. * The {@link #delegate()} method must be overridden to return the instance * being decorated. * * This class does <i>not</i> forward the {@code hashCode} and {@code equals} * methods through to the backing object, but relies on {@code Object}'s * implementation. This is necessary to preserve the symmetry of {@code equals}. * Custom definitions of equality are usually based on an interface, such as * {@code Set} or {@code List}, so that the implementation of {@code equals} can * cast the object being tested for equality to the custom interface. {@code * ForwardingObject} implements no such custom interfaces directly; they are * implemented only in subclasses. Therefore, forwarding {@code equals} would * break symmetry, as the forwarding object might consider itself equal to the * object being tested, but the reverse could not be true. This behavior is * consistent with the JDK's collection wrappers, such as * {@link java.util.Collections#unmodifiableCollection}. Use an * interface-specific subclass of {@code ForwardingObject}, such as * {@link ForwardingList}, to preserve equality behavior, or override {@code * equals} directly. * * <p> * The {@code toString} method is forwarded to the delegate. Although this class * does not implement {@link Serializable}, a serializable subclass may be * created since this class has a parameter-less constructor. * * @author Mike Bostock */public abstract class ForwardingObject{ /** Sole constructor. */ protected ForwardingObject() { } /** * Returns the backing delegate instance that methods are forwarded to. * Abstract subclasses generally override the {@link ForwardingObject} method * with an abstract method that has a more specific return type, such as * {@link ForwardingSet#delegate}. Concrete subclasses override this method * to supply the instance being decorated. */ protected abstract Object delegate(); /** * Returns the string representation generated by the delegate's {@code * toString} method. */ @Override public String toString() { return delegate().toString(); } /* No equals or hashCode. See class comments for details. */}
Expand Down
@@ -0,0 +1 @@
/* * Copyright (C) 2007 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 org.jboss.webbeans.util.collections;import java.util.Set;/** * A set which forwards all its method calls to another set. Subclasses should * override one or more methods to modify the behavior of the backing set as * desired per the <a * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>. * * @see ForwardingObject * @author Kevin Bourrillion */public abstract class ForwardingSet<E> extends ForwardingCollection<E> implements Set<E>{ @Override protected abstract Set<E> delegate(); @Override public boolean equals(Object object) { return object == this || delegate().equals(object); } @Override public int hashCode() { return delegate().hashCode(); }}
Expand Down
36 changes: 30 additions & 6 deletions jboss-tck-runner/pom.xml
Expand Up @@ -27,11 +27,6 @@
<artifactId>webbeans-porting-package</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.test</groupId>
<artifactId>jboss-test</artifactId>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand All @@ -43,13 +38,42 @@
<artifactId>jsr299-tck-impl</artifactId>
</dependency>

<!-- <dependency>-->
<!-- <groupId>org.jboss.naming</groupId>-->
<!-- <artifactId>jnp-client</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<!-- -->
<!-- <dependency>-->
<!-- <groupId>org.jboss.aspects</groupId>-->
<!-- <artifactId>jboss-security-aspects</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<!-- -->
<!-- <dependency>-->
<!-- <groupId>org.jboss.aspects</groupId>-->
<!-- <artifactId>jboss-remoting-aspects</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<!-- -->
<!-- <dependency>-->
<!-- <groupId>oswego-concurrent</groupId>-->
<!-- <artifactId>concurrent</artifactId>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<!---->
<dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<type>pom</type>
<scope>runtime</scope>
</dependency>


</dependencies>

<build>
Expand Down

0 comments on commit 2730d3d

Please sign in to comment.