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/03/23 16:26:58 UTC
svn commit: r521762 - in
/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler:
CompilerUtils.java FlowControllerChecker.java
processor/TwoPhaseCoreAnnotationProcessor.java
Author: crogers
Date: Fri Mar 23 08:26:57 2007
New Revision: 521762
URL: http://svn.apache.org/viewvc?view=rev&rev=521762
Log:
Fixed an AP processor utility routine to get an option for detecting the reconcile processing phase and updated a check() routine to only run during a build phase to avoid a perf hit in a call to PackageDeclaration.getClasses() - BEEHIVE-1176.
Tests: NetUI BVT (WinXP passed)
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/processor/TwoPhaseCoreAnnotationProcessor.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?view=diff&rev=521762&r1=521761&r2=521762
==============================================================================
--- 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 Fri Mar 23 08:26:57 2007
@@ -1307,7 +1307,15 @@
*/
public static String isReconcilePhase(CoreAnnotationProcessorEnv env)
throws FatalCompileTimeException {
- String[] phase = getOption("-A" + JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_PHASE, false, env);
+ // In Eclipse the option key is "phase" in the option map
+ // and does not include a '-A'.
+ String[] phase = getOption(JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_PHASE, false, env);
+
+ if (phase == null || phase.length == 0) {
+ // check for command line option
+ phase = getOption("-A" + JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_PHASE, false, env);
+ }
+
return phase != null && phase.length > 0 ? phase[0] : null;
}
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?view=diff&rev=521762&r1=521761&r2=521762
==============================================================================
--- 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 Fri Mar 23 08:26:57 2007
@@ -678,17 +678,35 @@
protected void checkForOverlappingClasses( ClassDeclaration jpfClass, String baseClass, String fileExtension,
String errorKey )
{
+ boolean isReconcilePhase = false;
+ try {
+ String phase = (String) CompilerUtils.isReconcilePhase(getEnv());
+ isReconcilePhase = "RECONCILE".equals(phase);
+ }
+ catch (FatalCompileTimeException e) {
+ e.printDiagnostic(getDiagnostics());
+ }
+
+ // In the Eclipse IDE's integration between JDT and APT, annotation
+ // processors run in two phases -- reconcile and build. To optimize
+ // for hosting in this environment (and other IDE-centric AP
+ // environments) this check can be skipped when processing for the
+ // reconcile phase.
+ // Custom AP environments that wish to control this should set the
+ // "phase" option for the annotation processor to "RECONCILE".
+ if (isReconcilePhase) {
+ return;
+ }
+
File jpfFile = CompilerUtils.getSourceFile( jpfClass, true );
File parentDir = jpfFile.getParentFile();
PackageDeclaration pkg = jpfClass.getPackage();
ClassDeclaration[] packageClasses = pkg.getClasses();
Set overlapping = new HashSet();
List overlappingFiles = new ArrayList();
-
- //
+
// First go through the other classes in this package to look for other classes of this type. Only one per
// directory is allowed.
- //
for ( int i = 0; i < packageClasses.length; i++ )
{
ClassDeclaration classDecl = packageClasses[i];
@@ -708,7 +726,7 @@
}
}
}
-
+
//
// Additionally, we'll go through the parent directory to make sure there are no other files of this type.
// This is a double-check for the case where duplicate files have the same class names inside them, which means
Modified: beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java?view=diff&rev=521762&r1=521761&r2=521762
==============================================================================
--- beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java (original)
+++ beehive/trunk/netui/src/compiler-core/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java Fri Mar 23 08:26:57 2007
@@ -97,8 +97,8 @@
// check and generate phases for a TwoPhaseAnnotationProcessor. In order to
// optimize for hosting in this environment (and other IDE-centric AP environments)
// the generate phase can be cut out when performing only the check phase.
- // Custom AP environments that wish to control this shoudl set the "phase" flag of the
- // annotation processor to "RECONCILE".
+ // Custom AP environments that wish to control this should set the
+ // "phase" option for the annotation processor to "RECONCILE".
try {
String phase = (String)CompilerUtils.isReconcilePhase(getAnnotationProcessorEnvironment());
isReconcilePhase = "RECONCILE".equals(phase);