openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1307489 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation: AnyLiteral.java DefaultLiteral.java
Date Fri, 30 Mar 2012 15:50:29 GMT
Author: struberg
Date: Fri Mar 30 15:50:28 2012
New Revision: 1307489

URL: http://svn.apache.org/viewvc?rev=1307489&view=rev
Log:
OWB-661 overwrite slow AnnotationLiteral methods

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java?rev=1307489&r1=1307488&r2=1307489&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnyLiteral.java
Fri Mar 30 15:50:28 2012
@@ -23,4 +23,30 @@ import javax.enterprise.util.AnnotationL
 
 public class AnyLiteral extends AnnotationLiteral<Any> implements Any
 {
+    @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
+        return "@javax.enterprise.inject.Any()";
+    }
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java?rev=1307489&r1=1307488&r2=1307489&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DefaultLiteral.java
Fri Mar 30 15:50:28 2012
@@ -24,10 +24,33 @@ import javax.enterprise.util.AnnotationL
 /**
  * {@link Default} literal annotation.
  * 
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
 public class DefaultLiteral extends AnnotationLiteral<Default> implements Default
 {
+    @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
+        return "@javax.enterprise.inject.Default()";
+    }
 }



Mime
View raw message