Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3d28b509d52de949fc58848ed785e22ace15abbe (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
/*******************************************************************************
 * Copyright (c) 2007, 2015 BEA Systems, Inc and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    wharley@bea.com - initial API and implementation
 *******************************************************************************/

package org.eclipse.jdt.compiler.apt.tests.processors.base;

import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;

/**
 * Base class for writing processors used in test cases.
 */
public abstract class BaseProcessor extends AbstractProcessor
{
	protected Elements _elementUtils;
	protected Types _typeUtils;

	/**
	 * Report an error to the test case code
	 * @param value
	 */
	public void reportError(String value) {
		// Debugging - don't report error
		// value = "succeeded";
		System.setProperty(this.getClass().getName(), value);
	}
	
	/**
	 * Report success to the test case code
	 */
	public void reportSuccess() {
		System.setProperty(this.getClass().getName(), "succeeded");
	}

	public void reportFailure() {
		System.setProperty(this.getClass().getName(), "failed");
	}

	@Override
	public synchronized void init(ProcessingEnvironment processingEnv) {
		super.init(processingEnv);
		_elementUtils = processingEnv.getElementUtils();
		_typeUtils = processingEnv.getTypeUtils();
	}
}

Back to the top