You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/05/27 00:43:32 UTC

svn commit: r178700 - /incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java

Author: rich
Date: Thu May 26 15:43:31 2005
New Revision: 178700

URL: http://svn.apache.org/viewcvs?rev=178700&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-754 : Invalid error for missing returnAction in a derived page flow

tests: bvt in netui (WinXP)
BB: self (linux)


Modified:
    incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java

Modified: incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java?rev=178700&r1=178699&r2=178700&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java (original)
+++ incubator/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java Thu May 26 15:43:31 2005
@@ -33,6 +33,7 @@
 import org.apache.beehive.netui.compiler.typesystem.env.AnnotationProcessorEnvironment;
 import org.apache.beehive.netui.compiler.typesystem.type.ClassType;
 import org.apache.beehive.netui.compiler.typesystem.type.TypeInstance;
+import org.apache.beehive.netui.compiler.processor.SilentDiagnostics;
 import org.apache.xmlbeans.XmlException;
 
 import java.io.File;
@@ -55,6 +56,8 @@
     private AnnotationGrammar _controllerGrammar;
     private AnnotationGrammar _actionGrammar;
     private AnnotationGrammar _exceptionHandlerGrammar;
+    private AnnotationGrammar _actionGrammarSilentDiagnostics;
+    private AnnotationGrammar _exceptionHandlerGrammarSilentDiagnostics;
     private FormBeanChecker _formBeanChecker;
     private Map _checkResultMap;
     
@@ -85,9 +88,14 @@
         _controllerGrammar = getControllerGrammar();
         _actionGrammar = new ActionGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), fcInfo );
         _exceptionHandlerGrammar =
-        new ExceptionHandlerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), fcInfo );
+                new ExceptionHandlerGrammar( getEnv(), getDiagnostics(), getRuntimeVersionChecker(), fcInfo );
         _formBeanChecker = new FormBeanChecker( getEnv(), getDiagnostics() );
         
+        SilentDiagnostics silentDiagnostics = new SilentDiagnostics();
+        _actionGrammarSilentDiagnostics = new ActionGrammar( getEnv(), silentDiagnostics, getRuntimeVersionChecker(), fcInfo );
+        _exceptionHandlerGrammarSilentDiagnostics =
+                new ExceptionHandlerGrammar( getEnv(), silentDiagnostics, getRuntimeVersionChecker(), fcInfo );
+        
         fcInfo.startBuild( getEnv(), jclass );
         
         try
@@ -141,11 +149,21 @@
             TypeDeclaration declaringType = method.getDeclaringType();
             
             //
-            // Only check the method if it's in this class, or if it's inherited from a class that's *not* on sourcepath
-            // (i.e., its SourcePosition is null).
+            // Only add diagnostics if the method is in this class, or if it's inherited from a class that's *not* on
+            // sourcepath (i.e., its SourcePosition is null).
             //
             if ( declaringType.equals( jclass ) || declaringType.getPosition() == null )
-            checkMethod( method, jclass );
+            {
+                checkMethod( method, jclass, _actionGrammar, _exceptionHandlerGrammar );
+            }
+            else
+            {
+                //
+                // We still want to run the checks, which aggregate information into the FlowControllerInfo.  We just
+                // don't want diagnostics to be printed.
+                //
+                checkMethod( method, jclass, _actionGrammarSilentDiagnostics, _exceptionHandlerGrammarSilentDiagnostics );
+            }
         }
 
         //
@@ -524,7 +542,8 @@
         }
     }
     
-    protected void checkMethod( MethodDeclaration method, ClassDeclaration jclass )
+    protected void checkMethod( MethodDeclaration method, ClassDeclaration jclass,
+                                AnnotationGrammar actionGrammar, AnnotationGrammar exceptionHandlerGrammar )
             throws FatalCompileTimeException
     {
         AnnotationInstance[] annotations = method.getAnnotationInstances();
@@ -536,7 +555,7 @@
             
             if ( annotationName.equals( ACTION_TAG_NAME ) )
             {
-                _actionGrammar.check( annotation, null, method );
+                actionGrammar.check( annotation, null, method );
                 
                 if ( ! CompilerUtils.isAssignableFrom( FORWARD_CLASS_NAME, method.getReturnType(), getEnv() ) )
                 {
@@ -545,7 +564,7 @@
             }
             else if ( annotationName.equals( EXCEPTION_HANDLER_TAG_NAME ) )
             {
-                _exceptionHandlerGrammar.check( annotation, null, method );
+                exceptionHandlerGrammar.check( annotation, null, method );
                 checkExceptionHandlerMethod( method );
             }
         }