diff options
author | Walter Harley | 2007-05-08 23:15:16 +0000 |
---|---|---|
committer | Walter Harley | 2007-05-08 23:15:16 +0000 |
commit | 27aef0560bb19b81e8fa90224ee21a025635acc0 (patch) | |
tree | 9b3276cda2f2aac095cca36d1bf6733866cf9468 /org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt | |
parent | ba69d22a0556f7a9cfe93e083652f61a196c0285 (diff) | |
download | eclipse.jdt.core-27aef0560bb19b81e8fa90224ee21a025635acc0.tar.gz eclipse.jdt.core-27aef0560bb19b81e8fa90224ee21a025635acc0.tar.xz eclipse.jdt.core-27aef0560bb19b81e8fa90224ee21a025635acc0.zip |
Bug 185220: problems reported via Messager should show up as problem markers, not as log entries.
Diffstat (limited to 'org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt')
2 files changed, 44 insertions, 3 deletions
diff --git a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/Apt6CompilationParticipant.java b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/Apt6CompilationParticipant.java new file mode 100644 index 0000000000..32144309c9 --- /dev/null +++ b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/Apt6CompilationParticipant.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2007 BEA Systems, Inc. + * 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.internal.apt.pluggable.core; + +import org.eclipse.jdt.core.compiler.CompilationParticipant; + +/** + * Compilation participant for Java 6 annotation processing. Java 6 annotation + * processors are dispatched via the org.eclipse.jdt.core.annotationProcessorManager + * extension point, but this compilation participant is still required in order + * to register a managed problem marker. + * @since 3.3 + */ +public class Apt6CompilationParticipant extends CompilationParticipant { + + public Apt6CompilationParticipant() { + } + +} diff --git a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/dispatch/IdeMessagerImpl.java b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/dispatch/IdeMessagerImpl.java index 6d1c26d563..12b095a4b3 100644 --- a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/dispatch/IdeMessagerImpl.java +++ b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/dispatch/IdeMessagerImpl.java @@ -20,8 +20,9 @@ import javax.tools.Diagnostic.Kind; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.compiler.CategorizedProblem; import org.eclipse.jdt.internal.apt.pluggable.core.Apt6Plugin; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.apt.dispatch.AptProblem; import org.eclipse.jdt.internal.compiler.apt.dispatch.BatchMessagerImpl; /** @@ -71,8 +72,19 @@ public class IdeMessagerImpl implements Messager { */ public void printMessage(Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v) { - CategorizedProblem problem = BatchMessagerImpl.createProblem(kind, msg, e); - Apt6Plugin.log(new Status(IStatus.INFO, Apt6Plugin.PLUGIN_ID, Apt6Plugin.STATUS_EXCEPTION, problem.toString(), null)); + AptProblem problem = BatchMessagerImpl.createProblem(kind, msg, e); + if (kind == Kind.NOTE) { + Apt6Plugin.log(new Status(IStatus.INFO, Apt6Plugin.PLUGIN_ID, Apt6Plugin.STATUS_EXCEPTION, problem.getMessage(), null)); + } + else if (null != problem._referenceContext) { + CompilationResult result = problem._referenceContext.compilationResult(); + result.record(problem, problem._referenceContext); + } + else { + // Unknown reference context; e.g., reported against an element not being compiled. + // TODO: report against project?? log?? + Apt6Plugin.log(new Status(IStatus.INFO, Apt6Plugin.PLUGIN_ID, Apt6Plugin.STATUS_EXCEPTION, problem.getMessage(), null)); + } } } |