Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 55694 Details for
Bug 160773
[jsr269] Need interfaces between jdt compiler and jsr269 impl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch_160773.txt (text/plain), 24.51 KB, created by
Olivier Thomann
on 2006-12-14 13:31:00 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2006-12-14 13:31:00 EST
Size:
24.51 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.93 >diff -u -r1.93 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 12 Dec 2006 15:52:24 -0000 1.93 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 14 Dec 2006 18:28:19 -0000 >@@ -940,12 +940,26 @@ > " -g:none no debug info\n" + > " -preserveAllLocals preserve unused local vars for debug purpose\n" + > " \n" + >- " Ignored options:\n" + >- " -J<option> pass option to virtual machine (ignored)\n" + >- " -X<option> specify non-standard option (ignored\n" + >- " except for -Xemacs)\n" + >- " -X print non-standard options and exit (ignored)\n" + >- " -O optimize for execution time (ignored)\n" + >+ " Annotation processing options:\n" + >+ " These options are meaningful only in a 1.6 environment.\n" + >+ " -Akey[=value] annotation processors options that are made to\n" + >+ " annotation processors. key are identifiers separated\n" + >+ " by ..\n" + >+ " -processorpath <directories and zip/jar files separated by ;>\n" + >+ " specify locations where to find annotation processors\n" + >+ " If this option is not used, the classpath will be\n" + >+ " searched for processors.\n" + >+ " -processor <class1[,class2,...]>\n" + >+ " Qualified names of the annotation processors to run.\n" + >+ " This bypasses the default annotation discovery process\n" + >+ " -proc:only run annotation processors, but do not compile\n" + >+ " -proc:none perform compilation but do not run annotation\n" + >+ " processors\n" + >+ " -s <dir> specify a directory where to put the generated source\n" + >+ " files\n" + >+ " -XprintProcessorInfo print information about which annotations and which\n" + >+ " elements a processor is asked to process\n" + >+ " -XprintRounds print information about annotation processing rounds.\n" + > " \n" + > " Advanced options:\n" + > " @<file> read command line arguments from file\n" + >@@ -970,6 +984,13 @@ > " -? -help print this help message\n" + > " -v -version print compiler version\n" + > " -showversion print compiler version and continue\n" + >+ " \n" + >+ " Ignored options:\n" + >+ " -J<option> pass option to virtual machine (ignored)\n" + >+ " -X<option> specify non-standard option (ignored\n" + >+ " except for listed -X options)\n" + >+ " -X print non-standard options and exit (ignored)\n" + >+ " -O optimize for execution time (ignored)\n" + > "\n"; > String expandedExpectedOutput = > MessageFormat.format(expectedOutput, new String[] { >@@ -1137,6 +1158,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.debug.localVariable\" value=\"do not generate\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + >@@ -1203,6 +1225,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"enabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" + >#P org.eclipse.jdt.core >Index: batch/org/eclipse/jdt/internal/compiler/batch/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties,v >retrieving revision 1.590 >diff -u -r1.590 messages.properties >--- batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 13 Dec 2006 12:11:24 -0000 1.590 >+++ batch/org/eclipse/jdt/internal/compiler/batch/messages.properties 14 Dec 2006 18:28:20 -0000 >@@ -63,7 +63,7 @@ > configure.noClasspath = no classpath defined, using default directory instead > configure.incorrectClasspath = incorrect classpath: {0} > configure.invalidexpansionargumentname = expansion argument file {0} does not exist or cannot be read >-configure.cannotOpenLog = cannot open .log file >+configure.cannotOpenLog = cannot open .log file: {0} > configure.unexpectedCustomEncoding = unexpected custom encoding specification: {0}[{1}] > configure.unsupportedEncoding = unsupported encoding format: {0} > configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0} >@@ -160,12 +160,26 @@ > \ -g:none no debug info\n\ > \ -preserveAllLocals preserve unused local vars for debug purpose\n\ > \ \n\ >-\ Ignored options:\n\ >-\ -J<option> pass option to virtual machine (ignored)\n\ >-\ -X<option> specify non-standard option (ignored\n\ >-\ except for -Xemacs)\n\ >-\ -X print non-standard options and exit (ignored)\n\ >-\ -O optimize for execution time (ignored)\n\ >+\ Annotation processing options:\n\ >+\ These options are meaningful only in a 1.6 environment.\n\ >+\ -Akey[=value] annotation processors options that are made to\n\ >+\ annotation processors. key are identifiers separated\n\ >+\ by '.'.\n\ >+\ -processorpath <directories and zip/jar files separated by {0}>\n\ >+\ specify locations where to find annotation processors\n\ >+\ If this option is not used, the classpath will be\n\ >+\ searched for processors.\n\ >+\ -processor <class1[,class2,...]>\n\ >+\ Qualified names of the annotation processors to run.\n\ >+\ This bypasses the default annotation discovery process\n\ >+\ -proc:only run annotation processors, but do not compile\n\ >+\ -proc:none perform compilation but do not run annotation\n\ >+\ processors\n\ >+\ -s <dir> specify a directory where to put the generated source\n\ >+\ files\n\ >+\ -XprintProcessorInfo print information about which annotations and which\n\ >+\ elements a processor is asked to process\n\ >+\ -XprintRounds print information about annotation processing rounds.\n\ > \ \n\ > \ Advanced options:\n\ > \ @<file> read command line arguments from file\n\ >@@ -189,7 +203,14 @@ > \ \n\ > \ -? -help print this help message\n\ > \ -v -version print compiler version\n\ >-\ -showversion print compiler version and continue\n >+\ -showversion print compiler version and continue\n\ >+\ \n\ >+\ Ignored options:\n\ >+\ -J<option> pass option to virtual machine (ignored)\n\ >+\ -X<option> specify non-standard option (ignored\n\ >+\ except for listed -X options)\n\ >+\ -X print non-standard options and exit (ignored)\n\ >+\ -O optimize for execution time (ignored)\n > misc.usage.warn = {1} {2}\n\ > {3}\n\ > \ \n\ >Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v >retrieving revision 1.273 >diff -u -r1.273 Main.java >--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 5 Dec 2006 22:03:22 -0000 1.273 >+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 14 Dec 2006 18:28:20 -0000 >@@ -44,6 +44,7 @@ > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.compiler.InvalidInputException; > import org.eclipse.jdt.core.compiler.IProblem; >+import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; > import org.eclipse.jdt.internal.compiler.ClassFile; > import org.eclipse.jdt.internal.compiler.CompilationResult; > import org.eclipse.jdt.internal.compiler.Compiler; >@@ -940,7 +941,7 @@ > this.log.println("# " + dateFormat.format(date));//$NON-NLS-1$ > } > } catch (FileNotFoundException e) { >- throw new InvalidInputException(this.main.bind("configure.cannotOpenLog")); //$NON-NLS-1$ >+ throw new InvalidInputException(this.main.bind("configure.cannotOpenLog", logFileName)); //$NON-NLS-1$ > } > } > >@@ -1151,6 +1152,10 @@ > > public boolean verbose = false; > >+private String[] expandedCommandLine; >+ >+private PrintWriter err; >+ > public Main(PrintWriter outWriter, PrintWriter errWriter, boolean systemExitWhenFinished) { > this(outWriter, errWriter, systemExitWhenFinished, null); > } >@@ -1918,6 +1923,9 @@ > final int INSIDE_SOURCE_PATH_start = 13; > final int INSIDE_ENDORSED_DIRS = 15; > final int INSIDE_SOURCE_DIRECTORY_DESTINATION_PATH = 16; >+ final int INSIDE_PROCESSOR_PATH_start = 17; >+ final int INSIDE_PROCESSOR_start = 18; >+ final int INSIDE_S_start = 19; > > final int DEFAULT = 0; > ArrayList bootclasspaths = new ArrayList(DEFAULT_SIZE_CLASSPATH); >@@ -1996,6 +2004,7 @@ > } > } > argCount = newCommandLineArgs.length; >+ this.expandedCommandLine = newCommandLineArgs; > while (++index < argCount) { > > if (customEncoding != null) { >@@ -2422,6 +2431,42 @@ > this.logger.setEmacs(); > continue; > } >+ // annotation processing >+ if (currentArg.startsWith("-A")) { //$NON-NLS-1$ >+ mode = DEFAULT; >+ continue; >+ } >+ if (currentArg.equals("-processorpath")) { //$NON-NLS-1$ >+ mode = INSIDE_PROCESSOR_PATH_start; >+ continue; >+ } >+ if (currentArg.equals("-processor")) { //$NON-NLS-1$ >+ mode = INSIDE_PROCESSOR_start; >+ continue; >+ } >+ if (currentArg.equals("-proc:only")) { //$NON-NLS-1$ >+ this.options.put( >+ CompilerOptions.OPTION_GenerateClassFiles, >+ CompilerOptions.DISABLED); >+ mode = DEFAULT; >+ continue; >+ } >+ if (currentArg.equals("-proc:none")) { //$NON-NLS-1$ >+ this.options.put( >+ CompilerOptions.OPTION_Process_Annotations, >+ CompilerOptions.DISABLED); >+ mode = DEFAULT; >+ continue; >+ } >+ if (currentArg.equals("-s")) { //$NON-NLS-1$ >+ mode = INSIDE_S_start; >+ continue; >+ } >+ if (currentArg.equals("-XprintProcessorInfo") //$NON-NLS-1$ >+ || currentArg.equals("-XprintRounds")) { //$NON-NLS-1$ >+ mode = DEFAULT; >+ continue; >+ } > // tolerated javac options - quietly filtered out > if (currentArg.startsWith("-X")) { //$NON-NLS-1$ > mode = DEFAULT; >@@ -2576,7 +2621,19 @@ > this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ > "[-d " + currentArg)); //$NON-NLS-1$ > } >- // continue; fall through on purpose >+ break; >+ case INSIDE_PROCESSOR_PATH_start : >+ // nothing to do here. This is consumed again by the AnnotationProcessorManager >+ mode = DEFAULT; >+ continue; >+ case INSIDE_PROCESSOR_start : >+ // nothing to do here. This is consumed again by the AnnotationProcessorManager >+ mode = DEFAULT; >+ continue; >+ case INSIDE_S_start : >+ // nothing to do here. This is consumed again by the AnnotationProcessorManager >+ mode = DEFAULT; >+ continue; > } > > // default is input directory, if no custom destination path exists >@@ -2678,13 +2735,14 @@ > this.timesCounter = 0; > } > >- if (filesCount != 0) >+ if (filesCount != 0) { > System.arraycopy( > this.filenames, > 0, > (this.filenames = new String[filesCount]), > 0, > filesCount); >+ } > > setPaths(bootclasspaths, > sourcepathClasspathArg, >@@ -2857,6 +2915,7 @@ > Map customDefaultOptions) { > this.logger = new Logger(this, outWriter, errWriter); > this.out = outWriter; >+ this.err = errWriter; > this.systemExitWhenFinished = systemExit; > this.options = new CompilerOptions().getMap(); > if (customDefaultOptions != null) { >@@ -2952,6 +3011,11 @@ > getProblemFactory(), > this.out); > >+ if (this.compilerOptions.complianceLevel >= ClassFileConstants.JDK1_6 >+ && this.compilerOptions.processAnnotations) { >+ initializeAnnotationProcessorManager(); >+ } >+ > // set the non-externally configurable options. > this.compilerOptions.verbose = this.verbose; > this.compilerOptions.produceReferenceInfo = this.produceRefInfo; >@@ -2967,7 +3031,24 @@ > // cleanup > environment.cleanup(); > } >- >+protected void initializeAnnotationProcessorManager() { >+ try { >+ Class c = Class.forName("org.eclipse.jdt.internal.compiler.apt.dispatch.AnnotationProcessorManager"); //$NON-NLS-1$ >+ AbstractAnnotationProcessorManager annotationManager = (AbstractAnnotationProcessorManager) c.newInstance(); >+ annotationManager.configure(this, this.expandedCommandLine); >+ annotationManager.setErr(this.err); >+ annotationManager.setOut(this.out); >+ this.batchCompiler.annotationProcessorManager = annotationManager; >+ } catch (ClassNotFoundException e) { >+ // ignore >+ } catch (InstantiationException e) { >+ // should not happen >+ throw new org.eclipse.jdt.internal.compiler.problem.AbortCompilation(); >+ } catch (IllegalAccessException e) { >+ // should not happen >+ throw new org.eclipse.jdt.internal.compiler.problem.AbortCompilation(); >+ } >+} > public void printUsage() { > printUsage("misc.usage"); //$NON-NLS-1$ > } >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.176 >diff -u -r1.176 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 1 Dec 2006 21:44:44 -0000 1.176 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 14 Dec 2006 18:28:21 -0000 >@@ -108,6 +108,8 @@ > public static final String OPTION_ReportParameterAssignment = "org.eclipse.jdt.core.compiler.problem.parameterAssignment"; //$NON-NLS-1$ > public static final String OPTION_ReportFallthroughCase = "org.eclipse.jdt.core.compiler.problem.fallthroughCase"; //$NON-NLS-1$ > public static final String OPTION_ReportOverridingMethodWithoutSuperInvocation = "org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation"; //$NON-NLS-1$ >+ public static final String OPTION_GenerateClassFiles = "org.eclipse.jdt.core.compiler.generateClassFiles"; //$NON-NLS-1$ >+ public static final String OPTION_Process_Annotations = "org.eclipse.jdt.core.compiler.processAnnotations"; //$NON-NLS-1$ > > // Backward compatibility > public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$ >@@ -303,6 +305,10 @@ > // store annotations > public boolean storeAnnotations = false; > >+ // annotation processing >+ public boolean generateClassFiles = true; >+ public boolean processAnnotations = true; >+ > /** > * Initializing the compiler options with defaults > */ >@@ -412,6 +418,8 @@ > optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment)); > optionsMap.put(OPTION_ReportFallthroughCase, getSeverityString(FallthroughCase)); > optionsMap.put(OPTION_ReportOverridingMethodWithoutSuperInvocation, getSeverityString(OverridingMethodWithoutSuperInvocation)); >+ optionsMap.put(OPTION_GenerateClassFiles, this.generateClassFiles ? ENABLED : DISABLED); >+ optionsMap.put(OPTION_Process_Annotations, this.processAnnotations ? ENABLED : DISABLED); > return optionsMap; > } > >@@ -740,6 +748,20 @@ > this.reportMissingJavadocCommentsOverriding = false; > } > } >+ if ((optionValue = optionsMap.get(OPTION_GenerateClassFiles)) != null) { >+ if (ENABLED.equals(optionValue)) { >+ this.generateClassFiles = true; >+ } else if (DISABLED.equals(optionValue)) { >+ this.generateClassFiles = false; >+ } >+ } >+ if ((optionValue = optionsMap.get(OPTION_Process_Annotations)) != null) { >+ if (ENABLED.equals(optionValue)) { >+ this.processAnnotations = true; >+ } else if (DISABLED.equals(optionValue)) { >+ this.processAnnotations = false; >+ } >+ } > } > > public String toString() { >@@ -819,6 +841,8 @@ > buf.append("\n\t- unused label: ").append(getSeverityString(UnusedLabel)); //$NON-NLS-1$ > buf.append("\n\t- treat optional error as fatal: ").append(this.treatOptionalErrorAsFatal ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- parameter assignment: ").append(getSeverityString(ParameterAssignment)); //$NON-NLS-1$ >+ buf.append("\n\t- generate class files: ").append(this.generateClassFiles ? ENABLED : DISABLED); //$NON-NLS-1$ >+ buf.append("\n\t- process annotations: ").append(this.processAnnotations ? ENABLED : DISABLED); //$NON-NLS-1$ > return buf.toString(); > } > >Index: compiler/org/eclipse/jdt/internal/compiler/Compiler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java,v >retrieving revision 1.81 >diff -u -r1.81 Compiler.java >--- compiler/org/eclipse/jdt/internal/compiler/Compiler.java 28 Nov 2006 03:54:20 -0000 1.81 >+++ compiler/org/eclipse/jdt/internal/compiler/Compiler.java 14 Dec 2006 18:28:21 -0000 >@@ -40,6 +40,9 @@ > // ONCE STABILIZED, THESE SHOULD RETURN TO A FINAL FIELD > public static boolean DEBUG = false; > public int parseThreshold = -1; >+ >+ public AbstractAnnotationProcessorManager annotationProcessorManager; >+ > // number of initial units parsed at once (-1: none) > > /* >@@ -354,34 +357,30 @@ > CompilationUnitDeclaration parsedUnit; > CompilationResult unitResult = > new CompilationResult(sourceUnits[i], i, maxUnits, this.options.maxProblemsPerUnit); >- try { >- if (options.verbose) { >- this.out.println( >- Messages.bind(Messages.compilation_request, >- new String[] { >- String.valueOf(i + 1), >- String.valueOf(maxUnits), >- new String(sourceUnits[i].getFileName()) >- })); >- } >- // diet parsing for large collection of units >- if (totalUnits < parseThreshold) { >- parsedUnit = parser.parse(sourceUnits[i], unitResult); >- } else { >- parsedUnit = parser.dietParse(sourceUnits[i], unitResult); >- } >- // initial type binding creation >- lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/); >- this.addCompilationUnit(sourceUnits[i], parsedUnit); >- ImportReference currentPackage = parsedUnit.currentPackage; >- if (currentPackage != null) { >- unitResult.recordPackageName(currentPackage.tokens); >- } >- //} catch (AbortCompilationUnit e) { >- // requestor.acceptResult(unitResult.tagAsAccepted()); >- } finally { >- sourceUnits[i] = null; // no longer hold onto the unit >+ if (options.verbose) { >+ this.out.println( >+ Messages.bind(Messages.compilation_request, >+ new String[] { >+ String.valueOf(i + 1), >+ String.valueOf(maxUnits), >+ new String(sourceUnits[i].getFileName()) >+ })); >+ } >+ // diet parsing for large collection of units >+ if (totalUnits < parseThreshold) { >+ parsedUnit = parser.parse(sourceUnits[i], unitResult); >+ } else { >+ parsedUnit = parser.dietParse(sourceUnits[i], unitResult); >+ } >+ ImportReference currentPackage = parsedUnit.currentPackage; >+ if (currentPackage != null) { >+ unitResult.recordPackageName(currentPackage.tokens); > } >+ // initial type binding creation >+ lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/); >+ this.addCompilationUnit(sourceUnits[i], parsedUnit); >+ //} catch (AbortCompilationUnit e) { >+ // requestor.acceptResult(unitResult.tagAsAccepted()); > } > // binding resolution > lookupEnvironment.completeTypeBindings(); >@@ -394,14 +393,19 @@ > */ > public void compile(ICompilationUnit[] sourceUnits) { > CompilationUnitDeclaration unit = null; >- int i = 0; > try { > // build and record parsed units > > beginToCompile(sourceUnits); > >+ if (this.annotationProcessorManager != null) { >+ processAnnotations(sourceUnits); >+ if (!options.generateClassFiles) { >+ return; >+ } >+ } > // process all units (some more could be injected in the loop by the lookup environment) >- for (; i < this.totalUnits; i++) { >+ for (int i = 0; i < this.totalUnits; i++) { > unit = unitsToProcess[i]; > try { > if (options.verbose) >@@ -450,6 +454,33 @@ > } > } > >+ protected void processAnnotations(ICompilationUnit[] sourceUnits) { >+ int newUnitSize = 0; >+ do { >+ this.annotationProcessorManager.processAnnotations(unitsToProcess, false); >+ List newUnits = this.annotationProcessorManager.getNewUnits(); >+ newUnitSize = newUnits.size(); >+ ICompilationUnit[] newSourceUnits = sourceUnits; >+ if (newUnitSize != 0) { >+ // we reset the compiler in order to restart with the new units >+ this.reset(); >+ int sourceUnitsLength = sourceUnits.length; >+ newSourceUnits = new ICompilationUnit[sourceUnitsLength + newUnitSize]; >+ newUnits.toArray(newSourceUnits); >+ System.arraycopy(sourceUnits, 0, newSourceUnits, newUnitSize, sourceUnitsLength); >+ beginToCompile(newSourceUnits); >+ this.annotationProcessorManager.reset(); >+ } >+ } while (newUnitSize != 0); >+ // one more loop to create possible resources >+ // this loop cannot create any java source files >+ this.annotationProcessorManager.processAnnotations(unitsToProcess, true); >+ List newUnits = this.annotationProcessorManager.getNewUnits(); >+ if (newUnits.size() != 0) { >+ // TODO report error >+ } >+ } >+ > /* > * Compiler crash recovery in case of unexpected runtime exceptions > */ >Index: compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java >=================================================================== >RCS file: compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java >diff -N compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+package org.eclipse.jdt.internal.compiler; >+ >+import java.io.PrintWriter; >+import java.util.List; >+ >+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; >+import org.eclipse.jdt.internal.compiler.batch.Main; >+ >+public abstract class AbstractAnnotationProcessorManager { >+ public abstract void configure(Main batchCompiler, String[] options); >+ >+ public abstract void setOut(PrintWriter out); >+ >+ public abstract void setErr(PrintWriter err); >+ >+ public abstract List getNewUnits(); >+ >+ public abstract void reset(); >+ >+ public abstract void processAnnotations(CompilationUnitDeclaration[] units, boolean isLastRound); >+ >+ public abstract void setProcessors(Object[] processors); >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 160773
:
53949
| 55694