Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 022b20ae91a138735828283d1b779bff204d057c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*******************************************************************************
 * Copyright (c) 2006, 2018 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     BEA - Patch for bug 172743
 *******************************************************************************/
package org.eclipse.jdt.internal.compiler;

import java.io.PrintWriter;

import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;

public abstract class AbstractAnnotationProcessorManager {
	/**
	 * Configure the receiver using the given batch compiler and the given options.
	 * The parameter batchCompiler is expected to be an instance of the batch compiler. This method is
	 * only used for the batch mode. For the IDE mode, please see {@link #configureFromPlatform(Compiler, Object, Object, boolean)}.
	 *
	 * @param batchCompiler the given batch compiler object
	 * @param options the given options
	 */
	public abstract void configure(Object batchCompiler, String[] options);

	/**
	 * Configure the receiver using the given compiler, the given compilationUnitLocator and
	 * the given java project.
	 *
	 * @param compiler the given compiler
	 * @param compilationUnitLocator the given compilation unit locator
	 * @param javaProject the given java project
	 * @param isTestCode 
	 */
	public abstract void configureFromPlatform(Compiler compiler, Object compilationUnitLocator, Object javaProject, boolean isTestCode);

	/**
	 * Set the print writer for the standard output.
	 *
	 * @param out the given print writer for output
	 */
	public abstract void setOut(PrintWriter out);

	/**
	 * Set the print writer for the standard error.
	 *
	 * @param err the given print writer for error
	 */
	public abstract void setErr(PrintWriter err);

	/**
	 * Return the new units created in the last round.
	 *
	 * @return the new units created in the last round
	 */
	public abstract ICompilationUnit[] getNewUnits();

	/**
	 * Return the new binary bindings created in the last round.
	 *
	 * @return the new binary bindings created in the last round
	 */
	public abstract ReferenceBinding[] getNewClassFiles();

	/**
	 * Returns the deleted units.
	 * @return the deleted units
	 */
	public abstract ICompilationUnit[] getDeletedUnits();

	/**
	 * Reinitialize the receiver
	 */
	public abstract void reset();

	/**
	 * Final cleanup after all rounds have completed.
	 */
	protected void cleanUp() {
		// default: do nothing, because reset() already did the common work
	}

	/**
	 * Run a new annotation processing round on the given values.
	 *
	 * @param units the given source type
	 * @param referenceBindings the given binary types
	 * @param isLastRound flag to notify the last round
	 */
	public abstract void processAnnotations(CompilationUnitDeclaration[] units, ReferenceBinding[] referenceBindings, boolean isLastRound);

	/**
	 * Set the processors for annotation processing.
	 *
	 * @param processors the given processors
	 */
	public abstract void setProcessors(Object[] processors);
}

Back to the top