Author: rmannibucau
Date: Sat Jan 5 17:57:59 2013
New Revision: 1429340
URL: http://svn.apache.org/viewvc?rev=1429340&view=rev
Log:
OWB-751 backporting OWB-750
Added:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AbstractAnnotationLiteral.java
Modified:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
Added:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AbstractAnnotationLiteral.java
URL:
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AbstractAnnotationLiteral.java?rev=1429340&view=auto
==============================================================================
---
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AbstractAnnotationLiteral.java
(added)
+++
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AbstractAnnotationLiteral.java
Sat Jan 5 17:57:59 2013
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.webbeans.annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import java.lang.annotation.Annotation;
+
+public class AbstractAnnotationLiteral<T extends Annotation> extends
AnnotationLiteral<T>
+{
+ @Override
+ public int hashCode()
+ {
+ // implemented for performance reasons
+ // currently this is needed because AnnotationLiteral always returns 0
as hashCode
+ return 0;
+ }
+
+ @Override
+ public boolean equals(final Object other)
+ {
+ // implemented for performance reasons
+ return Annotation.class.isInstance(other) &&
+
Annotation.class.cast(other).annotationType().equals(annotationType());
+ }
+}
Modified:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
URL:
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java?rev=1429340&r1=1429339&r2=1429340&view=diff
==============================================================================
---
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
(original)
+++
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
Sat Jan 5 17:57:59 2013
@@ -19,33 +19,13 @@
package org.apache.webbeans.annotation;
import javax.enterprise.inject.Any;
-import javax.enterprise.util.AnnotationLiteral;
-public class AnyLiteral extends AnnotationLiteral<Any> implements Any
+public class AnyLiteral extends AbstractAnnotationLiteral<Any> implements Any
{
private static final String TOSTRING = "@javax.enterprise.inject.Any()";
private static final long serialVersionUID = -8922048102786275371L;
@Override
- public int hashCode()
- {
- // implemented for performance reasons
- // currently this is needed because AnnotationLiteral always returns 0
as hashCode
- return 0;
- }
-
- @Override
- public boolean equals(Object other)
- {
- // implemented for performance reasons
- if (other instanceof Any)
- {
- return true;
- }
- return false;
- }
-
- @Override
public String toString()
{
// implemented for performance reasons
Modified:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
URL:
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java?rev=1429340&r1=1429339&r2=1429340&view=diff
==============================================================================
---
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
(original)
+++
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
Sat Jan 5 17:57:59 2013
@@ -19,38 +19,18 @@
package org.apache.webbeans.annotation;
import javax.enterprise.inject.Default;
-import javax.enterprise.util.AnnotationLiteral;
/**
* {@link Default} literal annotation.
*
* @since 1.0
*/
-public class DefaultLiteral extends AnnotationLiteral<Default> implements
Default
+public class DefaultLiteral extends AbstractAnnotationLiteral<Default>
implements Default
{
private static final String TOSTRING =
"@javax.enterprise.inject.Default()";
private static final long serialVersionUID = 6788272256977634238L;
@Override
- public int hashCode()
- {
- // implemented for performance reasons
- // currently this is needed because AnnotationLiteral always returns 0
as hashCode
- return 0;
- }
-
- @Override
- public boolean equals(Object other)
- {
- // implemented for performance reasons
- if (other instanceof Default)
- {
- return true;
- }
- return false;
- }
-
- @Override
public String toString()
{
// implemented for performance reasons
Modified:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
URL:
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java?rev=1429340&r1=1429339&r2=1429340&view=diff
==============================================================================
---
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
(original)
+++
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/RequestedScopeLiteral.java
Sat Jan 5 17:57:59 2013
@@ -19,7 +19,6 @@
package org.apache.webbeans.annotation;
import javax.enterprise.context.RequestScoped;
-import javax.enterprise.util.AnnotationLiteral;
/**
* {@link RequestScoped} literal annotation.
@@ -27,7 +26,7 @@ import javax.enterprise.util.AnnotationL
* @author <a href="mailto:[email protected]">Gurkan Erdogdu</a>
* @since 1.0
*/
-public class RequestedScopeLiteral extends AnnotationLiteral<RequestScoped>
implements RequestScoped
+public class RequestedScopeLiteral extends
AbstractAnnotationLiteral<RequestScoped> implements RequestScoped
{
private static final long serialVersionUID = -7333612898060695008L;
Modified:
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
URL:
http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java?rev=1429340&r1=1429339&r2=1429340&view=diff
==============================================================================
---
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
(original)
+++
openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/annotation/SessionScopeLiteral.java
Sat Jan 5 17:57:59 2013
@@ -19,7 +19,6 @@
package org.apache.webbeans.annotation;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.util.AnnotationLiteral;
/**
* {@link javax.enterprise.context.RequestScoped} literal annotation.
@@ -27,7 +26,7 @@ import javax.enterprise.util.AnnotationL
* @author <a href="mailto:[email protected]">Gurkan Erdogdu</a>
* @since 1.0
*/
-public class SessionScopeLiteral extends AnnotationLiteral<SessionScoped>
implements SessionScoped
+public class SessionScopeLiteral extends
AbstractAnnotationLiteral<SessionScoped> implements SessionScoped
{
private static final long serialVersionUID = -7469945140661485990L;