You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2007/08/29 22:41:05 UTC
svn commit: r570927 - in /beehive/trunk/netui:
src/compiler-core/org/apache/beehive/netui/compiler/
test/src/compilerTests/org/apache/beehive/netui/test/compiler/
Author: crogers
Date: Wed Aug 29 13:41:04 2007
New Revision: 570927
URL: http://svn.apache.org/viewvc?rev=570927&view=rev
Log:
Added option for configuring NetUI compiler to run/skip the check for more than one Controller class within the Controller's package (BEEHIVE-1204). Also updated the compiler test to explicitly run the check for another Controller class.
Tests: NetUI BVT (WinXP passed)
CR: cschoett
Modified:
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java?rev=570927&r1=570926&r2=570927&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/CompilerUtils.java Wed Aug 29 13:41:04 2007
@@ -1319,6 +1319,27 @@
return phase != null && phase.length > 0 ? phase[0] : null;
}
+ /**
+ * Utility method to see if the AP should perform the check for an
+ * overlapping Controller (another Controller in the same package).
+ *
+ * @param env the annotation processing environment
+ * @return <code>true</code> if the AP should perform the check
+ * for an overlapping Controller.
+ * @throws FatalCompileTimeException if an error occurs getting
+ * the value of the option
+ */
+ public static boolean isCheckForOverlappingController(CoreAnnotationProcessorEnv env)
+ throws FatalCompileTimeException {
+ // check for command line option
+ String[] option = getOption("-A" + JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_OVERLAPPING_CONTROLLER, false, env);
+ if (option != null && option.length > 0 && "true".equals(option[0])) {
+ return true;
+ }
+
+ return false;
+ }
+
private static String[] getOption( String optionName, boolean required, CoreAnnotationProcessorEnv env )
throws MissingOptionException
{
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java?rev=570927&r1=570926&r2=570927&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/FlowControllerChecker.java Wed Aug 29 13:41:04 2007
@@ -678,9 +678,15 @@
protected void checkForOverlappingClasses( ClassDeclaration jpfClass, String baseClass, String fileExtension,
String errorKey )
{
+ // By default this method will not go through the expensive of the APT
+ // checking for another Controller in the same package unless option
+ // (JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_OVERLAPPING_CONTROLLER)
+ // is set to true. (BEEHIVE-1204)
+ boolean doCheck = false;
boolean isReconcilePhase = false;
try {
- String phase = (String) CompilerUtils.isReconcilePhase(getEnv());
+ doCheck = CompilerUtils.isCheckForOverlappingController(getEnv());
+ String phase = CompilerUtils.isReconcilePhase(getEnv());
isReconcilePhase = "RECONCILE".equals(phase);
}
catch (FatalCompileTimeException e) {
@@ -694,7 +700,7 @@
// reconcile phase.
// Custom AP environments that wish to control this should set the
// "phase" option for the annotation processor to "RECONCILE".
- if (isReconcilePhase) {
+ if (!doCheck || isReconcilePhase) {
return;
}
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java?rev=570927&r1=570926&r2=570927&view=diff
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/JpfLanguageConstants.java Wed Aug 29 13:41:04 2007
@@ -27,6 +27,7 @@
public static final String ANNOTATIONS_CLASSNAME = PAGEFLOW_PACKAGE + ".annotations.Jpf";
public static final String ANNOTATION_PROCESSOR_OPTION_PHASE = "phase";
+ public static final String ANNOTATION_PROCESSOR_OPTION_OVERLAPPING_CONTROLLER = "checkForOverlappingController";
public static final String ACTION_TAG_NAME = "Action";
public static final String SIMPLE_ACTION_TAG_NAME = "SimpleAction";
Modified: beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java?rev=570927&r1=570926&r2=570927&view=diff
==============================================================================
--- beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java (original)
+++ beehive/trunk/netui/test/src/compilerTests/org/apache/beehive/netui/test/compiler/RunApt.java Wed Aug 29 13:41:04 2007
@@ -133,6 +133,9 @@
aptArgs.add("-sourcepath");
aptArgs.add(tempDir.getAbsolutePath());
+ // Option for the overlapping controller test.
+ aptArgs.add("-AcheckForOverlappingController=true");
+
aptArgs.add("-Aweb.content.root=" + webappRoot);
// Find all the source files by the specified extentions