Personally I like the "//X TODO" version (with or without the X). As with any comments, you need to make sure it is kept up to date if you make changes in the area. But it is visually very easy to track and eclipse even tags it.

Paul J. Reder

On 05/27/2010 01:12 PM, Mark Struberg wrote:
Hi Gurkan!

What do you think about differentiating between a // comment which is really 
meant as comment

// i like to describe something
doSomething()

and

//X doSomething()

which means this is simply temporarily disabled and should get removed

I usually even write

//X TODO doSomething() not needed anymore!?

or something. If you do this, then it's pretty easy to grep through the code 
and remove them finally. Otherwise we will end up having lot's of commented-out 
java code where no one knows if it's still important or not.

wdyt?


LieGrue,
strub


--- On Thu, 5/27/10, [email protected]<[email protected]>  wrote:

From: [email protected]<[email protected]>
Subject: svn commit: r948875 - in /openwebbeans/trunk/webbeans-impl/src: 
main/java/org/apache/webbeans/component/ 
test/java/org/apache/webbeans/newtests/interceptors/dependent/
To: [email protected]
Date: Thursday, May 27, 2010, 4:12 PM
Author: gerdogdu
Date: Thu May 27 16:12:18 2010
New Revision: 948875

URL: http://svn.apache.org/viewvc?rev=948875&view=rev
Log:
[OWB-387] DependentContext Interceptor Double Call for
PostConstruct

Added:

openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
   (with
props)

openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
   (with
props)

openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
   (with
props)

openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
   (with
props)
Modified:

openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java

Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=948875&r1=948874&r2=948875&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
Thu May 27 16:12:18 2010
@@ -139,7 +139,7 @@ public abstract class
AbstractInjectionT

    //Means that Dependent Bean has
interceptor/decorator

    if(JavassistProxyFactory.isProxyInstance(result))
              {
-
afterConstructor(instance, creationalContext);
+
//afterConstructor(instance, creationalContext);

    dependentProxy = result;

    isDependentProxy = true;
              }

Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java?rev=948875&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
Thu May 27 16:12:18 2010
@@ -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.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Named;
+
+...@named("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean")
+public class DependentLifecycleBean extends
DependentSuperBean
+{
+    public static int value = 0;
+
+    @PostConstruct
+    public void postConstruct()
+    {
+        value++;
+    }
+
+    @PreDestroy
+    public void preDestroy()
+    {
+        value --;
+    }
+}

Propchange:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleBean.java
------------------------------------------------------------------------------
     svn:eol-style = native

Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java?rev=948875&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.newtests.interceptors.dependent;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.junit.Test;
+
+public class DependentLifecycleTest extends
AbstractUnitTest
+{
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testLifecycle()
+    {
+        Collection<URL>  beanXmls
= new ArrayList<URL>();
+
+
Collection<Class<?>>  beanClasses = new
ArrayList<Class<?>>();
+
beanClasses.add(DependentLifecycleBean.class);
+
+        startContainer(beanClasses,
beanXmls);
+
+        Set<Bean<?>>  beans
=
getBeanManager().getBeans("org.apache.webbeans.newtests.interceptors.dependent.DependentLifecycleBean");
+
Assert.assertNotNull(beans);
+
Bean<DependentLifecycleBean>  bean =
(Bean<DependentLifecycleBean>)beans.iterator().next();
+
+
CreationalContext<DependentLifecycleBean>  ctx =
getBeanManager().createCreationalContext(bean);
+
+        Object reference =
getBeanManager().getReference(bean,
DependentLifecycleBean.class, ctx);
+
Assert.assertNotNull(reference);
+
+        Assert.assertTrue(reference
instanceof DependentLifecycleBean);
+
+        Assert.assertEquals(1,
DependentLifecycleBean.value);
+
Assert.assertTrue(DependentSuperBean.SC);
+
Assert.assertTrue(MyExtraSuper.SC);
+

+        ctx.release();
+
+        shutDownContainer();
+
+        Assert.assertEquals(0,
DependentLifecycleBean.value);
+
Assert.assertFalse(DependentSuperBean.SC);
+
Assert.assertFalse(MyExtraSuper.SC);
+
+    }
+}

Propchange:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentLifecycleTest.java
------------------------------------------------------------------------------
     svn:eol-style = native

Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java?rev=948875&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class DependentSuperBean extends MyExtraSuper
+{
+    public static boolean SC = false;
+
+    @PostConstruct
+    public void myPostConstruct()
+    {
+        SC = true;
+    }
+
+    @PreDestroy
+    public void myPreDestroy()
+    {
+        SC = false;
+    }
+
+}

Propchange:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/DependentSuperBean.java
------------------------------------------------------------------------------
     svn:eol-style = native

Added:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java?rev=948875&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
Thu May 27 16:12:18 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.newtests.interceptors.dependent;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+public class MyExtraSuper
+{
+    public static boolean SC = false;
+
+    @PostConstruct
+    public void myEctraPostConstruct()
+    {
+        SC = true;
+    }
+
+    @PreDestroy
+    public void myEctraPreDestroy()
+    {
+        SC = false;
+    }
+
+}

Propchange:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/dependent/MyExtraSuper.java
------------------------------------------------------------------------------
     svn:eol-style = native








--
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein

Reply via email to